Module: FilmOn::Services::Channels
- Included in:
- Base
- Defined in:
- lib/film_on/services/channels.rb
Instance Method Summary collapse
-
#channel(id, opts = {}) ⇒ Object
channel: will get the verbose details for a channel with the given id.
-
#channels(opts = {}) ⇒ Object
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.
-
#convert_channel(json) ⇒ Object
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.
-
#convert_channels(json) ⇒ Object
convert_channels: takes the raw JSON and coverts it into a nice ruby array of objects.
Instance Method Details
#channel(id, opts = {}) ⇒ Object
channel: will get the verbose details for a channel with the given id
8 9 10 11 12 13 14 15 16 |
# 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 = {}) ⇒ Object
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.
22 23 24 25 26 27 28 29 |
# 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) ⇒ Object
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
36 37 38 39 |
# File 'lib/film_on/services/channels.rb', line 36 def convert_channel(json) hash = JSON.parse(json) FilmOn::Channel.new(hash) end |