Class: FCC::Station::Info
- Inherits:
-
Object
- Object
- FCC::Station::Info
- Includes:
- HTTParty
- Defined in:
- lib/fcc/station/info.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
Returns the value of attribute results.
-
#service ⇒ Object
Returns the value of attribute service.
Instance Method Summary collapse
- #find(id_or_call_sign, options = {}) ⇒ Object
-
#initialize(service) ⇒ Info
constructor
A new instance of Info.
Constructor Details
#initialize(service) ⇒ Info
Returns a new instance of Info.
11 12 13 |
# File 'lib/fcc/station/info.rb', line 11 def initialize(service) @service = service end |
Instance Attribute Details
#results ⇒ Object
Returns the value of attribute results.
9 10 11 |
# File 'lib/fcc/station/info.rb', line 9 def results @results end |
#service ⇒ Object
Returns the value of attribute service.
9 10 11 |
# File 'lib/fcc/station/info.rb', line 9 def service @service end |
Instance Method Details
#find(id_or_call_sign, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fcc/station/info.rb', line 15 def find(id_or_call_sign, = {}) id = if id_or_call_sign =~ /^\d+$/ id_or_call_sign else Station.index(service).call_sign_to_id(id_or_call_sign) end response = self.class.get("/api/service/#{service.to_s.downcase}/facility/id/#{id}") begin body = response['results']['facility'] body['band'] = service.to_s.upcase.to_s body rescue StandardError => e return nil end end |