worth_watching 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"Title":"Captain America: The Winter Soldier","Year":"2014","Rated":"N/A","Released":"04 Apr 2014","Runtime":"128 min","Genre":"Action, Adventure, Sci-Fi","Director":"Anthony Russo, Joe Russo","Writer":"Christopher Markus (screenplay), Stephen McFeely (screenplay), Ed Brubaker (concept and story), Joe Simon (comic book), Jack Kirby (comic book)","Actors":"Scarlett Johansson, Chris Evans, Hayley Atwell, Cobie Smulders","Plot":"Steve Rogers struggles to embrace his role in the modern world and battles a new threat from old history: the Soviet agent known as the Winter Soldier.","Language":"English","Country":"USA","Awards":"N/A","Poster":"http://ia.media-imdb.com/images/M/MV5BMzA2NDkwODAwM15BMl5BanBnXkFtZTgwODk5MTgzMTE@._V1_SX300.jpg","Metascore":"N/A","imdbRating":"N/A","imdbVotes":"N/A","imdbID":"tt1843866","Type":"movie","Response":"True"}
@@ -0,0 +1,36 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+ {"total":33,"reviews":[{"critic":"David Edelstein","date":"2014-04-04","freshness":"fresh","publication":"Vulture","quote":"Beneath the expensive, computer-generated busyness of this second Captain America installment is a bracing, old-style conspiracy thriller made extra-scary by new technology and the increasingly ugly trade-offs of a post-9/11 world.","links":{"review":"http://www.vulture.com/2014/04/review-captain-america-the-winter-soldier.html"}},{"critic":"Adam Nayman","date":"2014-04-04","original_score":"3.5/4","freshness":"fresh","publication":"Globe and Mail","quote":"This is the first Marvel Studios movie since the original Iron Man that really stands on its own.","links":{"review":"http://www.theglobeandmail.com/arts/film/film-reviews/captain-america-american-beauty/article17805222/"}},{"critic":"Richard Roeper","date":"2014-04-03","original_score":"3.5/5","freshness":"fresh","publication":"Richard Roeper.com","quote":"We not only get an edgier, more complex, more compelling storyline, we get the most badass 95-year-old the world has ever known.","links":{"review":"http://www.richardroeper.com/reviews/captainamericathewintersoldier.aspx"}},{"critic":"Manohla Dargis","date":"2014-04-03","freshness":"rotten","publication":"New York Times","quote":"Like many others of its type, [it] gets off to a kinetic start only to lose steam before blowing everything up.","links":{"review":"http://www.nytimes.com/2014/04/04/movies/hero-returns-in-captain-america-the-winter-soldier.html?smid=tw-nytmovies&seid=auto"}},{"critic":"Peter Howell","date":"2014-04-03","original_score":"3/4","freshness":"fresh","publication":"Toronto Star","quote":"The best kind of blockbuster comic-book movie, tweaking the brain while dazzling the eye.","links":{"review":"http://www.thestar.com/entertainment/movies/2014/04/03/captain_america_meets_modernday_paranoia_in_the_winter_soldier_review.html"}}],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771312513/reviews.json?review_type=top_critic&page_limit=5&country=uk&page=1","next":"http://api.rottentomatoes.com/api/public/v1.0/movies/771312513/reviews.json?review_type=top_critic&page_limit=5&country=uk&page=2","alternate":"http://www.rottentomatoes.com/m/captain_america_the_winter_soldier_2014/#reviews","rel":"http://api.rottentomatoes.com/api/public/v1.0/movies/771312513.json"},"link_template":"http://api.rottentomatoes.com/api/public/v1.0/movies/{movie-id}/reviews.json?review_type={top_critic|all|dvd}&page_limit={results-per-page}&page={page-number}&country={country-code}"}
36
+
@@ -0,0 +1,30 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+ {"id":771312513,"title":"Captain America: The Winter Soldier","year":2014,"genres":["Action & Adventure","Science Fiction & Fantasy"],"mpaa_rating":"PG-13","runtime":136,"critics_consensus":"Suspenseful and politically astute, Captain America: The Winter Soldier is a superior entry in the Avengers canon and is sure to thrill Marvel diehards.","release_dates":{"theater":"2014-04-04"},"ratings":{"critics_rating":"Certified Fresh","critics_score":88,"audience_rating":"Upright","audience_score":95},"synopsis":"After being deemed unfit for military service, Steve Rogers volunteers for a top secret research project that turns him into Captain America, a superhero dedicated to defending America's ideals.","posters":{"thumbnail":"http://content8.flixster.com/movie/11/17/72/11177246_mob.jpg","profile":"http://content8.flixster.com/movie/11/17/72/11177246_pro.jpg","detailed":"http://content8.flixster.com/movie/11/17/72/11177246_det.jpg","original":"http://content8.flixster.com/movie/11/17/72/11177246_ori.jpg"},"abridged_cast":[{"name":"Chris Evans","id":"162652784","characters":["Captain America/Steve Rogers"]},{"name":"Anthony Mackie","id":"162653786","characters":["Sam Wilson/Falcon"]},{"name":"Sebastian Stan","id":"326299814","characters":["Bucky Barnes/Winter Soldier"]},{"name":"Samuel L. Jackson","id":"162652156","characters":["Nick Fury"]},{"name":"Scarlett Johansson","id":"162652872","characters":["Natasha Romanoff/Black Widow"]}],"abridged_directors":[{"name":"Anthony Russo"},{"name":"Joe Russo"}],"studio":"Walt Disney Pictures","alternate_ids":{"imdb":"1843866"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771312513.json","alternate":"http://www.rottentomatoes.com/m/captain_america_the_winter_soldier_2014/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771312513/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771312513/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771312513/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771312513/similar.json"}}
@@ -0,0 +1 @@
1
+ {"adult":false,"backdrop_path":"/4qfXT9BtxeFuamR4F49m2mpKQI1.jpg","belongs_to_collection":{"id":131295,"name":"Captain America Collection","poster_path":"/933jisuZBkkIbS9Nrltaqdnc7Cn.jpg","backdrop_path":"/5sLmXNMGU8CedByJ7RBwZOy0pXr.jpg"},"budget":170000000,"genres":[{"id":28,"name":"Action"},{"id":12,"name":"Adventure"},{"id":878,"name":"Science Fiction"}],"homepage":"http://www.captainamericathewintersoldiermovie.com","id":100402,"imdb_id":"tt1843866","original_title":"Captain America: The Winter Soldier","overview":"After the cataclysmic events in New York with The Avengers, Steve Rogers, aka Captain America is living quietly in Washington, D.C. and trying to adjust to the modern world. But when a S.H.I.E.L.D. colleague comes under attack, Steve becomes embroiled in a web of intrigue that threatens to put the world at risk. Joining forces with the Black Widow, Captain America struggles to expose the ever-widening conspiracy while fighting off professional assassins sent to silence him at every turn. When the full scope of the villainous plot is revealed, Captain America and the Black Widow enlist the help of a new ally, the Falcon. However, they soon find themselves up against an unexpected and formidable enemy—the Winter Soldier.","popularity":62.2410519372985,"poster_path":"/pH4oeiZAh9a40tly4D0l6aAB3ms.jpg","production_companies":[{"name":"Marvel Studios","id":420},{"name":"Marvel Entertainment, LLC","id":325}],"production_countries":[{"iso_3166_1":"US","name":"United States of America"}],"release_date":"2014-04-04","revenue":0,"runtime":128,"spoken_languages":[{"iso_639_1":"en","name":"English"}],"status":"Released","tagline":"In heroes we trust.","title":"Captain America: The Winter Soldier","vote_average":6.5,"vote_count":77}
@@ -86,6 +86,33 @@ describe 'WorthWatching::Aggregator' do
86
86
  expect(reviews.first.link).to eq("http://www.villagevoice.com/2010-06-15/film/toys-are-us-in-toy-story-3/full/")
87
87
  end
88
88
  end
89
+
90
+ context "when the OMDB API has not IMDb rating info for a movie" do
91
+ before do
92
+ json_response = File.read(File.dirname(__FILE__) + "/../support/json_responses/captain_america_rt.json")
93
+ stub_request(:get, /api\.rottentomatoes\.com\/api\/public\/v1\.0\/movies\/771312513\.json\?apikey\=.*/).to_return(:status => 200, :body => json_response,:headers => {"content-type"=>["application/json; charset=utf-8"]})
94
+
95
+ json_response = File.read(File.dirname(__FILE__) + "/../support/json_responses/captain_america_omdb.json")
96
+ stub_request(:get, "http://www.omdbapi.com/?i=tt1843866").to_return(:status => 200, :body => json_response,:headers => {"content-type"=>["application/json; charset=utf-8"]})
97
+
98
+ json_response = File.read(File.dirname(__FILE__) + "/../support/json_responses/captain_america_tmdb.json")
99
+ stub_request(:get, /api\.themoviedb\.org\/3\/movie\/tt1843866\?api_key\=.*/).to_return(:status => 200, :body => json_response,:headers => {"content-type"=>["application/json; charset=utf-8"]})
100
+
101
+ json_response = File.read(File.dirname(__FILE__) + "/../support/json_responses/captain_america_reviews_rt.json")
102
+ stub_request(:get, /api\.rottentomatoes\.com\/api\/public\/v1\.0\/movies\/771312513\/reviews\.json\?apikey\=.*&country=uk&page=1&page_limit=5&review_type=top_critic/).to_return(:status => 200, :body => json_response,:headers => {"content-type"=>["application/json; charset=utf-8"]})
103
+
104
+ json_response = File.read(File.dirname(__FILE__) + "/../support/html_responses/captain_america_mc.html")
105
+ stub_request(:get, "http://www.metacritic.com/search/movie/Captain+America:+The+Winter+Soldier/results").to_return(:status => 200, :body => json_response,:headers => {"content-type"=>["text/html; charset=utf-8"]})
106
+
107
+ json_response = File.read(File.dirname(__FILE__) + "/../support/html_responses/captain_america_imdb.html")
108
+ stub_request(:get, "http://m.imdb.com/title/tt1843866").to_return(:status => 200, :body => json_response,:headers => {"content-type"=>["text/html; charset=utf-8"]})
109
+ end
110
+
111
+ it "scrapes the rating directly from the movie's IMDb page" do
112
+ movie = aggregator.aggregate_movie("771312513")
113
+ expect(movie.imdb_rating).to eq(8.3)
114
+ end
115
+ end
89
116
  end
90
117
 
91
118
  describe "searching for movies" do
@@ -45,7 +45,6 @@ describe "WorthWatching::Movie" do
45
45
 
46
46
  it "has a general summary" do
47
47
  summary = "------------------------------------------------------------\nToy Story 3\n------------------------------------------------------------\nReleased: 18 Jun 2010\n------------------------------------------------------------\nPixar returns to their first success with Toy Story 3. The movie begins with Andy leaving for college and donating his beloved toys -- including Woody (Tom Hanks) and Buzz (Tim Allen) -- to a daycare. While the crew meets new friends, including Ken (Michael Keaton), they soon grow to hate their new surroundings and plan an escape. The film was directed by Lee Unkrich from a script co-authored by Little Miss Sunshine scribe Michael Arndt. ~ Perry Seibert, Rovi\n------------------------------------------------------------\nCast: Tom Hanks, Tim Allen, Joan Cusack, Ned Beatty\n------------------------------------------------------------\nRotten Tomatoes rating: 99\nIMDB rating: Not retrieved\nMetacritic rating: Not retrieved\n\n"
48
- puts movie.summary
49
48
  expect(movie.summary).to eq(summary)
50
49
  end
51
50
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worth_watching
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - http://github.com/alessndro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-03 00:00:00.000000000 Z
11
+ date: 2014-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,6 +123,11 @@ files:
123
123
  - LICENSE.txt
124
124
  - README.md
125
125
  - Rakefile
126
+ - Untitled 2.sketch/Data
127
+ - Untitled 2.sketch/QuickLook/Preview.png
128
+ - Untitled 2.sketch/QuickLook/Thumbnail.png
129
+ - Untitled 2.sketch/metadata
130
+ - Untitled 2.sketch/version
126
131
  - lib/worth_watching.rb
127
132
  - lib/worth_watching/aggregator.rb
128
133
  - lib/worth_watching/movie.rb
@@ -134,10 +139,16 @@ files:
134
139
  - logo.sketch/QuickLook/Thumbnail.png
135
140
  - logo.sketch/metadata
136
141
  - logo.sketch/version
142
+ - spec/support/html_responses/captain_america_imdb.html
143
+ - spec/support/html_responses/captain_america_mc.html
137
144
  - spec/support/html_responses/toy_story_mc.html
138
145
  - spec/support/json_responses/0_movie_search_result.json
139
146
  - spec/support/json_responses/1_movie_search_result.json
140
147
  - spec/support/json_responses/3_movie_search_result.json
148
+ - spec/support/json_responses/captain_america_omdb.json
149
+ - spec/support/json_responses/captain_america_reviews_rt.json
150
+ - spec/support/json_responses/captain_america_rt.json
151
+ - spec/support/json_responses/captain_america_tmdb.json
141
152
  - spec/support/json_responses/rt_top_16_dvd_rentals.json
142
153
  - spec/support/json_responses/rt_top_16_in_cinemas.json
143
154
  - spec/support/json_responses/toy_story_omdb.json
@@ -175,10 +186,16 @@ signing_key:
175
186
  specification_version: 4
176
187
  summary: Retrieve the ratings of a movie from IMDB, Rotten Tomatoes and Metacritic
177
188
  test_files:
189
+ - spec/support/html_responses/captain_america_imdb.html
190
+ - spec/support/html_responses/captain_america_mc.html
178
191
  - spec/support/html_responses/toy_story_mc.html
179
192
  - spec/support/json_responses/0_movie_search_result.json
180
193
  - spec/support/json_responses/1_movie_search_result.json
181
194
  - spec/support/json_responses/3_movie_search_result.json
195
+ - spec/support/json_responses/captain_america_omdb.json
196
+ - spec/support/json_responses/captain_america_reviews_rt.json
197
+ - spec/support/json_responses/captain_america_rt.json
198
+ - spec/support/json_responses/captain_america_tmdb.json
182
199
  - spec/support/json_responses/rt_top_16_dvd_rentals.json
183
200
  - spec/support/json_responses/rt_top_16_in_cinemas.json
184
201
  - spec/support/json_responses/toy_story_omdb.json