Class: Governator::CivilServices

Inherits:
Object
  • Object
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

#initialize(governor) ⇒ CivilServices

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

#governorObject (readonly)

Returns the value of attribute governor.



18
19
20
# File 'lib/governator/civil_services.rb', line 18

def governor
  @governor
end

Class Method Details

.jsonObject



9
10
11
# File 'lib/governator/civil_services.rb', line 9

def self.json
  @_json ||= JSON.parse get_page_contents(uri)
end

.uriObject



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

#contact_formObject



40
41
42
# File 'lib/governator/civil_services.rb', line 40

def contact_form
  record['contact_page'] if record
end

#facebookObject



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

Returns:

  • (Boolean)


32
33
34
# File 'lib/governator/civil_services.rb', line 32

def facebook_url?
  record && record['facebook_url']
end

#photo_urlObject



36
37
38
# File 'lib/governator/civil_services.rb', line 36

def photo_url
  record['photo_url'] if record
end

#twitterObject



24
25
26
# File 'lib/governator/civil_services.rb', line 24

def twitter
  record['twitter_handle'] if record
end