class TMSAPI::Resource::Stations

Public Class Methods

new(connection, options = {}) click to toggle source
Calls superclass method TMSAPI::Resource::Base::new
# File lib/tmsapi/resource/stations.rb, line 7
def initialize(connection, options = {})
  super(connection, "v1")
end

Public Instance Methods

airings(stationId, params = nil) click to toggle source
# File lib/tmsapi/resource/stations.rb, line 23
def airings(stationId, params = nil)
  params = { :startDateTime => Time.now.strftime("%Y-%m-%dT%H:%MZ")} unless params
  
  get(airings_path(stationId),params).each do |airing|
    TMSAPI::Model::Airing.new airing
  end
end
details(stationId, lineupId = nil) click to toggle source
# File lib/tmsapi/resource/stations.rb, line 11
def details(stationId, lineupId = nil)
  if lineupId then
    params = {:lineupId => lineupId}
  else
    params = nil
  end
  
  get(details_path(stationId),params).each do |station|
    TMSAPI::Model::Station.new station
  end
end

Private Instance Methods

airings_path(stationId) click to toggle source
# File lib/tmsapi/resource/stations.rb, line 37
def airings_path(stationId)
  "#{details_path(stationId)}/airings"
end
base_path() click to toggle source
# File lib/tmsapi/resource/stations.rb, line 41
def base_path
  "stations"
end
details_path(stationId) click to toggle source
# File lib/tmsapi/resource/stations.rb, line 33
def details_path(stationId)
  "#{base_path}/#{stationId}"
end