class FCC::Station::Index

Attributes

service[RW]

Public Class Methods

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

Public Instance Methods

call_sign_to_id(call_sign) click to toggle source
# File lib/fcc/station/index.rb, line 14
def call_sign_to_id(call_sign)
  found = results.detect do |hash|
    hash['callSign'] == call_sign.upcase
  end

  found ||= results.detect do |hash|
    hash['callSign'] == "#{call_sign.upcase}-#{service.to_s.upcase}"
  end

  found['id'] if found
end
inspect() click to toggle source
# File lib/fcc/station/index.rb, line 26
def inspect
  "<Station::Index @results=[#{results.size}]>"
end
results() click to toggle source
# File lib/fcc/station/index.rb, line 30
def results
  @results ||= begin
    response = self.class.get("/api/service/#{service.to_s.downcase}/facility/getall")
    response.parsed_response['results']['facilityList']
  end
end