themoviedb 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/themoviedb.rb CHANGED
@@ -10,5 +10,5 @@ end
10
10
  end
11
11
 
12
12
  module Tmdb
13
- VERSION = "0.0.7"
13
+ VERSION = "0.0.8"
14
14
  end
@@ -6,12 +6,20 @@ module Tmdb
6
6
  headers 'Accept' => 'application/json'
7
7
 
8
8
  def self.config
9
- @@config
9
+ @@config ||= {}
10
10
  end
11
11
 
12
12
  def self.key(api_key)
13
- @@config = { :api_key => api_key }
13
+ self.config[:api_key] = api_key
14
+ end
15
+
16
+ def self.language(lang)
17
+ if (lang.nil?)
18
+ self.config.delete(:language)
19
+ else
20
+ self.config[:language] = lang
21
+ end
14
22
  end
15
23
 
16
24
  end
17
- end
25
+ end
data/spec/movie_spec.rb CHANGED
@@ -1,190 +1,245 @@
1
-
2
1
  require 'rspec'
3
2
  require 'spec_helper'
3
+ require 'vcr'
4
4
 
5
5
  describe Tmdb::Movie do
6
-
6
+
7
7
  @fields = [:id,:adult,:backdrop_path,:belongs_to_collection,
8
- :budget,:genres,:homepage,:imdb_id,:original_title,
9
- :overview,:popularity,:poster_path,:production_companies,
10
- :production_countries,:release_date,:revenue,:runtime,
11
- :spoken_languages,:status,:tagline,:title,:vote_average,
12
- :vote_count]
13
-
8
+ :budget,:genres,:homepage,:imdb_id,:original_title,
9
+ :overview,:popularity,:poster_path,:production_companies,
10
+ :production_countries,:release_date,:revenue,:runtime,
11
+ :spoken_languages,:status,:tagline,:title,:vote_average,
12
+ :vote_count]
13
+
14
14
  @fields.each do |field|
15
- it { should respond_to field }
16
- end
17
-
18
- describe "For a movie" do
19
- before(:each) do
20
- @movie = Tmdb::Movie
21
- end
22
-
23
- it "should return the latest movies" do
24
- @movie.latest.should be_true
25
- end
26
-
27
- it "should return the upcoming movies" do
28
- @movie.upcoming.should be_true
29
- end
30
-
31
- it "should show movies that are now playing" do
32
- @movie.now_playing.should be_true
33
- end
15
+ it { should respond_to field }
16
+ end
17
+
18
+ describe "For a movie" do
19
+ before(:each) do
20
+ @movie = Tmdb::Movie
21
+ end
22
+
23
+ it "should return the latest movies" do
24
+ VCR.use_cassette 'movie/return_latest_movie' do
25
+ @movie.latest.should be_true
26
+ end
27
+ end
28
+
29
+ it "should return the upcoming movies" do
30
+ VCR.use_cassette 'movie/return_upcoming_movie' do
31
+ @movie.upcoming.should be_true
32
+ end
33
+ end
34
+
35
+ it "should show movies that are now playing" do
36
+ VCR.use_cassette 'movie/now_playing' do
37
+ @movie.now_playing.should be_true
38
+ end
39
+ end
34
40
 
35
41
  it "should return popular movies" do
36
- @movie.popular.should be_true
37
- end
38
-
39
- it "should return top rated movies" do
40
- @movie.top_rated.should be_true
41
- end
42
-
43
- it "should return alternative titles for an ID" do
44
- @movie.alternative_titles(5).should be_true
45
- end
46
-
47
- it "should return cast information for an ID" do
48
- @movie.casts(5).should be_true
49
- end
50
-
51
- it "should return crew for an ID" do
52
- @movie.crew(5).should be_true
53
- end
54
- it "should return keywords for an ID" do
55
- @movie.keywords(5).should be_true
56
- end
57
- it "should return releases for an ID" do
58
- @movie.releases(5).should be_true
59
- end
60
-
61
- it "should return trailers for an ID" do
62
- @movie.trailers(5).should be_true
63
- end
64
-
65
- it "should return translations for an ID" do
66
- @movie.translations(5).should be_true
67
- end
68
-
69
- it "should return similar_movies for an ID" do
70
- @movie.similar_movies(5).should be_true
71
- end
72
-
73
- it "should return the list the movie belongs to" do
74
- @movie.lists(5).should be_true
75
- end
76
-
77
- it "should return the changes made" do
78
- @movie.changes(5).should be_true
79
- end
80
- end
42
+ VCR.use_cassette 'movie/popular' do
43
+ @movie.popular.should be_true
44
+ end
45
+ end
46
+
47
+ it "should return top rated movies" do
48
+ VCR.use_cassette 'movie/top_rated' do
49
+ @movie.top_rated.should be_true
50
+ end
51
+ end
52
+
53
+ it "should return alternative titles for an ID" do
54
+ VCR.use_cassette 'movie/alternative_titles_for_id' do
55
+ @movie.alternative_titles(5).should be_true
56
+ end
57
+ end
58
+
59
+ it "should return cast information for an ID" do
60
+ VCR.use_cassette 'movie/cast_information_for_id' do
61
+ @movie.casts(5).should be_true
62
+ end
63
+ end
64
+
65
+ it "should return crew for an ID" do
66
+ VCR.use_cassette 'movie/crew_for_id' do
67
+ @movie.crew(5).should be_true
68
+ end
69
+ end
70
+
71
+ it "should return keywords for an ID" do
72
+ VCR.use_cassette 'movie/keywords_for_id' do
73
+ @movie.keywords(5).should be_true
74
+ end
75
+ end
76
+
77
+ it "should return releases for an ID" do
78
+ VCR.use_cassette 'movie/releases_for_id' do
79
+ @movie.releases(5).should be_true
80
+ end
81
+ end
82
+
83
+ it "should return trailers for an ID" do
84
+ VCR.use_cassette 'movie/trailers_for_id' do
85
+ @movie.trailers(5).should be_true
86
+ end
87
+ end
88
+
89
+ it "should return translations for an ID" do
90
+ VCR.use_cassette 'movie/translations_for_id' do
91
+ @movie.translations(5).should be_true
92
+ end
93
+ end
94
+
95
+ it "should return similar_movies for an ID" do
96
+ VCR.use_cassette 'movie/similar_for_id' do
97
+ @movie.similar_movies(5).should be_true
98
+ end
99
+ end
100
+
101
+ it "should return the list the movie belongs to" do
102
+ VCR.use_cassette 'movie/movie_belongs_for_id' do
103
+ @movie.lists(5).should be_true
104
+ end
105
+ end
106
+
107
+ it "should return the changes made" do
108
+ VCR.use_cassette 'movie/changes_made' do
109
+ @movie.changes(5).should be_true
110
+ end
111
+ end
112
+ end
81
113
 
82
114
  describe "For a movie detail" do
83
115
 
84
- before(:each) do
85
- @movie = Tmdb::Movie.detail(22855)
86
- end
87
-
88
- it "should return a id" do
89
- @movie.id.should == 22855
90
- end
91
-
92
- it "should return a adult" do
93
- @movie.adult.should == false
94
- end
95
-
96
- it "should return a backdrop_path" do
97
- @movie.backdrop_path.should == "/mXuqM7ksHW1AJ30AInwJvJTAwut.jpg"
98
- end
99
-
100
- it "should return a belongs_to_collection" do
101
- @movie.belongs_to_collection.should == {"id"=>51845, "name"=>"DC Universe Animated Original Movies", "poster_path"=>"/qB1Qe5qIbHvr3NsH9xKwCi6WHMn.jpg", "backdrop_path"=>"/3DMJMsy8Yo1LjgFckXIAnHgLo9O.jpg"}
102
- end
103
-
104
- it "should return a budget" do
105
- @movie.budget.should == 0
106
- end
107
-
108
- it "should return genres" do
109
- @movie.genres.should == [{"id"=>28, "name"=>"Action"}, {"id"=>12, "name"=>"Adventure"}, {"id"=>16, "name"=>"Animation"}]
110
- end
111
-
112
- it "should return homepage" do
113
- @movie.homepage.should == "http://www.warnervideo.com/supermanbatmandvd/"
114
- end
115
-
116
- it "should return a imdb_id" do
117
- @movie.imdb_id.should == "tt1398941"
118
- end
119
-
120
- it "should return a original_title" do
121
- @movie.original_title.should == "Superman/Batman: Public Enemies"
122
- end
123
-
124
- it "should return a overview" do
125
- @movie.overview.should == "United States President Lex Luthor uses the oncoming trajectory of a Kryptonite meteor to frame Superman and declare a $1 billion bounty on the heads of the Man of Steel and his ‘partner in crime’, Batman. Heroes and villains alike launch a relentless pursuit of Superman and Batman, who must unite—and recruit help—to try and stave off the action-packed onslaught, stop the meteor Luthors plot."
126
- end
127
-
128
- it "should return popularity" do
129
- @movie.popularity.should == 1.04449268
130
- end
131
-
132
- it "should return poster_path" do
133
- @movie.poster_path.should == "/7eaHkUKAzfstt6XQCiXyuKiZUAw.jpg"
134
- end
135
-
136
- it "should return production_companies" do
137
- @movie.production_companies.should == [{"name"=>"DC Comics", "id"=>429}, {"name"=>"Warner Premiere", "id"=>4811}]
138
- end
139
-
140
- it "should return production_countries" do
141
- @movie.production_countries.should == [{"iso_3166_1"=>"US", "name"=>"United States of America"}]
142
- end
143
-
144
- it "should return release_date" do
145
- @movie.release_date.should == "2009-09-29"
146
- end
147
-
148
- it "should return revenue" do
149
- @movie.revenue.should == 0
150
- end
151
-
152
- it "should return a runtime" do
153
- @movie.runtime.should == 67
154
- end
155
-
156
- it "should return spoken_languages" do
157
- @movie.spoken_languages.should == [{"iso_639_1"=>"en", "name"=>"English"}]
158
- end
159
-
160
- it "should return status" do
161
- @movie.status.should == "Released"
162
- end
163
-
164
- it "should return vote_average" do
165
- @movie.vote_average.should == 7.4
166
- end
167
-
168
- it "should return vote_count" do
169
- @movie.vote_count.should == 11
170
- end
171
- end
172
-
173
- describe "For a movies images" do
174
-
175
- before(:each) do
176
- @movie = Tmdb::Movie.images(22855)
177
- end
178
-
179
- it "should return backdrops" do
180
- @movie['backdrops'].should be_true
181
- end
182
-
183
- it "should return posters" do
184
- @movie['posters'].should be_true
185
- end
186
-
187
- end
188
-
189
-
116
+ before(:each) do
117
+ VCR.use_cassette 'movie/detail' do
118
+ @movie = Tmdb::Movie.detail(22855)
119
+ end
120
+ end
121
+
122
+ it "should return a id" do
123
+ @movie.id.should == 22855
124
+ end
125
+
126
+ it "should return a adult" do
127
+ @movie.adult.should == false
128
+ end
129
+
130
+ it "should return a backdrop_path" do
131
+ @movie.backdrop_path.should == "/mXuqM7ksHW1AJ30AInwJvJTAwut.jpg"
132
+ end
133
+
134
+ it "should return a belongs_to_collection" do
135
+ @movie.belongs_to_collection.should == {"id"=>51845, "name"=>"DC Universe Animated Original Movies", "poster_path"=>"/qB1Qe5qIbHvr3NsH9xKwCi6WHMn.jpg", "backdrop_path"=>"/3DMJMsy8Yo1LjgFckXIAnHgLo9O.jpg"}
136
+ end
137
+
138
+ it "should return a budget" do
139
+ @movie.budget.should == 0
140
+ end
141
+
142
+ it "should return genres" do
143
+ @movie.genres.should == [{"id"=>28, "name"=>"Action"}, {"id"=>12, "name"=>"Adventure"}, {"id"=>16, "name"=>"Animation"}]
144
+ end
145
+
146
+ it "should return homepage" do
147
+ @movie.homepage.should == "http://www.warnervideo.com/supermanbatmandvd/"
148
+ end
149
+
150
+ it "should return a imdb_id" do
151
+ @movie.imdb_id.should == "tt1398941"
152
+ end
153
+
154
+ it "should return a original_title" do
155
+ @movie.original_title.should == "Superman/Batman: Public Enemies"
156
+ end
157
+
158
+ it "should return a overview" do
159
+ @movie.overview.should == "United States President Lex Luthor uses the oncoming trajectory of a Kryptonite meteor to frame Superman and declare a $1 billion bounty on the heads of the Man of Steel and his ‘partner in crime’, Batman. Heroes and villains alike launch a relentless pursuit of Superman and Batman, who must unite—and recruit help—to try and stave off the action-packed onslaught, stop the meteor Luthors plot."
160
+ end
161
+
162
+ it "should return popularity" do
163
+ @movie.popularity.should == 1.15974723131612
164
+ end
165
+
166
+ it "should return poster_path" do
167
+ @movie.poster_path.should == "/7eaHkUKAzfstt6XQCiXyuKiZUAw.jpg"
168
+ end
169
+
170
+ it "should return production_companies" do
171
+ @movie.production_companies.should == [{"name"=>"DC Comics", "id"=>429}, {"name"=>"Warner Premiere", "id"=>4811}]
172
+ end
173
+
174
+ it "should return production_countries" do
175
+ @movie.production_countries.should == [{"iso_3166_1"=>"US", "name"=>"United States of America"}]
176
+ end
177
+
178
+ it "should return release_date" do
179
+ @movie.release_date.should == "2009-09-29"
180
+ end
181
+
182
+ it "should return revenue" do
183
+ @movie.revenue.should == 0
184
+ end
185
+
186
+ it "should return a runtime" do
187
+ @movie.runtime.should == 67
188
+ end
189
+
190
+ it "should return spoken_languages" do
191
+ @movie.spoken_languages.should == [{"iso_639_1"=>"en", "name"=>"English"}]
192
+ end
193
+
194
+ it "should return status" do
195
+ @movie.status.should == "Released"
196
+ end
197
+
198
+ it "should return vote_average" do
199
+ @movie.vote_average.should == 7.4
200
+ end
201
+
202
+ it "should return vote_count" do
203
+ @movie.vote_count.should == 23
204
+ end
205
+ end
206
+
207
+ describe "For a movies images" do
208
+
209
+ before(:each) do
210
+ VCR.use_cassette 'movie/images' do
211
+ @movie = Tmdb::Movie.images(22855)
212
+ end
213
+ end
214
+
215
+ it "should return backdrops" do
216
+ @movie['backdrops'].length == 4
217
+ end
218
+
219
+ it "should return posters" do
220
+ @movie['posters'].should be_true
221
+ end
222
+
223
+ end
224
+
225
+ describe "For other languages" do
226
+
227
+ before(:each) do
228
+ Tmdb::Api.language("de")
229
+ VCR.use_cassette 'movie/language_german' do
230
+ @movie = Tmdb::Movie.detail(562)
231
+ end
232
+ Tmdb::Api.language(nil)
233
+ end
234
+
235
+ it "should return the german name" do
236
+ @movie.title.should == "Stirb Langsam"
237
+ end
238
+
239
+ it "should return the german description" do
240
+ @movie.overview.should == "Eine Gruppe schwerbewaffneter Terroristen stürmt ein Bürohochhaus. Ihr Ziel: 624 Mio. Dollar, die als Wertpapiere in einem computergesicherten Safe lagern. Doch sie haben die Rechnung ohne den New Yorker Cop John McClane gemacht. Erster Teil der „Die Hard“ - Trilogie von 1988, die ein Genre neu belebte und den damals eher unbekannten Bruce Willis zur Action-Ikone aufsteigen ließ."
241
+ end
242
+
243
+ end
244
+
190
245
  end
metadata CHANGED
@@ -1,27 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: themoviedb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Ahmet Abdi
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-07-28 00:00:00.000000000 Z
12
+ date: 2013-09-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: httparty
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  description: Provides a simple, easy to use interface for the Movie Database API.
@@ -45,26 +48,27 @@ files:
45
48
  - spec/movie_spec.rb
46
49
  homepage: http://rubygems.org/gems/themoviedb
47
50
  licenses: []
48
- metadata: {}
49
51
  post_install_message:
50
52
  rdoc_options: []
51
53
  require_paths:
52
54
  - lib
53
55
  required_ruby_version: !ruby/object:Gem::Requirement
56
+ none: false
54
57
  requirements:
55
- - - '>='
58
+ - - ! '>='
56
59
  - !ruby/object:Gem::Version
57
60
  version: '0'
58
61
  required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
59
63
  requirements:
60
- - - '>='
64
+ - - ! '>='
61
65
  - !ruby/object:Gem::Version
62
66
  version: '0'
63
67
  requirements: []
64
68
  rubyforge_project: themoviedb
65
- rubygems_version: 2.0.0.rc.2
69
+ rubygems_version: 1.8.24
66
70
  signing_key:
67
- specification_version: 4
71
+ specification_version: 3
68
72
  summary: A Ruby wrapper for the The Movie Database API.
69
73
  test_files:
70
74
  - spec/movie_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 5132d9504ddeeb045fef1f6a1d71d793f964fc34
4
- data.tar.gz: 52d2f201f5aae4384601c6fded28625e8246b115
5
- SHA512:
6
- metadata.gz: 9580fa9d16a5790df94a9613e4ce44610b047862883ddb2831f90cd2304601350159aeed7281deab6f40a6e291ef081fd5497d7d2b63bcb87135d018ee9d424e
7
- data.tar.gz: cf6b0a5897793c9b6906e878fefcb22c6d91f6671ca61ff8399e2887bd72087188d319b669151de276e0afe23cc3e64e5f7ab6415e05fb15aa42a53a784ff71d