class FCC::Station::Info

Attributes

results[RW]
service[RW]

Public Class Methods

new(service) click to toggle source
# File lib/fcc/station/info.rb, line 11
def initialize(service)
  @service = service
end

Public Instance Methods

find(id_or_call_sign, options = {}) click to toggle source
# File lib/fcc/station/info.rb, line 15
def find(id_or_call_sign, options = {})
  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