get_your_rep 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/core_extensions/array/get_your_rep_mutations.rb +23 -0
- data/lib/core_extensions/hash/get_your_rep_mutations.rb +24 -0
- data/lib/get_your_rep.rb +26 -0
- data/lib/get_your_rep/delegation.rb +87 -0
- data/lib/get_your_rep/google.rb +188 -0
- data/lib/get_your_rep/open_states.rb +105 -0
- data/lib/get_your_rep/representative.rb +272 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4c39c75a50253c1577d10857f573ecaa22d15db5
|
4
|
+
data.tar.gz: 864d2b90e058ced10c772a335b8955267e1c72b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c3953b26969bd0c12c19e30c114c1d7c2110dba4800d7370b5907a61b31d550720ab8a3c73774ddafa5bf07a57cbfad62601d2de7a3cedd55442550b6145104a
|
7
|
+
data.tar.gz: 682ed118c5cf9e013f2bcfe525a113b5946cbd4aeebf005d9402e0bf08b02e0125fde00a01c2ee564860681f8ac4a98bb62c559ad3a91b77ce5be3aab64fcbd0
|
@@ -0,0 +1,23 @@
|
|
1
|
+
##
|
2
|
+
# Core class extensions.
|
3
|
+
module CoreExtensions
|
4
|
+
##
|
5
|
+
# Extend the core Array class.
|
6
|
+
module Array
|
7
|
+
##
|
8
|
+
# Patches for GetYourRep namespace.
|
9
|
+
module GetYourRepMutations
|
10
|
+
|
11
|
+
# Converts an Array to a Delegation
|
12
|
+
def to_del
|
13
|
+
GetYourRep::Delegation.new(self)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Converts an Array to a Representative
|
17
|
+
def to_rep
|
18
|
+
GetYourRep::Representative[to_h]
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
##
|
2
|
+
# Core class extensions.
|
3
|
+
module CoreExtensions
|
4
|
+
##
|
5
|
+
# Extend the core Hash class.
|
6
|
+
module Hash
|
7
|
+
##
|
8
|
+
# Patches for GetYourRep namespace.
|
9
|
+
module GetYourRepMutations
|
10
|
+
|
11
|
+
# Wraps a Hash in a Delegation
|
12
|
+
def to_del
|
13
|
+
del = GetYourRep::Delegation.new
|
14
|
+
del << self
|
15
|
+
end
|
16
|
+
|
17
|
+
# Converts a Hash to a Representative
|
18
|
+
def to_rep
|
19
|
+
GetYourRep::Representative[self]
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/get_your_rep.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'geocoder'
|
3
|
+
require 'get_your_rep/open_states'
|
4
|
+
require 'get_your_rep/delegation'
|
5
|
+
require 'get_your_rep/representative'
|
6
|
+
require 'get_your_rep/google'
|
7
|
+
require 'core_extensions/array/get_your_rep_mutations'
|
8
|
+
require 'core_extensions/hash/get_your_rep_mutations'
|
9
|
+
|
10
|
+
##
|
11
|
+
# Monkey patch the Array and Hash classes with .to_rep and .to_del methods.
|
12
|
+
Array.include CoreExtensions::Array::GetYourRepMutations
|
13
|
+
Hash.include CoreExtensions::Hash::GetYourRepMutations
|
14
|
+
|
15
|
+
##
|
16
|
+
# Top level namespace.
|
17
|
+
module GetYourRep
|
18
|
+
|
19
|
+
##
|
20
|
+
# Get all reps using Google for state executives and national reps,
|
21
|
+
# and OpenStates for state reps.
|
22
|
+
def self.all(address)
|
23
|
+
@reps = Google.top_level_reps(address)
|
24
|
+
@reps << OpenStates.now(address)
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module GetYourRep
|
2
|
+
|
3
|
+
# The Delegation class inherits from Array and describes methods that can be called on a Delegation for ease of display and database query.
|
4
|
+
class Delegation < Array
|
5
|
+
|
6
|
+
# Overloads the << operator so the receiving object is not overwritten as an Array, and there are no nested Delegations.
|
7
|
+
def <<(value)
|
8
|
+
|
9
|
+
if value.is_a?(Delegation) || value.is_a?(Array)
|
10
|
+
self.replace(self + value)
|
11
|
+
else
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
# Overloads the + operator to return a new Delegation instead of an Array.
|
18
|
+
def +(value)
|
19
|
+
super.to_del
|
20
|
+
end
|
21
|
+
|
22
|
+
# Overloads #reverse to return a new Delegation instead of an Array.
|
23
|
+
def reverse
|
24
|
+
self.replace(super)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Collects the first names of every rep in the Delegation.
|
28
|
+
def first_names
|
29
|
+
self.map { |rep| rep.first_name }
|
30
|
+
end
|
31
|
+
|
32
|
+
# Collects the last names of every rep in the Delegation.
|
33
|
+
def last_names
|
34
|
+
self.map { |rep| rep.last_name }
|
35
|
+
end
|
36
|
+
|
37
|
+
# Maps all rep business cards.
|
38
|
+
def business_cards
|
39
|
+
self.map { |rep| rep.business_card }
|
40
|
+
end
|
41
|
+
|
42
|
+
# Get the [1] index.
|
43
|
+
def second
|
44
|
+
self[1]
|
45
|
+
end
|
46
|
+
|
47
|
+
# Get the [2] index.
|
48
|
+
def third
|
49
|
+
self[2]
|
50
|
+
end
|
51
|
+
|
52
|
+
# Get the [3] index.
|
53
|
+
def fourth
|
54
|
+
self[3]
|
55
|
+
end
|
56
|
+
|
57
|
+
# Get the [4] index.
|
58
|
+
def fifth
|
59
|
+
self[4]
|
60
|
+
end
|
61
|
+
|
62
|
+
# Get the [5] index.
|
63
|
+
def sixth
|
64
|
+
self[5]
|
65
|
+
end
|
66
|
+
|
67
|
+
# Get the [6] index.
|
68
|
+
def seventh
|
69
|
+
self[6]
|
70
|
+
end
|
71
|
+
|
72
|
+
# Get the [7] index.
|
73
|
+
def eigth
|
74
|
+
self[7]
|
75
|
+
end
|
76
|
+
|
77
|
+
# Get the [8] index.
|
78
|
+
def ninth
|
79
|
+
self[8]
|
80
|
+
end
|
81
|
+
|
82
|
+
# Get the [9] index.
|
83
|
+
def tenth
|
84
|
+
self[9]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
module GetYourRep
|
2
|
+
|
3
|
+
# Retrieve your elected representatives from the Google Civic Information API, parse it from
|
4
|
+
# JSON, and assemble it into a usable Ruby Hash-like object called a Representative.
|
5
|
+
# Representatives are then wrapped in an Array-like object called a Delegation.
|
6
|
+
#
|
7
|
+
# You must configure your own Google API key as an environment variable using the constant name
|
8
|
+
# 'GOOGLE_API_KEY' in order for this gem to work.
|
9
|
+
class Google
|
10
|
+
|
11
|
+
# The Google API key is used to access data from the Google Civic Information API. You must
|
12
|
+
# obtain your own and configure it as an environment variable on your system.
|
13
|
+
API_KEY = ENV['GOOGLE_API_KEY']
|
14
|
+
|
15
|
+
# Initiates a chain of class method calls that will instantiate a
|
16
|
+
# Delegation object and return it.
|
17
|
+
# Supported options for :level are "national"(default) and "state".
|
18
|
+
# Supported options for :role are "representative"(default), "senator", "executive" and "vice executive".
|
19
|
+
def self.now(address, level: 'national', role: 'representative')
|
20
|
+
address = convert_zip_to_address(address) if address_is_a_zip?(address)
|
21
|
+
@address = parse_address(address)
|
22
|
+
@level = level
|
23
|
+
@role = role
|
24
|
+
get_rep
|
25
|
+
end
|
26
|
+
|
27
|
+
#Returns reps in Congress and State Legislature, plus Governor and Lieutenant Governor.
|
28
|
+
def self.all(address)
|
29
|
+
top_level_reps(address)
|
30
|
+
|
31
|
+
@role = 'representative'
|
32
|
+
state_rep = get_rep
|
33
|
+
|
34
|
+
@role = 'senator'
|
35
|
+
state_sen = get_rep
|
36
|
+
|
37
|
+
#Check the Open States API if Google can't find state reps.
|
38
|
+
if state_rep.empty? && state_sen.empty?
|
39
|
+
@reps << GetYourRep::OpenStates.now(@coordinates)
|
40
|
+
else
|
41
|
+
@reps << state_rep
|
42
|
+
@reps << state_sen
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.top_level_reps(address)
|
48
|
+
@reps = now(address)
|
49
|
+
|
50
|
+
@role = 'senator'
|
51
|
+
@reps << get_rep
|
52
|
+
|
53
|
+
@level = 'state'
|
54
|
+
@role = 'executive'
|
55
|
+
@reps << get_rep
|
56
|
+
|
57
|
+
@role = 'vice executive'
|
58
|
+
@reps << get_rep
|
59
|
+
end
|
60
|
+
|
61
|
+
# Parses a String address and prepares for an HTTP request. Accepts Strings and Integers as args.
|
62
|
+
def self.parse_address(address)
|
63
|
+
address = '0%o' % address if address.is_a?(Integer)
|
64
|
+
raise "Entry must be of types String or Integer" if !address.is_a?(String)
|
65
|
+
address = address.tr(',', '').split.join('%20')
|
66
|
+
end
|
67
|
+
|
68
|
+
# Unparses a parsed address
|
69
|
+
# def self.unparsed_address(address)
|
70
|
+
# address.split('%20').join(' ')
|
71
|
+
# end
|
72
|
+
|
73
|
+
# Check if an address value is a zip code or a full address.
|
74
|
+
def self.address_is_a_zip?(address)
|
75
|
+
address = '0%o' % address if address.is_a?(Integer)
|
76
|
+
raise "Entry must be of types String or Integer" if !address.is_a?(String)
|
77
|
+
!(address =~ /^\d{5}(-\d{4})?$/).nil?
|
78
|
+
end
|
79
|
+
|
80
|
+
# Convert a zip code to a street address using Geocoder to convert zip to coordinates
|
81
|
+
# and coordinates to an address.
|
82
|
+
def self.convert_zip_to_address(address)
|
83
|
+
@coordinates = Geocoder.coordinates(address)
|
84
|
+
address = Geocoder.address(@coordinates)
|
85
|
+
trim_street_number(address)
|
86
|
+
end
|
87
|
+
|
88
|
+
# If a street number is a range reduce it to one number.
|
89
|
+
def self.trim_street_number(address)
|
90
|
+
address = address.split(' ')
|
91
|
+
address[0] = address[0].split('-').shift
|
92
|
+
address.join(' ')
|
93
|
+
end
|
94
|
+
|
95
|
+
# Sets parameters for and executes Google API request.
|
96
|
+
def self.get_rep
|
97
|
+
|
98
|
+
level = case @level
|
99
|
+
when 'national'
|
100
|
+
'country'
|
101
|
+
when 'state'
|
102
|
+
'administrativeArea1'
|
103
|
+
else
|
104
|
+
@level
|
105
|
+
end
|
106
|
+
|
107
|
+
role = case @role
|
108
|
+
when 'representative'
|
109
|
+
'legislatorLowerBody'
|
110
|
+
when 'senator'
|
111
|
+
'legislatorUpperBody'
|
112
|
+
when 'executive'
|
113
|
+
'headOfGovernment'
|
114
|
+
when 'vice executive'
|
115
|
+
'deputyHeadOfGovernment'
|
116
|
+
else
|
117
|
+
@role
|
118
|
+
end
|
119
|
+
|
120
|
+
url = "https://www.googleapis.com/civicinfo/v2/representatives?address=#{@address}%20&includeOffices=true&levels=#{level}&roles=#{role}&fields=offices%2Cofficials&key=#{API_KEY}"
|
121
|
+
@response = HTTParty.get(url).parsed_response
|
122
|
+
deliver_response
|
123
|
+
end
|
124
|
+
|
125
|
+
def self.deliver_response
|
126
|
+
if @response.empty?
|
127
|
+
puts "'Google can't find a rep with that address. Checking the Open States API."
|
128
|
+
return GetYourRep::Delegation.new
|
129
|
+
elsif @response['error']
|
130
|
+
puts 'Error message received. Confirm and re-enter your address and check your parameters.'
|
131
|
+
puts @response
|
132
|
+
return GetYourRep::Delegation.new
|
133
|
+
end
|
134
|
+
parse_rep
|
135
|
+
@delegation
|
136
|
+
end
|
137
|
+
|
138
|
+
# Parses the JSON response and assembles it into a Delegation object,
|
139
|
+
# except for social media attributes, which are handles by .parse_channels.
|
140
|
+
def self.parse_rep
|
141
|
+
|
142
|
+
@delegation = GetYourRep::Delegation.new
|
143
|
+
@officials = @response['officials']
|
144
|
+
|
145
|
+
@officials.each do |official|
|
146
|
+
@delegation << GetYourRep::Representative[
|
147
|
+
:name, official['name'],
|
148
|
+
:office, @response['offices'].first['name'],
|
149
|
+
:party, official['party'],
|
150
|
+
:phone, official['phones'],
|
151
|
+
:office_locations, offices(official),
|
152
|
+
:email, official['emails'] || [],
|
153
|
+
:url, (official['urls'].first if official['urls']),
|
154
|
+
:photo, official['photoUrl'],
|
155
|
+
]
|
156
|
+
parse_channels(official) if official['channels']
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def self.offices(official)
|
161
|
+
offices = []
|
162
|
+
|
163
|
+
official['address'].each do |office|
|
164
|
+
office_hash = {}
|
165
|
+
|
166
|
+
if office['line1'].downcase.match(/(state|house|senate|assembly|capitol|dirksen|reyburn|rayburn|legislative|legislature|government)+/)
|
167
|
+
office_hash[:type] = 'capitol'
|
168
|
+
else
|
169
|
+
office_hash[:type] = 'district'
|
170
|
+
end
|
171
|
+
|
172
|
+
office_hash[:line_1] = office['line1']
|
173
|
+
office_hash[:line_2] = office['line_2']
|
174
|
+
office_hash[:line_3] = "#{office['city'].capitalize}, #{office['state']} #{office['zip']}"
|
175
|
+
offices << office_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
offices
|
179
|
+
end
|
180
|
+
|
181
|
+
# Parses social media handles and adds them to the Delegation object.
|
182
|
+
def self.parse_channels(official)
|
183
|
+
official['channels'].each do |channel|
|
184
|
+
@delegation.last[channel['type'].downcase.to_sym] = channel['id']
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module GetYourRep
|
2
|
+
|
3
|
+
# Retrieve your elected state representatives from the Open States API, parse it from
|
4
|
+
# JSON, and assemble it into a usable Ruby Hash-like object called a Representative.
|
5
|
+
# Representatives are then wrapped in an Array-like object called a Delegation.
|
6
|
+
class OpenStates
|
7
|
+
|
8
|
+
# Initiates a chain of class method calls that will instantiate a
|
9
|
+
# Delegation object and return it.
|
10
|
+
def self.now(address)
|
11
|
+
@coordinates = get_coordinates(address)
|
12
|
+
@response = get_rep
|
13
|
+
|
14
|
+
if @response.empty?
|
15
|
+
puts 'Could not find your rep. Your location search might be too broad, try refining it.'
|
16
|
+
return GetYourRep::Delegation.new
|
17
|
+
elsif @response.first['error']
|
18
|
+
puts 'Error message received. Confirm and re-enter your address and check your parameters.'
|
19
|
+
puts @response
|
20
|
+
return GetYourRep::Delegation.new
|
21
|
+
end
|
22
|
+
|
23
|
+
parse_rep
|
24
|
+
@delegation
|
25
|
+
end
|
26
|
+
|
27
|
+
# Geocodes an address and returns the coordinates.
|
28
|
+
def self.get_coordinates(address)
|
29
|
+
return address if address.is_a?(Array)
|
30
|
+
address = '0%o' % address if address.is_a?(Integer)
|
31
|
+
raise "Entry must be coordinates or of types String or Integer" if !address.is_a?(String)
|
32
|
+
Geocoder.coordinates(address)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Sets parameters for and executes Open States API request.
|
36
|
+
def self.get_rep
|
37
|
+
lat = @coordinates.first
|
38
|
+
long = @coordinates.last
|
39
|
+
url = "http://openstates.org/api/v1/legislators/geo/?lat=#{lat}&long=#{long}"
|
40
|
+
HTTParty.get(url).parsed_response
|
41
|
+
end
|
42
|
+
|
43
|
+
# Parses the JSON response and assembles it into a Delegation object.
|
44
|
+
def self.parse_rep
|
45
|
+
|
46
|
+
@delegation = GetYourRep::Delegation.new
|
47
|
+
|
48
|
+
@response.each do |rep|
|
49
|
+
@delegation << GetYourRep::Representative[
|
50
|
+
:name, rep['full_name'].split(', ').reverse.join(' '),
|
51
|
+
:office, "#{rep['state'].upcase} #{rep['chamber'].capitalize} Chamber, #{rep['district']}",
|
52
|
+
:party, rep['party'],
|
53
|
+
:phone, phone(rep),
|
54
|
+
:office_locations, offices(rep),
|
55
|
+
:email, email(rep),
|
56
|
+
:url, rep['url'],
|
57
|
+
:photo, rep['photo_url'],
|
58
|
+
:committees, committees(rep)
|
59
|
+
]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.offices(rep)
|
64
|
+
rep['offices'].map do |office|
|
65
|
+
|
66
|
+
office_hash = {}
|
67
|
+
office_hash[:type] = office['type']
|
68
|
+
address = office['address'].split("\n")
|
69
|
+
|
70
|
+
if address.size == 1
|
71
|
+
address = office['address'].split(', ')
|
72
|
+
end
|
73
|
+
|
74
|
+
if office['name'].downcase != "capitol office" &&
|
75
|
+
office['name'].downcase != "district office"
|
76
|
+
|
77
|
+
address.unshift(office['name'])
|
78
|
+
end
|
79
|
+
|
80
|
+
i = 1
|
81
|
+
address.each do |line|
|
82
|
+
office_hash["line_#{i}".to_sym] = line
|
83
|
+
i += 1
|
84
|
+
end
|
85
|
+
|
86
|
+
office_hash
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Parses the phone, giving preference to district office..
|
91
|
+
def self.phone(rep)
|
92
|
+
rep['offices'].map { |office| office['phone']} - [nil]
|
93
|
+
end
|
94
|
+
|
95
|
+
# Parses the email address.
|
96
|
+
def self.email(rep)
|
97
|
+
rep['offices'].map { |office| office['email'] } - [nil]
|
98
|
+
end
|
99
|
+
|
100
|
+
# Parses committee involvement.
|
101
|
+
def self.committees(rep)
|
102
|
+
rep['roles'].map { |role| role['committee'] } - [nil]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,272 @@
|
|
1
|
+
module GetYourRep
|
2
|
+
|
3
|
+
# Stores rep info in key/value pairs, and makes values accessible by instance method.
|
4
|
+
class Representative < Hash
|
5
|
+
|
6
|
+
# Maps attributes to a simple array for easy printing, iteration, and display. It uses #each rather than #map so it can skip over nil values without mapping them.
|
7
|
+
def business_card
|
8
|
+
|
9
|
+
card = []
|
10
|
+
|
11
|
+
self.each do |key, value|
|
12
|
+
next if value.nil?
|
13
|
+
if key == :facebook || key == :twitter || key == :youtube || key == :googleplus
|
14
|
+
card << "#{key.to_s.capitalize}: #{value}"
|
15
|
+
else
|
16
|
+
card << "#{value}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
card
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get the :name value.
|
24
|
+
def name
|
25
|
+
@name = self[:name]
|
26
|
+
end
|
27
|
+
|
28
|
+
# Set the :name value.
|
29
|
+
def name=(value)
|
30
|
+
@name = value
|
31
|
+
self[:name] = @name
|
32
|
+
end
|
33
|
+
|
34
|
+
# Strips the first name out of the full name if there's no :first_name.
|
35
|
+
def first_name
|
36
|
+
|
37
|
+
return self[:first_name] if self[:first_name]
|
38
|
+
|
39
|
+
if (name.split.count > 3) || (name.split[-2].downcase == name.split[-2])
|
40
|
+
name.split[0..-3].join(' ')
|
41
|
+
else
|
42
|
+
name.split[0..-2].join(' ')
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
# Get the :middle_name value.
|
48
|
+
def middle_name
|
49
|
+
@middle_name = self[:middle_name]
|
50
|
+
end
|
51
|
+
|
52
|
+
# Strips the surname out of the full name if there's no :last_name.
|
53
|
+
def last_name
|
54
|
+
|
55
|
+
return self[:last_name] if self[:last_name]
|
56
|
+
|
57
|
+
if (name.split.count > 3) || (name.split[-2].downcase == name.split[-2])
|
58
|
+
name.split[-2..-1].join(' ')
|
59
|
+
else
|
60
|
+
name.split.last
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
# Get the :office value.
|
66
|
+
def office
|
67
|
+
@office = self[:office]
|
68
|
+
end
|
69
|
+
|
70
|
+
# Set the :office value.
|
71
|
+
def office=(value)
|
72
|
+
@office = value
|
73
|
+
self[:office] = @office
|
74
|
+
end
|
75
|
+
|
76
|
+
# Get the :party value.
|
77
|
+
def party
|
78
|
+
@party = self[:party]
|
79
|
+
end
|
80
|
+
|
81
|
+
# Set the :party value.
|
82
|
+
def party=(value)
|
83
|
+
@party = value
|
84
|
+
self[:party] = @party
|
85
|
+
end
|
86
|
+
|
87
|
+
# Get the :phone value.
|
88
|
+
def phone
|
89
|
+
@phone = self[:phone]
|
90
|
+
end
|
91
|
+
|
92
|
+
# Set the :phone value.
|
93
|
+
def phone=(value)
|
94
|
+
@phone = value
|
95
|
+
self[:phone] = @phone
|
96
|
+
end
|
97
|
+
|
98
|
+
# Get the :alt_phone value.
|
99
|
+
# def alt_phone
|
100
|
+
# @alt_phone = self[:alt_phone]
|
101
|
+
# end
|
102
|
+
|
103
|
+
# Set the :alt_phone value.
|
104
|
+
# def alt_phone=(value)
|
105
|
+
# @alt_phone = value
|
106
|
+
# self[:alt_phone] = @alt_phone
|
107
|
+
# end
|
108
|
+
|
109
|
+
# Get the :alt_address_1 value.
|
110
|
+
# def alt_address_1
|
111
|
+
# @alt_address_1 = self[:alt_address_1]
|
112
|
+
# end
|
113
|
+
|
114
|
+
# Set the :alt_address_1 value.
|
115
|
+
# def alt_address_1=(value)
|
116
|
+
# @alt_address_1 = value
|
117
|
+
# self[:alt_address_1] = @alt_address_1
|
118
|
+
# end
|
119
|
+
|
120
|
+
# Get the :alt_address_2 value.
|
121
|
+
# def alt_address_2
|
122
|
+
# @alt_address_2 = self[:alt_address_2]
|
123
|
+
# end
|
124
|
+
|
125
|
+
# Set the :alt_address_2 value.
|
126
|
+
# def alt_address_2=(value)
|
127
|
+
# @alt_address_2 = value
|
128
|
+
# self[:alt_address_2] = @alt_address_2
|
129
|
+
# end
|
130
|
+
|
131
|
+
# Get the :alt_address_3 value.
|
132
|
+
# def alt_address_3
|
133
|
+
# @alt_address_3 = self[:alt_address_3]
|
134
|
+
# end
|
135
|
+
|
136
|
+
# Set the :alt_address_3 value.
|
137
|
+
# def alt_address_3=(value)
|
138
|
+
# @alt_address_3 = value
|
139
|
+
# self[:alt_address_3] = @alt_address_3
|
140
|
+
# end
|
141
|
+
|
142
|
+
# Get the :address_1 value.
|
143
|
+
# def address_1
|
144
|
+
# @address_1 = self[:address_1]
|
145
|
+
# end
|
146
|
+
|
147
|
+
# Set the :address_1 value.
|
148
|
+
# def address_1=(value)
|
149
|
+
# @address_1 = value
|
150
|
+
# self[:address_1] = @address_1
|
151
|
+
# end
|
152
|
+
|
153
|
+
# Get the :address_2 value.
|
154
|
+
# def address_2
|
155
|
+
# @address_2 = self[:address_2]
|
156
|
+
# end
|
157
|
+
|
158
|
+
# Set the :address_2 value.
|
159
|
+
# def address_2=(value)
|
160
|
+
# @address_2 = value
|
161
|
+
# self[:address_2] = @address_2
|
162
|
+
# end
|
163
|
+
|
164
|
+
# Get the :address_3 value.
|
165
|
+
# def address_3
|
166
|
+
# @address_3 = self[:address_3]
|
167
|
+
# end
|
168
|
+
|
169
|
+
# Set the :address_3 value.
|
170
|
+
# def address_3=(value)
|
171
|
+
# @address_3 = value
|
172
|
+
# self[:address_3] = @address_3
|
173
|
+
# end
|
174
|
+
|
175
|
+
def office_locations
|
176
|
+
@office_locations = self[:office_locations]
|
177
|
+
end
|
178
|
+
|
179
|
+
def office_locations=(value)
|
180
|
+
@office_locations = value
|
181
|
+
self[:office_locations] = @office_locations
|
182
|
+
end
|
183
|
+
|
184
|
+
# Get the :email value.
|
185
|
+
def email
|
186
|
+
@email = self[:email]
|
187
|
+
end
|
188
|
+
|
189
|
+
# Set the :email value.
|
190
|
+
def email=(value)
|
191
|
+
@email = value
|
192
|
+
self[:email] = @email
|
193
|
+
end
|
194
|
+
|
195
|
+
# Get the :committees value.
|
196
|
+
def committees
|
197
|
+
@committees = self[:committees]
|
198
|
+
end
|
199
|
+
|
200
|
+
# Set the :committees value.
|
201
|
+
def committees=(value)
|
202
|
+
@committees = value
|
203
|
+
self[:committees] = @committees
|
204
|
+
end
|
205
|
+
|
206
|
+
# Get the :url value.
|
207
|
+
def url
|
208
|
+
@url = self[:url]
|
209
|
+
end
|
210
|
+
|
211
|
+
# Set the :url value.
|
212
|
+
def url=(value)
|
213
|
+
@url = value
|
214
|
+
self[:url] = @url
|
215
|
+
end
|
216
|
+
|
217
|
+
# Get the :photo value.
|
218
|
+
def photo
|
219
|
+
@photo = self[:photo]
|
220
|
+
end
|
221
|
+
|
222
|
+
# Set the :photo value.
|
223
|
+
def photo=(value)
|
224
|
+
@photo = value
|
225
|
+
self[:photo] = @photo
|
226
|
+
end
|
227
|
+
|
228
|
+
# Get the :twitter value.
|
229
|
+
def twitter
|
230
|
+
@twitter = self[:twitter]
|
231
|
+
end
|
232
|
+
|
233
|
+
# Set the :twitter value.
|
234
|
+
def twitter=(value)
|
235
|
+
@twitter = value
|
236
|
+
self[:twitter] = @twitter
|
237
|
+
end
|
238
|
+
|
239
|
+
# Get the :facebook value.
|
240
|
+
def facebook
|
241
|
+
@facebook = self[:facebook]
|
242
|
+
end
|
243
|
+
|
244
|
+
# Set the :facebook value.
|
245
|
+
def facebook=(value)
|
246
|
+
@facebook = value
|
247
|
+
self[:facebook] = @facebook
|
248
|
+
end
|
249
|
+
|
250
|
+
# Get the :youtube value.
|
251
|
+
def youtube
|
252
|
+
@youtube = self[:youtube]
|
253
|
+
end
|
254
|
+
|
255
|
+
# Set the :youtube value.
|
256
|
+
def youtube=(value)
|
257
|
+
@youtube = value
|
258
|
+
self[:youtube] = @youtube
|
259
|
+
end
|
260
|
+
|
261
|
+
# Get the :googleplus value.
|
262
|
+
def googleplus
|
263
|
+
@googleplus = self[:googleplus]
|
264
|
+
end
|
265
|
+
|
266
|
+
# Set the :googleplus value.
|
267
|
+
def googleplus=(value)
|
268
|
+
@googleplus = value
|
269
|
+
self[:googleplus] = @googleplus
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: get_your_rep
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- msimonborg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: geocoder
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.4'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.4.1
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.4'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.4.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: pry
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: minitest
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '5.10'
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 5.10.1
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '5.10'
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 5.10.1
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: minitest-reporters
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '1.1'
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 1.1.13
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '1.1'
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 1.1.13
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: rake
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '10'
|
108
|
+
type: :development
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - "~>"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '10'
|
115
|
+
description: Get your rep with Google's Civic Information API using your address and
|
116
|
+
API key. Also access the Open States API for additional information about state
|
117
|
+
legislators. Formerly get-your-rep. New API, new guts, faster performance, more
|
118
|
+
extensible, better results. Zip codes are geocoded for improved data returns. Namespaced
|
119
|
+
to avoid naming collisions. Generally better programmed. Changes to API may persist
|
120
|
+
until 1.0. Documentation will be updated soon.
|
121
|
+
email: msimonborg@gmail.com
|
122
|
+
executables: []
|
123
|
+
extensions: []
|
124
|
+
extra_rdoc_files: []
|
125
|
+
files:
|
126
|
+
- lib/core_extensions/array/get_your_rep_mutations.rb
|
127
|
+
- lib/core_extensions/hash/get_your_rep_mutations.rb
|
128
|
+
- lib/get_your_rep.rb
|
129
|
+
- lib/get_your_rep/delegation.rb
|
130
|
+
- lib/get_your_rep/google.rb
|
131
|
+
- lib/get_your_rep/open_states.rb
|
132
|
+
- lib/get_your_rep/representative.rb
|
133
|
+
homepage: https://github.com/msimonborg/get-your-rep
|
134
|
+
licenses:
|
135
|
+
- MIT
|
136
|
+
metadata: {}
|
137
|
+
post_install_message:
|
138
|
+
rdoc_options: []
|
139
|
+
require_paths:
|
140
|
+
- lib
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 2.0.0
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
requirements: []
|
152
|
+
rubyforge_project:
|
153
|
+
rubygems_version: 2.5.2
|
154
|
+
signing_key:
|
155
|
+
specification_version: 4
|
156
|
+
summary: Get yo' rep!
|
157
|
+
test_files: []
|