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 +4 -4
- data/README.md +9 -31
- data/lib/get_your_rep/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccf0d4bcb0cebbd57048490af4d795fd480f37c3
|
4
|
+
data.tar.gz: a35ddcdaf831d6f1afd5d74314cfa37882d2470e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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
|
-
|
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
|
-
|
39
|
+
You can iterate over a Delegation's reps like so: `delegetion.reps.each { |rep| rep.name }`.
|
41
40
|
|
42
|
-
|
41
|
+
There is also a shortcut for that: `delegation.each { |rep| rep.name }`.
|
43
42
|
|
44
|
-
|
43
|
+
There is also a shortcut for that: `delegation.names`. Also works with `#first_names`, `#last_names`, and `#office_locations`.
|
45
44
|
|
46
|
-
|
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
|
-
|
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
|
|
data/lib/get_your_rep/version.rb
CHANGED