ratr 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/Gemfile.lock +26 -1
- data/README.md +96 -27
- data/Rakefile +1 -0
- data/bin/ratr +2 -109
- data/examples/movies_small.csv +0 -20
- data/lib/ratr.rb +12 -0
- data/lib/ratr/application.rb +58 -0
- data/lib/ratr/meta_rating.rb +26 -0
- data/lib/ratr/omdb_http_wrapper.rb +36 -0
- data/lib/ratr/parallel_http_processor.rb +19 -0
- data/lib/ratr/pool_manager.rb +22 -0
- data/lib/ratr/rotten_tomatoes_http_wrapper.rb +72 -0
- data/lib/ratr/serial_http_processor.rb +10 -0
- data/lib/ratr/source.rb +20 -0
- data/lib/ratr/utils/array_of_hashes.rb +9 -0
- data/lib/ratr/utils/average_calculator.rb +12 -0
- data/lib/ratr/version.rb +1 -1
- data/ratr.gemspec +5 -1
- data/spec/application_spec.rb +18 -0
- data/spec/array_of_hashes_spec.rb +34 -0
- data/spec/average_calculator_spec.rb +22 -0
- data/spec/meta_rating_spec.rb +26 -0
- data/spec/source_spec.rb +35 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/vcr/Ratr_Application/_call/returns_an_array_of_movies_scored_high_to_low_from_the_provided_CSV.yml +671 -0
- data/spec/vcr/Ratr_Source/omdb_source/_fetch/returns_scores_for_each_movie_provided.yml +96 -0
- data/spec/vcr/Ratr_Source/rotten_tomatoes_source/_fetch/returns_scores_for_each_movie_provided.yml +173 -0
- metadata +67 -3
- data/ratr-0.1.1.gem +0 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://www.omdbapi.com/?t=8%20Mile&y=2002
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Cache-Control:
|
18
|
+
- public, max-age=3082
|
19
|
+
Content-Type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
Expires:
|
22
|
+
- Fri, 08 May 2015 13:05:58 GMT
|
23
|
+
Last-Modified:
|
24
|
+
- Fri, 08 May 2015 12:05:58 GMT
|
25
|
+
Vary:
|
26
|
+
- ! '*'
|
27
|
+
Server:
|
28
|
+
- Microsoft-IIS/7.5
|
29
|
+
X-Aspnet-Version:
|
30
|
+
- 4.0.30319
|
31
|
+
X-Powered-By:
|
32
|
+
- ASP.NET
|
33
|
+
Access-Control-Allow-Origin:
|
34
|
+
- ! '*'
|
35
|
+
Date:
|
36
|
+
- Fri, 08 May 2015 12:14:35 GMT
|
37
|
+
Content-Length:
|
38
|
+
- '716'
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '{"Title":"8 Mile","Year":"2002","Rated":"R","Released":"8 Nov 2002","Runtime":"110
|
42
|
+
min","Genre":"Drama, Music","Director":"Curtis Hanson","Writer":"Scott Silver","Actors":"Eminem,
|
43
|
+
Kim Basinger, Mekhi Phifer, Brittany Murphy","Plot":"A young rapper, struggling
|
44
|
+
with every aspect of his life, wants to make the most of what could be his
|
45
|
+
final opportunity but his problems around gives him doubts.","Language":"English","Country":"USA,
|
46
|
+
Germany","Awards":"Won 1 Oscar. Another 10 wins & 19 nominations.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTU2MTgyOTk3MF5BMl5BanBnXkFtZTYwOTg2NTI5._V1_SX300.jpg","Metascore":"77","imdbRating":"6.9","imdbVotes":"156,790","imdbID":"tt0298203","Type":"movie","Response":"True"}'
|
47
|
+
http_version:
|
48
|
+
recorded_at: Fri, 08 May 2015 12:14:36 GMT
|
49
|
+
- request:
|
50
|
+
method: get
|
51
|
+
uri: http://www.omdbapi.com/?t=The%20Abyss&y=1989
|
52
|
+
body:
|
53
|
+
encoding: US-ASCII
|
54
|
+
string: ''
|
55
|
+
headers:
|
56
|
+
User-Agent:
|
57
|
+
- Faraday v0.9.1
|
58
|
+
response:
|
59
|
+
status:
|
60
|
+
code: 200
|
61
|
+
message: OK
|
62
|
+
headers:
|
63
|
+
Cache-Control:
|
64
|
+
- public, max-age=3180
|
65
|
+
Content-Type:
|
66
|
+
- application/json; charset=utf-8
|
67
|
+
Expires:
|
68
|
+
- Fri, 08 May 2015 13:07:36 GMT
|
69
|
+
Last-Modified:
|
70
|
+
- Fri, 08 May 2015 12:07:36 GMT
|
71
|
+
Vary:
|
72
|
+
- ! '*'
|
73
|
+
Server:
|
74
|
+
- Microsoft-IIS/7.5
|
75
|
+
X-Aspnet-Version:
|
76
|
+
- 4.0.30319
|
77
|
+
X-Powered-By:
|
78
|
+
- ASP.NET
|
79
|
+
Access-Control-Allow-Origin:
|
80
|
+
- ! '*'
|
81
|
+
Date:
|
82
|
+
- Fri, 08 May 2015 12:14:35 GMT
|
83
|
+
Content-Length:
|
84
|
+
- '721'
|
85
|
+
body:
|
86
|
+
encoding: US-ASCII
|
87
|
+
string: ! '{"Title":"The Abyss","Year":"1989","Rated":"PG-13","Released":"9
|
88
|
+
Aug 1989","Runtime":"139 min","Genre":"Adventure, Drama, Sci-Fi","Director":"James
|
89
|
+
Cameron","Writer":"James Cameron","Actors":"Ed Harris, Mary Elizabeth Mastrantonio,
|
90
|
+
Michael Biehn, Leo Burmester","Plot":"A civilian diving team are enlisted
|
91
|
+
to search for a lost nuclear submarine and face danger while encountering
|
92
|
+
an alien aquatic species.","Language":"English","Country":"USA","Awards":"Won
|
93
|
+
1 Oscar. Another 4 wins & 13 nominations.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTIwMDA4MTEzMF5BMl5BanBnXkFtZTcwMTcxMTU1MQ@@._V1_SX300.jpg","Metascore":"62","imdbRating":"7.6","imdbVotes":"117,800","imdbID":"tt0096754","Type":"movie","Response":"True"}'
|
94
|
+
http_version:
|
95
|
+
recorded_at: Fri, 08 May 2015 12:14:36 GMT
|
96
|
+
recorded_with: VCR 2.9.3
|
data/spec/vcr/Ratr_Source/rotten_tomatoes_source/_fetch/returns_scores_for_each_movie_provided.yml
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=ww8qgxbhjbqudvupbr8sqd7x&page_limit=1&q=8%20Mile%202002
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Content-Language:
|
18
|
+
- en-US
|
19
|
+
Content-Type:
|
20
|
+
- text/javascript;charset=ISO-8859-1
|
21
|
+
Date:
|
22
|
+
- Fri, 08 May 2015 12:06:04 GMT
|
23
|
+
Flx-Build-Date:
|
24
|
+
- '2015-05-07 12:53:20'
|
25
|
+
Flx-Commit:
|
26
|
+
- JOBRELEASE.2015-05-07.12-25-31 3a929c5
|
27
|
+
Flx-Server:
|
28
|
+
- web235.flixster.com
|
29
|
+
Rt-Commit:
|
30
|
+
- 2001eec
|
31
|
+
Server:
|
32
|
+
- Mashery Proxy
|
33
|
+
Set-Cookie:
|
34
|
+
- JSESSIONID=31FA3879BB96A73E02A2862FBF104585; Path=/; HttpOnly
|
35
|
+
Vary:
|
36
|
+
- User-Agent,Accept-Encoding
|
37
|
+
X-Mashery-Responder:
|
38
|
+
- prod-j-worker-us-east-1d-70.mashery.com
|
39
|
+
Content-Length:
|
40
|
+
- '2035'
|
41
|
+
Connection:
|
42
|
+
- keep-alive
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ! '
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
{"total":6,"movies":[{"id":"13198","title":"8 Mile","year":2002,"mpaa_rating":"R","runtime":111,"critics_consensus":"","release_dates":{"theater":"2002-11-08","dvd":"2003-03-18"},"ratings":{"critics_rating":"Certified
|
79
|
+
Fresh","critics_score":76,"audience_rating":"Spilled","audience_score":54},"synopsis":"","posters":{"thumbnail":"http://resizing.flixster.com/-dRJgjsKWKaYjNmXqNAxz3LqIyE=/54x81/dkpu1ddg7pbsk.cloudfront.net/movie/11/18/06/11180668_ori.jpg","profile":"http://resizing.flixster.com/-dRJgjsKWKaYjNmXqNAxz3LqIyE=/54x81/dkpu1ddg7pbsk.cloudfront.net/movie/11/18/06/11180668_ori.jpg","detailed":"http://resizing.flixster.com/-dRJgjsKWKaYjNmXqNAxz3LqIyE=/54x81/dkpu1ddg7pbsk.cloudfront.net/movie/11/18/06/11180668_ori.jpg","original":"http://resizing.flixster.com/-dRJgjsKWKaYjNmXqNAxz3LqIyE=/54x81/dkpu1ddg7pbsk.cloudfront.net/movie/11/18/06/11180668_ori.jpg"},"abridged_cast":[{"name":"Eminem","id":"162688835","characters":["Jimmy
|
80
|
+
`Rabbit'' Smith"]},{"name":"Kim Basinger","id":"162664684","characters":["Stephanie"]},{"name":"Mekhi
|
81
|
+
Phifer","id":"162667293","characters":["Future"]},{"name":"Brittany Murphy","id":"162666533","characters":["Alex"]},{"name":"Evan
|
82
|
+
Jones","id":"364627387","characters":["Cheddar Bob"]}],"alternate_ids":{"imdb":"0298203"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/13198.json","alternate":"http://www.rottentomatoes.com/m/8_mile/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/13198/cast.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/13198/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/13198/similar.json"}}],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies.json?q=8+Mile+2002&page_limit=1&page=1","next":"http://api.rottentomatoes.com/api/public/v1.0/movies.json?q=8+Mile+2002&page_limit=1&page=2"},"link_template":"http://api.rottentomatoes.com/api/public/v1.0/movies.json?q={search-term}&page_limit={results-per-page}&page={page-number}"}
|
83
|
+
|
84
|
+
'
|
85
|
+
http_version:
|
86
|
+
recorded_at: Fri, 08 May 2015 12:14:36 GMT
|
87
|
+
- request:
|
88
|
+
method: get
|
89
|
+
uri: http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=ww8qgxbhjbqudvupbr8sqd7x&page_limit=1&q=The%20Abyss%201989
|
90
|
+
body:
|
91
|
+
encoding: US-ASCII
|
92
|
+
string: ''
|
93
|
+
headers:
|
94
|
+
User-Agent:
|
95
|
+
- Faraday v0.9.1
|
96
|
+
response:
|
97
|
+
status:
|
98
|
+
code: 200
|
99
|
+
message: OK
|
100
|
+
headers:
|
101
|
+
Content-Language:
|
102
|
+
- en-US
|
103
|
+
Content-Type:
|
104
|
+
- text/javascript;charset=ISO-8859-1
|
105
|
+
Date:
|
106
|
+
- Fri, 08 May 2015 12:07:37 GMT
|
107
|
+
Flx-Build-Date:
|
108
|
+
- '2015-05-07 12:53:20'
|
109
|
+
Flx-Commit:
|
110
|
+
- JOBRELEASE.2015-05-07.12-25-31 3a929c5
|
111
|
+
Flx-Server:
|
112
|
+
- web235.flixster.com
|
113
|
+
Rt-Commit:
|
114
|
+
- 2001eec
|
115
|
+
Server:
|
116
|
+
- Mashery Proxy
|
117
|
+
Set-Cookie:
|
118
|
+
- JSESSIONID=9641EA4C42BBE669B12175FA29C575D3; Path=/; HttpOnly
|
119
|
+
Vary:
|
120
|
+
- User-Agent,Accept-Encoding
|
121
|
+
X-Mashery-Responder:
|
122
|
+
- prod-j-worker-us-east-1b-52.mashery.com
|
123
|
+
Content-Length:
|
124
|
+
- '2079'
|
125
|
+
Connection:
|
126
|
+
- keep-alive
|
127
|
+
body:
|
128
|
+
encoding: US-ASCII
|
129
|
+
string: ! '
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
{"total":17,"movies":[{"id":"12161","title":"The Abyss","year":1989,"mpaa_rating":"PG-13","runtime":140,"critics_consensus":"","release_dates":{"theater":"1989-08-09","dvd":"2000-11-07"},"ratings":{"critics_rating":"Certified
|
163
|
+
Fresh","critics_score":89,"audience_rating":"Upright","audience_score":83},"synopsis":"","posters":{"thumbnail":"http://resizing.flixster.com/8Ar0HekhaMAQIv5kXVapUkvgUB8=/53x77/dkpu1ddg7pbsk.cloudfront.net/movie/11/16/48/11164848_ori.jpg","profile":"http://resizing.flixster.com/8Ar0HekhaMAQIv5kXVapUkvgUB8=/53x77/dkpu1ddg7pbsk.cloudfront.net/movie/11/16/48/11164848_ori.jpg","detailed":"http://resizing.flixster.com/8Ar0HekhaMAQIv5kXVapUkvgUB8=/53x77/dkpu1ddg7pbsk.cloudfront.net/movie/11/16/48/11164848_ori.jpg","original":"http://resizing.flixster.com/8Ar0HekhaMAQIv5kXVapUkvgUB8=/53x77/dkpu1ddg7pbsk.cloudfront.net/movie/11/16/48/11164848_ori.jpg"},"abridged_cast":[{"name":"Ed
|
164
|
+
Harris","id":"162654543","characters":["Bud Brigman"]},{"name":"Mary Elizabeth
|
165
|
+
Mastrantonio","id":"162662591","characters":["Lindsey"]},{"name":"Michael
|
166
|
+
Biehn","id":"162681092","characters":["Lt. Coffey"]},{"name":"Leo Burmester","id":"364653377","characters":["Catfish
|
167
|
+
De Vries"]},{"name":"Leo Burmeister","id":"770923957","characters":["Catfish
|
168
|
+
De Vries"]}],"alternate_ids":{"imdb":"0096754"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/12161.json","alternate":"http://www.rottentomatoes.com/m/abyss/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/12161/cast.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/12161/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/12161/similar.json"}}],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies.json?q=The+Abyss+1989&page_limit=1&page=1","next":"http://api.rottentomatoes.com/api/public/v1.0/movies.json?q=The+Abyss+1989&page_limit=1&page=2"},"link_template":"http://api.rottentomatoes.com/api/public/v1.0/movies.json?q={search-term}&page_limit={results-per-page}&page={page-number}"}
|
169
|
+
|
170
|
+
'
|
171
|
+
http_version:
|
172
|
+
recorded_at: Fri, 08 May 2015 12:14:36 GMT
|
173
|
+
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ratr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Robertson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -52,6 +52,48 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: vcr
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.9'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.9'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.11'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.11'
|
55
97
|
description: Rotten Tomatoes + imdb rating mashup assignment
|
56
98
|
email:
|
57
99
|
- patricksrobertson@gmail.com
|
@@ -60,15 +102,37 @@ executables:
|
|
60
102
|
extensions: []
|
61
103
|
extra_rdoc_files: []
|
62
104
|
files:
|
105
|
+
- .gitignore
|
106
|
+
- .rspec
|
63
107
|
- Gemfile
|
64
108
|
- Gemfile.lock
|
65
109
|
- README.md
|
110
|
+
- Rakefile
|
66
111
|
- bin/ratr
|
67
112
|
- examples/movies.csv
|
68
113
|
- examples/movies_small.csv
|
114
|
+
- lib/ratr.rb
|
115
|
+
- lib/ratr/application.rb
|
116
|
+
- lib/ratr/meta_rating.rb
|
117
|
+
- lib/ratr/omdb_http_wrapper.rb
|
118
|
+
- lib/ratr/parallel_http_processor.rb
|
119
|
+
- lib/ratr/pool_manager.rb
|
120
|
+
- lib/ratr/rotten_tomatoes_http_wrapper.rb
|
121
|
+
- lib/ratr/serial_http_processor.rb
|
122
|
+
- lib/ratr/source.rb
|
123
|
+
- lib/ratr/utils/array_of_hashes.rb
|
124
|
+
- lib/ratr/utils/average_calculator.rb
|
69
125
|
- lib/ratr/version.rb
|
70
|
-
- ratr-0.1.1.gem
|
71
126
|
- ratr.gemspec
|
127
|
+
- spec/application_spec.rb
|
128
|
+
- spec/array_of_hashes_spec.rb
|
129
|
+
- spec/average_calculator_spec.rb
|
130
|
+
- spec/meta_rating_spec.rb
|
131
|
+
- spec/source_spec.rb
|
132
|
+
- spec/spec_helper.rb
|
133
|
+
- spec/vcr/Ratr_Application/_call/returns_an_array_of_movies_scored_high_to_low_from_the_provided_CSV.yml
|
134
|
+
- spec/vcr/Ratr_Source/omdb_source/_fetch/returns_scores_for_each_movie_provided.yml
|
135
|
+
- spec/vcr/Ratr_Source/rotten_tomatoes_source/_fetch/returns_scores_for_each_movie_provided.yml
|
72
136
|
homepage: https://github.com/patricksrobertson/ratr
|
73
137
|
licenses:
|
74
138
|
- MIT
|
data/ratr-0.1.1.gem
DELETED
Binary file
|