Class: Governator::CivilServices

Inherits:
Object
  • Object
show all
Defined in:
lib/governator/civil_services.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(governor) ⇒ CivilServices

Returns a new instance of CivilServices.



14
15
16
# File 'lib/governator/civil_services.rb', line 14

def initialize(governor)
  @governor = governor
end

Instance Attribute Details

#governorObject (readonly)

Returns the value of attribute governor.



12
13
14
# File 'lib/governator/civil_services.rb', line 12

def governor
  @governor
end

Class Method Details

.jsonObject



5
6
7
8
9
10
# File 'lib/governator/civil_services.rb', line 5

def self.json
  @_json ||= JSON.parse Faraday.get(
    'https://raw.githubusercontent.com/CivilServiceUSA/us-governors'\
      '/master/us-governors/data/us-governors.json'
  ).body
end

Instance Method Details

#contact_formObject



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

def contact_form
  record['contact_page'] if record
end

#facebookObject



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

def facebook
  if record && record['facebook_url']
    @_facebook ||= record['facebook_url'].sub('https://www.facebook.com/', '')
  end
end

#photo_urlObject



28
29
30
# File 'lib/governator/civil_services.rb', line 28

def photo_url
  record['photo_url'] if record
end

#twitterObject



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

def twitter
  record['twitter_handle'] if record
end