module FilmOn::Services::Channels
Public Instance Methods
channel(id, opts={})
click to toggle source
channel: will get the verbose details for a channel with the given id
# File lib/film_on/services/channels.rb, line 8 def channel(id, opts={}) id = id.to_s return @channel[id] if @channel[id] && !opts[:json] json = get("channel/#{id}") if opts[:json] return json end @channel[id] = convert_channel(json) end
channels(opts={})
click to toggle source
channels: will get the entire current list of channels for FilmOn
, each channels has a small amount of useful data, refer to channel
for additional channel information.
# File lib/film_on/services/channels.rb, line 22 def channels(opts={}) return @channels if @channels && !opts[:json] json = get("channels") if opts[:json] return json end @channels = convert_channels(json) end
convert_channel(json)
click to toggle source
convert_channel
: takes the raw JSON and coverts it into a nice ruby object normal for use after storing the JSON in a caching mechanism
# File lib/film_on/services/channels.rb, line 36 def convert_channel(json) hash = JSON.parse(json) FilmOn::Channel.new(hash) end
convert_channels(json)
click to toggle source
convert_channels
: takes the raw JSON and coverts it into a nice ruby array of objects
# File lib/film_on/services/channels.rb, line 45 def convert_channels(json) hash = JSON.parse(json) hash.map{|ch| FilmOn::Channel.new(ch)} end