Class: Governator::CivilServices
- Inherits:
-
Object
- Object
- Governator::CivilServices
- Defined in:
- lib/governator/civil_services.rb
Instance Attribute Summary collapse
-
#governor ⇒ Object
readonly
Returns the value of attribute governor.
Class Method Summary collapse
Instance Method Summary collapse
- #contact_form ⇒ Object
- #facebook ⇒ Object
-
#initialize(governor) ⇒ CivilServices
constructor
A new instance of CivilServices.
- #photo_url ⇒ Object
- #twitter ⇒ Object
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
#governor ⇒ Object (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
.json ⇒ Object
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_form ⇒ Object
32 33 34 |
# File 'lib/governator/civil_services.rb', line 32 def contact_form record['contact_page'] if record end |
#facebook ⇒ Object
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_url ⇒ Object
28 29 30 |
# File 'lib/governator/civil_services.rb', line 28 def photo_url record['photo_url'] if record end |
#twitter ⇒ Object
18 19 20 |
# File 'lib/governator/civil_services.rb', line 18 def twitter record['twitter_handle'] if record end |