class Shin::Reviews::Moviezine

Public Instance Methods

find(h = {}) click to toggle source

Currently IMDB ID is the only way

# File lib/shin/reviews/moviezine.rb, line 14
def find(h = {})
  raise MissingArgument, "You are missing the argument 'imdb' which is required to use this source." unless h[:imdb] != ""
  
  # We got the needed things
  imdb_id_int = h[:imdb].gsub(/^tt/, "")
  response = Base.get('https://www.film2home.se/Services/MovieZine.svc/GetReview?imdbId='+imdb_id_int.to_s)
  
  # Raise error if it didn't have a correct http code.
  raise HTTPError, "The response didn't have a 200 HTTP Code. It had #{response.code}." unless response.code == 200
  
  data = response.parsed_response
  {name: nil, year: nil, title: data['Title'], rating: data['Rating'].to_i, url: data['Url'], votes: nil}.to_hashugar
end
new() click to toggle source
# File lib/shin/reviews/moviezine.rb, line 9
def new
  self
end