Class: Geocodio::Legislator
- Inherits:
-
Object
- Object
- Geocodio::Legislator
- Defined in:
- lib/geocodio/legislator.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#ballotpedia_id ⇒ Object
readonly
Returns the value of attribute ballotpedia_id.
-
#bioguide_id ⇒ Object
readonly
Returns the value of attribute bioguide_id.
-
#birthday ⇒ Object
readonly
Returns the value of attribute birthday.
-
#contact_form ⇒ Object
readonly
Returns the value of attribute contact_form.
-
#cspan_id ⇒ Object
readonly
Returns the value of attribute cspan_id.
-
#facebook ⇒ Object
readonly
Returns the value of attribute facebook.
-
#gender ⇒ Object
readonly
Returns the value of attribute gender.
-
#govtrack_id ⇒ Object
readonly
Returns the value of attribute govtrack_id.
-
#icpsr_id ⇒ Object
readonly
Returns the value of attribute icpsr_id.
-
#lis_id ⇒ Object
readonly
Returns the value of attribute lis_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#opensecrets_id ⇒ Object
readonly
Returns the value of attribute opensecrets_id.
-
#party ⇒ Object
readonly
Returns the value of attribute party.
-
#phone ⇒ Object
readonly
Returns the value of attribute phone.
-
#rss_url ⇒ Object
readonly
Returns the value of attribute rss_url.
-
#thomas_id ⇒ Object
readonly
Returns the value of attribute thomas_id.
-
#twitter ⇒ Object
readonly
Returns the value of attribute twitter.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#votesmart_id ⇒ Object
readonly
Returns the value of attribute votesmart_id.
-
#washington_post_id ⇒ Object
readonly
Returns the value of attribute washington_post_id.
-
#wikipedia_id ⇒ Object
readonly
Returns the value of attribute wikipedia_id.
-
#youtube ⇒ Object
readonly
Returns the value of attribute youtube.
-
#youtube_id ⇒ Object
readonly
Returns the value of attribute youtube_id.
Instance Method Summary collapse
-
#initialize(payload = {}) ⇒ Legislator
constructor
A new instance of Legislator.
Constructor Details
#initialize(payload = {}) ⇒ Legislator
Returns a new instance of Legislator.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/geocodio/legislator.rb', line 29 def initialize(payload = {}) @type = payload['type'] if payload['bio'] @name = "#{payload['bio']['first_name']} #{payload['bio']['last_name']}" @birthday = Date.new(*payload['bio']['birthday'].split('-').map(&:to_i)) @gender = payload['bio']['gender'] @party = payload['bio']['party'] end if payload['contact'] @url = payload['contact']['url'] @address = payload['contact']['address'] @phone = payload['contact']['phone'] @contact_form = payload['contact']['contact_form'] end if payload['social'] @rss_url = payload['social']['rss_url'] @twitter = payload['social']['twitter'] @facebook = payload['social']['facebook'] @youtube = payload['social']['youtube'] @youtube_id = payload['social']['youtube_id'] end if payload['references'] @bioguide_id = payload['references']['bioguide_id'] @thomas_id = payload['references']['thomas_id'] @opensecrets_id = payload['references']['opensecrets_id'] @lis_id = payload['references']['lis_id'] @cspan_id = payload['references']['cspan_id'] @govtrack_id = payload['references']['govtrack_id'] @votesmart_id = payload['references']['votesmart_id'] @ballotpedia_id = payload['references']['ballotpedia_id'] @washington_post_id = payload['references']['washington_post_id'] @icpsr_id = payload['references']['icpsr_id'] @wikipedia_id = payload['references']['wikipedia_id'] end end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
9 10 11 |
# File 'lib/geocodio/legislator.rb', line 9 def address @address end |
#ballotpedia_id ⇒ Object (readonly)
Returns the value of attribute ballotpedia_id.
24 25 26 |
# File 'lib/geocodio/legislator.rb', line 24 def ballotpedia_id @ballotpedia_id end |
#bioguide_id ⇒ Object (readonly)
Returns the value of attribute bioguide_id.
17 18 19 |
# File 'lib/geocodio/legislator.rb', line 17 def bioguide_id @bioguide_id end |
#birthday ⇒ Object (readonly)
Returns the value of attribute birthday.
5 6 7 |
# File 'lib/geocodio/legislator.rb', line 5 def birthday @birthday end |
#contact_form ⇒ Object (readonly)
Returns the value of attribute contact_form.
11 12 13 |
# File 'lib/geocodio/legislator.rb', line 11 def contact_form @contact_form end |
#cspan_id ⇒ Object (readonly)
Returns the value of attribute cspan_id.
21 22 23 |
# File 'lib/geocodio/legislator.rb', line 21 def cspan_id @cspan_id end |
#facebook ⇒ Object (readonly)
Returns the value of attribute facebook.
14 15 16 |
# File 'lib/geocodio/legislator.rb', line 14 def facebook @facebook end |
#gender ⇒ Object (readonly)
Returns the value of attribute gender.
6 7 8 |
# File 'lib/geocodio/legislator.rb', line 6 def gender @gender end |
#govtrack_id ⇒ Object (readonly)
Returns the value of attribute govtrack_id.
22 23 24 |
# File 'lib/geocodio/legislator.rb', line 22 def govtrack_id @govtrack_id end |
#icpsr_id ⇒ Object (readonly)
Returns the value of attribute icpsr_id.
26 27 28 |
# File 'lib/geocodio/legislator.rb', line 26 def icpsr_id @icpsr_id end |
#lis_id ⇒ Object (readonly)
Returns the value of attribute lis_id.
20 21 22 |
# File 'lib/geocodio/legislator.rb', line 20 def lis_id @lis_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/geocodio/legislator.rb', line 4 def name @name end |
#opensecrets_id ⇒ Object (readonly)
Returns the value of attribute opensecrets_id.
19 20 21 |
# File 'lib/geocodio/legislator.rb', line 19 def opensecrets_id @opensecrets_id end |
#party ⇒ Object (readonly)
Returns the value of attribute party.
7 8 9 |
# File 'lib/geocodio/legislator.rb', line 7 def party @party end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
10 11 12 |
# File 'lib/geocodio/legislator.rb', line 10 def phone @phone end |
#rss_url ⇒ Object (readonly)
Returns the value of attribute rss_url.
12 13 14 |
# File 'lib/geocodio/legislator.rb', line 12 def rss_url @rss_url end |
#thomas_id ⇒ Object (readonly)
Returns the value of attribute thomas_id.
18 19 20 |
# File 'lib/geocodio/legislator.rb', line 18 def thomas_id @thomas_id end |
#twitter ⇒ Object (readonly)
Returns the value of attribute twitter.
13 14 15 |
# File 'lib/geocodio/legislator.rb', line 13 def twitter @twitter end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/geocodio/legislator.rb', line 3 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/geocodio/legislator.rb', line 8 def url @url end |
#votesmart_id ⇒ Object (readonly)
Returns the value of attribute votesmart_id.
23 24 25 |
# File 'lib/geocodio/legislator.rb', line 23 def votesmart_id @votesmart_id end |
#washington_post_id ⇒ Object (readonly)
Returns the value of attribute washington_post_id.
25 26 27 |
# File 'lib/geocodio/legislator.rb', line 25 def washington_post_id @washington_post_id end |
#wikipedia_id ⇒ Object (readonly)
Returns the value of attribute wikipedia_id.
27 28 29 |
# File 'lib/geocodio/legislator.rb', line 27 def wikipedia_id @wikipedia_id end |
#youtube ⇒ Object (readonly)
Returns the value of attribute youtube.
15 16 17 |
# File 'lib/geocodio/legislator.rb', line 15 def youtube @youtube end |
#youtube_id ⇒ Object (readonly)
Returns the value of attribute youtube_id.
16 17 18 |
# File 'lib/geocodio/legislator.rb', line 16 def youtube_id @youtube_id end |