badfruit 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/Manifest +0 -1
- data/README.md +8 -3
- data/Rakefile +1 -1
- data/badfruit.gemspec +3 -3
- data/features/client_creation.feature +1 -1
- data/features/client_reviews.feature +10 -0
- data/features/step_definitions/step_definitions.rb +15 -1
- data/lib/badfruit/Movies/movie.rb +11 -3
- data/lib/badfruit/Movies/movies.rb +8 -1
- data/lib/badfruit/base.rb +7 -1
- metadata +3 -3
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/Manifest
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@ This is a rough gem to interface with the Rotten Tomatoes API.
|
|
6
6
|
Prerequisites
|
7
7
|
-------------
|
8
8
|
|
9
|
-
|
9
|
+
gem install badfruit
|
10
10
|
|
11
11
|
YOU ARE NOW READY TO GET SOME SWEET MOVIE DATA!
|
12
12
|
|
@@ -19,7 +19,7 @@ So there are two main parts of the api, movies and lists. Each of these parts re
|
|
19
19
|
|
20
20
|
Will return you an array of movie objects that represent that latest dvd releases. From this array you can execute actions on the individual movies themselves like...
|
21
21
|
|
22
|
-
|
22
|
+
movies = bf.lists.new_dvd_releases
|
23
23
|
movies[0].full_cast
|
24
24
|
movies[0].reviews
|
25
25
|
|
@@ -37,4 +37,9 @@ 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
|
40
|
+
The current version of the gem is 1.1.0, if you'd like to add anything feel free to submit a patch!
|
41
|
+
|
42
|
+
Thanks
|
43
|
+
------
|
44
|
+
|
45
|
+
Thanks to Tagrudev for the search by id feature!
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('badfruit', '1.
|
5
|
+
Echoe.new('badfruit', '1.1.0') 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,16 +2,16 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{badfruit}
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.1.0"
|
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-
|
10
|
+
s.date = %q{2011-07-14}
|
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"]
|
14
|
-
s.files = ["LICENSE", "Manifest", "README.md", "Rakefile", "
|
14
|
+
s.files = ["LICENSE", "Manifest", "README.md", "Rakefile", "features/client_creation.feature", "features/client_query.feature", "features/client_reviews.feature", "features/step_definitions/step_definitions.rb", "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", "badfruit.gemspec"]
|
15
15
|
s.homepage = %q{http://www.github.com/brianmichel/badfruit}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Badfruit", "--main", "README.md"]
|
17
17
|
s.require_paths = ["lib"]
|
@@ -13,3 +13,13 @@ Feature: Reviews
|
|
13
13
|
| api_key | movie_name |
|
14
14
|
| "API_KEY_HERE" | "Hackers" |
|
15
15
|
| "API_KEY_HERE" | "Gone With the Wind" |
|
16
|
+
|
17
|
+
Scenario Outline: Get Information For Specific Movie by id
|
18
|
+
Given I make a new client with <api_key>
|
19
|
+
And I query the API for <movie_id>
|
20
|
+
And I fetch the info for <movie_id>
|
21
|
+
Then the results should contain movie info
|
22
|
+
|
23
|
+
Examples:
|
24
|
+
| api_key | movie_id |
|
25
|
+
| "API_KEY_HERE" | 770671942 |
|
@@ -1,3 +1,4 @@
|
|
1
|
+
$:.push(File.expand_path('../../../lib', __FILE__))
|
1
2
|
require 'badfruit'
|
2
3
|
|
3
4
|
Given /I make a new client with "([^"]*)"$/ do |key|
|
@@ -9,10 +10,18 @@ Given /I query the API for "([^"]*)"$/ do |movie_name|
|
|
9
10
|
@movies = @badfruit.movies.search_by_name("#{movie_name}",50)
|
10
11
|
end
|
11
12
|
|
13
|
+
Given /^I query the API for (\d+)$/ do |movie_id|
|
14
|
+
@movie = @badfruit.movies.search_by_id("#{movie_id}")
|
15
|
+
end
|
16
|
+
|
12
17
|
Given /I fetch the reviews for "([^"]*)"$/ do |movie_name|
|
13
18
|
@reviews = @movies[0].reviews
|
14
19
|
end
|
15
20
|
|
21
|
+
Given /^I fetch the info for (\d+)$/ do |movie_id|
|
22
|
+
@info = @movie.info
|
23
|
+
end
|
24
|
+
|
16
25
|
|
17
26
|
Then /the result should contain the same "([^"]*)"$/ do |key|
|
18
27
|
@badfruit.api_key.should == key
|
@@ -30,4 +39,9 @@ Then /the results should contain reviews/ do
|
|
30
39
|
review.quote.should_not == nil
|
31
40
|
review.publication.should_not == nil
|
32
41
|
end
|
33
|
-
end
|
42
|
+
end
|
43
|
+
|
44
|
+
Then /^the results should contain movie info$/ do
|
45
|
+
@info.should_not == nil
|
46
|
+
end
|
47
|
+
|
@@ -1,11 +1,19 @@
|
|
1
1
|
module BadFruit
|
2
2
|
class Movie
|
3
|
-
attr_accessor :id, :name, :
|
3
|
+
attr_accessor :id, :name, :year, :genres, :mpaa_rating, :runtime, :release_dates,
|
4
|
+
:synopsis, :cast, :directors, :scores, :posters
|
4
5
|
|
5
6
|
def initialize(movieHash, badfruit)
|
6
7
|
@id = movieHash["id"]
|
7
8
|
@name = movieHash["title"]
|
8
|
-
@
|
9
|
+
@year = movieHash["year"]
|
10
|
+
@genres = movieHash["genres"]
|
11
|
+
@mpaa_rating = movieHash["mpaa_rating"]
|
12
|
+
@runtime = movieHash["runtime"]
|
13
|
+
@release_dates = movieHash["release_dates"]
|
14
|
+
@synopsis = movieHash["synopsis"]
|
15
|
+
@cast = movieHash["abridged_cast"]
|
16
|
+
@directors = movieHash["abridged_directors"]
|
9
17
|
@scores = Scores.new(movieHash["ratings"]) #single score object containing two scores
|
10
18
|
@posters = Posters.new(movieHash["posters"]) #single posters object containing four poster urls
|
11
19
|
@badfruit = badfruit
|
@@ -30,4 +38,4 @@ module BadFruit
|
|
30
38
|
return JSON.parse(@badfruit.get_movie_info(@id, "details"))
|
31
39
|
end
|
32
40
|
end
|
33
|
-
end
|
41
|
+
end
|
@@ -13,5 +13,12 @@ module BadFruit
|
|
13
13
|
end
|
14
14
|
return @badfruit.parse_movies_array(JSON.parse(@badfruit.search_movies(name, page_limit, page)))
|
15
15
|
end
|
16
|
+
|
17
|
+
# search by id
|
18
|
+
def search_by_id(movie_id)
|
19
|
+
movie = @badfruit.get_movie_info(movie_id, "main")
|
20
|
+
raise 'Movie not found' if movie.blank?
|
21
|
+
@badfruit.parse_movie_array(JSON.parse(movie))
|
22
|
+
end
|
16
23
|
end
|
17
|
-
end
|
24
|
+
end
|
data/lib/badfruit/base.rb
CHANGED
@@ -29,6 +29,8 @@ module BadFruit
|
|
29
29
|
url = "#{MOVIE_DETAIL_BASE_URL}/#{movie_id}/reviews.json?apikey=#{@api_key}"
|
30
30
|
when "cast"
|
31
31
|
url = "#{MOVIE_DETAIL_BASE_URL}/#{movie_id}/cast.json?apikey=#{@api_key}"
|
32
|
+
when "main"
|
33
|
+
url = "#{MOVIE_DETAIL_BASE_URL}/#{movie_id}.json?apikey=#{@api_key}"
|
32
34
|
else
|
33
35
|
puts "Not a valid action"
|
34
36
|
return
|
@@ -72,6 +74,10 @@ module BadFruit
|
|
72
74
|
return moviesArray
|
73
75
|
end
|
74
76
|
|
77
|
+
def parse_movie_array(hash)
|
78
|
+
Movie.new(hash, self)
|
79
|
+
end
|
80
|
+
|
75
81
|
def parse_actors_array(hash)
|
76
82
|
actorsArray = Array.new
|
77
83
|
hash["cast"].each do |actor|
|
@@ -80,4 +86,4 @@ module BadFruit
|
|
80
86
|
return actorsArray
|
81
87
|
end
|
82
88
|
end
|
83
|
-
end
|
89
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: badfruit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.
|
5
|
+
version: 1.1.0
|
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-
|
34
|
+
date: 2011-07-14 00:00:00 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
@@ -89,7 +89,6 @@ files:
|
|
89
89
|
- Manifest
|
90
90
|
- README.md
|
91
91
|
- Rakefile
|
92
|
-
- badfruit.gemspec
|
93
92
|
- features/client_creation.feature
|
94
93
|
- features/client_query.feature
|
95
94
|
- features/client_reviews.feature
|
@@ -103,6 +102,7 @@ files:
|
|
103
102
|
- lib/badfruit/Reviews/review.rb
|
104
103
|
- lib/badfruit/Scores/scores.rb
|
105
104
|
- lib/badfruit/base.rb
|
105
|
+
- badfruit.gemspec
|
106
106
|
homepage: http://www.github.com/brianmichel/badfruit
|
107
107
|
licenses: []
|
108
108
|
|
metadata.gz.sig
CHANGED
Binary file
|