tomato_power 0.0.5
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.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Guardfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +57 -0
- data/Rakefile +1 -0
- data/lib/tomato_power/api/api.rb +97 -0
- data/lib/tomato_power/api/tomato_methods.rb +82 -0
- data/lib/tomato_power/client.rb +35 -0
- data/lib/tomato_power/helpers/helpers.rb +12 -0
- data/lib/tomato_power/helpers/parsers.rb +28 -0
- data/lib/tomato_power/movie/actor.rb +12 -0
- data/lib/tomato_power/movie/clip.rb +10 -0
- data/lib/tomato_power/movie/movie.rb +56 -0
- data/lib/tomato_power/movie/review.rb +15 -0
- data/lib/tomato_power/version.rb +3 -0
- data/lib/tomato_power.rb +22 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/support/sample_data/no_results +1 -0
- data/spec/support/sample_data/sample_actor +5 -0
- data/spec/support/sample_data/sample_actors +186 -0
- data/spec/support/sample_data/sample_alias +64 -0
- data/spec/support/sample_data/sample_clip +6 -0
- data/spec/support/sample_data/sample_clips +147 -0
- data/spec/support/sample_data/sample_movie +1 -0
- data/spec/support/sample_data/sample_movies +46 -0
- data/spec/support/sample_data/sample_review +8 -0
- data/spec/support/sample_data/sample_reviews +191 -0
- data/spec/support/vcr/TomatoPower_API/API_Methods/valid_methods/should_create_methods.yml +598 -0
- data/spec/support/vcr/TomatoPower_API/API_options_validation/valid_options/should_consider_0_options_valid.yml +306 -0
- data/spec/support/vcr/TomatoPower_API/API_options_validation/valid_options/should_not_raise_error.yml +101 -0
- data/spec/support/vcr/TomatoPower_API/List_request/searching_by_title/should_return_a_list_of_movie_objects.yml +101 -0
- data/spec/support/vcr/TomatoPower_API/List_request/searching_by_title/should_url_encode_search_string_before_sending.yml +102 -0
- data/spec/support/vcr/TomatoPower_API/List_request/should_return_a_list_of_movie_objects.yml +101 -0
- data/spec/support/vcr/TomatoPower_API/List_request/should_url_encode_search_string_before_sending.yml +102 -0
- data/spec/support/vcr/TomatoPower_API/Movie_request/cast/should_return_cast_of_movie.yml +356 -0
- data/spec/support/vcr/TomatoPower_API/Movie_request/clips/should_return_clips_of_movie.yml +638 -0
- data/spec/support/vcr/TomatoPower_API/Movie_request/no_results/should_return_error_string_if_no_results_are_found.yml +49 -0
- data/spec/support/vcr/TomatoPower_API/Movie_request/reviews/should_return_reviews.yml +271 -0
- data/spec/support/vcr/TomatoPower_API/Movie_request/should_return_single_movie.yml +161 -0
- data/spec/support/vcr/TomatoPower_API/Movie_request/similar/should_return_similar_movies.yml +121 -0
- data/spec/support/vcr/TomatoPower_Client/box_office_movies/should_return_list_of_movies.yml +396 -0
- data/spec/support/vcr/TomatoPower_Client/current_release_dvds/should_return_list_of_movies.yml +427 -0
- data/spec/support/vcr/TomatoPower_Client/in_theaters_movies/should_return_list_of_movies.yml +380 -0
- data/spec/support/vcr/TomatoPower_Client/new_release_dvds/should_return_list_of_movies.yml +392 -0
- data/spec/support/vcr/TomatoPower_Client/opening_movies/should_return_list_of_movies.yml +213 -0
- data/spec/support/vcr/TomatoPower_Client/search_by_id/should_return_list_of_movies_by_id.yml +88 -0
- data/spec/support/vcr/TomatoPower_Client/search_by_title/should_return_list_of_movies_by_title.yml +89 -0
- data/spec/support/vcr/TomatoPower_Client/top_rentals/should_return_list_of_movies.yml +409 -0
- data/spec/support/vcr/TomatoPower_Client/upcoming_dvds/should_return_list_of_movies.yml +359 -0
- data/spec/support/vcr/TomatoPower_Client/upcoming_movies/should_return_list_of_movies.yml +341 -0
- data/spec/support/vcr/TomatoPower_Movie/clips/should_return_clips.yml +250 -0
- data/spec/support/vcr/TomatoPower_Movie/full_cast/should_return_cast.yml +279 -0
- data/spec/support/vcr/TomatoPower_Movie/reviews/should_return_reviews.yml +205 -0
- data/spec/support/vcr/TomatoPower_Movie/similar/should_return_similar_movies.yml +231 -0
- data/spec/support/vcr/TomatoPower_Movie/similar/should_return_similars.yml +81 -0
- data/spec/support/vcr.rb +13 -0
- data/spec/unit_specs/actor_spec.rb +16 -0
- data/spec/unit_specs/api_spec.rb +126 -0
- data/spec/unit_specs/client_spec.rb +73 -0
- data/spec/unit_specs/clip_spec.rb +14 -0
- data/spec/unit_specs/helpers.rb +50 -0
- data/spec/unit_specs/helpers_spec.rb +4 -0
- data/spec/unit_specs/movie_spec.rb +75 -0
- data/spec/unit_specs/parsers_spec.rb +55 -0
- data/spec/unit_specs/review_spec.rb +17 -0
- data/spec/unit_specs/tomato_power_spec.rb +6 -0
- data/tomato_power.gemspec +29 -0
- metadata +295 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module TomatoPower
|
|
4
|
+
describe TomatoPower::API , :vcr => {:record => :new_episodes} do
|
|
5
|
+
before do
|
|
6
|
+
@api = TomatoPower::API.new TestHelpers::api_key
|
|
7
|
+
end
|
|
8
|
+
describe "API Methods" do
|
|
9
|
+
describe "invalid methods" do
|
|
10
|
+
invalid_api_methods = [:invliad_search, :invalid_lookup]
|
|
11
|
+
invalid_api_methods.each do |method|
|
|
12
|
+
|
|
13
|
+
it "should raise error when called" do
|
|
14
|
+
expect{ @api.send method }.to raise_error(NoMethodError)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should not respond" do
|
|
18
|
+
@api.respond_to?(method).should be_false
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "valid methods" do
|
|
24
|
+
valid_api_methods = [:movies_search, :upcoming_dvds, :opening_movies]
|
|
25
|
+
|
|
26
|
+
it "should create methods" do
|
|
27
|
+
valid_api_methods.each do |method|
|
|
28
|
+
expect{ @api.send method }.not_to raise_error(NoMethodError)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
it "should respond" do
|
|
33
|
+
valid_api_methods.each do |method|
|
|
34
|
+
expect { respond_to? method}.to be_true
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe "API options validation" do
|
|
41
|
+
|
|
42
|
+
describe "valid options" do
|
|
43
|
+
|
|
44
|
+
it "should not raise error" do
|
|
45
|
+
expect {@api.movies_search({:q => "jack",:page => 1,
|
|
46
|
+
:page_limit => 2})}.not_to raise_error
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should consider 0 options valid" do
|
|
50
|
+
expect {@api.box_office_movies}.not_to raise_error
|
|
51
|
+
expect {@api.movies_search}.not_to raise_error
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
describe "invalid options" do
|
|
57
|
+
it "should raise error" do
|
|
58
|
+
expect {@api.movies_search({:invalid => "jack",:invalid => 1,
|
|
59
|
+
:invalid => 2})}.to raise_error
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
describe "List request" do
|
|
65
|
+
|
|
66
|
+
describe "searching by title" do
|
|
67
|
+
it "should return a list of movie objects" do
|
|
68
|
+
movies = @api.movies_search({:q => "jack", :page_limit => 2})
|
|
69
|
+
movies.should be_kind_of(Array)
|
|
70
|
+
movies[0].should be_kind_of(TomatoPower::Movie)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "should url encode search string before sending" do
|
|
74
|
+
movies = @api.movies_search({:q => "Mission Impossible", :page_limit => 2})
|
|
75
|
+
movies.should be_kind_of(Array)
|
|
76
|
+
movies[0].should be_kind_of(TomatoPower::Movie)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
describe "Movie request" do
|
|
82
|
+
before do
|
|
83
|
+
@movie = TomatoPower::Movie.new TestHelpers::sample :movie
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
describe "cast" do
|
|
87
|
+
it "should return cast of movie" do
|
|
88
|
+
cast = @api.movie_cast({:movie_id => @movie.id})
|
|
89
|
+
cast.should be_kind_of(Array)
|
|
90
|
+
cast[0].should be_kind_of(Actor)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe "clips" do
|
|
95
|
+
it "should return clips of movie" do
|
|
96
|
+
clips = @api.movie_clips({:movie_id => @movie.id})
|
|
97
|
+
clips.should be_kind_of(Array)
|
|
98
|
+
clips[0].should be_kind_of(Clip)
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
describe "reviews" do
|
|
103
|
+
it "should return reviews" do
|
|
104
|
+
reviews = @api.movie_reviews({:movie_id => @movie.id})
|
|
105
|
+
reviews.should be_kind_of(Array)
|
|
106
|
+
reviews[0].should be_kind_of(Review)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
describe "similar" do
|
|
111
|
+
it "should return similar movies" do
|
|
112
|
+
similar = @api.movie_similar({:movie_id => @movie.id})
|
|
113
|
+
similar.should be_kind_of(Array)
|
|
114
|
+
similar[0].should be_kind_of(Movie)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
describe "no results" do
|
|
118
|
+
it "should return error string if no results are found" do
|
|
119
|
+
reviews = @api.movie_reviews({:movie_id => 1})
|
|
120
|
+
reviews.should be_kind_of(Array)
|
|
121
|
+
reviews[0].include?('No Results').should be_true
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module TomatoPower
|
|
4
|
+
describe TomatoPower::Client, :vcr => {:record => :new_episodes} do
|
|
5
|
+
before do
|
|
6
|
+
@client = TomatoPower.new TestHelpers::api_key
|
|
7
|
+
end
|
|
8
|
+
describe "search_by_title" do
|
|
9
|
+
it "should return list of movies by title" do
|
|
10
|
+
movies = @client.search_by_title("Mission Impossible", {page_limit: 1, page:1})
|
|
11
|
+
movies.should be_kind_of(Array)
|
|
12
|
+
movies[0].title.include?("Mission")
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
describe "search_by_id" do
|
|
16
|
+
it "should return list of movies by id" do
|
|
17
|
+
movies = @client.search_by_id "0031381"
|
|
18
|
+
movies.should be_kind_of(Array)
|
|
19
|
+
movies[0].title.include?("Gone with the Wind")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
describe "box_office_movies" do
|
|
23
|
+
it "should return list of movies" do
|
|
24
|
+
movies = @client.box_office_movies({limit: 20, country: 'us'})
|
|
25
|
+
movies.should be_kind_of(Array)
|
|
26
|
+
movies.length <= 20
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
describe "in_theaters_movies" do
|
|
30
|
+
it "should return list of movies" do
|
|
31
|
+
movies = @client.movies_in_theaters({page_limit: 20, page: 1, country: 'us'})
|
|
32
|
+
movies.should be_kind_of(Array)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
describe "opening_movies" do
|
|
36
|
+
it "should return list of movies" do
|
|
37
|
+
movies = @client.opening_movies({limit: 20, country: 'us'})
|
|
38
|
+
movies.should be_kind_of(Array)
|
|
39
|
+
movies.length <= 20
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
describe "upcoming_movies" do
|
|
43
|
+
it "should return list of movies" do
|
|
44
|
+
movies = @client.upcoming_movies({page_limit: 21, page: 1, country: 'us'})
|
|
45
|
+
movies.should be_kind_of(Array)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
describe "top_rentals" do
|
|
49
|
+
it "should return list of movies" do
|
|
50
|
+
movies = @client.top_rentals({limit: 21,country: 'us'})
|
|
51
|
+
movies.should be_kind_of(Array)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
describe "current_release_dvds" do
|
|
55
|
+
it "should return list of movies" do
|
|
56
|
+
movies = @client.current_release_dvds({page_limit: 21,page: 1,country:'us'})
|
|
57
|
+
movies.should be_kind_of(Array)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
describe "new_release_dvds" do
|
|
61
|
+
it "should return list of movies" do
|
|
62
|
+
movies = @client.new_release_dvds({page_limit: 21,page: 1,country:'us'})
|
|
63
|
+
movies.should be_kind_of(Array)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
describe "upcoming_dvds" do
|
|
67
|
+
it "should return list of movies" do
|
|
68
|
+
movies = @client.upcoming_dvds({page_limit: 21,page: 1,country:'us'})
|
|
69
|
+
movies.should be_kind_of(Array)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module TomatoPower
|
|
4
|
+
describe TomatoPower::Clip do
|
|
5
|
+
before do
|
|
6
|
+
@clip = Clip.new TestHelpers::sample :clip
|
|
7
|
+
end
|
|
8
|
+
describe "attributes" do
|
|
9
|
+
it { should respond_to ( :title )}
|
|
10
|
+
it { should respond_to ( :duration )}
|
|
11
|
+
it { should respond_to ( :thumbnail )}
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module TestHelpers
|
|
2
|
+
String.class_eval do
|
|
3
|
+
def is_valid_url?
|
|
4
|
+
uri = URI.parse self
|
|
5
|
+
uri.kind_of? URI::HTTP
|
|
6
|
+
rescue URI::InvalidURIError
|
|
7
|
+
false
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.api_key
|
|
12
|
+
begin
|
|
13
|
+
api_key = ENV.fetch("ROTTEN_TOMATOES_API_KEY")
|
|
14
|
+
rescue
|
|
15
|
+
api_key_file = File.join(File.expand_path(File.dirname(__FILE__)),
|
|
16
|
+
'../config', 'tomato_power_config.yaml')
|
|
17
|
+
raise "tomato_power_config not found" unless File.exists?(api_key_file)
|
|
18
|
+
ENV["ROTTEN_TOMATOES_API_KEY"] =
|
|
19
|
+
YAML::load(File.open(api_key_file))["ROTTEN_TOMATOES_API_KEY"]
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.sample sample_type
|
|
24
|
+
case sample_type
|
|
25
|
+
when :movie
|
|
26
|
+
file = File.join(File.dirname(__FILE__), '../support/sample_data/sample_movie')
|
|
27
|
+
when :movies
|
|
28
|
+
file = File.join(File.dirname(__FILE__), '../support/sample_data/sample_movies')
|
|
29
|
+
when :actor
|
|
30
|
+
file = File.join(File.dirname(__FILE__), '../support/sample_data/sample_actor')
|
|
31
|
+
when :actors
|
|
32
|
+
file = File.join(File.dirname(__FILE__), '../support/sample_data/sample_actors')
|
|
33
|
+
when :clip
|
|
34
|
+
file = File.join(File.dirname(__FILE__), '../support/sample_data/sample_clip')
|
|
35
|
+
when :clips
|
|
36
|
+
file = File.join(File.dirname(__FILE__), '../support/sample_data/sample_clips')
|
|
37
|
+
when :review
|
|
38
|
+
file = File.join(File.dirname(__FILE__), '../support/sample_data/sample_review')
|
|
39
|
+
when :reviews
|
|
40
|
+
file = File.join(File.dirname(__FILE__), '../support/sample_data/sample_reviews')
|
|
41
|
+
when :alias
|
|
42
|
+
file = File.join(File.dirname(__FILE__), '../support/sample_data/sample_alias')
|
|
43
|
+
when :no_results
|
|
44
|
+
file = File.join(File.dirname(__FILE__), '../support/sample_data/no_results')
|
|
45
|
+
else
|
|
46
|
+
raise ArgumentError.new("Unrecognized type: #{type}")
|
|
47
|
+
end
|
|
48
|
+
JSON.parse(File.open(file).read)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'json'
|
|
3
|
+
|
|
4
|
+
module TomatoPower
|
|
5
|
+
describe TomatoPower::Movie, :vcr => { :record => :new_episodes} do
|
|
6
|
+
before do
|
|
7
|
+
TomatoPower::api = TomatoPower::API.new TestHelpers::api_key
|
|
8
|
+
@movie = Movie.new TestHelpers::sample :movie
|
|
9
|
+
subject { @movie }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe "attributes" do
|
|
13
|
+
it { should respond_to(:id)}
|
|
14
|
+
it { should respond_to(:info)}
|
|
15
|
+
it { should respond_to(:abridged_cast)}
|
|
16
|
+
it { should respond_to(:title)}
|
|
17
|
+
it { should respond_to(:ratings)}
|
|
18
|
+
it { should respond_to(:mpaa_rating)}
|
|
19
|
+
it { should respond_to(:runtime)}
|
|
20
|
+
it { should respond_to(:release_dates)}
|
|
21
|
+
it { should respond_to(:synopsis)}
|
|
22
|
+
it { should respond_to(:posters)}
|
|
23
|
+
it { should respond_to(:alternate_ids)}
|
|
24
|
+
it { should respond_to(:links)}
|
|
25
|
+
it { should respond_to(:abridged_directors)}
|
|
26
|
+
it { should respond_to(:studio)}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe "valid methods" do
|
|
30
|
+
it "should respond to vaild methods" do
|
|
31
|
+
valid_api_methods = [:full_cast, :clips, :reviews]
|
|
32
|
+
valid_api_methods.each do |method|
|
|
33
|
+
expect { respond_to? method}.to be_true
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
describe "invalid methods" do
|
|
38
|
+
it "should not respond" do
|
|
39
|
+
invalid_api_methods = [:invalid_method, :invalid_clips, :invalid_reviews]
|
|
40
|
+
invalid_api_methods.each do |method|
|
|
41
|
+
@movie.respond_to?(method).should be_false
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
describe "full_cast" do
|
|
46
|
+
it "should return cast" do
|
|
47
|
+
cast = @movie.full_cast
|
|
48
|
+
cast.should be_kind_of(Array)
|
|
49
|
+
cast[0].should be_kind_of(Actor)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
describe "clips" do
|
|
53
|
+
it "should return clips" do
|
|
54
|
+
clips = @movie.clips
|
|
55
|
+
clips.should be_kind_of(Array)
|
|
56
|
+
clips[0].should be_kind_of(Clip)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
describe "reviews" do
|
|
60
|
+
it "should return reviews" do
|
|
61
|
+
reviews = @movie.reviews({:review_type => "all", :page => 1,
|
|
62
|
+
:country => 'us'})
|
|
63
|
+
reviews.should be_kind_of(Array)
|
|
64
|
+
reviews[0].should be_kind_of(Review)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
describe "similar" do
|
|
68
|
+
it "should return similar movies" do
|
|
69
|
+
similar = @movie.similar
|
|
70
|
+
similar.should be_kind_of(Array)
|
|
71
|
+
similar[0].should be_kind_of(Movie)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'json'
|
|
3
|
+
|
|
4
|
+
module TomatoPower
|
|
5
|
+
module Parser
|
|
6
|
+
describe TomatoPower::Parser do
|
|
7
|
+
describe "parse" do
|
|
8
|
+
before do
|
|
9
|
+
@movies = TestHelpers::sample :movies
|
|
10
|
+
@actors = TestHelpers::sample :actors
|
|
11
|
+
@clips = TestHelpers::sample :clips
|
|
12
|
+
@reviews = TestHelpers::sample :reviews
|
|
13
|
+
@no_results = TestHelpers::sample :no_results
|
|
14
|
+
@alias = TestHelpers::sample :alias
|
|
15
|
+
end
|
|
16
|
+
describe "movies" do
|
|
17
|
+
it "should return correct payload" do
|
|
18
|
+
payload = TomatoPower::Parser::parse @movies
|
|
19
|
+
payload.first.should be_kind_of(TomatoPower::Movie)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
describe "actors" do
|
|
23
|
+
it "should return correct payload" do
|
|
24
|
+
payload = TomatoPower::Parser::parse @actors
|
|
25
|
+
payload.first.should be_kind_of(TomatoPower::Actor)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
describe "clips" do
|
|
29
|
+
it "should return correct payload" do
|
|
30
|
+
payload = TomatoPower::Parser::parse @clips
|
|
31
|
+
payload.first.should be_kind_of(TomatoPower::Clip)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
describe "reviews" do
|
|
35
|
+
it "should return correct payload" do
|
|
36
|
+
payload = TomatoPower::Parser::parse @reviews
|
|
37
|
+
payload.first.should be_kind_of(TomatoPower::Review)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
describe "alias" do
|
|
41
|
+
it "should return correct payload" do
|
|
42
|
+
payload = TomatoPower::Parser::parse @alias
|
|
43
|
+
payload.first.should be_kind_of(TomatoPower::Movie)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
describe "No results" do
|
|
47
|
+
it "should return payload with no results string" do
|
|
48
|
+
payload = TomatoPower::Parser::parse @no_results
|
|
49
|
+
payload.first.include?("No Results").should be_true
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module TomatoPower
|
|
4
|
+
describe TomatoPower::Review do
|
|
5
|
+
before do
|
|
6
|
+
@review = TomatoPower::Review.new TestHelpers::sample :review
|
|
7
|
+
end
|
|
8
|
+
describe "attributes" do
|
|
9
|
+
it { should respond_to(:critic)}
|
|
10
|
+
it { should respond_to(:date)}
|
|
11
|
+
it { should respond_to(:freshness)}
|
|
12
|
+
it { should respond_to(:publication)}
|
|
13
|
+
it { should respond_to(:quote)}
|
|
14
|
+
it { should respond_to(:links)}
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'tomato_power/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |gem|
|
|
7
|
+
gem.name = "tomato_power"
|
|
8
|
+
gem.version = TomatoPower::VERSION
|
|
9
|
+
gem.authors = ["Sean Kay"]
|
|
10
|
+
gem.email = ["f.sean.kay@gmail.com\n"]
|
|
11
|
+
gem.description = %q{RottenTomatoes API wrapper}
|
|
12
|
+
gem.summary = %q{Easily access Rotten Tomatoes API methods}
|
|
13
|
+
gem.homepage = ""
|
|
14
|
+
|
|
15
|
+
gem.add_dependency "active_support"
|
|
16
|
+
|
|
17
|
+
gem.add_development_dependency "rspec"
|
|
18
|
+
gem.add_development_dependency "pry"
|
|
19
|
+
gem.add_development_dependency "fuubar"
|
|
20
|
+
gem.add_development_dependency "vcr"
|
|
21
|
+
gem.add_development_dependency "webmock"
|
|
22
|
+
gem.add_development_dependency "guard-rspec"
|
|
23
|
+
gem.add_development_dependency "rb-fsevent"
|
|
24
|
+
|
|
25
|
+
gem.files = `git ls-files`.split($/)
|
|
26
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
27
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
28
|
+
gem.require_paths = ["lib"]
|
|
29
|
+
end
|