Sha256: 63f0f6ac7b22cfc6bfdd1062d48075bc32eb4ebf71335a5cd6bd93a3e1b1c776
Contents?: true
Size: 1.35 KB
Versions: 6
Compression:
Stored size: 1.35 KB
Contents
module FilmOn module Services module Channels # channel: will get the verbose details for a channel with # the given id # 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: 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. # 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: takes the raw JSON # and coverts it into a nice ruby object # normal for use after storing the JSON in # a caching mechanism # def convert_channel(json) hash = JSON.parse(json) FilmOn::Channel.new(hash) end # convert_channels: takes the raw JSON # and coverts it into a nice ruby array of # objects # def convert_channels(json) hash = JSON.parse(json) hash.map{|ch| FilmOn::Channel.new(ch)} end end end end
Version data entries
6 entries across 6 versions & 1 rubygems