class Shin::Play::Cmore
Public Instance Methods
before(params={})
click to toggle source
Fix these before running
# File lib/shin/play/cmore.rb, line 12 def before(params={}) raise MissingArgument, "You are missing the argument 'cmore_code' which is required to use this source." unless Shin.get[:cmore_code] != nil return "http://www.cmore." + Shin.get[:cmore_code] + "/", CMORE_API_URL + "capiche.cmore." + Shin.get[:cmore_code] + "/" end
find(params={})
click to toggle source
Find
# File lib/shin/play/cmore.rb, line 81 def find(params={}) domain, api_domain = before() country = Shin.get[:cmore_code] # Response response = Base.get(api_domain + 'films/find.json?page_count=50&' + URI.encode_www_form(params)) raise HTTPError, "The response didn't have a 200 HTTP Code. It had #{response.code}." unless response.code == 200 # Data data = Oj.load(response.body) rescue nil # Can't be nil if data != nil data.to_hashugar else raise NotValid, "Couldn't parse the JSON" end end
list(list_id)
click to toggle source
Get a list
# File lib/shin/play/cmore.rb, line 19 def list(list_id) domain, api_domain = before() country = Shin.get[:cmore_code] # Get list response = Base.get(api_domain + 'api/CMA/content/panel/' + list_id + '.json') raise HTTPError, "The response didn't have a 200 HTTP Code. It had #{response.code}." unless response.code == 200 # Data data = Oj.load(response.body) rescue nil # Can't be nil if data != nil data['results'].to_hashugar else raise NotValid, "Couldn't parse the JSON" end end
movie(params={})
click to toggle source
Movie
# File lib/shin/play/cmore.rb, line 60 def movie(params={}) domain, api_domain = before() country = Shin.get[:cmore_code] # Response response = Base.get(api_domain + 'film/' + params[:id] + '.json') raise HTTPError, "The response didn't have a 200 HTTP Code. It had #{response.code}." unless response.code == 200 # Data data = Oj.load(response.body) rescue nil # Can't be nil if data != nil data.to_hashugar else raise NotValid, "Couldn't parse the JSON" end end
new()
click to toggle source
# File lib/shin/play/cmore.rb, line 7 def new self end
show(params={})
click to toggle source
Show
# File lib/shin/play/cmore.rb, line 39 def show(params={}) domain, api_domain = before() country = Shin.get[:cmore_code] # Response response = Base.get(api_domain + 'serie/' + params[:id] + '.json') raise HTTPError, "The response didn't have a 200 HTTP Code. It had #{response.code}." unless response.code == 200 # Data data = Oj.load(response.body) rescue nil # Can't be nil if data != nil data.to_hashugar else raise NotValid, "Couldn't parse the JSON" end end