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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bd9362cdbe5d931bfd354ea7e22fd7c23d5ee68
4
- data.tar.gz: 1c35adffd61d54740fb67258d9eabf3c955d4fff
3
+ metadata.gz: 554560315d6c7db01362225d760136eb419ca619
4
+ data.tar.gz: fc8090b6adf0ebbceaf0089dfd12f5fc98d15e94
5
5
  SHA512:
6
- metadata.gz: d4e8791e638143afc121582290b1c1016f0020333ef74fe07bffbc7479e7ab5755f5a8e9e387a03d006a08e86bcc1572fe8c9bf8b2a8aa309f81c37a666fe095
7
- data.tar.gz: 5d664181bd57667b2ffac0be8c3406b116c2b025c96ff6741f65f4b25720a337945c67c91e99ca37bb24da693aa43ac131866ad6b9f5072df0c6981fad8bc05e
6
+ metadata.gz: d0d176b9b91c5ac0185a8b30b144cf500c3eeb8b4dbb065414550096a88b8735b87daaac61ed82b94d52e862ba610dbf0b3b26c47c7e779c2907834b8b4b9806
7
+ data.tar.gz: ae30817284d34f4d6cdcfc7694e3149074a06ef5187340d80ff6e7e9513adeb8ea90c61db09ad3666712bc2949d3b3d974ffcab9de27f8ca4b77805eaf92ab33
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.5
data/.travis.yml CHANGED
@@ -1,12 +1,6 @@
1
1
  language: ruby
2
2
  script: bundle exec rspec spec
3
3
  rvm:
4
- - 2.1.0
4
+ - 2.1.5
5
5
  - 2.0.0
6
6
  - 1.9.3
7
- notifications:
8
- email: false
9
- campfire:
10
- rooms:
11
- - secure: VkO6I3V//FGfYngmANVEdTGRMeRDPwivLopNZJyeSRHE25XMhDrB0HWZfQF0OI6qtziVjyYOXGF+sPAHfYJcUvCNyw4I+7JA5/veZ/lEgv/6NZq1t8DdPfhoDs+cYhg0DYa1czsVbRDzCtub+nQ8LxewSZGO3zd2W+uVBJ0VPzs=
12
-
data/lib/tmdb-api.rb CHANGED
@@ -14,6 +14,7 @@ require 'tmdb-api/production_country'
14
14
  require 'tmdb-api/spoken_language'
15
15
  require 'tmdb-api/changes'
16
16
  require 'tmdb-api/person'
17
+ require 'tmdb-api/known_for'
17
18
 
18
19
  require 'tmdb-api/version'
19
20
 
@@ -22,6 +22,23 @@ module TMDb
22
22
  res.success? ? Changes.new(res) : bad_response(res)
23
23
  end
24
24
 
25
+ # Public: Get a list of people ids that have been edited. The rules of movie
26
+ # changes are also valid here.
27
+ #
28
+ # options - The hash options used to filter the search (default: {}).
29
+ # :page - Page. Minimum 1, maximum 1000.
30
+ # :start_date - Start date (YYYY-MM-DD).
31
+ # :end_date - End date (YYYY-MM-DD).
32
+ #
33
+ # Examples
34
+ #
35
+ # TMDb::Changes.people
36
+ # TMDb::Changes.people(page: 3, start_date: '2013-03-23')
37
+ def self.people(options = {})
38
+ res = get('/person/changes', query: options)
39
+ res.success? ? Changes.new(res) : bad_response(res)
40
+ end
41
+
25
42
  private
26
43
 
27
44
  # Internal: sets the fetched result to the instance variables.
@@ -1,9 +1,5 @@
1
1
  module TMDb
2
2
  class Genre < Base
3
-
4
- # Genre attributes
5
- ATTRIBUTES = :id, :name
6
-
7
- attr_reader *ATTRIBUTES
3
+ attr_reader :id, :name
8
4
  end
9
5
  end
@@ -1,3 +1,3 @@
1
1
  ActiveSupport::Inflector.inflections do |inflect|
2
- inflect.uncountable %w( also_known_as )
2
+ inflect.uncountable %w(also_known_as)
3
3
  end
@@ -0,0 +1,5 @@
1
+ module TMDb
2
+ class KnownFor < Base
3
+ attr_reader :title, :id, :media_type
4
+ end
5
+ end
@@ -2,12 +2,11 @@ module TMDb
2
2
  class Movie < Base
3
3
  extend Searchable
4
4
 
5
- # Movie attributes
6
5
  ATTRIBUTES = :id, :adult, :backdrop_path, :belongs_to_collection, :budget,
7
- :genres, :homepage, :imdb_id, :original_title, :overview,
8
- :popularity, :poster_path, :production_companies, :runtime,
9
- :production_countries, :release_date, :revenue, :spoken_languages,
10
- :status, :tagline, :title, :vote_average, :vote_count
6
+ :genres, :homepage, :imdb_id, :original_title, :overview, :popularity,
7
+ :poster_path, :production_companies, :runtime, :production_countries,
8
+ :release_date, :revenue, :spoken_languages, :status, :tagline, :title,
9
+ :vote_average, :vote_count
11
10
 
12
11
  attr_reader *ATTRIBUTES
13
12
 
@@ -20,8 +19,8 @@ module TMDb
20
19
  #
21
20
  # Examples
22
21
  #
23
- # TMDb::Movie.find(68721)
24
- # TMDb::Movie.find(68721, language: 'pt')
22
+ # TMDb::Movie.find(68721)
23
+ # TMDb::Movie.find(68721, language: 'pt')
25
24
  def self.find(id, options = {})
26
25
  res = get("/movie/#{id}", query: options)
27
26
  res.success? ? Movie.new(res) : bad_response(res)
@@ -34,7 +33,7 @@ module TMDb
34
33
  #
35
34
  # Examples
36
35
  #
37
- # TMDb::Movie.alternative_titles(68721, country: 'br')
36
+ # TMDb::Movie.alternative_titles(68721, country: 'br')
38
37
  def self.alternative_titles(id, options = {})
39
38
  res = get("/movie/#{id}/alternative_titles", query: options)
40
39
  res.success? ? res['titles'] : bad_response(res)
@@ -47,7 +46,7 @@ module TMDb
47
46
  #
48
47
  # Examples
49
48
  #
50
- # TMDb::Movie.cast(68721, language: pt)
49
+ # TMDb::Movie.cast(68721, language: pt)
51
50
  def self.cast(id, options = {})
52
51
  res = get("/movie/#{id}/credits", query: options)
53
52
  res.success? ? res['cast'] : bad_response(res)
@@ -60,8 +59,7 @@ module TMDb
60
59
  #
61
60
  # Examples
62
61
  #
63
- # TMDb::Movie.crew(68721, language: pt)
64
-
62
+ # TMDb::Movie.crew(68721, language: pt)
65
63
  def self.crew(id, options = {})
66
64
  res = get("/movie/#{id}/credits", query: options)
67
65
  res.success? ? res['crew'] : bad_response(res)
@@ -74,9 +72,8 @@ module TMDb
74
72
  #
75
73
  # Examples
76
74
  #
77
- # TMDb::Movie.find(68721).images
78
- # TMDb::Movie.images(68721, language: 'pt')
79
-
75
+ # TMDb::Movie.find(68721).images
76
+ # TMDb::Movie.images(68721, language: 'pt')
80
77
  def self.images(id, options = {})
81
78
  res = get("/movie/#{id}/images", query: options)
82
79
  res.success? ? res : bad_response(res)
@@ -89,7 +86,7 @@ module TMDb
89
86
  #
90
87
  # Examples
91
88
  #
92
- # TMDb::Movie.keywords(68721, language: pt)
89
+ # TMDb::Movie.keywords(68721, language: pt)
93
90
  def self.keywords(id, options = {})
94
91
  res = get("/movie/#{id}/keywords", query: options)
95
92
  res.success? ? res['keywords'] : bad_response(res)
@@ -102,7 +99,7 @@ module TMDb
102
99
  #
103
100
  # Examples
104
101
  #
105
- # TMDb::Movie.trailers(68721, language: pt)
102
+ # TMDb::Movie.trailers(68721, language: pt)
106
103
  def self.trailers(id, options = {})
107
104
  res = get("/movie/#{id}/trailers", query: options)
108
105
  res.success? ? res : bad_response(res)
@@ -112,7 +109,7 @@ module TMDb
112
109
  #
113
110
  # Examples
114
111
  #
115
- # TMDb::Movie.releases(68721)
112
+ # TMDb::Movie.releases(68721)
116
113
  def self.releases(id)
117
114
  res = get("/movie/#{id}/releases")
118
115
  res.success? ? res['countries'] : bad_response(res)
@@ -127,8 +124,8 @@ module TMDb
127
124
  #
128
125
  # Examples
129
126
  #
130
- # TMDb::Movie.upcoming
131
- # TMDb::Movie.upcoming(page: 3, language: 'pt')
127
+ # TMDb::Movie.upcoming
128
+ # TMDb::Movie.upcoming(page: 3, language: 'pt')
132
129
  def self.upcoming(options = {})
133
130
  res = get('/movie/upcoming', query: options)
134
131
 
@@ -2,9 +2,8 @@ module TMDb
2
2
  class Person < Base
3
3
  extend Searchable
4
4
 
5
- # Person attributes
6
- ATTRIBUTES = :id, :adult, :also_known_as, :biography, :birthday, :deathday,
7
- :homepage, :name, :place_of_birth, :profile_path, :popularity, :imdb_id
5
+ ATTRIBUTES = :id, :adult, :also_known_as, :biography, :homepage, :name,
6
+ :place_of_birth, :profile_path, :popularity, :imdb_id, :known_for
8
7
 
9
8
  attr_reader *ATTRIBUTES
10
9
 
@@ -16,7 +15,7 @@ module TMDb
16
15
  #
17
16
  # Examples
18
17
  #
19
- # TMDb::Person.find(138)
18
+ # TMDb::Person.find(138)
20
19
  def self.find(id, options = {})
21
20
  res = get("/person/#{id}", query: options)
22
21
  res.success? ? Person.new(res) : bad_response(res)
@@ -28,7 +27,7 @@ module TMDb
28
27
  #
29
28
  # Examples
30
29
  #
31
- # TMDb::Person.images(138)
30
+ # TMDb::Person.images(138)
32
31
  def self.images(id)
33
32
  res = get("/person/#{id}/images")
34
33
  res.success? ? res : bad_response(res)
@@ -41,8 +40,8 @@ module TMDb
41
40
  #
42
41
  # Examples
43
42
  #
44
- # TMDb::Person.popular
45
- # TMDb::Person.popular(page: 4)
43
+ # TMDb::Person.popular
44
+ # TMDb::Person.popular(page: 4)
46
45
  def self.popular(options = {})
47
46
  res = get('/person/popular', query: options)
48
47
 
@@ -52,5 +51,15 @@ module TMDb
52
51
  bad_response(res)
53
52
  end
54
53
  end
54
+
55
+ # Public: return the parsed birthday.
56
+ def birthday
57
+ Date.parse(@birthday) rescue nil
58
+ end
59
+
60
+ # Public: return the parsed deathday.
61
+ def deathday
62
+ Date.parse(@deathday) rescue nil
63
+ end
55
64
  end
56
65
  end
@@ -1,9 +1,5 @@
1
1
  module TMDb
2
2
  class ProductionCompany < Base
3
-
4
- # Genre attributes
5
- ATTRIBUTES = :id, :name
6
-
7
- attr_reader *ATTRIBUTES
3
+ attr_reader :id, :name
8
4
  end
9
5
  end
@@ -1,10 +1,6 @@
1
1
  module TMDb
2
2
  class ProductionCountry < Base
3
-
4
- # Genre attributes
5
- ATTRIBUTES = :iso_3166_1, :name
6
-
7
- attr_reader *ATTRIBUTES
3
+ attr_reader :iso_3166_1, :name
8
4
 
9
5
  # Public: alias for the iso_3166_1 attribute.
10
6
  def code
@@ -13,13 +13,13 @@ module TMDb
13
13
  # Examples
14
14
  #
15
15
  ## For a movie
16
- # TMDb::Movie.search('Iron Man')
17
- # TMDb::Movie.search('The Matrix', year: 1999)
18
- # TMDb::Movie.search('Forret Gump', language: 'pt', year: 1994)
16
+ # TMDb::Movie.search('Iron Man')
17
+ # TMDb::Movie.search('The Matrix', year: 1999)
18
+ # TMDb::Movie.search('Forret Gump', language: 'pt', year: 1994)
19
19
  #
20
20
  ## For a person
21
- # TMDb::Person.search('Peter Jackson')
22
- # TMDb::Person.search('Paul', page: 4)
21
+ # TMDb::Person.search('Peter Jackson')
22
+ # TMDb::Person.search('Paul', page: 4)
23
23
  def search(query, options = {})
24
24
  options.merge!(query: query)
25
25
  res = get("/search/#{resource}", query: options)
@@ -1,10 +1,6 @@
1
1
  module TMDb
2
2
  class SpokenLanguage < Base
3
-
4
- # Spoken language attributes
5
- ATTRIBUTES = :iso_639_1, :name
6
-
7
- attr_reader *ATTRIBUTES
3
+ attr_reader :iso_639_1, :name
8
4
 
9
5
  # Public: alias for the iso_639_1 attribute.
10
6
  def code
@@ -1,3 +1,3 @@
1
1
  module TMDb
2
- VERSION = "0.0.6"
2
+ VERSION = '0.0.7'
3
3
  end
@@ -0,0 +1,407 @@
1
+ {
2
+ "results": [
3
+ {
4
+ "id": 1303652,
5
+ "adult": false
6
+ },
7
+ {
8
+ "id": 1238933,
9
+ "adult": false
10
+ },
11
+ {
12
+ "id": 1303653,
13
+ "adult": false
14
+ },
15
+ {
16
+ "id": 1303654,
17
+ "adult": false
18
+ },
19
+ {
20
+ "id": 1303655,
21
+ "adult": false
22
+ },
23
+ {
24
+ "id": 1303656,
25
+ "adult": false
26
+ },
27
+ {
28
+ "id": 1303657,
29
+ "adult": false
30
+ },
31
+ {
32
+ "id": 1303658,
33
+ "adult": false
34
+ },
35
+ {
36
+ "id": 1303659,
37
+ "adult": false
38
+ },
39
+ {
40
+ "id": 1303660,
41
+ "adult": false
42
+ },
43
+ {
44
+ "id": 1303661,
45
+ "adult": false
46
+ },
47
+ {
48
+ "id": 1303662,
49
+ "adult": false
50
+ },
51
+ {
52
+ "id": 1303663,
53
+ "adult": false
54
+ },
55
+ {
56
+ "id": 1303664,
57
+ "adult": false
58
+ },
59
+ {
60
+ "id": 1303665,
61
+ "adult": false
62
+ },
63
+ {
64
+ "id": 1303666,
65
+ "adult": false
66
+ },
67
+ {
68
+ "id": 1303667,
69
+ "adult": false
70
+ },
71
+ {
72
+ "id": 1303668,
73
+ "adult": false
74
+ },
75
+ {
76
+ "id": 1303669,
77
+ "adult": false
78
+ },
79
+ {
80
+ "id": 1303670,
81
+ "adult": false
82
+ },
83
+ {
84
+ "id": 1303671,
85
+ "adult": false
86
+ },
87
+ {
88
+ "id": 1303672,
89
+ "adult": false
90
+ },
91
+ {
92
+ "id": 1303673,
93
+ "adult": false
94
+ },
95
+ {
96
+ "id": 1303674,
97
+ "adult": false
98
+ },
99
+ {
100
+ "id": 1303675,
101
+ "adult": false
102
+ },
103
+ {
104
+ "id": 1303676,
105
+ "adult": false
106
+ },
107
+ {
108
+ "id": 1303677,
109
+ "adult": false
110
+ },
111
+ {
112
+ "id": 1303678,
113
+ "adult": false
114
+ },
115
+ {
116
+ "id": 1303679,
117
+ "adult": false
118
+ },
119
+ {
120
+ "id": 1303680,
121
+ "adult": false
122
+ },
123
+ {
124
+ "id": 1303681,
125
+ "adult": false
126
+ },
127
+ {
128
+ "id": 1253797,
129
+ "adult": false
130
+ },
131
+ {
132
+ "id": 1303682,
133
+ "adult": false
134
+ },
135
+ {
136
+ "id": 1303683,
137
+ "adult": false
138
+ },
139
+ {
140
+ "id": 1303032,
141
+ "adult": false
142
+ },
143
+ {
144
+ "id": 1303684,
145
+ "adult": false
146
+ },
147
+ {
148
+ "id": 1303685,
149
+ "adult": false
150
+ },
151
+ {
152
+ "id": 1303686,
153
+ "adult": false
154
+ },
155
+ {
156
+ "id": 1303687,
157
+ "adult": false
158
+ },
159
+ {
160
+ "id": 1303688,
161
+ "adult": false
162
+ },
163
+ {
164
+ "id": 1303689,
165
+ "adult": false
166
+ },
167
+ {
168
+ "id": 1303690,
169
+ "adult": false
170
+ },
171
+ {
172
+ "id": 1303691,
173
+ "adult": false
174
+ },
175
+ {
176
+ "id": 1303692,
177
+ "adult": false
178
+ },
179
+ {
180
+ "id": 1303693,
181
+ "adult": false
182
+ },
183
+ {
184
+ "id": 1303694,
185
+ "adult": false
186
+ },
187
+ {
188
+ "id": 560038,
189
+ "adult": false
190
+ },
191
+ {
192
+ "id": 1059577,
193
+ "adult": false
194
+ },
195
+ {
196
+ "id": 1303695,
197
+ "adult": false
198
+ },
199
+ {
200
+ "id": 1303696,
201
+ "adult": false
202
+ },
203
+ {
204
+ "id": 1303697,
205
+ "adult": false
206
+ },
207
+ {
208
+ "id": 1303698,
209
+ "adult": false
210
+ },
211
+ {
212
+ "id": 1303699,
213
+ "adult": false
214
+ },
215
+ {
216
+ "id": 1096643,
217
+ "adult": false
218
+ },
219
+ {
220
+ "id": 1303700,
221
+ "adult": false
222
+ },
223
+ {
224
+ "id": 1303701,
225
+ "adult": false
226
+ },
227
+ {
228
+ "id": 1303702,
229
+ "adult": false
230
+ },
231
+ {
232
+ "id": 1303703,
233
+ "adult": false
234
+ },
235
+ {
236
+ "id": 1303704,
237
+ "adult": false
238
+ },
239
+ {
240
+ "id": 1303705,
241
+ "adult": false
242
+ },
243
+ {
244
+ "id": 1303706,
245
+ "adult": false
246
+ },
247
+ {
248
+ "id": 1303707,
249
+ "adult": false
250
+ },
251
+ {
252
+ "id": 1303708,
253
+ "adult": false
254
+ },
255
+ {
256
+ "id": 1303709,
257
+ "adult": false
258
+ },
259
+ {
260
+ "id": 1303710,
261
+ "adult": false
262
+ },
263
+ {
264
+ "id": 1303711,
265
+ "adult": false
266
+ },
267
+ {
268
+ "id": 1303712,
269
+ "adult": false
270
+ },
271
+ {
272
+ "id": 1303713,
273
+ "adult": false
274
+ },
275
+ {
276
+ "id": 1303714,
277
+ "adult": false
278
+ },
279
+ {
280
+ "id": 1303715,
281
+ "adult": false
282
+ },
283
+ {
284
+ "id": 1303716,
285
+ "adult": false
286
+ },
287
+ {
288
+ "id": 1303717,
289
+ "adult": false
290
+ },
291
+ {
292
+ "id": 1091510,
293
+ "adult": false
294
+ },
295
+ {
296
+ "id": 951286,
297
+ "adult": false
298
+ },
299
+ {
300
+ "id": 1142146,
301
+ "adult": false
302
+ },
303
+ {
304
+ "id": 559065,
305
+ "adult": false
306
+ },
307
+ {
308
+ "id": 1303718,
309
+ "adult": false
310
+ },
311
+ {
312
+ "id": 1303719,
313
+ "adult": false
314
+ },
315
+ {
316
+ "id": 1303720,
317
+ "adult": false
318
+ },
319
+ {
320
+ "id": 1303721,
321
+ "adult": false
322
+ },
323
+ {
324
+ "id": 1303722,
325
+ "adult": false
326
+ },
327
+ {
328
+ "id": 60561,
329
+ "adult": false
330
+ },
331
+ {
332
+ "id": 1303723,
333
+ "adult": false
334
+ },
335
+ {
336
+ "id": 1303724,
337
+ "adult": false
338
+ },
339
+ {
340
+ "id": 1303725,
341
+ "adult": false
342
+ },
343
+ {
344
+ "id": 1303726,
345
+ "adult": false
346
+ },
347
+ {
348
+ "id": 1303727,
349
+ "adult": false
350
+ },
351
+ {
352
+ "id": 1303728,
353
+ "adult": false
354
+ },
355
+ {
356
+ "id": 1303729,
357
+ "adult": false
358
+ },
359
+ {
360
+ "id": 1303730,
361
+ "adult": false
362
+ },
363
+ {
364
+ "id": 1303731,
365
+ "adult": false
366
+ },
367
+ {
368
+ "id": 1303732,
369
+ "adult": false
370
+ },
371
+ {
372
+ "id": 1303733,
373
+ "adult": false
374
+ },
375
+ {
376
+ "id": 1303734,
377
+ "adult": false
378
+ },
379
+ {
380
+ "id": 1303735,
381
+ "adult": false
382
+ },
383
+ {
384
+ "id": 1303736,
385
+ "adult": false
386
+ },
387
+ {
388
+ "id": 1303737,
389
+ "adult": false
390
+ },
391
+ {
392
+ "id": 1303738,
393
+ "adult": false
394
+ },
395
+ {
396
+ "id": 1303739,
397
+ "adult": false
398
+ },
399
+ {
400
+ "id": 1303740,
401
+ "adult": false
402
+ }
403
+ ],
404
+ "page": 1,
405
+ "total_pages": 6,
406
+ "total_results": 555
407
+ }