memo_tomato 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/lib/memo_tomato/parser/base.rb +13 -17
- data/lib/memo_tomato/parser/movie_info.rb +1 -1
- data/lib/memo_tomato/parser/search_movie.rb +1 -1
- data/lib/memo_tomato/parser/similar_movies.rb +1 -1
- data/lib/memo_tomato/parser/upcoming_movies.rb +1 -1
- data/lib/memo_tomato/version.rb +1 -1
- data/spec/memo_tomato/parser/movie_info_spec.rb +12 -4
- data/spec/mock_json/movies/770885199.json +40 -0
- metadata +20 -18
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
@@ -9,7 +9,7 @@ module MemoTomato
|
|
9
9
|
parse_content @content
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def parse_entry(movie)
|
13
13
|
MemoTomato::Movie.new(
|
14
14
|
:id => movie.id,
|
15
15
|
:title => movie.title,
|
@@ -20,28 +20,24 @@ module MemoTomato
|
|
20
20
|
:synopsis => movie.synopsis,
|
21
21
|
:image => movie.posters.detailed,
|
22
22
|
:studio => movie.studio,
|
23
|
-
:cast =>
|
24
|
-
movie.abridged_cast.collect do |actor|
|
23
|
+
:cast =>
|
24
|
+
Array(movie.abridged_cast).collect do |actor|
|
25
25
|
MemoTomato::Actor.new(
|
26
26
|
:name => actor.name,
|
27
27
|
:characters => actor.characters
|
28
28
|
)
|
29
29
|
end,
|
30
|
-
:directors =>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
)
|
36
|
-
end
|
30
|
+
:directors =>
|
31
|
+
Array(movie.abridged_directors).collect do |director|
|
32
|
+
MemoTomato::Director.new(
|
33
|
+
:name => director.name
|
34
|
+
)
|
37
35
|
end,
|
38
|
-
:genres =>
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
)
|
44
|
-
end
|
36
|
+
:genres =>
|
37
|
+
Array(movie.genres).collect do |genre|
|
38
|
+
MemoTomato::Genre.new(
|
39
|
+
:type => genre
|
40
|
+
)
|
45
41
|
end
|
46
42
|
)
|
47
43
|
end
|
data/lib/memo_tomato/version.rb
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
2
|
+
require 'pry'
|
2
3
|
|
3
4
|
describe MemoTomato::Parser::MovieInfo do
|
4
5
|
let(:client) { MemoTomato::Client.new(:apikey => "abcd1234") }
|
5
6
|
|
6
7
|
it 'should be awesome' do
|
7
8
|
mock_api :get, 'movies/770672122' , 'movies/770672122', :params => client.params do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
movie = client.movie_info("770672122")
|
10
|
+
movie.id.should == 770672122
|
11
|
+
movie.directors.first.name.should == "Lee Unkrich"
|
12
|
+
movie.genres.first.type.should == "Animation"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should handle missing attributes like director' do
|
17
|
+
mock_api :get, 'movies/770885199' , 'movies/770885199', :params => client.params do
|
18
|
+
movie = client.movie_info("770885199")
|
19
|
+
movie.directors.should == []
|
12
20
|
end
|
13
21
|
end
|
14
22
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
{
|
2
|
+
"id": 770885199,
|
3
|
+
"title": "Monty Python Meets Beyond the Fringe",
|
4
|
+
"year": "",
|
5
|
+
"genres": [
|
6
|
+
"Comedy"
|
7
|
+
],
|
8
|
+
"mpaa_rating": "Unrated",
|
9
|
+
"runtime": 85,
|
10
|
+
"release_dates": {},
|
11
|
+
"ratings": {
|
12
|
+
"critics_score": -1,
|
13
|
+
"audience_score": 100
|
14
|
+
},
|
15
|
+
"synopsis": "",
|
16
|
+
"posters": {
|
17
|
+
"thumbnail": "http://images.rottentomatoescdn.com/images/redesign/poster_default.gif",
|
18
|
+
"profile": "http://images.rottentomatoescdn.com/images/redesign/poster_default.gif",
|
19
|
+
"detailed": "http://images.rottentomatoescdn.com/images/redesign/poster_default.gif",
|
20
|
+
"original": "http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"
|
21
|
+
},
|
22
|
+
"abridged_cast": [
|
23
|
+
{
|
24
|
+
"name": "Monty Python Cast",
|
25
|
+
"id": "770882204"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"name": "Beyond The Fringe Cast",
|
29
|
+
"id": "770882205"
|
30
|
+
}
|
31
|
+
],
|
32
|
+
"links": {
|
33
|
+
"self": "http://api.rottentomatoes.com/api/public/v1.0/movies/770885199.json",
|
34
|
+
"alternate": "http://www.rottentomatoes.com/m/monty_python_meets_beyond_the_fringe/",
|
35
|
+
"cast": "http://api.rottentomatoes.com/api/public/v1.0/movies/770885199/cast.json",
|
36
|
+
"clips": "http://api.rottentomatoes.com/api/public/v1.0/movies/770885199/clips.json",
|
37
|
+
"reviews": "http://api.rottentomatoes.com/api/public/v1.0/movies/770885199/reviews.json",
|
38
|
+
"similar": "http://api.rottentomatoes.com/api/public/v1.0/movies/770885199/similar.json"
|
39
|
+
}
|
40
|
+
}
|
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.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-03-
|
13
|
+
date: 2012-03-14 00:00:00.000000000 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: multi_json
|
18
|
-
requirement: &
|
18
|
+
requirement: &10456680 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '1.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *10456680
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: httpclient
|
29
|
-
requirement: &
|
29
|
+
requirement: &10506980 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 2.2.0.2
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *10506980
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: hashie
|
40
|
-
requirement: &
|
40
|
+
requirement: &10506520 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: 1.1.0
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *10506520
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: pry
|
51
|
-
requirement: &
|
51
|
+
requirement: &10506060 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: 0.9.8.4
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *10506060
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: rake
|
62
|
-
requirement: &
|
62
|
+
requirement: &10505600 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ! '>='
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: 0.8.7
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *10505600
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: rspec
|
73
|
-
requirement: &
|
73
|
+
requirement: &10505140 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: '2'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *10505140
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: webmock
|
84
|
-
requirement: &
|
84
|
+
requirement: &10504680 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: 1.6.2
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *10504680
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: timecop
|
95
|
-
requirement: &
|
95
|
+
requirement: &10504220 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ! '>='
|
@@ -100,7 +100,7 @@ dependencies:
|
|
100
100
|
version: 0.3.5
|
101
101
|
type: :development
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *10504220
|
104
104
|
description: https://github.com/appsbakery/memo_tomato
|
105
105
|
email:
|
106
106
|
- tagrudev@gmail.com
|
@@ -110,6 +110,7 @@ extensions: []
|
|
110
110
|
extra_rdoc_files: []
|
111
111
|
files:
|
112
112
|
- .gitignore
|
113
|
+
- .rspec
|
113
114
|
- Gemfile
|
114
115
|
- README.md
|
115
116
|
- Rakefile
|
@@ -138,6 +139,7 @@ files:
|
|
138
139
|
- spec/mock_json/movies.json
|
139
140
|
- spec/mock_json/movies/770672122.json
|
140
141
|
- spec/mock_json/movies/770672122/similar.json
|
142
|
+
- spec/mock_json/movies/770885199.json
|
141
143
|
- spec/spec_helper.rb
|
142
144
|
has_rdoc: true
|
143
145
|
homepage: http://www.appsbakery.eu
|