Module: Metacritic
- Defined in:
- lib/metacritic.rb,
lib/metacritic/Game.rb,
lib/metacritic/movie.rb,
lib/metacritic/review.rb,
lib/metacritic/version.rb
Defined Under Namespace
Classes: Game, Movie, Reviews
Constant Summary
collapse
- VERSION =
"0.1.1"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
11
12
13
|
# File 'lib/metacritic.rb', line 11
def api_key
@api_key
end
|
.response ⇒ Object
Returns the value of attribute response.
11
12
13
|
# File 'lib/metacritic.rb', line 11
def response
@response
end
|
Class Method Details
.game(title) ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/metacritic.rb', line 50
def game(title)
@game = Unirest.post "https://byroredux-metacritic.p.mashape.com/find/game",
headers:{
"X-Mashape-Key" => api_key,
"Content-Type" => "application/x-www-form-urlencoded",
"Accept" => "application/json"
},
parameters:{
"platform" => 1,
"retry" => 4,
"title" => title
}
Game.new(@game)
end
|
.movie(title) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/metacritic.rb', line 17
def movie(title)
@response = Unirest.post "https://byroredux-metacritic.p.mashape.com/find/movie",
headers:{
"X-Mashape-Key" => api_key,
"Content-Type" => "application/x-www-form-urlencoded",
"Accept" => "application/json"
},
parameters:{
"retry" => 4,
"title" => title
}
Movie.new(@response)
end
|
.reviews(url) ⇒ Object
46
47
48
|
# File 'lib/metacritic.rb', line 46
def reviews(url)
Reviews.new(url)
end
|