class Shin::Play::Dplay
Public Instance Methods
before(params={})
click to toggle source
Fix these before running
# File lib/shin/play/dplay.rb, line 12 def before(params={}) raise MissingArgument, "You are missing the argument 'dplay_code' which is required to use this source." unless Shin.get[:dplay_code] != nil "http://www.dplay." + Shin.get[:dplay_code] end
module(params={})
click to toggle source
Module (added recently)
# File lib/shin/play/dplay.rb, line 77 def module(params={}) domain = before() # Response response = Base.get(domain + '/api/v2/ajax/modules?' + 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 # Multiple 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/dplay.rb, line 7 def new self end
program(params={})
click to toggle source
Program
# File lib/shin/play/dplay.rb, line 38 def program(params={}) raise MissingArgument, "You are missing the argument 'show_id' which is required to use this source." unless params[:show_id] != "" domain = before() # Response response = Base.get(domain + '/api/v2/ajax/shows/' + params[:show_id].to_s + '?show_id=' + params[:show_id].to_s) 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
programs(params={})
click to toggle source
Programs
# File lib/shin/play/dplay.rb, line 19 def programs(params={}) domain = before() # Response response = Base.get(domain + '/api/v2/ajax/shows?' + 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 # Multiple if data != nil data.to_hashugar else raise NotValid, "Couldn't parse the JSON" end end
videos(params={})
click to toggle source
Videos
# File lib/shin/play/dplay.rb, line 58 def videos(params={}) domain = before() # Response response = Base.get(domain + '/api/v2/ajax/shows/' + params[:show_id] + '/seasons?' + 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 # Multiple if data != nil data.to_hashugar else raise NotValid, "Couldn't parse the JSON" end end