module FilmOn::Services::VideoOnDemand

Constants

VodSearchResult

VodSearchResult: Struct to handle the response from the search, which includes an array of movies, as well as the actual number returned (total) and the overall total for the seach result (total_found) to get the array of movies we have to do film_on.vod_search.movies

Public Instance Methods

convert_genres(json) click to toggle source

convert_genres: takes the raw JSON and converts it into a nice ruby array of objects

# File lib/film_on/services/video_on_demand.rb, line 103
def convert_genres(json)
  hash = JSON.parse(json)["response"]
  hash.map{|gen| FilmOn::Genre.new(gen)}
end
convert_movie(json) click to toggle source

convert_movie: 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/video_on_demand.rb, line 95
def convert_movie(json)
  hash = JSON.parse(json)["response"]
  FilmOn::Movie.new(hash)
end
genres(opts={}) click to toggle source

Ref: www.filmon.com/page/api-vod

# File lib/film_on/services/video_on_demand.rb, line 15
def genres(opts={})
  return @genres if @genres && !opts[:json]
  json = get_vod("genres")
  if opts[:json]
    return json
  end
  @genres = convert_genres(json)
end
movie(id, opts={}) click to toggle source

movie: retrieve a specific movie with a given id

# File lib/film_on/services/video_on_demand.rb, line 66
def movie(id, opts={})
  id = id.to_s
  return @movie[id] if @movie[id] && !opts[:json]
  json = get_vod("movie", {id: id})
  if opts[:json]
    return json
  end
  @movie[id] = convert_movie(json)
end