Code Monkey home page Code Monkey logo

house-salad's Introduction

House Salad Base

This repo is used as a base for the Consuming API lesson taught in Backend Module 3. To complete the lesson you will need to sign-up for an API key from the ProPublica Congress API.

Versions

Rails 5.1.7 Ruby 2.5.3

Setup

git clone https://github.com/turingschool-examples/house-salad-base house-salad

cd house-salad

rails db:{create,migrate}

Exercise

Write a test and complete this user story

NOTE: Please use the existing form in the application.

As a user
When I visit "/"
And I select "Colorado" from the dropdown
And I click on "Locate Members of the House"
Then my path should be "/search" with "state=CO" in the parameters
And I should see a message "7 Results"
And I should see a list of the 7 members of the house for Colorado
And I should see a name, role, party, and district for each member

Notes on Refactor

For the most part, I followed the lesson pretty closely. However, a couple things to note:

  • First, it occurred to me that the Member object doesn't inherit from any rails classes, and is basically a poro that is formatted as a rails resouce object, but the SearchResults object is separated into it's own poro folder, which makes sense considering it has a very different format. Nothing too complicated here, just something that I found interesting.

  • The PropublicaService object is formatted in a pretty logical fashion, however, I think that in an application with multiple api calls (like brownfield), and therefore multiple services, the code ends up being not very DRY. As such, I think that it would be helpful to have a BaseService class, that handles conn and get_json in an abstract way. Each service could then utilize these methods to expose the api calls that are useful to the services.

house-salad's People

Contributors

brianzanti avatar dependabot[bot] avatar dionew1 avatar shock253 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.