tmdb-api 0.0.6 → 0.0.7

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/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'tmdb-api'
2
2
  require 'rspec'
3
3
  require 'webmock/rspec'
4
+ require 'pry'
4
5
 
5
6
  # Load all support files
6
7
  Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|r| require r}
@@ -20,4 +20,24 @@ describe TMDb::Changes do
20
20
  expect { TMDb::Changes.movies }.to raise_error ArgumentError
21
21
  end
22
22
  end
23
+
24
+ describe '.people' do
25
+ it 'returns the changed people' do
26
+ stub_get('/person/changes').to_return(json_response('changes/people.json'))
27
+
28
+ changes = TMDb::Changes.people
29
+
30
+ expect(changes.changes).to have(100).items
31
+ expect(changes.total_results).to eql(555)
32
+ expect(changes.total_pages).to eql(6)
33
+ expect(changes.page).to eql(1)
34
+ expect(changes.changes.first).to eql(1303652)
35
+ end
36
+
37
+ it 'raises with a bad request' do
38
+ stub_get('/person/changes').to_return(status: 404)
39
+
40
+ expect { TMDb::Changes.people }.to raise_error ArgumentError
41
+ end
42
+ end
23
43
  end
@@ -11,114 +11,43 @@ describe TMDb::Movie do
11
11
 
12
12
  it 'returns the "adult" attribute' do
13
13
  expect(movie.adult).to eq(false)
14
- end
15
-
16
- it 'returns the "backdrop_path" attribute' do
17
14
  expect(movie.backdrop_path).to eq('/hSaH9tt67bozo9K50sbH0s4YjEc.jpg')
18
- end
19
-
20
- it 'returns the "belongs_to_collection" attribute' do
21
15
  expect(movie.belongs_to_collection).to eq(nil)
22
- end
23
-
24
- it 'returns the "budget" attribute' do
25
16
  expect(movie.budget).to eq(3300000)
26
- end
27
-
28
- it 'returns movie genres as objects' do
29
- expect(movie.genres).to have(4).genres
30
-
31
- first_genre = movie.genres.first
32
- expect(first_genre.id).to eql(28)
33
- expect(first_genre.name).to eql('Action')
34
- end
35
-
36
- it 'returns the "homepage" attribute' do
37
17
  expect(movie.homepage).to eq('http://cidadededeus.globo.com/')
38
- end
39
-
40
- it 'returns the "id" attribute' do
41
18
  expect(movie.id).to eq(598)
42
- end
43
-
44
- it 'returns the "imdb_id" attribute' do
45
19
  expect(movie.imdb_id).to eq('tt0317248')
46
- end
47
-
48
- it 'returns the "original_title" attribute' do
49
20
  expect(movie.original_title).to eq('Cidade de Deus')
50
- end
51
-
52
- it 'returns the "overview" attribute' do
53
21
  expect(movie.overview).to eq(
54
22
  'City of God depicts the raw violence in the ghettos of Rio de Janeiro.'
55
23
  )
56
- end
57
-
58
- it 'returns the "popularity" attribute' do
59
24
  expect(movie.popularity).to eq(1.3497251049225558)
60
- end
61
-
62
- it 'returns the "poster_path" attribute' do
63
25
  expect(movie.poster_path).to eq('/mwDnSQR1CkxuDjSKfgiNT0sIOjM.jpg')
64
- end
65
-
66
- it 'returns movie production companies as objects' do
67
26
  expect(movie.production_companies).to have(7).production_companies
27
+ expect(movie.release_date).to eq('2002-08-31')
28
+ expect(movie.revenue).to eq(27387381)
29
+ expect(movie.runtime).to eq(130)
30
+ expect(movie.spoken_languages).to have(1).spoken_languages
31
+ expect(movie.status).to eq('Released')
32
+ expect(movie.tagline).to eq('If you run you\'re dead...if you stay, you\'re dead again. Period.')
33
+ expect(movie.title).to eq('City of God')
34
+ expect(movie.vote_average).to eq(8.2)
35
+ expect(movie.vote_count).to eq(52)
68
36
 
69
37
  first_company = movie.production_companies.first
70
38
  expect(first_company.id).to eql(345)
71
39
  expect(first_company.name).to eql('O2 Filmes')
72
- end
73
-
74
- it 'returns movie production countries as objects' do
75
40
  expect(movie.production_countries).to have(2).production_countries
76
41
 
77
42
  first_country = movie.production_countries.first
78
43
  expect(first_country.iso_3166_1).to eql('BR')
79
44
  expect(first_country.code).to eql('BR')
80
45
  expect(first_country.name).to eql('Brazil')
81
- end
82
-
83
- it 'returns the "release_date" attribute' do
84
- expect(movie.release_date).to eq('2002-08-31')
85
- end
86
-
87
- it 'returns the "revenue" attribute' do
88
- expect(movie.revenue).to eq(27387381)
89
- end
90
-
91
- it 'returns the "runtime" attribute' do
92
- expect(movie.runtime).to eq(130)
93
- end
94
-
95
- it 'returns movie spoken languages as objects' do
96
- expect(movie.spoken_languages).to have(1).spoken_languages
97
46
 
98
- first_country = movie.spoken_languages.first
99
- expect(first_country.iso_639_1).to eql('pt')
100
- expect(first_country.code).to eql('pt')
101
- expect(first_country.name).to eql('Português')
102
- end
103
-
104
- it 'returns the "status" attribute' do
105
- expect(movie.status).to eq('Released')
106
- end
107
-
108
- it 'returns the "tagline" attribute' do
109
- expect(movie.tagline).to eq('If you run you\'re dead...if you stay, you\'re dead again. Period.')
110
- end
111
-
112
- it 'returns the "title" attribute' do
113
- expect(movie.title).to eq('City of God')
114
- end
115
-
116
- it 'returns the "vote_average" attribute' do
117
- expect(movie.vote_average).to eq(8.2)
118
- end
119
-
120
- it 'returns the "vote_count" attribute' do
121
- expect(movie.vote_count).to eq(52)
47
+ first_spoken_language = movie.spoken_languages.first
48
+ expect(first_spoken_language.iso_639_1).to eql('pt')
49
+ expect(first_spoken_language.code).to eql('pt')
50
+ expect(first_spoken_language.name).to eql('Português')
122
51
  end
123
52
 
124
53
  it 'raises with a bad request' do
@@ -8,55 +8,22 @@ describe TMDb::Person do
8
8
 
9
9
  let!(:person) { TMDb::Person.find(1327) }
10
10
 
11
- it 'returns "adult" attribute' do
11
+ it 'returns a TMDb::Person object with the filled attributes' do
12
12
  expect(person.adult).to eq(false)
13
- end
14
-
15
- it 'returns "also_known_as" as array of strings' do
16
13
  expect(person.also_known_as).to match_array([
17
- 'Sir Ian McKellan',
18
- 'Sir Ian McKellen',
19
- 'Ian Murray McKellen'
14
+ 'Sir Ian McKellan',
15
+ 'Sir Ian McKellen',
16
+ 'Ian Murray McKellen'
20
17
  ])
21
- end
22
-
23
- it 'return "biography" attribute' do
24
18
  expect(person.biography).to start_with("Sir Ian Murray McKellen is an English actor.")
25
- end
26
-
27
- it 'returns "birthday" attribute' do
28
- expect(person.birthday).to eq('1939-05-25')
29
- end
30
-
31
- it 'returns "deathday" attribute' do
32
- expect(person.deathday).to eq('')
33
- end
34
-
35
- it 'returns "homepage" attribute' do
19
+ expect(person.birthday).to eq(Date.parse('1939-05-25'))
20
+ expect(person.deathday).to eq(nil)
36
21
  expect(person.homepage).to eq('http://www.mckellen.com/')
37
- end
38
-
39
- it 'returns "id" attribute' do
40
22
  expect(person.id).to eq(1327)
41
- end
42
-
43
- it 'returns "imdb_id" attribute' do
44
23
  expect(person.imdb_id).to eq('nm0005212')
45
- end
46
-
47
- it 'returns "name" attribute' do
48
24
  expect(person.name).to eq('Ian McKellen')
49
- end
50
-
51
- it 'returns "place_of_birth" attribute' do
52
25
  expect(person.place_of_birth).to eq('Burnley, England')
53
- end
54
-
55
- it 'returns "popularity" attribute' do
56
26
  expect(person.popularity).to eq(16.0104684226102)
57
- end
58
-
59
- it 'returns "profile_path" attribute' do
60
27
  expect(person.profile_path).to eq('/c51mP46oPgAgFf7bFWVHlScZynM.jpg')
61
28
  end
62
29
 
@@ -93,9 +60,17 @@ describe TMDb::Person do
93
60
 
94
61
  popular = TMDb::Person.popular
95
62
 
63
+ expect(popular.first.id).to eq(63)
96
64
  expect(popular.first.adult).to eq(false)
97
- expect(popular.first.name).to eq('Daniel Craig')
98
- expect(popular.first.profile_path).to eq('/wWMdqiqW6unT6TnXydQbOtYffeO.jpg')
65
+ expect(popular.first.name).to eq('Milla Jovovich')
66
+ expect(popular.first.popularity).to eq(24.8431766091385)
67
+ expect(popular.first.profile_path).to eq('/mcNgLarIVho7LheWcvd1oQ2tBOg.jpg')
68
+
69
+ known_for = popular.first.known_for.first
70
+ expect(known_for). to be_an_instance_of(TMDb::KnownFor)
71
+ expect(known_for.id).to eq(18)
72
+ expect(known_for.title).to eq('The Fifth Element')
73
+ expect(known_for.media_type).to eq('movie')
99
74
  end
100
75
 
101
76
  it 'raises with a bad request' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmdb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andriel Nuernberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-23 00:00:00.000000000 Z
11
+ date: 2014-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -129,6 +129,7 @@ files:
129
129
  - lib/tmdb-api/genre.rb
130
130
  - lib/tmdb-api/httparty.rb
131
131
  - lib/tmdb-api/inflections.rb
132
+ - lib/tmdb-api/known_for.rb
132
133
  - lib/tmdb-api/movie.rb
133
134
  - lib/tmdb-api/person.rb
134
135
  - lib/tmdb-api/production_company.rb
@@ -137,6 +138,7 @@ files:
137
138
  - lib/tmdb-api/spoken_language.rb
138
139
  - lib/tmdb-api/version.rb
139
140
  - spec/fixtures/changes/movies.json
141
+ - spec/fixtures/changes/people.json
140
142
  - spec/fixtures/movie/alternative_titles.json
141
143
  - spec/fixtures/movie/credits.json
142
144
  - spec/fixtures/movie/find.json
@@ -153,7 +155,7 @@ files:
153
155
  - spec/fixtures/searchable/search_person_by_name.json
154
156
  - spec/spec_helper.rb
155
157
  - spec/support/stubber.rb
156
- - spec/tmdb-api/change_spec.rb
158
+ - spec/tmdb-api/changes_spec.rb
157
159
  - spec/tmdb-api/movie_spec.rb
158
160
  - spec/tmdb-api/person_spec.rb
159
161
  - spec/tmdb-api/searchable_spec.rb
@@ -185,6 +187,7 @@ specification_version: 4
185
187
  summary: The Mobie Database API v3
186
188
  test_files:
187
189
  - spec/fixtures/changes/movies.json
190
+ - spec/fixtures/changes/people.json
188
191
  - spec/fixtures/movie/alternative_titles.json
189
192
  - spec/fixtures/movie/credits.json
190
193
  - spec/fixtures/movie/find.json
@@ -201,7 +204,7 @@ test_files:
201
204
  - spec/fixtures/searchable/search_person_by_name.json
202
205
  - spec/spec_helper.rb
203
206
  - spec/support/stubber.rb
204
- - spec/tmdb-api/change_spec.rb
207
+ - spec/tmdb-api/changes_spec.rb
205
208
  - spec/tmdb-api/movie_spec.rb
206
209
  - spec/tmdb-api/person_spec.rb
207
210
  - spec/tmdb-api/searchable_spec.rb