themoviedb 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ebcb66fb616a6440c71c2bac3aea9c412ebd307b
4
- data.tar.gz: cce60ce5a6e3215ded44f391e4ae3d770b8ac50e
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWNmNWIwNzhmMTE1ZDA5ZDhmMzQxZjEwMWFiZTE5OTg0YTMyNWU0Ng==
5
+ data.tar.gz: !binary |-
6
+ OWU4MmQ4MTIyNGQyODU0ZTgzYTRiZGNiOWQ4Y2Q2ZmM5ZDAxM2E4Nw==
5
7
  SHA512:
6
- metadata.gz: 3c30a1ccbbbc0410c7c374634059ffbd785a736679e9ee260af25312016453803680772760ba3f26119e5dffed148d711d9637937ea88f54fecd6efbfc9ac176
7
- data.tar.gz: 603f5898bee059b0baac20ca61095ec4088f446d49c80b2486af9bd6253bab8767d8c438bac5d3de506a6e68d1adc6116301c3e60fe360cc5566bdb28592bfa9
8
+ metadata.gz: !binary |-
9
+ MDU4OTY0YjVjY2VlZWU1YTMyOTlhMWQ4YjNhY2ZmY2YzODBjNDdjMDU3MGRk
10
+ OTc3NjY3OWE0MmMwNDE5YWQzYWE5OTlkMGFkNzVjYTlkMzliNDE1YTQ4Nzcz
11
+ MmE3ODFiNDQ1NDdiMzZlYThkZGRkNTBlMjI0Njc1M2M2NjMyNTQ=
12
+ data.tar.gz: !binary |-
13
+ YmU4ZTc5NGQ0YWVjNjExZmUyMzY5YzA2NDA1MDU5ZTE2N2JkNjJmZTk1MzBj
14
+ ODY5ODFlOWJkNTA4ZGRiYzY2M2FmMmQ0ZWYxYzRiZDk4MTE3OGM1MzdjYjZm
15
+ MGQ5NDczMWJiZjZkYTcwMGViNzhiYWNlZWQ3N2UwOWI0ZDA2ZTE=
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'httparty'
3
+ require 'hashugar'
3
4
 
4
5
  ["api", "search", "resource", "configuration"].each do |inc|
5
6
  require File.join(File.dirname(__FILE__), "themoviedb", inc)
@@ -1,4 +1,4 @@
1
- module Tmdb
1
+ module Tmdb
2
2
  class Configuration
3
3
  def initialize()
4
4
  @params = {}
@@ -6,8 +6,8 @@ module Tmdb
6
6
  self
7
7
  end
8
8
 
9
- # To build an image URL, you will need 3 pieces of data.
10
- # The base_url, size and file_path.
9
+ # To build an image URL, you will need 3 pieces of data.
10
+ # The base_url, size and file_path.
11
11
  # Simply combine them all and you will have a fully qualified URL. Here’s an example URL:
12
12
  # http://cf2.imgobject.com/t/p/w500/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg
13
13
  def base_url
@@ -12,13 +12,13 @@ module Tmdb
12
12
  #Get the TV episode cast credits by combination of season and episode number.
13
13
  def self.cast(id, season, episode, conditions={})
14
14
  search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}/credits")
15
- search.fetch_response['cast']
15
+ search.fetch_response.cast
16
16
  end
17
17
 
18
18
  #Get the TV episode crew credits by combination of season and episode number.
19
19
  def self.crew(id, season, episode, conditions={})
20
20
  search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}/credits")
21
- search.fetch_response['crew']
21
+ search.fetch_response.crew
22
22
  end
23
23
 
24
24
  #Get the external ids for a TV episode by comabination of a season and episode number.
@@ -38,7 +38,7 @@ module Tmdb
38
38
  :lists,
39
39
  :changes
40
40
  ]
41
-
41
+
42
42
  @@fields.each do |field|
43
43
  attr_accessor field
44
44
  end
@@ -89,13 +89,13 @@ module Tmdb
89
89
  #Get the cast information for a specific movie id.
90
90
  def self.casts(id, conditions={})
91
91
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/casts")
92
- search.fetch_response['cast']
92
+ search.fetch_response.cast
93
93
  end
94
94
 
95
95
  #Get the cast information for a specific movie id.
96
96
  def self.crew(id, conditions={})
97
97
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/casts")
98
- search.fetch_response['crew']
98
+ search.fetch_response.crew
99
99
  end
100
100
 
101
101
  #Get the images (posters and backdrops) for a specific movie id.
@@ -127,12 +127,12 @@ module Tmdb
127
127
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/translations")
128
128
  search.fetch_response
129
129
  end
130
-
130
+
131
131
  #Get the similar movies for a specific movie id.
132
132
  def self.similar_movies(id, conditions={})
133
133
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/similar_movies")
134
134
  search.filter(conditions)
135
- search.fetch_response['results']
135
+ search.fetch
136
136
  end
137
137
 
138
138
  #Get the lists that the movie belongs to.
@@ -142,9 +142,9 @@ module Tmdb
142
142
  end
143
143
 
144
144
  #Get the changes for a specific movie id.
145
- #Changes are grouped by key, and ordered by date in descending order.
146
- #By default, only the last 24 hours of changes are returned.
147
- #The maximum number of days that can be returned in a single request is 14.
145
+ #Changes are grouped by key, and ordered by date in descending order.
146
+ #By default, only the last 24 hours of changes are returned.
147
+ #The maximum number of days that can be returned in a single request is 14.
148
148
  #The language is present on fields that are translatable.
149
149
  def self.changes(id, conditions={})
150
150
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/changes")
@@ -2,15 +2,15 @@ module Tmdb
2
2
  class Resource
3
3
  @@endpoints = {}
4
4
  @@endpoint_id = {}
5
-
5
+
6
6
  def self.has_resource(singular=nil, opts={})
7
- @@endpoints[self.name.downcase] = {
8
- :singular => singular.nil? ? "#{self.name.downcase}" : singular,
7
+ @@endpoints[self.name.downcase] = {
8
+ :singular => singular.nil? ? "#{self.name.downcase}" : singular,
9
9
  :plural => opts[:plural].nil? ? "#{self.name.downcase}s" : opts[:plural]
10
10
  }
11
11
  @@endpoint_id[self.name.downcase] = opts[:id].nil? ? "" : "#{opts[:id]}-"
12
12
  end
13
-
13
+
14
14
  def self.endpoints
15
15
  @@endpoints[self.name.downcase]
16
16
  end
@@ -18,12 +18,12 @@ module Tmdb
18
18
  def self.endpoint_id
19
19
  @@endpoint_id[self.name.downcase]
20
20
  end
21
-
21
+
22
22
  #Get the basic resource information for a specific id.
23
23
  def self.detail(id, conditions={})
24
24
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
25
25
  search.filter(conditions)
26
- self.new(search.fetch_response)
26
+ search.fetch_response
27
27
  end
28
28
 
29
29
  def self.list(conditions={})
@@ -33,7 +33,7 @@ module Tmdb
33
33
  self.new(result)
34
34
  end
35
35
  end
36
-
36
+
37
37
  def self.search(query)
38
38
  search = Tmdb::Search.new
39
39
  search.resource("#{self.endpoints[:singular]}")
@@ -42,7 +42,7 @@ module Tmdb
42
42
  self.new(result)
43
43
  end
44
44
  end
45
-
45
+
46
46
  class << self
47
47
  alias_method :find, :search
48
48
  end
@@ -22,22 +22,23 @@ module Tmdb
22
22
  end
23
23
 
24
24
  def resource(resource)
25
- if resource == 'movie' then
26
- @resource = '/search/movie'
27
- elsif resource == 'collection' then
28
- @resource = '/search/collection'
29
- elsif resource == 'tv' then
30
- @resource = '/search/tv'
31
- elsif resource == 'person' then
32
- @resource = '/search/person'
33
- elsif resource == 'list' then
34
- @resource = '/search/list'
35
- elsif resource == 'company' then
36
- @resource = '/search/company'
37
- elsif resource == 'keyword' then
38
- @resource = '/search/keyword'
39
- elsif resource == 'find'
40
- @resource = '/find'
25
+ @resource = case resource
26
+ when 'movie'
27
+ '/search/movie'
28
+ when 'collection'
29
+ '/search/collection'
30
+ when 'tv'
31
+ '/search/tv'
32
+ when 'person'
33
+ '/search/person'
34
+ when 'list'
35
+ '/search/list'
36
+ when 'company'
37
+ '/search/company'
38
+ when 'keyword'
39
+ '/search/keyword'
40
+ when 'find'
41
+ '/find'
41
42
  end
42
43
  self
43
44
  end
@@ -55,8 +56,8 @@ module Tmdb
55
56
  end
56
57
 
57
58
  #Sends back main data
58
- def fetch()
59
- fetch_response['results']
59
+ def fetch
60
+ fetch_response.results
60
61
  end
61
62
 
62
63
  #Send back whole response
@@ -72,7 +73,7 @@ module Tmdb
72
73
  etag = original_etag.gsub(/"/, '')
73
74
 
74
75
  Api.set_response({'code' => response.code, 'etag' => etag})
75
- response.to_hash
76
+ return response.to_hash.to_hashugar
76
77
  end
77
78
  end
78
79
  end
@@ -12,13 +12,13 @@ module Tmdb
12
12
  #Get the cast credits for a TV season by season number.
13
13
  def self.cast(id, season, conditions={})
14
14
  search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}/credits")
15
- search.fetch_response['cast']
15
+ search.fetch_response.cast
16
16
  end
17
17
 
18
18
  #Get the crew credits for a TV season by season number.
19
19
  def self.crew(id, season, conditions={})
20
20
  search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}/credits")
21
- search.fetch_response['crew']
21
+ search.fetch_response.crew
22
22
  end
23
23
 
24
24
  #Get the external ids that we have stored for a TV season by season number.
@@ -57,13 +57,13 @@ module Tmdb
57
57
  #Get the cast information about a TV series.
58
58
  def self.cast(id, conditions={})
59
59
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/credits")
60
- search.fetch_response['cast']
60
+ search.fetch_response.cast
61
61
  end
62
62
 
63
63
  #Get the crew information about a TV series.
64
64
  def self.crew(id, conditions={})
65
65
  search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/credits")
66
- search.fetch_response['crew']
66
+ search.fetch_response.crew
67
67
  end
68
68
 
69
69
  #Get the external ids that we have stored for a TV series.
@@ -1,3 +1,3 @@
1
1
  module Tmdb
2
- VERSION = "0.0.22"
2
+ VERSION = "0.0.23"
3
3
  end
@@ -47,7 +47,7 @@ describe Tmdb::Company do
47
47
  end
48
48
 
49
49
  it "could have a parent company" do
50
- @company.parent_company["name"].should eq("Sony Pictures Entertainment")
50
+ @company.parent_company.name.should eq("Sony Pictures Entertainment")
51
51
  end
52
52
 
53
53
  end
@@ -65,31 +65,31 @@ describe Tmdb::Company do
65
65
  end
66
66
 
67
67
  it "should have a id" do
68
- @movie["id"].should eq(97020)
68
+ @movie.id.should eq(97020)
69
69
  end
70
70
 
71
71
  it "should have a title" do
72
- @movie["title"].should eq("RoboCop")
72
+ @movie.title.should eq("RoboCop")
73
73
  end
74
74
 
75
75
  it "should have a original title" do
76
- @movie["original_title"].should eq("RoboCop")
76
+ @movie.original_title.should eq("RoboCop")
77
77
  end
78
78
 
79
79
  it "should have a poster" do
80
- @movie["poster_path"].should eq("/xxLhczZMiJt1iRdhfkVkuMu87si.jpg")
80
+ @movie.poster_path.should eq("/xxLhczZMiJt1iRdhfkVkuMu87si.jpg")
81
81
  end
82
82
 
83
83
  it "should have a popularity rating" do
84
- @movie["popularity"].should eq(3.13451193740971)
84
+ @movie.popularity.should eq(3.13451193740971)
85
85
  end
86
86
 
87
87
  it "should show whether it is an adult movie" do
88
- @movie["adult"].should eq(false)
88
+ @movie.adult.should eq(false)
89
89
  end
90
90
 
91
91
  it "should have a release date" do
92
- @movie["release_date"].should eq("2014-02-07")
92
+ @movie.release_date.should eq("2014-02-07")
93
93
  end
94
94
 
95
95
  end
@@ -12,17 +12,17 @@ describe Tmdb::Find do
12
12
  it "should return results for imdb_id" do
13
13
  VCR.use_cassette 'find/search_imdb' do
14
14
  find = @find.imdb_id("tt1375666")
15
- find['movie_results'].should be_true
16
- find['person_results'].should be_true
17
- find['tv_results'].should be_true
15
+ find.movie_results.should be_true
16
+ find.person_results.should be_true
17
+ find.tv_results.should be_true
18
18
  end
19
19
  end
20
20
 
21
21
  it "should return results for tvdb_id" do
22
22
  VCR.use_cassette 'find/search_tvdb' do
23
23
  find = @find.tvdb_id("81189")
24
- find['tv_results'].first['name'].should == 'Breaking Bad'
25
- find['tv_results'].should be_true
24
+ find.tv_results.first.name.should == 'Breaking Bad'
25
+ find.tv_results.should be_true
26
26
  end
27
27
  end
28
28
 
@@ -140,7 +140,7 @@ describe Tmdb::Movie do
140
140
  end
141
141
 
142
142
  it "should return a belongs_to_collection" do
143
- @movie.belongs_to_collection.should == {"id"=>51845, "name"=>"DC Universe Animated Original Movies", "poster_path"=>"/qB1Qe5qIbHvr3NsH9xKwCi6WHMn.jpg", "backdrop_path"=>"/3DMJMsy8Yo1LjgFckXIAnHgLo9O.jpg"}
143
+ @movie.belongs_to_collection.name.should == "DC Universe Animated Original Movies"
144
144
  end
145
145
 
146
146
  it "should return a budget" do
@@ -148,7 +148,7 @@ describe Tmdb::Movie do
148
148
  end
149
149
 
150
150
  it "should return genres" do
151
- @movie.genres.should == [{"id"=>28, "name"=>"Action"}, {"id"=>12, "name"=>"Adventure"}, {"id"=>16, "name"=>"Animation"}]
151
+ @movie.genres.should_not == []
152
152
  end
153
153
 
154
154
  it "should return homepage" do
@@ -176,11 +176,11 @@ describe Tmdb::Movie do
176
176
  end
177
177
 
178
178
  it "should return production_companies" do
179
- @movie.production_companies.should == [{"name"=>"DC Comics", "id"=>429}, {"name"=>"Warner Premiere", "id"=>4811}]
179
+ @movie.production_companies.should_not == []
180
180
  end
181
181
 
182
182
  it "should return production_countries" do
183
- @movie.production_countries.should == [{"iso_3166_1"=>"US", "name"=>"United States of America"}]
183
+ @movie.production_countries.should_not == []
184
184
  end
185
185
 
186
186
  it "should return release_date" do
@@ -196,7 +196,7 @@ describe Tmdb::Movie do
196
196
  end
197
197
 
198
198
  it "should return spoken_languages" do
199
- @movie.spoken_languages.should == [{"iso_639_1"=>"en", "name"=>"English"}]
199
+ @movie.spoken_languages.first.name.should == "English"
200
200
  end
201
201
 
202
202
  it "should return status" do
@@ -222,56 +222,56 @@ describe Tmdb::Movie do
222
222
  end
223
223
 
224
224
  it 'should return alternative_titles' do
225
- @movie.alternative_titles['titles'].size.should == 4
226
- @movie.alternative_titles['titles'].first['title'].should == 'Superman und Batman Public Enemies'
225
+ @movie.alternative_titles.titles.size.should == 4
226
+ @movie.alternative_titles.titles.first.title.should == 'Superman und Batman Public Enemies'
227
227
  end
228
228
 
229
229
  it 'should return credits' do
230
- @movie.credits['cast'].size.should == 20
231
- @movie.credits['cast'].first['id'].should == 34947
232
- @movie.credits['crew'].size.should == 3
233
- @movie.credits['crew'].first['id'].should == 90367
230
+ @movie.credits.cast.size.should == 20
231
+ @movie.credits.cast.first.id.should == 34947
232
+ @movie.credits.crew.size.should == 3
233
+ @movie.credits.crew.first.id.should == 90367
234
234
  end
235
235
 
236
236
  it 'should return images' do
237
- @movie.images['backdrops'].size.should == 6
238
- @movie.images['backdrops'].first['file_path'].should == '/mXuqM7ksHW1AJ30AInwJvJTAwut.jpg'
239
- @movie.images['posters'].size.should == 9
240
- @movie.images['posters'].first['file_path'].should == '/7eaHkUKAzfstt6XQCiXyuKiZUAw.jpg'
237
+ @movie.images.backdrops.size.should == 6
238
+ @movie.images.backdrops.first.file_path.should == '/mXuqM7ksHW1AJ30AInwJvJTAwut.jpg'
239
+ @movie.images.posters.size.should == 9
240
+ @movie.images.posters.first.file_path.should == '/7eaHkUKAzfstt6XQCiXyuKiZUAw.jpg'
241
241
  end
242
242
 
243
243
  it 'should return keywords' do
244
- @movie.keywords['keywords'].size.should == 2
245
- @movie.keywords['keywords'].first['id'].should == 9715
244
+ @movie.keywords.keywords.size.should == 2
245
+ @movie.keywords.keywords.first.id.should == 9715
246
246
  end
247
247
 
248
248
  it 'should return releases' do
249
- @movie.releases['countries'].size.should == 1
250
- @movie.releases['countries'].first['release_date'].should == '2009-09-29'
249
+ @movie.releases.countries.size.should == 1
250
+ @movie.releases.countries.first.release_date.should == '2009-09-29'
251
251
  end
252
252
 
253
253
  it 'should return trailers' do
254
- @movie.trailers['quicktime'].should == []
255
- @movie.trailers['youtube'].size.should == 1
256
- @movie.trailers['youtube'].first['name'].should == 'Official Preview Trailer'
254
+ @movie.trailers.quicktime.should == []
255
+ @movie.trailers.youtube.size.should == 1
256
+ @movie.trailers.youtube.first.name.should == 'Official Preview Trailer'
257
257
  end
258
258
 
259
259
  it 'should return translations' do
260
- @movie.translations['translations'].size.should == 13
261
- @movie.translations['translations'].first['name'].should == 'English'
260
+ @movie.translations.translations.size.should == 13
261
+ @movie.translations.translations.first.name.should == 'English'
262
262
  end
263
263
 
264
264
  it 'should return reviews' do
265
- @movie.reviews['results'].should == []
265
+ @movie.reviews.results.should == []
266
266
  end
267
267
 
268
268
  it 'should return lists' do
269
- @movie.lists['results'].size.should == 4
270
- @movie.lists['results'].first['id'].should == '51d6b52219c295172912ff1e'
269
+ @movie.lists.results.size.should == 4
270
+ @movie.lists.results.first.id.should == '51d6b52219c295172912ff1e'
271
271
  end
272
272
 
273
273
  it 'should return changes' do
274
- @movie.changes['changes'].should == []
274
+ @movie.changes.changes.should == []
275
275
  end
276
276
  end
277
277
 
@@ -284,11 +284,11 @@ describe Tmdb::Movie do
284
284
  end
285
285
 
286
286
  it "should return backdrops" do
287
- @movie['backdrops'].length == 4
287
+ @movie.backdrops.length == 4
288
288
  end
289
289
 
290
290
  it "should return posters" do
291
- @movie['posters'].should be_true
291
+ @movie.posters.should be_true
292
292
  end
293
293
 
294
294
  end
@@ -308,7 +308,7 @@ describe Tmdb::Movie do
308
308
  end
309
309
 
310
310
  it "should return the german description" do
311
- @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ß."
311
+ @movie.overview.should == "Eigentlich möchte der New Yorker Polizist John McClane dieses Weihnachten nur seine Noch-Ehefrau Holly, welche in Los Angeles in einer großen, erfolgreichen Firma Karriere gemacht hat, besuchen und das Fest mit den beiden gemeinsamen Kinder verbringen. Als die Feierlichkeiten im Nakatomi Plaza beginnen sollen, stürmt eine Gruppe von Terroristen das Hochhaus und nur John McClane schafft es ihnen zu entwischen. Lediglich bewaffnet mit ein paar Zigaretten und einem Walkie-Talkie, wodurch er den Funk der Geiselnehmer mithören kann, und mit Waffen, welche die Terroristen gelegentlich so rumliegen lassen, muss John nun nicht nur sein eigenes Leben retten, sondern möglichst auch das aller anderen Beteiligten. Und so beschließt er, die äußerst brutale Truppe auszumerzen und sich einen Terroristen nach dem anderen vorzuknöpfen. Während draußen dann schon die Polizei und das FBI stümperhaft versucht, das Gebäude zu stürmen, kämpft McClane ohne Schuhe gegen die 12 Aggressoren..."
312
312
  end
313
313
 
314
314
  end
@@ -101,33 +101,33 @@ describe Tmdb::Person do
101
101
  end
102
102
 
103
103
  it 'should return movie credits' do
104
- @person.movie_credits['cast'].size.should == 47
105
- @person.movie_credits['cast'].first['id'].should == 388
106
- @person.movie_credits['crew'].size.should == 4
107
- @person.movie_credits['crew'].first['id'].should == 13435
104
+ @person.movie_credits.cast.size.should == 47
105
+ @person.movie_credits.cast.first.id.should == 388
106
+ @person.movie_credits.crew.size.should == 4
107
+ @person.movie_credits.crew.first.id.should == 13435
108
108
  end
109
109
 
110
110
  it 'should return tv credits' do
111
- @person.tv_credits['cast'].size.should == 17
112
- @person.tv_credits['cast'].first['id'].should == 1709
113
- @person.tv_credits['crew'].size.should == 3
114
- @person.tv_credits['crew'].first['id'].should == 18881
111
+ @person.tv_credits.cast.size.should == 17
112
+ @person.tv_credits.cast.first.id.should == 1709
113
+ @person.tv_credits.crew.size.should == 3
114
+ @person.tv_credits.crew.first.id.should == 18881
115
115
  end
116
116
 
117
117
  it 'should return combined credits' do
118
- @person.combined_credits['cast'].size.should == 64
119
- @person.combined_credits['cast'].first['id'].should == 388
120
- @person.combined_credits['crew'].size.should == 7
121
- @person.combined_credits['crew'].first['id'].should == 13435
118
+ @person.combined_credits.cast.size.should == 64
119
+ @person.combined_credits.cast.first.id.should == 388
120
+ @person.combined_credits.crew.size.should == 7
121
+ @person.combined_credits.crew.first.id.should == 13435
122
122
  end
123
123
 
124
124
  it 'should return images' do
125
- @person.images['profiles'].size.should == 6
126
- @person.images['profiles'].first['file_path'].should == '/khMf8LLTtppUwuZqqnigD2nAy26.jpg'
125
+ @person.images.profiles.size.should == 6
126
+ @person.images.profiles.first.file_path.should == '/khMf8LLTtppUwuZqqnigD2nAy26.jpg'
127
127
  end
128
128
 
129
129
  it 'should return changes' do
130
- @person.changes['changes'].should == []
130
+ @person.changes.changes.should == []
131
131
  end
132
132
  end
133
133
 
@@ -139,7 +139,7 @@ describe Tmdb::Person do
139
139
  end
140
140
 
141
141
  it "should return profiles" do
142
- @person_images['profiles'].length == 6
142
+ @person_images.profiles.length == 6
143
143
  end
144
144
  end
145
145
  end
@@ -44,11 +44,11 @@ describe Tmdb::TV do
44
44
  end
45
45
 
46
46
  it "should return backdrops for chuck" do
47
- @tv['backdrops'].length.should >= 1
47
+ @tv.backdrops.length.should >= 1
48
48
  end
49
49
 
50
50
  it "should return posters for chuck" do
51
- @tv['posters'].length.should >= 1
51
+ @tv.posters.length.should >= 1
52
52
  end
53
53
  end
54
54
 
@@ -69,7 +69,7 @@ describe Tmdb::TV do
69
69
  end
70
70
 
71
71
  it "should return a created date" do
72
- @tv.created_by.should == [{"id"=>66633, "name"=>"Vince Gilligan", "profile_path"=>"/wSTvJGz7QbJf1HK2Mv1Cev6W9TV.jpg"}]
72
+ @tv.created_by.first.name.should == "Vince Gilligan"
73
73
  end
74
74
 
75
75
  it "should return a run time" do
@@ -77,7 +77,7 @@ describe Tmdb::TV do
77
77
  end
78
78
 
79
79
  it "should return genres" do
80
- @tv.genres.should == [{"id"=>18, "name"=>"Drama"}]
80
+ @tv.genres.should_not == []
81
81
  end
82
82
 
83
83
  it "should return a first air date" do
@@ -105,7 +105,8 @@ describe Tmdb::TV do
105
105
  end
106
106
 
107
107
  it "should return a network" do
108
- @tv.networks.should == [{"id"=>174, "name"=>"AMC"}]
108
+ @tv.networks.first.id.should == 174
109
+ @tv.networks.first.name == "AMC"
109
110
  end
110
111
 
111
112
  it "should return the number of episodes" do
@@ -137,7 +138,7 @@ describe Tmdb::TV do
137
138
  end
138
139
 
139
140
  it "should return seasons" do
140
- @tv.seasons.should == [{"air_date"=>"2009-02-17", "poster_path"=>"/AngNuUbXSciwLnUXtdOBHqphxNr.jpg", "season_number"=>0}, {"air_date"=>"2008-01-20", "poster_path"=>"/dHCYpEoHEjAV6Xt3eyNthkdLRl3.jpg", "season_number"=>1}, {"air_date"=>"2009-03-08", "poster_path"=>"/rCdISteF1GPvPsy0a5L0LDffjtP.jpg", "season_number"=>2}, {"air_date"=>"2010-03-21", "poster_path"=>"/vxoZzDLMwxpuR5i5z4qSIU4LShE.jpg", "season_number"=>3}, {"air_date"=>"2011-07-17", "poster_path"=>"/y4UJMKqfgDHLKDTp5uOe9oZWYnr.jpg", "season_number"=>4}, {"air_date"=>"2012-07-15", "poster_path"=>"/ih1JKNxEzW56azeFpEQmdu4poA4.jpg", "season_number"=>5}]
141
+ @tv.seasons.should_not == []
141
142
  end
142
143
 
143
144
  it "should return a status" do
@@ -164,14 +165,14 @@ describe Tmdb::TV do
164
165
  end
165
166
 
166
167
  it 'should return credits' do
167
- @tv.credits['cast'].size.should == 7
168
- @tv.credits['cast'].first['id'].should == 17419
169
- @tv.credits['crew'].size.should == 4
170
- @tv.credits['crew'].first['id'].should == 5162
168
+ @tv.credits.cast.size.should == 7
169
+ @tv.credits.cast.first.id.should == 17419
170
+ @tv.credits.crew.size.should == 4
171
+ @tv.credits.crew.first.id.should == 5162
171
172
  end
172
173
 
173
174
  it 'should return external_ids' do
174
- @tv.external_ids['imdb_id'].should == 'tt0903747'
175
+ @tv.external_ids.imdb_id.should == 'tt0903747'
175
176
  end
176
177
  end
177
178
 
@@ -188,39 +189,39 @@ describe Tmdb::TV do
188
189
  end
189
190
 
190
191
  it "each show should return an id" do
191
- @tv.first["id"].should == 57243
192
+ @tv.first.id.should == 57243
192
193
  end
193
194
 
194
195
  it "each show should return an name" do
195
- @tv.first["name"].should == "Doctor Who"
196
+ @tv.first.name.should == "Doctor Who"
196
197
  end
197
198
 
198
199
  it "each show should return an original name" do
199
- @tv.first["original_name"].should == "Doctor Who"
200
+ @tv.first.original_name.should == "Doctor Who"
200
201
  end
201
202
 
202
203
  it "each show should return an popularity" do
203
- @tv.first["popularity"].should == 16.5167252220739
204
+ @tv.first.popularity.should == 16.5167252220739
204
205
  end
205
206
 
206
207
  it "each show should return an poster_path" do
207
- @tv.first["poster_path"].should == "/4a94ptIdYz0JwSzo0dCNuPCcfM8.jpg"
208
+ @tv.first.poster_path.should == "/4a94ptIdYz0JwSzo0dCNuPCcfM8.jpg"
208
209
  end
209
210
 
210
211
  it "each show should return an vote_average" do
211
- @tv.first["vote_average"].should == 7.875
212
+ @tv.first.vote_average.should == 7.875
212
213
  end
213
214
 
214
215
  it "each show should return an vote_count" do
215
- @tv.first["vote_count"].should == 4
216
+ @tv.first.vote_count.should == 4
216
217
  end
217
218
 
218
219
  it "each show should return an backdrop" do
219
- @tv.first["backdrop_path"].should == nil
220
+ @tv.first.backdrop_path.should == nil
220
221
  end
221
222
 
222
223
  it "each show should return an first air date" do
223
- @tv.first["first_air_date"].should == "2005-03-26"
224
+ @tv.first.first_air_date.should == "2005-03-26"
224
225
  end
225
226
 
226
227
  end
@@ -238,39 +239,39 @@ describe Tmdb::TV do
238
239
  end
239
240
 
240
241
  it "each show should return an id" do
241
- @tv.first["id"].should == 1104
242
+ @tv.first.id.should == 1104
242
243
  end
243
244
 
244
245
  it "each show should return an name" do
245
- @tv.first["name"].should == "Mad Men"
246
+ @tv.first.name.should == "Mad Men"
246
247
  end
247
248
 
248
249
  it "each show should return an original name" do
249
- @tv.first["original_name"].should == "Mad Men"
250
+ @tv.first.original_name.should == "Mad Men"
250
251
  end
251
252
 
252
253
  it "each show should return an popularity" do
253
- @tv.first["popularity"].should == 2.15615937122719
254
+ @tv.first.popularity.should == 2.15615937122719
254
255
  end
255
256
 
256
257
  it "each show should return an poster_path" do
257
- @tv.first["poster_path"].should == "/xA2nHrx2oHGPnL4ehBwPxD0ABvb.jpg"
258
+ @tv.first.poster_path.should == "/xA2nHrx2oHGPnL4ehBwPxD0ABvb.jpg"
258
259
  end
259
260
 
260
261
  it "each show should return an vote_average" do
261
- @tv.first["vote_average"].should == 9.66666666666667
262
+ @tv.first.vote_average.should == 9.66666666666667
262
263
  end
263
264
 
264
265
  it "each show should return an vote_count" do
265
- @tv.first["vote_count"].should == 3
266
+ @tv.first.vote_count.should == 3
266
267
  end
267
268
 
268
269
  it "each show should return an backdrop" do
269
- @tv.first["backdrop_path"].should == "/yGW0NX3I8GXPlWPdoWWyaH0AsCk.jpg"
270
+ @tv.first.backdrop_path.should == "/yGW0NX3I8GXPlWPdoWWyaH0AsCk.jpg"
270
271
  end
271
272
 
272
273
  it "each show should return an first air date" do
273
- @tv.first["first_air_date"].should == "2007-07-19"
274
+ @tv.first.first_air_date.should == "2007-07-19"
274
275
  end
275
276
 
276
277
  end
@@ -281,36 +282,36 @@ describe Tmdb::TV do
281
282
 
282
283
  before(:each) do
283
284
  VCR.use_cassette 'tv/images' do
284
- @backdrop = Tmdb::TV.images(1396)['backdrops'].first
285
+ @backdrop = Tmdb::TV.images(1396).backdrops.first
285
286
  end
286
287
  end
287
288
 
288
289
  it "should return a aspect ratio" do
289
- @backdrop["aspect_ratio"].should == 1.78
290
+ @backdrop.aspect_ratio.should == 1.78
290
291
  end
291
292
 
292
293
  it "should return a file path" do
293
- @backdrop["file_path"].should == "/dRaV8HGx7Z9xmw77qSs8prp5OuI.jpg"
294
+ @backdrop.file_path.should == "/dRaV8HGx7Z9xmw77qSs8prp5OuI.jpg"
294
295
  end
295
296
 
296
297
  it "should return a height" do
297
- @backdrop["height"].should == 720
298
+ @backdrop.height.should == 720
298
299
  end
299
300
 
300
301
  it "should return a iso code" do
301
- @backdrop["iso_639_1"].should == nil
302
+ @backdrop.iso_639_1.should == nil
302
303
  end
303
304
 
304
305
  it "should return a vote average" do
305
- @backdrop["vote_average"].should == 0.0
306
+ @backdrop.vote_average.should == 0.0
306
307
  end
307
308
 
308
309
  it "should return a vote count" do
309
- @backdrop["vote_count"].should == 0.0
310
+ @backdrop.vote_count.should == 0.0
310
311
  end
311
312
 
312
313
  it "should return a width" do
313
- @backdrop["width"].should == 1280
314
+ @backdrop.width.should == 1280
314
315
  end
315
316
 
316
317
  end
@@ -319,36 +320,36 @@ describe Tmdb::TV do
319
320
 
320
321
  before(:each) do
321
322
  VCR.use_cassette 'tv/images' do
322
- @poster = Tmdb::TV.images(1396)['posters'].first
323
+ @poster = Tmdb::TV.images(1396).posters.first
323
324
  end
324
325
  end
325
326
 
326
327
  it "should return a aspect ratio" do
327
- @poster["aspect_ratio"].should == 1.0
328
+ @poster.aspect_ratio.should == 1.0
328
329
  end
329
330
 
330
331
  it "should return a file path" do
331
- @poster["file_path"].should == "/lVbofIPlw3kYa8FQgHT7GtWMI2Q.jpg"
332
+ @poster.file_path.should == "/lVbofIPlw3kYa8FQgHT7GtWMI2Q.jpg"
332
333
  end
333
334
 
334
335
  it "should return a height" do
335
- @poster["height"].should == 1000
336
+ @poster.height.should == 1000
336
337
  end
337
338
 
338
339
  it "should return a iso code" do
339
- @poster["iso_639_1"].should == "nl"
340
+ @poster.iso_639_1.should == "nl"
340
341
  end
341
342
 
342
343
  it "should return a vote average" do
343
- @poster["vote_average"].should == 5.3125
344
+ @poster.vote_average.should == 5.3125
344
345
  end
345
346
 
346
347
  it "should return a vote count" do
347
- @poster["vote_count"].should == 1
348
+ @poster.vote_count.should == 1
348
349
  end
349
350
 
350
351
  it "should return a width" do
351
- @poster["width"].should == 1000
352
+ @poster.width.should == 1000
352
353
  end
353
354
 
354
355
  end
@@ -364,27 +365,27 @@ describe Tmdb::TV do
364
365
  end
365
366
 
366
367
  it "should return a id" do
367
- @cast['id'].should == 17419
368
+ @cast.id.should == 17419
368
369
  end
369
370
 
370
371
  it "should return a name" do
371
- @cast['name'].should == "Bryan Cranston"
372
+ @cast.name.should == "Bryan Cranston"
372
373
  end
373
374
 
374
375
  it "should return a order" do
375
- @cast['order'].should == 0
376
+ @cast.order.should == 0
376
377
  end
377
378
 
378
379
  it "should return a profile image" do
379
- @cast['profile_path'].should == "/qXWgFCk4OJqmLRUBEj7cbp8dnkx.jpg"
380
+ @cast.profile_path.should == "/qXWgFCk4OJqmLRUBEj7cbp8dnkx.jpg"
380
381
  end
381
382
 
382
383
  it "should return a character name" do
383
- @cast['character'].should == "Walter White"
384
+ @cast.character.should == "Walter White"
384
385
  end
385
386
 
386
387
  it "should return a credit id" do
387
- @cast['credit_id'].should == "52542282760ee313280017f9"
388
+ @cast.credit_id.should == "52542282760ee313280017f9"
388
389
  end
389
390
 
390
391
  end
@@ -398,23 +399,23 @@ describe Tmdb::TV do
398
399
  end
399
400
 
400
401
  it "should return a id" do
401
- @crew['id'].should == 29779
402
+ @crew.id.should == 29779
402
403
  end
403
404
 
404
405
  it "should return a department" do
405
- @crew['department'].should == "Production"
406
+ @crew.department.should == "Production"
406
407
  end
407
408
 
408
409
  it "should return a job" do
409
- @crew['job'].should == "Executive Producer"
410
+ @crew.job.should == "Executive Producer"
410
411
  end
411
412
 
412
413
  it "should return a name" do
413
- @crew['name'].should == "Michelle MacLaren"
414
+ @crew.name.should == "Michelle MacLaren"
414
415
  end
415
416
 
416
417
  it "should return a profile image" do
417
- @crew['profile_path'].should == nil
418
+ @crew.profile_path.should == nil
418
419
  end
419
420
 
420
421
  end
@@ -428,27 +429,27 @@ describe Tmdb::TV do
428
429
  end
429
430
 
430
431
  it "should return a id" do
431
- @external['id'].should == 1396
432
+ @external.id.should == 1396
432
433
  end
433
434
 
434
435
  it "should return a imdb id" do
435
- @external['imdb_id'].should == "tt0903747"
436
+ @external.imdb_id.should == "tt0903747"
436
437
  end
437
438
 
438
439
  it "should return a tvdb id" do
439
- @external['tvdb_id'].should == 81189
440
+ @external.tvdb_id.should == 81189
440
441
  end
441
442
 
442
443
  it "should return a tvrage id" do
443
- @external['tvrage_id'].should == 18164
444
+ @external.tvrage_id.should == 18164
444
445
  end
445
446
 
446
447
  it "should return a freebase id" do
447
- @external['freebase_id'].should == "/en/breaking_bad"
448
+ @external.freebase_id.should == "/en/breaking_bad"
448
449
  end
449
450
 
450
451
  it "should return a freebase mid" do
451
- @external['freebase_mid'].should == "/m/03d34x8"
452
+ @external.freebase_mid.should == "/m/03d34x8"
452
453
  end
453
454
 
454
455
 
@@ -43,6 +43,7 @@ Gem::Specification.new do |s|
43
43
  s.require_paths = ["lib"]
44
44
 
45
45
  s.add_runtime_dependency 'httparty'
46
+ s.add_runtime_dependency 'hashugar'
46
47
 
47
48
  s.add_development_dependency 'vcr'
48
49
  s.add_development_dependency 'rake'
metadata CHANGED
@@ -1,83 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: themoviedb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmet Abdi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashugar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
25
39
  - !ruby/object:Gem::Version
26
40
  version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: vcr
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - '>='
45
+ - - ! '>='
32
46
  - !ruby/object:Gem::Version
33
47
  version: '0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - '>='
52
+ - - ! '>='
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - '>='
59
+ - - ! '>='
46
60
  - !ruby/object:Gem::Version
47
61
  version: '0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - '>='
66
+ - - ! '>='
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rspec
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - '>='
73
+ - - ! '>='
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - '>='
80
+ - - ! '>='
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: webmock
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - '>='
87
+ - - ! '>='
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - '>='
94
+ - - ! '>='
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  description: Provides a simple, easy to use interface for the Movie Database API.
@@ -87,12 +101,13 @@ executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
90
- - themoviedb.gemspec
91
104
  - lib/themoviedb.rb
92
105
  - lib/themoviedb/api.rb
93
106
  - lib/themoviedb/collection.rb
94
107
  - lib/themoviedb/company.rb
95
108
  - lib/themoviedb/configuration.rb
109
+ - lib/themoviedb/episode.rb
110
+ - lib/themoviedb/find.rb
96
111
  - lib/themoviedb/genre.rb
97
112
  - lib/themoviedb/job.rb
98
113
  - lib/themoviedb/movie.rb
@@ -100,15 +115,14 @@ files:
100
115
  - lib/themoviedb/resource.rb
101
116
  - lib/themoviedb/search.rb
102
117
  - lib/themoviedb/season.rb
103
- - lib/themoviedb/episode.rb
104
118
  - lib/themoviedb/tv.rb
105
- - lib/themoviedb/find.rb
106
119
  - lib/themoviedb/version.rb
107
- - spec/movie_spec.rb
108
- - spec/tv_spec.rb
109
120
  - spec/company_spec.rb
110
- - spec/person_spec.rb
111
121
  - spec/find_spec.rb
122
+ - spec/movie_spec.rb
123
+ - spec/person_spec.rb
124
+ - spec/tv_spec.rb
125
+ - themoviedb.gemspec
112
126
  homepage: http://rubygems.org/gems/themoviedb
113
127
  licenses: []
114
128
  metadata: {}
@@ -118,17 +132,17 @@ require_paths:
118
132
  - lib
119
133
  required_ruby_version: !ruby/object:Gem::Requirement
120
134
  requirements:
121
- - - '>='
135
+ - - ! '>='
122
136
  - !ruby/object:Gem::Version
123
137
  version: '0'
124
138
  required_rubygems_version: !ruby/object:Gem::Requirement
125
139
  requirements:
126
- - - '>='
140
+ - - ! '>='
127
141
  - !ruby/object:Gem::Version
128
142
  version: '0'
129
143
  requirements: []
130
144
  rubyforge_project: themoviedb
131
- rubygems_version: 2.1.11
145
+ rubygems_version: 2.2.2
132
146
  signing_key:
133
147
  specification_version: 4
134
148
  summary: A Ruby wrapper for the The Movie Database API.
@@ -138,3 +152,4 @@ test_files:
138
152
  - spec/company_spec.rb
139
153
  - spec/person_spec.rb
140
154
  - spec/find_spec.rb
155
+ has_rdoc: