tmdb-api 0.0.7 → 0.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 554560315d6c7db01362225d760136eb419ca619
4
- data.tar.gz: fc8090b6adf0ebbceaf0089dfd12f5fc98d15e94
3
+ metadata.gz: e1bf25e58fd929b4ad9f3cc15035febde45e58bd
4
+ data.tar.gz: 4f23eedc38e13d8cf58611962a66af9f7251fc05
5
5
  SHA512:
6
- metadata.gz: d0d176b9b91c5ac0185a8b30b144cf500c3eeb8b4dbb065414550096a88b8735b87daaac61ed82b94d52e862ba610dbf0b3b26c47c7e779c2907834b8b4b9806
7
- data.tar.gz: ae30817284d34f4d6cdcfc7694e3149074a06ef5187340d80ff6e7e9513adeb8ea90c61db09ad3666712bc2949d3b3d974ffcab9de27f8ca4b77805eaf92ab33
6
+ metadata.gz: 66aaa4a25ffa872c5de47e1e18487754eb4284d3f5c85e45d2a398f06ef2f0f06d14972beafc1d4e483d3a1a4721acab89b0cf38e561c7ae5e5bfec77c4d21f1
7
+ data.tar.gz: 4571d523f0a21bdd7ea97e01a057fd1341d3146bf0d6c9a615962ccbece37d758eb770193a06dfecec63400a3fb3918fb0d3facd74e9eda43dbc6c7c4d8270d0
data/lib/tmdb-api/base.rb CHANGED
@@ -38,7 +38,10 @@ module TMDb
38
38
  # Returns nothing
39
39
  def set_attributes(attributes)
40
40
  attributes.each do |key, value|
41
- value = build_objects(key, value) if candidate_to_object?(value)
41
+ if candidate_to_object?(value)
42
+ next unless TMDb.const_defined?(key.classify)
43
+ value = build_objects(key, value)
44
+ end
42
45
  self.instance_variable_set("@#{key}", value)
43
46
  end
44
47
  end
@@ -49,7 +52,7 @@ module TMDb
49
52
  #
50
53
  # Returns true or false
51
54
  def candidate_to_object?(value)
52
- value.is_a?(Array) && value.all? { |h| h.is_a?(Hash) }
55
+ value.is_a?(Array) && !value.empty? && value.all? { |h| h.is_a?(Hash) }
53
56
  end
54
57
 
55
58
  # Internal: Builds objects for the nested resources from API.
@@ -1,3 +1,3 @@
1
1
  module TMDb
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -1,10 +1,8 @@
1
1
  {
2
2
  "adult": false,
3
- "also_known_as":
4
- [
5
- "Sir Ian McKellan",
6
- "Sir Ian McKellen",
7
- "Ian Murray McKellen"
3
+ "also_known_as": [],
4
+ "oscar_awards": [
5
+ { "movie": "Harry Potter and the Order of the Phoenix" }
8
6
  ],
9
7
  "biography": "Sir Ian Murray McKellen is an English actor. He has received a Tony Award and two Academy Award nominations. His work has spanned genres from Shakespearean and modern theatre to popular fantasy and science fiction. He is known to many for roles such as Gandalf in the Lord of the Rings film trilogy and as Magneto in the X-Men films. In 1988, McKellen came out and announced he was gay. He became a founding member of Stonewall, one of the United Kingdom's most influential LGBT rights groups, of which he remains a prominent spokesman. He was made a Commander of the Order of the British Empire (CBE) in 1979, and knighted in the 1991 New Year Honours for his outstanding work and contributions to theatre. In the 2008 New Year Honours he was made a Companion of Honour (CH) for services to drama and to equality.",
10
8
  "birthday": "1939-05-25",
@@ -7,7 +7,7 @@ describe TMDb::Changes do
7
7
 
8
8
  changes = TMDb::Changes.movies
9
9
 
10
- expect(changes.changes).to have(100).items
10
+ expect(changes.changes.count).to eq(100)
11
11
  expect(changes.total_results).to eql(4645)
12
12
  expect(changes.total_pages).to eql(47)
13
13
  expect(changes.page).to eql(1)
@@ -27,7 +27,7 @@ describe TMDb::Changes do
27
27
 
28
28
  changes = TMDb::Changes.people
29
29
 
30
- expect(changes.changes).to have(100).items
30
+ expect(changes.changes.count).to eq(100)
31
31
  expect(changes.total_results).to eql(555)
32
32
  expect(changes.total_pages).to eql(6)
33
33
  expect(changes.page).to eql(1)
@@ -23,11 +23,11 @@ describe TMDb::Movie do
23
23
  )
24
24
  expect(movie.popularity).to eq(1.3497251049225558)
25
25
  expect(movie.poster_path).to eq('/mwDnSQR1CkxuDjSKfgiNT0sIOjM.jpg')
26
- expect(movie.production_companies).to have(7).production_companies
26
+ expect(movie.production_companies.count).to eq(7)
27
27
  expect(movie.release_date).to eq('2002-08-31')
28
28
  expect(movie.revenue).to eq(27387381)
29
29
  expect(movie.runtime).to eq(130)
30
- expect(movie.spoken_languages).to have(1).spoken_languages
30
+ expect(movie.spoken_languages.count).to eq(1)
31
31
  expect(movie.status).to eq('Released')
32
32
  expect(movie.tagline).to eq('If you run you\'re dead...if you stay, you\'re dead again. Period.')
33
33
  expect(movie.title).to eq('City of God')
@@ -37,7 +37,7 @@ describe TMDb::Movie do
37
37
  first_company = movie.production_companies.first
38
38
  expect(first_company.id).to eql(345)
39
39
  expect(first_company.name).to eql('O2 Filmes')
40
- expect(movie.production_countries).to have(2).production_countries
40
+ expect(movie.production_countries.count).to eq(2)
41
41
 
42
42
  first_country = movie.production_countries.first
43
43
  expect(first_country.iso_3166_1).to eql('BR')
@@ -119,7 +119,7 @@ describe TMDb::Movie do
119
119
 
120
120
  cast = TMDb::Movie.cast(550)
121
121
 
122
- expect(cast).to have(72).items
122
+ expect(cast.count).to eq(72)
123
123
 
124
124
  expect(cast.first).to eq(
125
125
  {
@@ -147,7 +147,7 @@ describe TMDb::Movie do
147
147
 
148
148
  crew = TMDb::Movie.crew(550)
149
149
 
150
- expect(crew).to have(14).items
150
+ expect(crew.count).to eq(14)
151
151
 
152
152
  expect(crew.first).to eq(
153
153
  {
@@ -174,8 +174,8 @@ describe TMDb::Movie do
174
174
 
175
175
  images = TMDb::Movie.images(598)
176
176
 
177
- expect(images['backdrops']).to have(7).items
178
- expect(images['posters']).to have(16).items
177
+ expect(images['backdrops'].count).to eq(7)
178
+ expect(images['posters'].count).to eq(16)
179
179
 
180
180
  expect(images['backdrops'].first).to eq(
181
181
  {
@@ -215,7 +215,7 @@ describe TMDb::Movie do
215
215
 
216
216
  keywords = TMDb::Movie.keywords(598)
217
217
 
218
- expect(keywords).to have(7).items
218
+ expect(keywords.count).to eq(7)
219
219
 
220
220
  expect(keywords).to match_array([
221
221
  {
@@ -285,7 +285,7 @@ describe TMDb::Movie do
285
285
 
286
286
  releases = TMDb::Movie.releases(598)
287
287
 
288
- expect(releases).to have(6).items
288
+ expect(releases.count).to eq(6)
289
289
 
290
290
  expect(releases).to match_array([
291
291
  {
@@ -334,7 +334,7 @@ describe TMDb::Movie do
334
334
 
335
335
  upcoming = TMDb::Movie.upcoming
336
336
 
337
- expect(upcoming).to have(20).movies
337
+ expect(upcoming.count).to eq(20)
338
338
  expect(upcoming.first.id).to eql(68726)
339
339
  expect(upcoming.first.title).to eql('Pacific Rim')
340
340
  end
@@ -10,11 +10,7 @@ describe TMDb::Person do
10
10
 
11
11
  it 'returns a TMDb::Person object with the filled attributes' do
12
12
  expect(person.adult).to eq(false)
13
- expect(person.also_known_as).to match_array([
14
- 'Sir Ian McKellan',
15
- 'Sir Ian McKellen',
16
- 'Ian Murray McKellen'
17
- ])
13
+ expect(person.also_known_as).to match_array([])
18
14
  expect(person.biography).to start_with("Sir Ian Murray McKellen is an English actor.")
19
15
  expect(person.birthday).to eq(Date.parse('1939-05-25'))
20
16
  expect(person.deathday).to eq(nil)
@@ -8,7 +8,7 @@ describe TMDb::Searchable do
8
8
 
9
9
  movies = TMDb::Movie.search("The Lord of the Rings")
10
10
 
11
- expect(movies).to have(7).items
11
+ expect(movies.count).to eq(7)
12
12
 
13
13
  expect(movies.first.adult).to eq(false)
14
14
  expect(movies.first.backdrop_path).to eq("/pIUvQ9Ed35wlWhY2oU6OmwEsmzG.jpg")
@@ -28,7 +28,7 @@ describe TMDb::Searchable do
28
28
 
29
29
  people = TMDb::Person.search('Peter Jackson')
30
30
 
31
- expect(people).to have(3).items
31
+ expect(people.count).to eq(3)
32
32
 
33
33
  expect(people.first.adult).to eq(false)
34
34
  expect(people.first.id).to eq(108)
data/tmdb-api.gemspec CHANGED
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "httparty", "~> 0.13.0"
22
- spec.add_dependency "activesupport", "~> 4.1.0.rc1"
22
+ spec.add_dependency "activesupport", "~> 4.1.8"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.5"
25
25
  spec.add_development_dependency "rake"
26
- spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "rspec", "~> 3.1.0"
27
27
  spec.add_development_dependency "webmock"
28
28
  spec.add_development_dependency "pry"
29
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmdb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andriel Nuernberg
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.1.0.rc1
33
+ version: 4.1.8
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.1.0.rc1
40
+ version: 4.1.8
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 3.1.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 3.1.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement