Class: GetYourRep::GoogleRep
- Defined in:
- lib/get_your_rep/responses/google_rep.rb
Overview
Parses rep information from Google response.
Instance Attribute Summary collapse
-
#address ⇒ Object
An array of office addresses to be passes to a GoogleOffice instance for parsing.
-
#channels ⇒ Object
An array of social media handles.
-
#emails ⇒ Object
An array of email addresses.
-
#hash ⇒ Object
Passes the GetYourRep::Representative constructor hash to different methods for assembly.
-
#office_name ⇒ Object
The office name must be parsed from an array passed to the build_hash method.
-
#phones ⇒ Object
An array of phone numbers.
-
#urls ⇒ Object
An array of websites.
Instance Method Summary collapse
-
#build_hash(offices_array, index) ⇒ Object
Build a hash from attributes to be passed to the GetYourRep::Representative constructor method.
-
#initialize(options = {}) ⇒ GoogleRep
constructor
Sets array attributes to empty arrays and and builds other attributes from options hash.
Constructor Details
#initialize(options = {}) ⇒ GoogleRep
Sets array attributes to empty arrays and and builds other attributes from options hash.
25 26 27 28 29 30 31 32 |
# File 'lib/get_your_rep/responses/google_rep.rb', line 25 def initialize( = {}) self.phones = [] self.emails = [] self.urls = [] self.address = [] self.channels = [] super end |
Instance Attribute Details
#address ⇒ Object
An array of office addresses to be passes to a GoogleOffice instance for parsing. Default = []
14 15 16 |
# File 'lib/get_your_rep/responses/google_rep.rb', line 14 def address @address end |
#channels ⇒ Object
An array of social media handles. Default = []
16 17 18 |
# File 'lib/get_your_rep/responses/google_rep.rb', line 16 def channels @channels end |
#emails ⇒ Object
An array of email addresses. Default = []
10 11 12 |
# File 'lib/get_your_rep/responses/google_rep.rb', line 10 def emails @emails end |
#hash ⇒ Object
Passes the GetYourRep::Representative constructor hash to different methods for assembly.
18 19 20 |
# File 'lib/get_your_rep/responses/google_rep.rb', line 18 def hash @hash end |
#office_name ⇒ Object
The office name must be parsed from an array passed to the build_hash method. the office_array is an array of hashes and is a sibling to the officials array from which the rep info is parsed.
22 23 24 |
# File 'lib/get_your_rep/responses/google_rep.rb', line 22 def office_name @office_name end |
#phones ⇒ Object
An array of phone numbers. Default = []
8 9 10 |
# File 'lib/get_your_rep/responses/google_rep.rb', line 8 def phones @phones end |
#urls ⇒ Object
An array of websites. Default = []
12 13 14 |
# File 'lib/get_your_rep/responses/google_rep.rb', line 12 def urls @urls end |
Instance Method Details
#build_hash(offices_array, index) ⇒ Object
Build a hash from attributes to be passed to the GetYourRep::Representative constructor method.
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/get_your_rep/responses/google_rep.rb', line 35 def build_hash(offices_array, index) find_office_name(offices_array, index) self.hash = { name: name, office: office_name, party: party, phones: phones, office_locations: office_locations, email: emails, url: url, photo: photoUrl } parse_channels hash end |