get_your_rep 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba6cc36506ebdc000dd985795884989ae947ec4a
4
- data.tar.gz: ae75fd36e09b93d71417ed39b24e674169356610
3
+ metadata.gz: ccf0d4bcb0cebbd57048490af4d795fd480f37c3
4
+ data.tar.gz: a35ddcdaf831d6f1afd5d74314cfa37882d2470e
5
5
  SHA512:
6
- metadata.gz: 1644ce639ff3fedb084bfd2e5ace28633d355da9a63ce7ca5134f10483746f4a45335b6f75c8956207309fa5f738775a101c7985ae320942856464feb5093722
7
- data.tar.gz: fedee5d0c4d211768ba342f988553c4af70687cc49c27c20d1b09041a93a38865c7bea921ddc5b648610b1402f7e40aba978651ea4f68e5eb3a5bf7525e9ed83
6
+ metadata.gz: 586fc35b059e5516f7266b861b8c2bc0a1a860b77118fe3c0dad68a388799052fc77ffa68a841b54b6523c7f7ed87d3d6a3f9f0c5a76f8bc1333a92acd828a71
7
+ data.tar.gz: 0534fb5c98e55c0569d1b335d27d56bbf493096ed1a1824a485ed681a41495dd42cf9761a29297fc790d145850d937101032976cc6b9050ab4411d1727a26c83
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This is the companion [gem](https://rubygems.org/gems/get_your_rep) for the [Phone Your Rep API] (https://github.com/thecristen/phone-your-rep-api)
4
4
 
5
- This gem sends requests to the Google Civic Information API for info on your representatives and parses the JSON response into a Ruby hash.
5
+ This gem sends requests to the Google Civic Information API and the OpenStates.org API for info on your representatives and parses the JSON responses into Ruby objects.
6
6
 
7
7
  ## Installation
8
8
 
@@ -27,48 +27,26 @@ Add this line to your ~/.bashrc or ~/.bash_profile
27
27
 
28
28
  ## Usage
29
29
 
30
- ### Usage documentation is out of date with new release. Update coming soon. Install and setup are accurate!
31
30
 
32
- Send queries like this `reps = GetYourRep.now(address, level:, role:)` to gather a Delegation of Representatives.
31
+ Send queries like this `reps = GetYourRep.all_reps(address)` to gather a Delegation of Representatives. This will get federal legislators from Google and state legislators form OpenStates.org
33
32
 
34
33
  `address` is your address. You can use just a zip code, but use a full address for the best results. Don't worry about commas, spaces, character case, or `.`s (`"123 1/2 main St., anywhere CA 12345"` is A-OK)
35
34
 
36
35
  Some queries will return `nil` when using only a zip code because not every zip code can be directly mapped to a voting district. I strongly recommend using a full address.
37
36
 
38
- `:level` is the level of government. The two values that are currently supported are `"state"` and `"national"`. The default value is `"national"`
37
+ Add Delegations together with `delegation.merge(other_delegation)`. This will add the other delegation's reps to the method caller, without altering the other.
39
38
 
40
- `:role` corresponds to the rep's legislative house. The values that are currently supported are `"representative"`, `"senator"`, `"executive"` and `"vice executive"`. The default value is `"representative"`
39
+ You can iterate over a Delegation's reps like so: `delegetion.reps.each { |rep| rep.name }`.
41
40
 
42
- Add Delegations together with `reps << other_reps`.
41
+ There is also a shortcut for that: `delegation.each { |rep| rep.name }`.
43
42
 
44
- Or, get Congress, State Legislature, Governor and Lieutenant Governor all at once with `GetYourRep.all(address)`.
43
+ There is also a shortcut for that: `delegation.names`. Also works with `#first_names`, `#last_names`, and `#office_locations`.
45
44
 
46
- When making db queries, for instance in a Rails app, you can use form useful collection like this:
45
+ Get Federal and State executives and legislators with `GetYourRep::Google.all_reps(address)`.
47
46
 
48
- ```
49
- 2.3.3 :008 > reps
50
- => [{...}, {...}, {...}, {...}, {...}]
51
- 2.3.3 :009 > reps.first_names
52
- => ["Peter", "Bernard", "Patrick J.", "Peter", "Phil"]
53
- 2.3.3 :010 > reps.last_names
54
- => ["Welch", "Sanders", "Leahy", "Shumlin", "Scott"]
55
- ```
56
-
57
- `reps.business_cards` gathers attributes of all reps in a Delegation into a simple array for easy iteration.
47
+ Get Congress only with `GetYourRep::Google.all_reps(address, congress_only: true)`.
58
48
 
59
- You can access an individual Representative and its attributes like this:
60
- ```
61
- 2.3.3 :003 > rep = reps.second
62
- => {:name=>"Bernard Sanders", :office=>"United States Senate", :party=>"Independent", :phone=>"(202) 224-5141", :address_1=>"332 dirksen building", :address_2=>nil, :address_3=>"Washington, DC 20510", :email=>nil, :url=>"http://www.sanders.senate.gov/", :photo=>"http://bioguide.congress.gov/bioguide/photo/S/S000033.jpg", :googleplus=>"+BernieSanders", :facebook=>"senatorsanders", :twitter=>"sensanders", :youtube=>"senatorsanders"}
63
- 2.3.3 :004 > rep.name
64
- => "Bernard Sanders"
65
- 2.3.3 :005 > rep.first_name
66
- => "Bernard"
67
- 2.3.3 :006 > rep.last_name
68
- => "Sanders"
69
- 2.3.3 :007 > rep.party
70
- => "Independent"
71
- ```
49
+ Get state legislators only with `GetYourRep::OpenStates.all_reps(address)`.
72
50
 
73
51
  ## Development
74
52
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GetYourRep
3
- VERSION = '1.0.0' # :nodoc:
3
+ VERSION = '1.0.1' # :nodoc:
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: get_your_rep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - msimonborg