class Shin::Play::Tv2sumo

Public Instance Methods

junior() click to toggle source

All children shows

# File lib/shin/play/tv2sumo.rb, line 45
def junior
  # Response
  response = Base.get('https://sumo.tv2.no/rest/categories/91101/shows?sort=alphabetical&size=999')
  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['shows'].to_hashugar
  else
    raise NotValid, "Couldn't parse the JSON"
  end
end
movies() click to toggle source

All movies

# File lib/shin/play/tv2sumo.rb, line 28
def movies
  # Response
  response = Base.get('https://sumo.tv2.no/rest/categories/90987/movies?sort=alphabetical&size=999')
  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['assets'].to_hashugar
  else
    raise NotValid, "Couldn't parse the JSON"
  end
end
new() click to toggle source
# File lib/shin/play/tv2sumo.rb, line 6
def new
  self
end
series() click to toggle source

All tv series

# File lib/shin/play/tv2sumo.rb, line 11
def series
  # Response
  response = Base.get('https://sumo.tv2.no/rest/categories/90316/shows?sort=alphabetical&size=999')
  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['shows'].to_hashugar
  else
    raise NotValid, "Couldn't parse the JSON"
  end
end