badfruit 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -37,7 +37,7 @@ PLEASE NOTE: You will need to add replace the "API_KEY_HERE" text with your key
37
37
 
38
38
  Version
39
39
  --------
40
- The current version of the gem is 1.1.0, if you'd like to add anything feel free to submit a patch!
40
+ The current version of the gem is 1.1.1, if you'd like to add anything feel free to submit a patch!
41
41
 
42
42
  Thanks
43
43
  ------
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('badfruit', '1.1.0') do |p|
5
+ Echoe.new('badfruit', '1.1.1') do |p|
6
6
  p.description = "Interface with the Rotten Tomatoes API"
7
7
  p.url = "http://www.github.com/brianmichel/badfruit"
8
8
  p.author = "Brian Michel"
data/badfruit.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{badfruit}
5
- s.version = "1.1.0"
5
+ s.version = "1.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Brian Michel"]
9
9
  s.cert_chain = ["/Users/brianmichel/gem-public_cert.pem"]
10
- s.date = %q{2011-07-14}
10
+ s.date = %q{2011-08-05}
11
11
  s.description = %q{Interface with the Rotten Tomatoes API}
12
12
  s.email = %q{brian.michel@gmail.com}
13
13
  s.extra_rdoc_files = ["LICENSE", "README.md", "lib/badfruit.rb", "lib/badfruit/Actors/actor.rb", "lib/badfruit/Lists/lists.rb", "lib/badfruit/Movies/movie.rb", "lib/badfruit/Movies/movies.rb", "lib/badfruit/Posters/posters.rb", "lib/badfruit/Reviews/review.rb", "lib/badfruit/Scores/scores.rb", "lib/badfruit/base.rb"]
@@ -13,7 +13,7 @@ Feature: Reviews
13
13
  | api_key | movie_name |
14
14
  | "API_KEY_HERE" | "Hackers" |
15
15
  | "API_KEY_HERE" | "Gone With the Wind" |
16
-
16
+
17
17
  Scenario Outline: Get Information For Specific Movie by id
18
18
  Given I make a new client with <api_key>
19
19
  And I query the API for <movie_id>
@@ -23,3 +23,13 @@ Feature: Reviews
23
23
  Examples:
24
24
  | api_key | movie_id |
25
25
  | "API_KEY_HERE" | 770671942 |
26
+
27
+ Scenario Outline: Get Similar movies by id
28
+ Given I make a new client with <api_key>
29
+ And I query the API for <similar_movie_id>
30
+ And I fetch the similar movies for <similar_movie_id>
31
+ Then the results should contain similar movies
32
+
33
+ Examples:
34
+ | api_key | similar_movie_id |
35
+ | "API_KEY_HERE" | 326459204 |
@@ -17,6 +17,9 @@ end
17
17
  Given /I fetch the reviews for "([^"]*)"$/ do |movie_name|
18
18
  @reviews = @movies[0].reviews
19
19
  end
20
+ Given /^I fetch the similar movies for (\d+)$/ do |similar_movie_id|
21
+ @similar_movies = @badfruit.similar_movies(similar_movie_id)
22
+ end
20
23
 
21
24
  Given /^I fetch the info for (\d+)$/ do |movie_id|
22
25
  @info = @movie.info
@@ -32,6 +35,9 @@ Then /the results should contain the "([^"]*)"$/ do |movie_name|
32
35
  should_be_true = movie_to_test.name.include? "#{movie_name}"
33
36
  should_be_true.should == true
34
37
  end
38
+ Then /^the results should contain similar movies$/ do
39
+ @similar_movies.should_not == nil
40
+ end
35
41
 
36
42
  Then /the results should contain reviews/ do
37
43
  @reviews.each do |review|
@@ -19,5 +19,9 @@ module BadFruit
19
19
  def new_dvd_releases
20
20
  return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action("new_releases")))
21
21
  end
22
+
23
+ def current_dvd_releases
24
+ return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action("current_releases")))
25
+ end
22
26
  end
23
- end
27
+ end
@@ -20,5 +20,11 @@ module BadFruit
20
20
  raise 'Movie not found' if movie.blank?
21
21
  @badfruit.parse_movie_array(JSON.parse(movie))
22
22
  end
23
+
24
+ # similar movie
25
+ def similar_movies(movie_id)
26
+ return @badfruit.parse_movies_array(JSON.parse(@badfruit.similar_movies(movie_id)))
27
+ end
28
+
23
29
  end
24
30
  end
data/lib/badfruit/base.rb CHANGED
@@ -19,7 +19,12 @@ module BadFruit
19
19
  url = "#{@@movies_query_url}&q=#{CGI::escape(name)}&page_limit=#{page_limit}&page=#{page}"
20
20
  return get(url)
21
21
  end
22
-
22
+
23
+ def similar_movies(movie_id)
24
+ url = "#{MOVIE_DETAIL_BASE_URL}/#{CGI::escape(movie_id)}/similar.json?apikey=#{@api_key}"
25
+ return get(url)
26
+ end
27
+
23
28
  def get_movie_info(movie_id, action)
24
29
  url = nil
25
30
  case action
@@ -49,6 +54,8 @@ module BadFruit
49
54
  url = "#{LISTS_DETAIL_BASE_URL}/movies/upcoming.json?apikey=#{@api_key}"
50
55
  when "in_theaters"
51
56
  url = "#{LISTS_DETAIL_BASE_URL}/movies/in_theaters.json?apikey=#{@api_key}"
57
+ when "current_releases"
58
+ url = "#{LISTS_DETAIL_BASE_URL}/dvds/current_releases.json?apikey=#{@api_key}"
52
59
  else
53
60
  puts "Not a valid action"
54
61
  return
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: badfruit
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.0
5
+ version: 1.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Michel
@@ -31,7 +31,7 @@ cert_chain:
31
31
  BcUuq0IKVG0Sd9yo6rY=
32
32
  -----END CERTIFICATE-----
33
33
 
34
- date: 2011-07-14 00:00:00 Z
34
+ date: 2011-08-05 00:00:00 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
metadata.gz.sig CHANGED
Binary file