module FilmOn::Services::Groups
Public Instance Methods
convert_groups(json)
click to toggle source
convert_groups
: takes the raw JSON and converts it into a nice ruby array of objects
# File lib/film_on/services/groups.rb, line 20 def convert_groups(json) hash = JSON.parse(json) hash.map{|gr| FilmOn::Group.new(gr)} end
find_group(id)
click to toggle source
find_group
: a convenience method to find the full detail of any given group
# File lib/film_on/services/groups.rb, line 28 def find_group(id) id = id.to_s groups.select{|gr| gr.id == id}.first end
groups(opts={})
click to toggle source
groups: will get the entire current list of groups for FilmOn
, each group holds an array of ids of associated channels
# File lib/film_on/services/groups.rb, line 8 def groups(opts={}) return @groups if @groups && !opts[:json] json = get("groups") if opts[:json] return json end @groups = convert_groups(json) end