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.
12 13 14 |
# File 'lib/fcc/station/info.rb', line 12 def initialize(service) @service = service end |
Instance Attribute Details
#results ⇒ Object
Returns the value of attribute results.
10 11 12 |
# File 'lib/fcc/station/info.rb', line 10 def results @results end |
#service ⇒ Object
Returns the value of attribute service.
10 11 12 |
# File 'lib/fcc/station/info.rb', line 10 def service @service end |
Instance Method Details
#find(id_or_call_sign, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fcc/station/info.rb', line 16 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}.json") response['results']['facility'] end |