Class: Governator::CivilServices
- Inherits:
-
Object
- Object
- Governator::CivilServices
show all
- Extended by:
- HTTPClient
- Defined in:
- lib/governator/civil_services.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from HTTPClient
base_uri, get_page_contents
Constructor Details
Returns a new instance of CivilServices.
20
21
22
|
# File 'lib/governator/civil_services.rb', line 20
def initialize(governor)
@governor = governor
end
|
Instance Attribute Details
#governor ⇒ Object
Returns the value of attribute governor.
18
19
20
|
# File 'lib/governator/civil_services.rb', line 18
def governor
@governor
end
|
Class Method Details
.json ⇒ Object
9
10
11
|
# File 'lib/governator/civil_services.rb', line 9
def self.json
@_json ||= JSON.parse get_page_contents(uri)
end
|
.uri ⇒ Object
13
14
15
16
|
# File 'lib/governator/civil_services.rb', line 13
def self.uri
@_uri ||= 'https://raw.githubusercontent.com/CivilServiceUSA/us-governors'\
'/master/us-governors/data/us-governors.json'
end
|
Instance Method Details
40
41
42
|
# File 'lib/governator/civil_services.rb', line 40
def contact_form
record['contact_page'] if record
end
|
#facebook ⇒ Object
28
29
30
|
# File 'lib/governator/civil_services.rb', line 28
def facebook
@_facebook ||= record['facebook_url'].sub('https://www.facebook.com/', '') if facebook_url?
end
|
#facebook_url? ⇒ Boolean
32
33
34
|
# File 'lib/governator/civil_services.rb', line 32
def facebook_url?
record && record['facebook_url']
end
|
#photo_url ⇒ Object
36
37
38
|
# File 'lib/governator/civil_services.rb', line 36
def photo_url
record['photo_url'] if record
end
|
24
25
26
|
# File 'lib/governator/civil_services.rb', line 24
def
record['twitter_handle'] if record
end
|