diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..0854d37 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'http://rubygems.org' + + +gem 'rspec' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..ea5be4a --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,18 @@ +GEM + remote: http://rubygems.org/ + specs: + diff-lcs (1.2.5) + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + rspec-core (2.14.7) + rspec-expectations (2.14.5) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.5) + +PLATFORMS + ruby + +DEPENDENCIES + rspec diff --git a/README.md b/README.md index 7400674..b935f33 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Slope of line is `(y1 - y2) / (x1 - x2)` ... In this case, if my average rating ``` (45 - 50).to_f / (2012 - 1990).to_f -=> -0.22727272727272727 +=> -0.22727272727272727 # getting madder ``` diff --git a/lib/api.rb b/lib/api.rb index a8d499c..ffd04d5 100644 --- a/lib/api.rb +++ b/lib/api.rb @@ -2,6 +2,7 @@ require "json" require "ostruct" require_relative "./movie" +require_relative "./movie_library" class Api APIKEY="4t6456xa33z8qhcqyuqgnkjh" @@ -16,7 +17,6 @@ def self.search_by_title(title) ) end - def self.get_url_as_json(url) JSON.parse(open(url).read) end diff --git a/lib/movie_library.rb b/lib/movie_library.rb new file mode 100644 index 0000000..10f78c2 --- /dev/null +++ b/lib/movie_library.rb @@ -0,0 +1,43 @@ +class MovieLibrary + + attr_reader :movies, :catalog, :slope + attr_accessor :slope + def initialize + @movies = [] + @catalog = [] + @slope = 0 + end + + def calculate_slope(catalog) + first = catalog.first + last = catalog.last + return 0 if catalog.count <= 1 + @slope = (first.score - last.score).to_f / (last.year - first.year).to_f + end + + def sort_by_year(movies) + @catalog = movies.sort { |movie,another_movie| movie.year <=> another_movie.year } + end + + def average_rating_by_year(year) + average_rating all_movies.select {|movie| movie.year == year} + end + + def average_rating(movies) + return 0 if count == 0 + movies.inject(0.0) { |sum, movie| sum + movie.score } / movies.size + end + + def add(movie) + movies << movie + calculate_slope sort_by_year(movies) + end + + def all_movies + @movies + end + + def count + movies.count + end +end diff --git a/movie_json.rb b/movie_json.rb index d8a91d7..7c3eb29 100644 --- a/movie_json.rb +++ b/movie_json.rb @@ -1,21 +1,42 @@ require_relative "lib/movie" +require_relative "lib/movie_library" require_relative "lib/api" def find_movie - puts "OH HAI. Search?" - movie_title = gets - movie = Api.search_by_title(movie_title) - puts "Found: #{movie.title}. Score: #{movie.score}" + begin + puts "OH HAI. Add a movie you really like?" + movie_title = gets + movie = Api.search_by_title(movie_title) + rescue NoMethodError + puts "Not found." + end end -find_movie +movie_library = MovieLibrary.new +movie = find_movie +if movie + movie_library.add(movie) + puts "Found: #{movie.title}. Score: #{movie.score}" +end while true do - puts "Search Again (Y/N)" + puts "Search Again (Y/N)" answer = gets.upcase[0] if answer == "Y" - find_movie + movie = find_movie + if movie + movie_library.add(movie) + puts "Found: #{movie.title}. Score: #{movie.score}" + end else + puts "\n--------------------------" + puts "Summary for your Movie Library" + puts "-----------------------------" + movie_library.all_movies.each do |movie| + puts "ID: #{movie.id}\tMovie: #{movie.title}\tYear: #{movie.year} Score: #{movie.score}\tAverage: #{movie_library.average_rating_by_year(movie.year)}" + end + puts "Your library has a Happiness Index of: #{movie_library.slope}" + puts "Goodbye!!!" break end end diff --git a/spec/api_spec.rb b/spec/api_spec.rb index 9014106..eb2db46 100644 --- a/spec/api_spec.rb +++ b/spec/api_spec.rb @@ -3,25 +3,30 @@ describe Api do - let(:movie) { Api.search_by_title("Forrest Gump") } + let(:movie) { Api.search_by_title("Forrest Gump") } - before do - Api.stub(:get_url_as_json) { JSON.parse(File.read("spec/fixtures/forrest.json")) } - end + before do + Api.stub(:get_url_as_json) { JSON.parse(File.read("spec/fixtures/forrest.json")) } + end - it "should search for movies" do - movie.title.should eq("Forrest Gump") - end + it "should search for movies" do + movie.title.should eq("Forrest Gump") + end - it "should return the score" do - movie.score.should eq(71) - end + it "should return the score" do + movie.score.should eq(71) + end - it "should return the id" do - movie.id.should eq(10036) - end + it "should return the id" do + movie.id.should eq(10036) + end + + it "should return the year" do + movie.year.should eq(1994) + end + + it "should not raise an error when searching for a non-existent movie" do + expect { Api.search_by_title("NOTHINGFOUNDHERE") }.to_not raise_error + end - it "should return the year" do - movie.year.should eq(1994) - end end diff --git a/spec/fixtures/2010.json b/spec/fixtures/2010.json new file mode 100644 index 0000000..85b30a0 --- /dev/null +++ b/spec/fixtures/2010.json @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{"total":44,"movies":[{"id":"770681152","title":"Shutter Island","year":2010,"mpaa_rating":"R","runtime":138,"critics_consensus":"It may not rank with Scorsese's best work, but Shutter Island's gleefully unapologetic genre thrills represent the director at his most unrestrained.","release_dates":{"theater":"2010-02-19","dvd":"2010-06-08"},"ratings":{"critics_rating":"Fresh","critics_score":69,"audience_rating":"Upright","audience_score":76},"synopsis":"Martin Scorsese and Leonardo DiCaprio team up for a fourth time for this adaptation of Shutter Island, a novel by Dennis Lehane (Mystic River). The film opens in 1954 as World War II veteran and current federal marshal Teddy Daniels (Leonardo DiCaprio) and his new partner, Chuck (Mark Ruffalo), ferry to Shutter Island, a water-bound mental hospital housing the criminally insane. They have been asked to investigate the disappearance of Rachel Solando (Emily Mortimer), a patient admitted to the asylum after she murdered her three children. As Teddy quizzes Dr. Cawley (Ben Kingsley), the head of the institution, he begins to suspect that the authorities in charge might not be giving him the whole truth, and that a terrible fate may befall all the patients in the spooky Ward C -- a unit devoted to the most heinous of the hospital's inmates. Complicating matters further, Teddy has a secret of his own -- the arsonist who murdered his wife is incarcerated on Shutter Island. Driven to confront his wife's killer, and stranded on the island because of a hurricane, Teddy must unravel the secrets of the eerie place before succumbing to his own madness. Max von Sydow, Emily Mortimer, Michelle Williams, Patricia Clarkson, and Jackie Earle Haley round out the supporting cast. ~ Perry Seibert, Rovi","posters":{"thumbnail":"http://content8.flixster.com/movie/11/16/92/11169254_mob.jpg","profile":"http://content8.flixster.com/movie/11/16/92/11169254_pro.jpg","detailed":"http://content8.flixster.com/movie/11/16/92/11169254_det.jpg","original":"http://content8.flixster.com/movie/11/16/92/11169254_ori.jpg"},"abridged_cast":[{"name":"Leonardo DiCaprio","id":"162659161","characters":["Teddy Daniels"]},{"name":"Mark Ruffalo","id":"162653904","characters":["Chuck Aule"]},{"name":"Ben Kingsley","id":"162653703","characters":["Dr. Cawley"]},{"name":"Michelle Williams","id":"162653583","characters":["Dolores"]},{"name":"Max von Sydow","id":"162657879","characters":["Dr. Naehring"]}],"alternate_ids":{"imdb":"1130884"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/770681152.json","alternate":"http://www.rottentomatoes.com/m/1198124-shutter_island/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/770681152/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/770681152/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/770681152/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/770681152/similar.json"}},{"id":"770683926","title":"Alice in Wonderland","year":2010,"mpaa_rating":"PG","runtime":109,"critics_consensus":"Tim Burton's Alice sacrifices the book's minimal narrative coherence -- and much of its heart -- but it's an undeniable visual treat.","release_dates":{"theater":"2010-03-05","dvd":"2010-06-01"},"ratings":{"critics_rating":"Rotten","critics_score":51,"audience_rating":"Spilled","audience_score":55},"synopsis":"n/a","posters":{"thumbnail":"http://content6.flixster.com/movie/10/93/73/10937308_mob.jpg","profile":"http://content6.flixster.com/movie/10/93/73/10937308_pro.jpg","detailed":"http://content6.flixster.com/movie/10/93/73/10937308_det.jpg","original":"http://content6.flixster.com/movie/10/93/73/10937308_ori.jpg"},"abridged_cast":[{"name":"Mia Wasikowska","id":"770688391","characters":["Alice"]},{"name":"Johnny Depp","id":"162652817","characters":["The Mad Hatter"]},{"name":"Anne Hathaway","id":"162656190","characters":["White Queen"]},{"name":"Helena Bonham Carter","id":"162652820","characters":["Red Queen"]},{"name":"Matt Lucas","id":"770698237","characters":["TweedleDee/TweedleDum"]}],"alternate_ids":{"imdb":"1014759"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/770683926.json","alternate":"http://www.rottentomatoes.com/m/1221547-alice_in_wonderland/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/770683926/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/770683926/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/770683926/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/770683926/similar.json"}},{"id":"770805766","title":"Valentine's Day","year":2010,"mpaa_rating":"PG-13","runtime":123,"critics_consensus":"Eager to please and stuffed with stars, Valentine's Day squanders its promise with a frantic, episodic plot and an abundance of rom-com cliches.","release_dates":{"theater":"2010-02-12","dvd":"2010-05-18"},"ratings":{"critics_rating":"Rotten","critics_score":18,"audience_rating":"Spilled","audience_score":48},"synopsis":"Gary Marshall's ensemble romantic comedy Valentine's Day follows nearly two dozen people as they find and lose love in all its many forms over the course of the title holiday. The numerous characters include a very busy florist (Ashton Kutcher) and his schoolteacher best friend (Jennifer Garner). She's having an affair with a married doctor (Patrick Dempsey). Meanwhile, a businessman (Bradley Cooper) and a military captain (Julia Roberts) on leave share a long conversation during an international flight. There's also an elderly couple (Hector Elizondo and Shirley MacLaine) who are caring for their elementary school-age grandson, who is pining for a classmate and missing his mother. The huge cast also includes Jamie Foxx as a local TV personality, Topher Grace, Queen Latifah, and Anne Hathaway. ~ Perry Seibert, Rovi","posters":{"thumbnail":"http://content6.flixster.com/movie/11/17/00/11170072_mob.jpg","profile":"http://content6.flixster.com/movie/11/17/00/11170072_pro.jpg","detailed":"http://content6.flixster.com/movie/11/17/00/11170072_det.jpg","original":"http://content6.flixster.com/movie/11/17/00/11170072_ori.jpg"},"abridged_cast":[{"name":"Julia Roberts","id":"162659460","characters":["Captain Kate Hazeltine"]},{"name":"Emma Roberts","id":"326298386","characters":["Grace"]},{"name":"Anne Hathaway","id":"162656190","characters":["Liz"]},{"name":"Jessica Alba","id":"162652782","characters":["Morley Clarkson"]},{"name":"Jessica Biel","id":"162652974","characters":["Kara Monahan"]}],"alternate_ids":{"imdb":"0817230"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/770805766.json","alternate":"http://www.rottentomatoes.com/m/valentines_day_2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/770805766/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/770805766/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/770805766/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/770805766/similar.json"}},{"id":"12419","title":"2010: The Year We Make Contact","year":1984,"mpaa_rating":"PG","runtime":114,"release_dates":{"theater":"1984-12-07","dvd":"1998-08-25"},"ratings":{"critics_rating":"Fresh","critics_score":66,"audience_rating":"Upright","audience_score":61},"synopsis":"","posters":{"thumbnail":"http://content7.flixster.com/movie/10/92/01/10920113_mob.jpg","profile":"http://content7.flixster.com/movie/10/92/01/10920113_pro.jpg","detailed":"http://content7.flixster.com/movie/10/92/01/10920113_det.jpg","original":"http://content7.flixster.com/movie/10/92/01/10920113_ori.jpg"},"abridged_cast":[{"name":"Roy Scheider","id":"162661798","characters":["Heywood Floyd"]},{"name":"John Lithgow","id":"162661569","characters":["Walter Curnow"]},{"name":"Helen Mirren","id":"162662871","characters":["Tanya Kirbuk"]},{"name":"Bob Balaban","id":"162674438","characters":["R. Chandra"]},{"name":"Keir Dullea","id":"162658493","characters":["Dave Bowman"]}],"alternate_ids":{"imdb":"0086837"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/12419.json","alternate":"http://www.rottentomatoes.com/m/2010_the_year_we_make_contact/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/12419/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/12419/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/12419/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/12419/similar.json"}},{"id":"771247738","title":"2010: Moby Dick","year":2010,"mpaa_rating":"Unrated","runtime":88,"release_dates":{"dvd":"2011-11-23"},"ratings":{"critics_score":-1,"audience_rating":"Spilled","audience_score":10},"synopsis":"Author Herman Melville's classic tale gets a modern-day makeover as the captain of a submarine hunts the massive whale that once disfigured him in a terrifying confrontation at sea. ~ Jason Buchanan, Rovi","posters":{"thumbnail":"http://content7.flixster.com/movie/11/15/86/11158689_mob.jpg","profile":"http://content7.flixster.com/movie/11/15/86/11158689_pro.jpg","detailed":"http://content7.flixster.com/movie/11/15/86/11158689_det.jpg","original":"http://content7.flixster.com/movie/11/15/86/11158689_ori.jpg"},"abridged_cast":[{"name":"Barry Bostwick","id":"162677211"},{"name":"Renee O'Connor","id":"519006652"},{"name":"Adam Grimes","id":"770744081"},{"name":"Michael Teh","id":"770688544"},{"name":"Matt Lagan","id":"770869281"}],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771247738.json","alternate":"http://www.rottentomatoes.com/m/2010_moby_dick/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771247738/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771247738/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771247738/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771247738/similar.json"}},{"id":"771035589","title":"2010 Writers Guild Awards","year":"","mpaa_rating":"Unrated","runtime":"","release_dates":{},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771035589.json","alternate":"http://www.rottentomatoes.com/m/2010_writers_guild_awards/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771035589/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771035589/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771035589/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771035589/similar.json"}},{"id":"771039092","title":"2010 NCAA Women's Final Four Championship","year":2010,"mpaa_rating":"Unrated","runtime":"","release_dates":{"dvd":"2010-05-18"},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"alternate_ids":{"imdb":"0316876"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039092.json","alternate":"http://www.rottentomatoes.com/m/2010_ncaa_womens_final_four_championship/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039092/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039092/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039092/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039092/similar.json"}},{"id":"771039093","title":"2010 NCAA Men's Final Four Championship: The Duke Blue Devils","year":2010,"mpaa_rating":"Unrated","runtime":"","release_dates":{"dvd":"2010-05-18"},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039093.json","alternate":"http://www.rottentomatoes.com/m/2010_ncaa_mens_final_four_championship_the_duke_blue_devils/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039093/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039093/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039093/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039093/similar.json"}},{"id":"771269394","title":"2010 Oscar Nominated Shorts Programme","year":2011,"mpaa_rating":"Unrated","runtime":98,"release_dates":{},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771269394.json","alternate":"http://www.rottentomatoes.com/m/2010_oscar_nominated_shorts_programme/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771269394/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771269394/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771269394/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771269394/similar.json"}},{"id":"514738215","title":"Knight Rider 2010","year":1994,"mpaa_rating":"Unrated","runtime":"","release_dates":{"theater":"1994-02-13"},"ratings":{"critics_score":-1,"audience_rating":"Spilled","audience_score":33},"synopsis":"","posters":{"thumbnail":"http://content6.flixster.com/movie/10/92/01/10920116_mob.jpg","profile":"http://content6.flixster.com/movie/10/92/01/10920116_pro.jpg","detailed":"http://content6.flixster.com/movie/10/92/01/10920116_det.jpg","original":"http://content6.flixster.com/movie/10/92/01/10920116_ori.jpg"},"abridged_cast":[{"name":"Michael Beach","id":"397673145"},{"name":"Ramon Chavez","id":"770946830","characters":["Professor"]},{"name":"Badja Djola","id":"351527524"},{"name":"Samuel Hernandez","id":"770933916","characters":["Bandit"]},{"name":"Brion James","id":"364636020","characters":["Jared"]}],"alternate_ids":{"imdb":"0110273"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/514738215.json","alternate":"http://www.rottentomatoes.com/m/knight-rider-2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/514738215/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/514738215/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/514738215/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/514738215/similar.json"}},{"id":"770855448","title":"Ice Castles (2010)","year":2010,"mpaa_rating":"PG","runtime":95,"release_dates":{"theater":"2010-02-09","dvd":"2010-02-09"},"ratings":{"critics_score":-1,"audience_rating":"Spilled","audience_score":48},"synopsis":"Oscar-nominated director Donald Wrye takes the helm for this remake of his own 1979 ice skating melodrama staring Robbie Benson. An overnight success in the hyper-competitive world of figure skating, Alexis Winston ditched her hometown boyfriend in a bid for superstardom. Alexis is at the top of her game when she's suddenly blinded in a tragic ice skating mishap. Her spirit broken, the fallen figure skater seeks the love that will help her lace up her skates, and reach for her dreams. ~ Jason Buchanan, Rovi","posters":{"thumbnail":"http://content8.flixster.com/movie/10/92/75/10927534_mob.jpg","profile":"http://content8.flixster.com/movie/10/92/75/10927534_pro.jpg","detailed":"http://content8.flixster.com/movie/10/92/75/10927534_det.jpg","original":"http://content8.flixster.com/movie/10/92/75/10927534_ori.jpg"},"abridged_cast":[{"name":"Taylor Firth","id":"770866450","characters":["Alexis Winston"]},{"name":"Rob Mayes","id":"770701513","characters":["Nick"]},{"name":"Henry Czerny","id":"343941171","characters":["Marcus"]},{"name":"Michelle Kwan","id":"770733281"},{"name":"Andrea Joyce","id":"770866451"}],"alternate_ids":{"imdb":"1412454"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/770855448.json","alternate":"http://www.rottentomatoes.com/m/1221637-ice_castles/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/770855448/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/770855448/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/770855448/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/770855448/similar.json"}},{"id":"770676741","title":"Tamala 2010: A Punk Cat in Space","year":2002,"mpaa_rating":"Unrated","runtime":92,"release_dates":{"theater":"2003-09-28"},"ratings":{"critics_rating":"Rotten","critics_score":46,"audience_rating":"Upright","audience_score":69},"synopsis":"","posters":{"thumbnail":"http://content6.flixster.com/movie/10/28/40/10284016_mob.jpg","profile":"http://content6.flixster.com/movie/10/28/40/10284016_pro.jpg","detailed":"http://content6.flixster.com/movie/10/28/40/10284016_det.jpg","original":"http://content6.flixster.com/movie/10/28/40/10284016_ori.jpg"},"abridged_cast":[{"name":"Shinji Takeda","id":"507075359"},{"name":"Beatrice Dalle","id":"359852908"},{"name":"Hisayo Mochizuki","id":"770683680"}],"alternate_ids":{"imdb":"0374262"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/770676741.json","alternate":"http://www.rottentomatoes.com/m/tamala-2010-a-punk-cat-in-space/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/770676741/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/770676741/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/770676741/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/770676741/similar.json"}},{"id":"770874917","title":"DCI 2010: The Countdown","year":2010,"mpaa_rating":"PG","runtime":120,"release_dates":{"theater":"2010-05-13"},"ratings":{"critics_score":-1,"audience_rating":"Upright","audience_score":67},"synopsis":"Kick off the 2010 season in a big way on the big screen! The best of the best in marching music are back for a one night event in select movie theaters nationwide. NCM Fathom and Drum Corps International are proud to present DCI 2010: The Countdown","posters":{"thumbnail":"http://content6.flixster.com/movie/10/95/55/10955536_mob.jpg","profile":"http://content6.flixster.com/movie/10/95/55/10955536_pro.jpg","detailed":"http://content6.flixster.com/movie/10/95/55/10955536_det.jpg","original":"http://content6.flixster.com/movie/10/95/55/10955536_ori.jpg"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/770874917.json","alternate":"http://www.rottentomatoes.com/m/dci_2010_the_countdown/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/770874917/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/770874917/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/770874917/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/770874917/similar.json"}},{"id":"771223458","title":"WWE: SummerSlam 2010","year":2010,"mpaa_rating":"Unrated","runtime":"","release_dates":{"dvd":"2011-10-18"},"ratings":{"critics_score":-1,"audience_rating":"Upright","audience_score":64},"synopsis":"Filmed in 2010 inside the Staples Center in Los Angeles, this all-star pay-per-view event features some of World Wrestling Entertainment's brightest superstars duking it out for big wins and bragging rights during the sweltering dog days of summer. Highlights include a multiwrestler brawl featuring the likes of John Cena, R-Truth, Chris Jericho, Edge, Wade Barrett, Heath Slater, Skip Sheffield and Michael Tarver.","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[{"name":"John Cena","id":"347990562"},{"name":"Big Show","id":"770737516"},{"name":"Undertaker","id":"770737957"},{"name":"Chris Jericho","id":"770681104"},{"name":"Edge","id":"770689655"}],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771223458.json","alternate":"http://www.rottentomatoes.com/m/wwe_summerslam_2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771223458/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771223458/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771223458/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771223458/similar.json"}},{"id":"771204041","title":"Eric Clapton: Crossroads Guitar Festival 2010","year":2010,"mpaa_rating":"Unrated","runtime":"","release_dates":{"dvd":"2010-11-09"},"ratings":{"critics_score":-1,"audience_rating":"Upright","audience_score":100},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[{"name":"B.B. King","id":"162661560"},{"name":"Bill Murray","id":"162653064"},{"name":"Buddy Guy","id":"162660534"},{"name":"Eric Clapton","id":"335719505"},{"name":"Jeff Beck","id":"770720906"}],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771204041.json","alternate":"http://www.rottentomatoes.com/m/eric_clapton_crossroads_guitar_festival_2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771204041/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771204041/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771204041/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771204041/similar.json"}},{"id":"770813559","title":"Fahrenheit 2010: Warming Up for the World Cup in South Africa","year":2009,"mpaa_rating":"Unrated","runtime":52,"release_dates":{},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/770813559.json","alternate":"http://www.rottentomatoes.com/m/fahrenheit-2010-warming-up-for-the-world-cup-in-south-africa/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/770813559/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/770813559/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/770813559/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/770813559/similar.json"}},{"id":"771039639","title":"All's Well, Ends Well 2010","year":2010,"mpaa_rating":"Unrated","runtime":93,"release_dates":{"dvd":"2010-05-25"},"ratings":{"critics_score":-1,"audience_rating":"Spilled","audience_score":22},"synopsis":"After spending a decade honing her ceremonial skills in the Midland, Princess Pearl of Flowerland returns home under orders from her father. On her way back, Princess Pearl finds herself smitten with General Wing, a strong leader in the Midland Army. Shortly after General Wing rescues a young woman named Ying from taking her own life, the travelers are besieged by a gang of pirates and Princess Pearl falls overboard during the attack. Miraculously, Princess Pearl is saved by Ying's father. Now the princess suffers from amnesia. But General Wing knows that Princess Pearl is still alive, and he won't rests until his true love is back in his arms. ~ Jason Buchanan, Rovi","posters":{"thumbnail":"http://content9.flixster.com/movie/11/15/17/11151703_mob.jpg","profile":"http://content9.flixster.com/movie/11/15/17/11151703_pro.jpg","detailed":"http://content9.flixster.com/movie/11/15/17/11151703_det.jpg","original":"http://content9.flixster.com/movie/11/15/17/11151703_ori.jpg"},"abridged_cast":[{"name":"Sandra Ng Kwan Yue","id":"603266699"},{"name":"Louis Koo","id":"162675099"},{"name":"Ronald Cheng","id":"496181128"},{"name":"Raymond Wong","id":"770692982"},{"name":"Lin Hung","id":"771074541"}],"alternate_ids":{"imdb":"0077148"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039639.json","alternate":"http://www.rottentomatoes.com/m/alls_well_ends_well_2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039639/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039639/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039639/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771039639/similar.json"}},{"id":"771029221","title":"Sci-Fi Film Classics 2010 Calendar","year":2010,"mpaa_rating":"Unrated","runtime":"","release_dates":{"dvd":"2010-03-23"},"ratings":{"critics_score":-1,"audience_rating":"Upright","audience_score":100},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771029221.json","alternate":"http://www.rottentomatoes.com/m/sci_fi_film_classics_2010_calendar/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771029221/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771029221/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771029221/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771029221/similar.json"}},{"id":"771202431","title":"Eric Clapton Crossroads 2010","year":2010,"mpaa_rating":"G","runtime":240,"release_dates":{"theater":"2010-07-27"},"ratings":{"critics_score":-1,"audience_rating":"Upright","audience_score":100},"synopsis":"Eric Clapton's Crossroads Guitar Festival 2010 was a day-long musical celebration featuring legendary guitarists and artistic collaborations by Eric and his friends including Allman Brothers Band, BB King, Buddy Guy, Jeff Beck, John Mayer, Sheryl Crow, Steve Winwood, Vince Gill, ZZ Top, and more. Crossroads Guitar Festival 2010 took place on Saturday, June 26 at Toyota Park in Chicago. The following artists participated in this unique event to benefit Crossroads Centre Antigua: Albert Lee, BB King, Bert Jansch, Buddy Guy, David Hidalgo and Cesar Rosas of Los Lobos, Derek Trucks, Doyle Bramhall II, Earl Klugh, Eric Clapton, Gary Clark Jr., Hubert Sumlin, James Burton, Jeff Beck, Jimmie Vaughan, Joe Bonamassa, John Mayer, Johnny Winter, Jonny Lang, Keb' Mo', Pino Daniele, Robert Cray, Robert Randolph, Sheryl Crow, Susan Tedeschi, Sonny Landreth, Stefan Grossman, Steve Winwood, Vince Gill, Warren Haynes, and ZZ Top. --© Official Site","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[{"name":"Stefan Grossman","id":"770713120"},{"name":"Buddy Guy","id":"162660534"},{"name":"B.B. King","id":"162661560"},{"name":"Jimmie Vaughan","id":"770721638"},{"name":"Ronnie Wood","id":"770715577"}],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202431.json","alternate":"http://www.rottentomatoes.com/m/eric_clapton_crossroads_2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202431/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202431/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202431/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202431/similar.json"}},{"id":"771268086","title":"NHL Stanley Cup Champions 2010: Chicago Blackhawks","year":2010,"mpaa_rating":"Unrated","runtime":200,"release_dates":{},"ratings":{"critics_score":-1,"audience_score":100},"synopsis":"For the first time in 49 years, the Chicago Blackhawks are Stanley Cup Champions. Young superstars Jonathan Toews and Patrick Kane, franchise defenseman Duncan Keith, breakout power forward Dustin Byfuglien and classy winger Marian Hossa flash their talents in front of emerging goaltender Antti Niemi to bring hockey's most coveted trophy back to the Windy City. Now, you can relive every step of their championship season from the NHL Premiere in Helsinki to the dramatic Stanley Cup Final against the Philadelphia Flyers. Follow the Hawks as they capture their first Central Division title and face-off with Nashville, Vancouver, San Jose and the Flyers during the Stanley Cup Playoffs. Go inside the glass and into the locker room with exclusive footage and interviews with players, coaches and franchise legends. Recapture all the unforgettable glory of the 2010 Stanley Cup Champion Chicago Blackhawks!","posters":{"thumbnail":"http://content8.flixster.com/movie/11/16/33/11163334_mob.jpg","profile":"http://content8.flixster.com/movie/11/16/33/11163334_pro.jpg","detailed":"http://content8.flixster.com/movie/11/16/33/11163334_det.jpg","original":"http://content8.flixster.com/movie/11/16/33/11163334_ori.jpg"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771268086.json","alternate":"http://www.rottentomatoes.com/m/nhl_stanley_cup_champions_2010_chicago_blackhawks/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771268086/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771268086/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771268086/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771268086/similar.json"}},{"id":"770859486","title":"Zeche Is Nich - Sieben Blicke Auf Das Ruhrgebiet 2010","year":2010,"mpaa_rating":"Unrated","runtime":"","release_dates":{"theater":"2010-12-31"},"ratings":{"critics_score":-1,"audience_rating":"Upright","audience_score":100},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[{"name":"Roozbeh Farhangmehr","id":"770874011"},{"name":"Sinan Farhangmehr","id":"770874012"},{"name":"Manfred Mock","id":"770704536"}],"alternate_ids":{"imdb":"1511525"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/770859486.json","alternate":"http://www.rottentomatoes.com/m/zeche_is_nich_sieben_blicke_auf_das_ruhrgebiet_2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/770859486/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/770859486/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/770859486/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/770859486/similar.json"}},{"id":"771035588","title":"Orange British Academy Film Awards 2010","year":"","mpaa_rating":"Unrated","runtime":"","release_dates":{},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771035588.json","alternate":"http://www.rottentomatoes.com/m/orange_british_academy_film_awards_2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771035588/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771035588/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771035588/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771035588/similar.json"}},{"id":"771029228","title":"Musicals Film Classics 2010 Calendar","year":2010,"mpaa_rating":"Unrated","runtime":"","release_dates":{"dvd":"2010-03-23"},"ratings":{"critics_score":-1,"audience_rating":"Upright","audience_score":100},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771029228.json","alternate":"http://www.rottentomatoes.com/m/musicals_film_classics_2010_calendar/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771029228/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771029228/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771029228/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771029228/similar.json"}},{"id":"771202601","title":"TNA Wrestling: Slammiversary 2010","year":2010,"mpaa_rating":"Unrated","runtime":"","release_dates":{"dvd":"2010-08-24"},"ratings":{"critics_score":-1,"audience_rating":"Upright","audience_score":100},"synopsis":"","posters":{"thumbnail":"http://content7.flixster.com/movie/11/15/20/11152069_mob.jpg","profile":"http://content7.flixster.com/movie/11/15/20/11152069_pro.jpg","detailed":"http://content7.flixster.com/movie/11/15/20/11152069_det.jpg","original":"http://content7.flixster.com/movie/11/15/20/11152069_ori.jpg"},"abridged_cast":[],"alternate_ids":{"imdb":"0467006"},"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202601.json","alternate":"http://www.rottentomatoes.com/m/tna_wrestling_slammiversary_2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202601/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202601/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202601/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202601/similar.json"}},{"id":"771202663","title":"Teensplash 2010, Part 1","year":"","mpaa_rating":"Unrated","runtime":"","release_dates":{},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"","posters":{"thumbnail":"http://content8.flixster.com/movie/11/14/30/11143098_mob.jpg","profile":"http://content8.flixster.com/movie/11/14/30/11143098_pro.jpg","detailed":"http://content8.flixster.com/movie/11/14/30/11143098_det.jpg","original":"http://content8.flixster.com/movie/11/14/30/11143098_ori.jpg"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202663.json","alternate":"http://www.rottentomatoes.com/m/teensplash_2010_part_1/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202663/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202663/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202663/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771202663/similar.json"}},{"id":"771203395","title":"Dci 2010: Big, Loud & Live 7","year":2010,"mpaa_rating":"G","runtime":"","release_dates":{"theater":"2010-08-12","dvd":"2010-09-01"},"ratings":{"critics_score":-1,"audience_rating":"Upright","audience_score":100},"synopsis":"August 12, 2010 - one night event. Drum Corps International World Championships, Big Loud & Live from the world championship quarterfinals.","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771203395.json","alternate":"http://www.rottentomatoes.com/m/dci_2010_big_loud_and_live_7/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771203395/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771203395/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771203395/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771203395/similar.json"}},{"id":"770863928","title":"Oscar Nominated Shorts 2010","year":2010,"mpaa_rating":"Unrated","runtime":190,"release_dates":{},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"Shorts International will once again bring the Oscar (R) nominated short film program (live-action and animation) to theaters in the United States, Canada, Mexico and the United Kingdom beginning Feb. 19. The theatrical release of the Academy Award (R) nominated short films, which has met with enthusiastic audiences ever since its launch five years ago, will give people around the world an opportunity to see the nominated films prior to the 82 Academy Awards (R) ceremony on March 7.","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/770863928.json","alternate":"http://www.rottentomatoes.com/m/oscar-nominated-shorts-2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/770863928/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/770863928/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/770863928/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/770863928/similar.json"}},{"id":"770874314","title":"Spike And Mike Sick And Twisted Festival Of Animation 2010","year":2010,"mpaa_rating":"Unrated","runtime":"","release_dates":{},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/770874314.json","alternate":"http://www.rottentomatoes.com/m/spike_and_mike_sick_and_twisted_festival_of_animation_2010/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/770874314/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/770874314/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/770874314/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/770874314/similar.json"}},{"id":"771040671","title":"Cannes 2010 Programme Courts 1","year":2013,"mpaa_rating":"Unrated","runtime":91,"release_dates":{},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771040671.json","alternate":"http://www.rottentomatoes.com/m/cannes_2010_programme_courts_1/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771040671/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771040671/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771040671/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771040671/similar.json"}},{"id":"771041072","title":"Cannes 2010 Programme Courts 2","year":2013,"mpaa_rating":"Unrated","runtime":84,"release_dates":{},"ratings":{"critics_score":-1,"audience_score":0},"synopsis":"","posters":{"thumbnail":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","profile":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","detailed":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif","original":"http://images.rottentomatoescdn.com/images/redesign/poster_default.gif"},"abridged_cast":[],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies/771041072.json","alternate":"http://www.rottentomatoes.com/m/cannes_2010_programme_courts_2/","cast":"http://api.rottentomatoes.com/api/public/v1.0/movies/771041072/cast.json","clips":"http://api.rottentomatoes.com/api/public/v1.0/movies/771041072/clips.json","reviews":"http://api.rottentomatoes.com/api/public/v1.0/movies/771041072/reviews.json","similar":"http://api.rottentomatoes.com/api/public/v1.0/movies/771041072/similar.json"}}],"links":{"self":"http://api.rottentomatoes.com/api/public/v1.0/movies.json?q=2010&page_limit=30&page=1","next":"http://api.rottentomatoes.com/api/public/v1.0/movies.json?q=2010&page_limit=30&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}"} diff --git a/spec/movie_library_spec.rb b/spec/movie_library_spec.rb new file mode 100644 index 0000000..ad12d74 --- /dev/null +++ b/spec/movie_library_spec.rb @@ -0,0 +1,81 @@ +require 'rspec' +require_relative "../lib/movie" +require_relative "../lib/movie_library" +describe MovieLibrary do + + let(:movie_library) {MovieLibrary.new} + let (:movie){Movie.new(id: "the-id", title: "the-title", year: 1998, score: 50)} + let (:another_movie){Movie.new(id: "the-id", title: "the-title", year: 2012, score: 50)} + let (:yet_another_movie){Movie.new(id: "the-id", title: "the-title", year: 1990, score: 45)} + describe "#new" do + + it 'should be a movie library object ' do + movie_library.is_a?(MovieLibrary).should be_true + end + + it 'should have no movies when initialized' do + movie_library.count.should eq(0) + end + end + + describe "#add" do + + it 'should add a new movie to the library whenever a search happens' do + movie_library.add(movie) + expect(movie_library.all_movies).to include (movie) + end + it 'should increase the movie count' do + movie_library.add(movie) + movie_library.count.should eq(1) + end + end + + describe "#average_rating" do + + it "should have no average rating when no movies are cataloged" do + movie_library.average_rating(Array.new).should eq(0) + end + + it 'should calculate the average rating' do + movie_library.add(movie) + movie_library.average_rating(movie_library.all_movies).should eq(50) + end + end + + describe "#average_rating_by_year" do + + it 'should have no average yearly rating when no movies are cataloged' do + movie_library.average_rating_by_year(movie.year).should eq(0) + end + + it 'should calculate the average rating by year when the library has' do + movie_library.add(movie) + movie_library.add(another_movie) + movie_library.add(yet_another_movie) + movie_library.average_rating_by_year(1998).should eq(50) + end + end + + describe "#sort_by_year" do + + it 'should sort the movies by year' do + movie_library.add(another_movie) + movie_library.add(yet_another_movie) + movie_library.catalog.should == [yet_another_movie, another_movie] + end + end + + describe "#calculate_slope" do + + it "should have no slope when the library only contains one movie" do + movie_library.add(movie) + movie_library.slope.should eq(0) + end + it 'should calculate the slope of the average ratings from the first year to the last year' do + movie_library.add(another_movie) + movie_library.add(yet_another_movie) + movie_library.slope.should eq(-0.22727272727272727) + end + + end +end diff --git a/spec/movie_spec.rb b/spec/movie_spec.rb index 088bd37..00de55f 100644 --- a/spec/movie_spec.rb +++ b/spec/movie_spec.rb @@ -1,12 +1,21 @@ +require 'rspec' require_relative "../lib/movie" describe Movie do - it "should store the title, year, and score" do - movie = Movie.new(id: "the-id", title: "the-title", year: 1998, score: 50) - movie.id.should eq("the-id") - movie.title.should eq("the-title") - movie.year.should eq(1998) - movie.score.should eq(50) - end - + describe "#new" do + + let (:movie){Movie.new(id: "the-id", title: "the-title", year: 1998, score: 50)} + + it "should store the title, year, and score" do + movie.id.should eq("the-id") + movie.title.should eq("the-title") + movie.year.should eq(1998) + movie.score.should eq(50) + end + + it 'should a movie object' do + movie.is_a?(Movie).should be_true + end + end + end