memo_tomato 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -0
- data/README.md +20 -20
- data/Rakefile +8 -0
- data/lib/memo_tomato/parser/base.rb +12 -3
- data/lib/memo_tomato/parser/movie_info.rb +2 -6
- data/lib/memo_tomato/parser/search_movie.rb +2 -5
- data/lib/memo_tomato/parser/similar_movies.rb +2 -5
- data/lib/memo_tomato/parser/upcoming_movies.rb +2 -5
- data/lib/memo_tomato/version.rb +1 -1
- data/memo_tomato.gemspec +11 -10
- data/spec/memo_tomato/parser/movie_info_spec.rb +8 -0
- data/spec/mock_json/movies/770675547.json +49 -0
- data/spec/spec_helper.rb +2 -3
- metadata +69 -40
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,32 +1,32 @@
|
|
1
1
|
# Memo Tomato #
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
This gem is an object-oriented Ruby wrapper for the Rotten Tomatoes API
|
4
|
+
http://api.rottentomatoes.com/
|
5
5
|
|
6
|
-
|
6
|
+
[![Build Status](https://secure.travis-ci.org/appsbakery/memo_tomato.png?branch=master)](http://travis-ci.org/appsbakery/memo_tomato)
|
7
|
+
[![Dependency Status](https://gemnasium.com/appsbakery/memo_tomato.png?travis)](http://gemnasium.com/appsbakery/memo_tomato)
|
7
8
|
|
8
|
-
|
9
|
+
## Installation
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
First you have to create a client with your api key
|
13
|
-
|
14
|
-
client = MemoTomato::Client.new(:key => "abcd1234")
|
15
|
-
|
16
|
-
You can search tv shows with
|
11
|
+
Install the latest stable release:
|
17
12
|
|
18
|
-
|
13
|
+
[sudo] gem install memo_tomato
|
19
14
|
|
20
|
-
|
15
|
+
In Rails, add it to your Gemfile:
|
21
16
|
|
22
|
-
|
17
|
+
```ruby
|
18
|
+
gem 'memo_tomato'
|
19
|
+
```
|
23
20
|
|
24
|
-
|
25
|
-
|
26
|
-
client.similar_movies("THE ID OF THE SHOW")
|
27
|
-
|
28
|
-
Get upcoming movies
|
21
|
+
## How to use it? ##
|
29
22
|
|
30
|
-
|
23
|
+
First you have to create a client with your api key
|
31
24
|
|
25
|
+
```ruby
|
26
|
+
client = MemoTomato::Client.new(:key => "abcd1234")
|
32
27
|
|
28
|
+
client.search("Star Wars") # Search for movies
|
29
|
+
client.movie_info("771271134") # Get movie info
|
30
|
+
client.similar_movies("771271134") # Get similar movies
|
31
|
+
client.upcoming_movies # Get upcoming movies
|
32
|
+
```
|
data/Rakefile
CHANGED
@@ -1,15 +1,24 @@
|
|
1
1
|
module MemoTomato
|
2
2
|
module Parser
|
3
3
|
class Base
|
4
|
-
def initialize(
|
5
|
-
@
|
4
|
+
def initialize(response)
|
5
|
+
@response = response
|
6
6
|
end
|
7
7
|
|
8
8
|
def parse
|
9
|
-
|
9
|
+
@content = Hashie::Mash.new(MultiJson.decode(@response.body))
|
10
|
+
parse_content
|
11
|
+
end
|
12
|
+
|
13
|
+
# This should be implemented in child class
|
14
|
+
def parse_content
|
10
15
|
end
|
11
16
|
|
12
17
|
def parse_entry(movie)
|
18
|
+
unless (movie.posters.detailed =~ /poster_default.gif$/).nil?
|
19
|
+
movie.posters.detailed = nil
|
20
|
+
end
|
21
|
+
|
13
22
|
MemoTomato::Movie.new(
|
14
23
|
:id => movie.id,
|
15
24
|
:title => movie.title,
|
@@ -1,13 +1,9 @@
|
|
1
1
|
module MemoTomato
|
2
2
|
module Parser
|
3
3
|
class MovieInfo < Base
|
4
|
-
def parse_content
|
5
|
-
|
6
|
-
parsed_response = Hashie::Mash.new(parsed_response)
|
7
|
-
|
8
|
-
parse_entry(parsed_response)
|
4
|
+
def parse_content
|
5
|
+
parse_entry(@content)
|
9
6
|
end
|
10
|
-
|
11
7
|
end
|
12
8
|
end
|
13
9
|
end
|
@@ -1,12 +1,9 @@
|
|
1
1
|
module MemoTomato
|
2
2
|
module Parser
|
3
3
|
class SearchMovie < Base
|
4
|
-
def parse_content
|
5
|
-
parsed_response = MultiJson.decode(content.body)
|
6
|
-
parsed_response = Hashie::Mash.new(parsed_response)
|
7
|
-
|
4
|
+
def parse_content
|
8
5
|
# In our case we want the first 30 movies
|
9
|
-
|
6
|
+
@content.movies.collect do |movie|
|
10
7
|
parse_entry(movie)
|
11
8
|
end
|
12
9
|
end
|
@@ -1,11 +1,8 @@
|
|
1
1
|
module MemoTomato
|
2
2
|
module Parser
|
3
3
|
class SimilarMovies < Base
|
4
|
-
def parse_content
|
5
|
-
|
6
|
-
parsed_response = Hashie::Mash.new(parsed_response)
|
7
|
-
|
8
|
-
parsed_response.movies.collect do |movie|
|
4
|
+
def parse_content
|
5
|
+
@content.movies.collect do |movie|
|
9
6
|
parse_entry(movie)
|
10
7
|
end
|
11
8
|
end
|
@@ -1,11 +1,8 @@
|
|
1
1
|
module MemoTomato
|
2
2
|
module Parser
|
3
3
|
class UpcomingMovies < Base
|
4
|
-
def parse_content
|
5
|
-
|
6
|
-
parsed_response = Hashie::Mash.new(parsed_response)
|
7
|
-
|
8
|
-
parsed_response.movies.collect do |movie|
|
4
|
+
def parse_content
|
5
|
+
@content.movies.collect do |movie|
|
9
6
|
parse_entry(movie)
|
10
7
|
end
|
11
8
|
end
|
data/lib/memo_tomato/version.rb
CHANGED
data/memo_tomato.gemspec
CHANGED
@@ -7,9 +7,9 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = MemoTomato::VERSION
|
8
8
|
s.authors = ["Todor Grudev", "Alex Ganov"]
|
9
9
|
s.email = ["tagrudev@gmail.com", "aganov@gmail.com"]
|
10
|
-
s.homepage = "http://
|
11
|
-
s.summary = %q{
|
12
|
-
s.description = %q{
|
10
|
+
s.homepage = "http://github.com/appsbakery/memo_tomato"
|
11
|
+
s.summary = %q{Ruby wrapper for the Rotten Tomatoes API}
|
12
|
+
s.description = %q{An object-oriented Ruby wrapper for the Rotten Tomatoes API http://api.rottentomatoes.com/}
|
13
13
|
|
14
14
|
s.rubyforge_project = "memo_tomato"
|
15
15
|
|
@@ -20,11 +20,12 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
# specify any dependencies here; for example:
|
22
22
|
s.add_runtime_dependency "multi_json", "~> 1.0"
|
23
|
-
s.add_runtime_dependency "httpclient", "
|
24
|
-
s.add_runtime_dependency "hashie", "
|
25
|
-
|
26
|
-
|
27
|
-
s.add_development_dependency "
|
28
|
-
s.add_development_dependency "
|
29
|
-
s.add_development_dependency "
|
23
|
+
s.add_runtime_dependency "httpclient", "~> 2.2"
|
24
|
+
s.add_runtime_dependency "hashie", "~> 1.1.0"
|
25
|
+
|
26
|
+
|
27
|
+
s.add_development_dependency "pry"
|
28
|
+
s.add_development_dependency "rake"
|
29
|
+
s.add_development_dependency "rspec", "~> 2.0"
|
30
|
+
s.add_development_dependency "webmock", "~> 1.6"
|
30
31
|
end
|
@@ -10,6 +10,7 @@ describe MemoTomato::Parser::MovieInfo do
|
|
10
10
|
movie.id.should == 770672122
|
11
11
|
movie.directors.first.name.should == "Lee Unkrich"
|
12
12
|
movie.genres.first.type.should == "Animation"
|
13
|
+
movie.image.should == "http://content6.flixster.com/movie/11/13/43/11134356_det.jpg"
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -19,5 +20,12 @@ describe MemoTomato::Parser::MovieInfo do
|
|
19
20
|
movie.directors.should == []
|
20
21
|
end
|
21
22
|
end
|
23
|
+
|
24
|
+
it 'should reject `default_poster.gif` for movie poster' do
|
25
|
+
mock_api :get, 'movies/770675547' , 'movies/770675547', :params => client.params do
|
26
|
+
movie = client.movie_info("770675547")
|
27
|
+
movie.image.should be_nil
|
28
|
+
end
|
29
|
+
end
|
22
30
|
end
|
23
31
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"id": 770675547,
|
3
|
+
"title": "Moi, Tintin (I, Tintin)",
|
4
|
+
"year": 1976,
|
5
|
+
"genres": [
|
6
|
+
"Documentary",
|
7
|
+
"Art House & International"
|
8
|
+
],
|
9
|
+
"mpaa_rating": "Unrated",
|
10
|
+
"runtime": 87,
|
11
|
+
"release_dates": {},
|
12
|
+
"ratings": {
|
13
|
+
"critics_score": -1,
|
14
|
+
"audience_score": 100
|
15
|
+
},
|
16
|
+
"synopsis": "",
|
17
|
+
"posters": {
|
18
|
+
"thumbnail": "http://images.rottentomatoescdn.com/images/redesign/poster_default.gif",
|
19
|
+
"profile": "http://images.rottentomatoescdn.com/images/redesign/poster_default.gif",
|
20
|
+
"detailed": "http://images.rottentomatoescdn.com/images/redesign/poster_default.gif",
|
21
|
+
"original": "http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"
|
22
|
+
},
|
23
|
+
"abridged_cast": [
|
24
|
+
{
|
25
|
+
"name": "Herge",
|
26
|
+
"id": "770674338"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"name": "Gerard Valet",
|
30
|
+
"id": "770680542"
|
31
|
+
}
|
32
|
+
],
|
33
|
+
"abridged_directors": [
|
34
|
+
{
|
35
|
+
"name": "Henri Roanne"
|
36
|
+
}
|
37
|
+
],
|
38
|
+
"alternate_ids": {
|
39
|
+
"imdb": "0257927"
|
40
|
+
},
|
41
|
+
"links": {
|
42
|
+
"self": "http://api.rottentomatoes.com/api/public/v1.0/movies/770675547.json",
|
43
|
+
"alternate": "http://www.rottentomatoes.com/m/moi-tintin-i-tintin/",
|
44
|
+
"cast": "http://api.rottentomatoes.com/api/public/v1.0/movies/770675547/cast.json",
|
45
|
+
"clips": "http://api.rottentomatoes.com/api/public/v1.0/movies/770675547/clips.json",
|
46
|
+
"reviews": "http://api.rottentomatoes.com/api/public/v1.0/movies/770675547/reviews.json",
|
47
|
+
"similar": "http://api.rottentomatoes.com/api/public/v1.0/movies/770675547/similar.json"
|
48
|
+
}
|
49
|
+
}
|
data/spec/spec_helper.rb
CHANGED
@@ -2,14 +2,13 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
3
|
|
4
4
|
|
5
|
-
require 'rspec'
|
6
5
|
require 'pry'
|
7
|
-
require '
|
6
|
+
require 'rspec'
|
8
7
|
require 'memo_tomato'
|
9
8
|
require 'helpers/webmock_helper'
|
10
9
|
|
11
10
|
RSpec.configure do |config|
|
12
11
|
config.before(:each) do
|
13
|
-
|
12
|
+
# Do nothing
|
14
13
|
end
|
15
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memo_tomato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
14
|
-
default_executable:
|
13
|
+
date: 2012-06-13 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: multi_json
|
18
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
19
18
|
none: false
|
20
19
|
requirements:
|
21
20
|
- - ~>
|
@@ -23,85 +22,109 @@ dependencies:
|
|
23
22
|
version: '1.0'
|
24
23
|
type: :runtime
|
25
24
|
prerelease: false
|
26
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '1.0'
|
27
31
|
- !ruby/object:Gem::Dependency
|
28
32
|
name: httpclient
|
29
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
30
34
|
none: false
|
31
35
|
requirements:
|
32
|
-
- -
|
36
|
+
- - ~>
|
33
37
|
- !ruby/object:Gem::Version
|
34
|
-
version: 2.2
|
38
|
+
version: '2.2'
|
35
39
|
type: :runtime
|
36
40
|
prerelease: false
|
37
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.2'
|
38
47
|
- !ruby/object:Gem::Dependency
|
39
48
|
name: hashie
|
40
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
41
50
|
none: false
|
42
51
|
requirements:
|
43
|
-
- -
|
52
|
+
- - ~>
|
44
53
|
- !ruby/object:Gem::Version
|
45
54
|
version: 1.1.0
|
46
55
|
type: :runtime
|
47
56
|
prerelease: false
|
48
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.1.0
|
49
63
|
- !ruby/object:Gem::Dependency
|
50
64
|
name: pry
|
51
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
52
66
|
none: false
|
53
67
|
requirements:
|
54
68
|
- - ! '>='
|
55
69
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0
|
70
|
+
version: '0'
|
57
71
|
type: :development
|
58
72
|
prerelease: false
|
59
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
60
79
|
- !ruby/object:Gem::Dependency
|
61
80
|
name: rake
|
62
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
63
82
|
none: false
|
64
83
|
requirements:
|
65
84
|
- - ! '>='
|
66
85
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0
|
86
|
+
version: '0'
|
68
87
|
type: :development
|
69
88
|
prerelease: false
|
70
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
71
95
|
- !ruby/object:Gem::Dependency
|
72
96
|
name: rspec
|
73
|
-
requirement:
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
74
98
|
none: false
|
75
99
|
requirements:
|
76
|
-
- -
|
100
|
+
- - ~>
|
77
101
|
- !ruby/object:Gem::Version
|
78
|
-
version: '2'
|
102
|
+
version: '2.0'
|
79
103
|
type: :development
|
80
104
|
prerelease: false
|
81
|
-
version_requirements:
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.0'
|
82
111
|
- !ruby/object:Gem::Dependency
|
83
112
|
name: webmock
|
84
|
-
requirement:
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
85
114
|
none: false
|
86
115
|
requirements:
|
87
|
-
- -
|
116
|
+
- - ~>
|
88
117
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.6
|
118
|
+
version: '1.6'
|
90
119
|
type: :development
|
91
120
|
prerelease: false
|
92
|
-
version_requirements:
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: timecop
|
95
|
-
requirement: &10504220 !ruby/object:Gem::Requirement
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
122
|
none: false
|
97
123
|
requirements:
|
98
|
-
- -
|
124
|
+
- - ~>
|
99
125
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
101
|
-
|
102
|
-
prerelease: false
|
103
|
-
version_requirements: *10504220
|
104
|
-
description: https://github.com/appsbakery/memo_tomato
|
126
|
+
version: '1.6'
|
127
|
+
description: An object-oriented Ruby wrapper for the Rotten Tomatoes API http://api.rottentomatoes.com/
|
105
128
|
email:
|
106
129
|
- tagrudev@gmail.com
|
107
130
|
- aganov@gmail.com
|
@@ -111,6 +134,7 @@ extra_rdoc_files: []
|
|
111
134
|
files:
|
112
135
|
- .gitignore
|
113
136
|
- .rspec
|
137
|
+
- .travis.yml
|
114
138
|
- Gemfile
|
115
139
|
- README.md
|
116
140
|
- Rakefile
|
@@ -139,10 +163,10 @@ files:
|
|
139
163
|
- spec/mock_json/movies.json
|
140
164
|
- spec/mock_json/movies/770672122.json
|
141
165
|
- spec/mock_json/movies/770672122/similar.json
|
166
|
+
- spec/mock_json/movies/770675547.json
|
142
167
|
- spec/mock_json/movies/770885199.json
|
143
168
|
- spec/spec_helper.rb
|
144
|
-
|
145
|
-
homepage: http://www.appsbakery.eu
|
169
|
+
homepage: http://github.com/appsbakery/memo_tomato
|
146
170
|
licenses: []
|
147
171
|
post_install_message:
|
148
172
|
rdoc_options: []
|
@@ -154,17 +178,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
178
|
- - ! '>='
|
155
179
|
- !ruby/object:Gem::Version
|
156
180
|
version: '0'
|
181
|
+
segments:
|
182
|
+
- 0
|
183
|
+
hash: 208243665
|
157
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
185
|
none: false
|
159
186
|
requirements:
|
160
187
|
- - ! '>='
|
161
188
|
- !ruby/object:Gem::Version
|
162
189
|
version: '0'
|
190
|
+
segments:
|
191
|
+
- 0
|
192
|
+
hash: 208243665
|
163
193
|
requirements: []
|
164
194
|
rubyforge_project: memo_tomato
|
165
|
-
rubygems_version: 1.
|
195
|
+
rubygems_version: 1.8.24
|
166
196
|
signing_key:
|
167
197
|
specification_version: 3
|
168
|
-
summary:
|
169
|
-
gem is created to fulfil the needs of the project http://watchmemo.com
|
198
|
+
summary: Ruby wrapper for the Rotten Tomatoes API
|
170
199
|
test_files: []
|