themoviedb-api 0.7.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b607aa74d50988027e64477938dcf4faf5827b3
4
- data.tar.gz: fb2500c3674056e7d5f62e4ac811fc912f7c027d
3
+ metadata.gz: 714d4a0d7a974bbea80c8e844120283d0499037a
4
+ data.tar.gz: c3f1b84a014d3af1e7e8f006bb9db63cffcc3e08
5
5
  SHA512:
6
- metadata.gz: d88955b7933dd5a4fbafbe0276d7b1bba567a8462066276889c3a61fd8aa63dbda38eb1429aac86b05f2b78ee5d5b49004712d30bea0937d699ebbf02499cb40
7
- data.tar.gz: c63561a02fde71ec1a5301d9f31c58128c6282dd13a39e3bfcd5a5cc1b551812233d386b356d3212c47f7a50af4b31439f6adc94afe6eaf5168394cc2cb940bc
6
+ metadata.gz: 37a7d54453cfe40d375401d03c9235906dd980228baf3ba2ff5f12f59abc4752fa078bd22c607f5a84cd14d3afad0b039cbdcdc0bb572146840485792e0503da
7
+ data.tar.gz: 89837c3a30eab64f0f2404b330e180a2996d8733ea23be22cc29adc85f29c7dd3c038445027ec841322e08aaeef935e7884f8f474795c3760a4855e910ad5d68
data/.travis.yml CHANGED
@@ -2,5 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - "2.2.2"
4
4
  - "2.1.6"
5
- - "2.1.2"
6
5
  script: bundle exec rspec spec
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ ## 1.0.0 (2015-07-17)
2
+
3
+ - Releasing stable version, all tests completed.
4
+ - Documentation completed.
5
+
6
+ ## 0.7.1 (2015-06-26)
7
+
8
+ Bugfixes:
9
+
10
+ - Added themoviedb-api.rb class in order to avoid specifying gem main class manually.
11
+
12
+ ## 0.7.0 (2015-06-3)
13
+
14
+ - First version, stable, but some more tests are required
15
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- themoviedb-api (0.7.1)
4
+ themoviedb-api (1.0.0)
5
5
  activesupport (~> 4.2.2, >= 4.2.2)
6
6
  httparty (~> 0.13.5, >= 0.13.5)
7
7
 
@@ -48,12 +48,12 @@ GEM
48
48
  rspec-core (~> 3.3.0)
49
49
  rspec-expectations (~> 3.3.0)
50
50
  rspec-mocks (~> 3.3.0)
51
- rspec-core (3.3.1)
51
+ rspec-core (3.3.2)
52
52
  rspec-support (~> 3.3.0)
53
- rspec-expectations (3.3.0)
53
+ rspec-expectations (3.3.1)
54
54
  diff-lcs (>= 1.2.0, < 2.0)
55
55
  rspec-support (~> 3.3.0)
56
- rspec-mocks (3.3.1)
56
+ rspec-mocks (3.3.2)
57
57
  diff-lcs (>= 1.2.0, < 2.0)
58
58
  rspec-support (~> 3.3.0)
59
59
  rspec-support (3.3.0)
data/README.md CHANGED
@@ -8,7 +8,900 @@
8
8
  [![Coverage Status](https://coveralls.io/repos/18Months/themoviedb-api/badge.svg)](https://coveralls.io/r/18Months/themoviedb-api)
9
9
  [![security](https://hakiri.io/github/18Months/themoviedb-api/master.svg)](https://hakiri.io/github/18Months/themoviedb-api/master)
10
10
 
11
- Documentation coming soon
11
+ A Ruby wrapper for the [The Movie Database API](http://docs.themoviedb.apiary.io/).
12
+
13
+ Provides a simple and intuitive interface for the Movie Database API making use of OpenStruct.
14
+
15
+ Get your API key [here](https://www.themoviedb.org/account).
16
+
17
+ ## Getting started
18
+
19
+ #### Install inside Rails app
20
+
21
+ Add this line to your application’s Gemfile:
22
+
23
+ ```ruby
24
+ gem 'themoviedb-api'
25
+ ```
26
+ #### Install outside Rails app
27
+
28
+ ```ruby
29
+ gem install themoviedb-api
30
+ ```
31
+
32
+ ## Initial Configuration
33
+
34
+ If you are using this gem in a Rails application you can set the following parameters in an initializer.
35
+
36
+ ```ruby
37
+ Tmdb::Api.key("KEY_HERE")
38
+ ```
39
+
40
+ You can change the language for the returned data with this:
41
+
42
+ ```ruby
43
+ Tmdb::Api.language("en")
44
+ ```
45
+
46
+ The default language is english.
47
+
48
+ You can temporarily override global language for one request by specifying the language as an additional parameter in the method called.
49
+
50
+ ```ruby
51
+ # Example
52
+ Tmdb::Movie.detail(550, language: 'it')
53
+ ```
54
+ ## Endpoints
55
+
56
+ All endpoints available are those listed in [The Movie Database API](http://docs.themoviedb.apiary.io/) documentation.
57
+
58
+ To be thorough they are listed here with a sample call:
59
+ * [Configuration](#configuration)
60
+ * [Certifications](#certifications)
61
+ * [Changes](#changes)
62
+ * [Collections](#collections)
63
+ * [Companies](#companies)
64
+ * [Credits](#credits)
65
+ * [Discover](#discover)
66
+ * [Find](#find)
67
+ * [Genres](#genres)
68
+ * [Jobs](#jobs)
69
+ * [Keywords](#keywords)
70
+ * [Movies](#movies)
71
+ * [Networks](#networks)
72
+ * [People](#people)
73
+ * [Reviews](#reviews)
74
+ * [Search](#search)
75
+ * [TV](#tv)
76
+ * [TV Seasons](#season)
77
+ * [TV Episodes](#episode)
78
+
79
+ Missing endpoints:
80
+ * Account
81
+ * Authentication
82
+ * Guest Sessions
83
+ * List
84
+ * Timezone
85
+
86
+ ## Configuration
87
+
88
+ Get the system wide configuration information. Some elements of the API require some knowledge of this configuration data.
89
+ This method currently holds the data relevant to building image URLs as well as the change key map.
90
+ To build an image URL, you will need 3 pieces of data. The base_url, size and file_path. Simply combine them all and you will have a fully qualified URL.
91
+
92
+ ```ruby
93
+ config = Tmdb::Configuration.get
94
+
95
+ # Response
96
+ Tmdb::Configuration {
97
+ :images => Tmdb::Configuration {
98
+ :base_url => "http://image.tmdb.org/t/p/",
99
+ :secure_base_url => "https://image.tmdb.org/t/p/",
100
+ :backdrop_sizes => [
101
+ [0] "w300",
102
+ [1] "w780",
103
+ [2] "w1280",
104
+ [3] "original"
105
+ ],
106
+ :logo_sizes => [
107
+ [0] "w45",
108
+ [1] "w92",
109
+ [2] "w154",
110
+ [3] "w185",
111
+ [4] "w300",
112
+ [5] "w500",
113
+ [6] "original"
114
+ ],
115
+ :poster_sizes => [
116
+ [0] "w92",
117
+ [1] "w154",
118
+ [2] "w185",
119
+ [3] "w342",
120
+ [4] "w500",
121
+ [5] "w780",
122
+ [6] "original"
123
+ ],
124
+ :profile_sizes => [
125
+ [0] "w45",
126
+ [1] "w185",
127
+ [2] "h632",
128
+ [3] "original"
129
+ ],
130
+ :still_sizes => [
131
+ [0] "w92",
132
+ [1] "w185",
133
+ [2] "w300",
134
+ [3] "original"
135
+ ]
136
+ },
137
+ :change_keys => [
138
+ [ 0] "adult",
139
+ [ 1] "air_date",
140
+ [ 2] "also_known_as",
141
+ [ 3] "alternative_titles",
142
+ [ 4] "biography",
143
+ [ 5] "birthday",
144
+ [ 6] "budget",
145
+ [ 7] "cast",
146
+ [ 8] "certifications",
147
+ [ 9] "character_names",
148
+ [10] "created_by",
149
+ [11] "crew",
150
+ [12] "deathday",
151
+ [13] "episode",
152
+ [14] "episode_number",
153
+ [15] "episode_run_time",
154
+ [16] "freebase_id",
155
+ [17] "freebase_mid",
156
+ [18] "general",
157
+ [19] "genres",
158
+ [20] "guest_stars",
159
+ [21] "homepage",
160
+ [22] "images",
161
+ [23] "imdb_id",
162
+ [24] "languages",
163
+ [25] "name",
164
+ [26] "network",
165
+ [27] "origin_country",
166
+ [28] "original_name",
167
+ [29] "original_title",
168
+ [30] "overview",
169
+ [31] "parts",
170
+ [32] "place_of_birth",
171
+ [33] "plot_keywords",
172
+ [34] "production_code",
173
+ [35] "production_companies",
174
+ [36] "production_countries",
175
+ [37] "releases",
176
+ [38] "revenue",
177
+ [39] "runtime",
178
+ [40] "season",
179
+ [41] "season_number",
180
+ [42] "season_regular",
181
+ [43] "spoken_languages",
182
+ [44] "status",
183
+ [45] "tagline",
184
+ [46] "title",
185
+ [47] "translations",
186
+ [48] "tvdb_id",
187
+ [49] "tvrage_id",
188
+ [50] "type",
189
+ [51] "video",
190
+ [52] "videos"
191
+ ]
192
+ }
193
+
194
+ # Retrieve images base url example
195
+ base_url = config.images.base_url
196
+ ```
197
+
198
+ ## Certifications
199
+
200
+ #### Movie List
201
+
202
+ Get the list of supported certifications for movies. These can be used in conjunction with the certification_country and certification.lte parameters when using discover.
203
+ ```ruby
204
+ Tmdb::Certification.movie_list
205
+ ```
206
+
207
+ #### TV List
208
+
209
+ Get the list of supported certifications for tv shows.
210
+ ```ruby
211
+ Tmdb::Certification.tv_list
212
+ ```
213
+
214
+ ## Changes
215
+
216
+ #### Movie
217
+
218
+ Get a list of movie ids that have been edited. By default we show the last 24 hours and only 100 items per page. The maximum number of days that can be returned in a single request is 14. You can then use the movie changes API to get the actual data that has been changed.
219
+ ```ruby
220
+ Tmdb::Change.movie
221
+ ```
222
+
223
+ #### Person
224
+
225
+ Get a list of people ids that have been edited. By default we show the last 24 hours and only 100 items per page. The maximum number of days that can be returned in a single request is 14. You can then use the person changes API to get the actual data that has been changed.
226
+ ```ruby
227
+ Tmdb::Change.person
228
+ ```
229
+
230
+ ## Collection
231
+
232
+ #### Detail
233
+
234
+ Get the basic collection information for a specific collection id. You can get the ID needed for this method by making a /movie/{id} request and paying attention to the belongs_to_collection hash.Movie parts are not sorted in any particular order. If you would like to sort them yourself you can use the provided release_date.
235
+ ```ruby
236
+ Tmdb::Collection.detail(10)
237
+ ```
238
+
239
+ #### Backdrops
240
+
241
+ Get all of the backdrops for a particular collection by collection id.
242
+ ```ruby
243
+ Tmdb::Collection.backdrops(10)
244
+ ```
245
+
246
+ #### Posters
247
+
248
+ Get all of the posters for a particular collection by collection id.
249
+ ```ruby
250
+ Tmdb::Collection.posters(10)
251
+ ```
252
+
253
+ ## Company
254
+
255
+ #### Detail
256
+
257
+ This method is used to retrieve all of the basic information about a company.
258
+ ```ruby
259
+ Tmdb::Company.detail(1)
260
+ ```
261
+
262
+ #### Movies
263
+
264
+ Get the list of movies associated with a particular company.
265
+ ```ruby
266
+ Tmdb::Company.movies(1)
267
+ ```
268
+
269
+ ## Credit
270
+
271
+ #### Detail
272
+
273
+ Get the detailed information about a particular credit record. This is currently only supported with the new credit model found in TV. These ids can be found from any TV credit response as well as the tv_credits and combined_credits methods for people.The episodes object returns a list of episodes and are generally going to be guest stars. The season array will return a list of season numbers. Season credits are credits that were marked with the "add to every season" option in the editing interface and are assumed to be "season regulars".
274
+ ```ruby
275
+ Tmdb::Credit.detail('5256c8b219c2956ff6047cd8')
276
+ ```
277
+
278
+ ## Discover
279
+
280
+ #### Movie
281
+
282
+ Discover movies by different types of data like average rating, number of votes, genres and certifications. You can get a valid list of certifications from Tmdb::Certification.
283
+ ```ruby
284
+ Tmdb::Discover.movie
285
+ ```
286
+ #### TV
287
+
288
+ Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates.
289
+ ```ruby
290
+ Tmdb::Discover.tv
291
+ ```
292
+
293
+ ## Find
294
+
295
+ #### Movie
296
+
297
+ The find movie method makes it easy to search for objects in our database by an external id. For instance, an IMDB ID. This will search all objects (movies, TV shows and people) and return the results in a single response.
298
+ The supported external sources for each object are as follows:
299
+
300
+ * Movies: imdb_id
301
+ * People: imdb_id, freebase_mid, freebase_id, tvrage_id
302
+ * TV Series: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id
303
+ * TV Seasons: freebase_mid, freebase_id, tvdb_id, tvrage_id
304
+ * TV Episodes: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id
305
+ ```ruby
306
+ Tmdb::Find.movie('tt0266543', external_source: 'imdb_id')
307
+ ```
308
+
309
+ ## Genres
310
+
311
+ #### Movie List
312
+
313
+ Get the list of movie genres.
314
+ ```ruby
315
+ Tmdb::Genre.movie_list
316
+ ```
317
+
318
+ #### TV List
319
+
320
+ Get the list of TV genres.
321
+ ```ruby
322
+ Tmdb::Genre.tv_list
323
+ ```
324
+
325
+ #### Movies
326
+
327
+ Get the list of movies for a particular genre by id. By default, only movies with 10 or more votes are included.
328
+ ```ruby
329
+ Tmdb::Genre.movies(18)
330
+ ```
331
+
332
+ ## Jobs
333
+
334
+ #### List
335
+
336
+ Get a list of valid jobs.
337
+ ```ruby
338
+ Tmdb::Job.list
339
+ ```
340
+
341
+ ## Keywords
342
+
343
+ #### Detail
344
+
345
+ Get the basic information for a specific keyword id.
346
+ ```ruby
347
+ Tmdb::Keyword.detail(1721)
348
+ ```
349
+
350
+ #### Movies
351
+
352
+ Get the list of movies for a particular keyword by id.
353
+ ```ruby
354
+ Tmdb::Keyword.movies(1721)
355
+ ```
356
+
357
+ ## Movies
358
+
359
+ #### Detail
360
+
361
+ Get the basic movie information for a specific movie id.
362
+ ```ruby
363
+ Tmdb::Movie.detail(550)
364
+ ```
365
+
366
+ #### Alternative titles
367
+
368
+ Get the alternative titles for a specific movie id.
369
+ ```ruby
370
+ Tmdb::Movie.alternative_titles(550)
371
+ ```
372
+
373
+ #### Cast
374
+
375
+ Get the cast information for a specific movie id.
376
+ ```ruby
377
+ Tmdb::Movie.cast(550)
378
+ ```
379
+
380
+ #### Crew
381
+
382
+ Get the crew information for a specific movie id.
383
+ ```ruby
384
+ Tmdb::Movie.crew(550)
385
+ ```
386
+
387
+ #### Directors
388
+
389
+ Get the directors information for a specific movie id.
390
+ ```ruby
391
+ Tmdb::Movie.director(550)
392
+ ```
393
+
394
+ #### Backdrops
395
+
396
+ Get the backdrops for a specific movie id.
397
+ ```ruby
398
+ Tmdb::Movie.backdrops(550)
399
+ ```
400
+
401
+ #### Posters
402
+
403
+ Get the posters for a specific movie id.
404
+ ```ruby
405
+ Tmdb::Movie.posters(550)
406
+ ```
407
+
408
+ #### Videos
409
+
410
+ Get the videos for a specific movie id.
411
+ ```ruby
412
+ Tmdb::Movie.videos(550)
413
+ ```
414
+
415
+ #### Keywords
416
+
417
+ Get the plot keywords for a specific movie id.
418
+ ```ruby
419
+ Tmdb::Movie.keywords(550)
420
+ ```
421
+
422
+ #### Releases
423
+
424
+ Get the release date and certification information by country for a specific movie id.
425
+ ```ruby
426
+ Tmdb::Movie.releases(550)
427
+ ```
428
+
429
+ #### Translations
430
+
431
+ Get the translations for a specific movie id.
432
+ ```ruby
433
+ Tmdb::Movie.translations(550)
434
+ ```
435
+
436
+ #### Similar
437
+
438
+ Get the similar movies for a specific movie id.
439
+ ```ruby
440
+ Tmdb::Movie.similar(550)
441
+ ```
442
+
443
+ #### Reviews
444
+
445
+ Get the reviews for a particular movie id.
446
+ ```ruby
447
+ Tmdb::Movie.reviews(550)
448
+ ```
449
+
450
+ #### Lists
451
+
452
+ Get the lists that the movie belongs to.
453
+ ```ruby
454
+ Tmdb::Movie.lists(550)
455
+ ```
456
+
457
+ #### Changes
458
+
459
+ Get the changes for a specific movie id.Changes are grouped by key, and ordered by date in descending order. By default, only the last 24 hours of changes are returned. The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable.
460
+ ```ruby
461
+ Tmdb::Movie.changes(550, start_date: '2015-06-20', end_date: '2015-06-26')
462
+ ```
463
+
464
+ #### Latest
465
+
466
+ Get the latest movie id.
467
+ ```ruby
468
+ Tmdb::Movie.latest
469
+ ```
470
+
471
+ #### Upcoming
472
+
473
+ Get the list of upcoming movies by release date. This list refreshes every day.
474
+ ```ruby
475
+ Tmdb::Movie.upcoming
476
+ ```
477
+
478
+ #### Now Playing
479
+
480
+ Get the list of movies playing that have been, or are being released this week. This list refreshes every day.
481
+ ```ruby
482
+ Tmdb::Movie.now_playing
483
+ ```
484
+
485
+ #### Popular
486
+
487
+ Get the list of popular movies on The Movie Database. This list refreshes every day.
488
+ ```ruby
489
+ Tmdb::Movie.popular
490
+ ```
491
+
492
+ #### Top Rated
493
+
494
+ Get the list of movies playing that have been, or are being released this week. This list refreshes every day.
495
+ ```ruby
496
+ Tmdb::Movie.top_rated
497
+ ```
498
+
499
+ ## Networks
500
+
501
+ #### Detail
502
+
503
+ This method is used to retrieve the basic information about a TV network. You can use this ID to search for TV shows with the discover. At this time we don't have much but this will be fleshed out over time.
504
+ ```ruby
505
+ Tmdb::Network.detail(1)
506
+ ```
507
+
508
+ ## People
509
+
510
+ #### Detail
511
+
512
+ Get the general person information for a specific id.
513
+ ```ruby
514
+ Tmdb::Person.detail(22970)
515
+ ```
516
+
517
+ #### Movie Credits
518
+
519
+ Get the movie credits for a specific person id.
520
+ ```ruby
521
+ Tmdb::Person.movie_credits(22970)
522
+ ```
523
+
524
+ #### TV Credits
525
+
526
+ Get the TV credits for a specific person id.To get the expanded details for each record, call the /credit method with the provided credit_id. This will provide details about which episode and/or season the credit is for.
527
+ ```ruby
528
+ Tmdb::Person.tv_credits(22970)
529
+ ```
530
+
531
+ #### Combined Credits
532
+
533
+ Get the combined (movie and TV) credits for a specific person id.To get the expanded details for each TV record, call the /credit method with the provided credit_id. This will provide details about which episode and/or season the credit is for.
534
+ ```ruby
535
+ Tmdb::Person.combined_credits(22970)
536
+ ```
537
+
538
+ #### External IDs
539
+
540
+ Get the external ids for a specific person id.
541
+ ```ruby
542
+ Tmdb::Person.external_ids(1)
543
+ ```
544
+
545
+ #### Images
546
+
547
+ Get the images for a specific person id.
548
+ ```ruby
549
+ Tmdb::Person.images(1)
550
+ ```
551
+
552
+ #### Tagged Images
553
+
554
+ Get the images that have been tagged with a specific person id. We return all of the image results with a media object mapped for each image.
555
+ ```ruby
556
+ Tmdb::Person.tagged_images(287)
557
+ ```
558
+
559
+ #### Changes
560
+
561
+ Get the changes for a specific person id.Changes are grouped by key, and ordered by date in descending order. By default, only the last 24 hours of changes are returned. The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable.
562
+ ```ruby
563
+ Tmdb::Person.changes(1, start_date: '2014-02-19', end_date: '2014-03-01')
564
+ ```
565
+
566
+ #### Popular
567
+ Get the list of popular people on The Movie Database. This list refreshes every day.
568
+ ```ruby
569
+ Tmdb::Person.popular
570
+ ```
571
+
572
+ #### Latest
573
+ Get the latest person id.
574
+ ```ruby
575
+ Tmdb::Person.latest
576
+ ```
577
+
578
+ ## Reviews
579
+
580
+ #### Detail
581
+
582
+ Get the full details of a review by ID.
583
+ ```ruby
584
+ Tmdb::Review.detail('5013bc76760ee372cb00253e')
585
+ ```
586
+
587
+ ## Search
588
+
589
+ All search endpoints allow partial searches (truncated or uncomplete words).
590
+
591
+ #### Company
592
+
593
+ Search for companies by name.
594
+ ```ruby
595
+ Tmdb::Search.company('Disney')
596
+ ```
597
+
598
+ #### Collection
599
+
600
+ Search for collections by name.
601
+ ```ruby
602
+ Tmdb::Search.collection('Lord of')
603
+ ```
604
+
605
+ #### Keyword
606
+
607
+ Search for keywords by name.
608
+ ```ruby
609
+ Tmdb::Search.keyword('Iron man')
610
+ ```
611
+
612
+ #### List
613
+
614
+ Search for lists by name and description.
615
+ ```ruby
616
+ Tmdb::Search.list('Cartoons')
617
+ ```
618
+
619
+ #### Movie
620
+
621
+ Search for movies by title.
622
+ ```ruby
623
+ Tmdb::Search.movie('Harry potter')
624
+ ```
625
+
626
+ #### Multi
627
+
628
+ Search the movie, tv show and person collections with a single query. Each item returned in the result array has a media_type field that maps to either movie, tv or person.Each mapped result is the same response you would get from each independent search.
629
+ ```ruby
630
+ Tmdb::Search.multi('Game of thrones')
631
+ ```
632
+
633
+ #### Person
634
+
635
+ Search for people by name.
636
+ ```ruby
637
+ Tmdb::Search.person('Angelina Jolie')
638
+ ```
639
+
640
+ #### TV
641
+
642
+ Search for TV shows by title.
643
+ ```ruby
644
+ Tmdb::Search.tv('Silicon Valley')
645
+ ```
646
+
647
+ ## TV
648
+
649
+ #### Detail
650
+
651
+ Get the primary information about a TV series by id.
652
+ ```ruby
653
+ Tmdb::TV.detail(1396)
654
+ ```
655
+
656
+ #### Alternative titles
657
+
658
+ Get the alternative titles for a specific show ID.
659
+ ```ruby
660
+ Tmdb::TV.alternative_titles(1396)
661
+ ```
662
+
663
+ #### Changes
664
+
665
+ Get the changes for a specific TV show id.Changes are grouped by key, and ordered by date in descending order. By default, only the last 24 hours of changes are returned. The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable.TV changes are different than movie changes in that there are some edits on seasons and episodes that will create a change entry at the show level. They can be found under the season and episode keys. These keys will contain a series_id and episode_id. You can use the /tv/season/{id}/changes and /tv/episode/{id}/changes methods to look up these specific changes.
666
+ ```ruby
667
+ Tmdb::TV.changes(1399, start_date: '2015-06-23', end_date: '2015-06-26')
668
+ ```
669
+
670
+ #### Content Ratings
671
+
672
+ Get the content ratings for a specific TV show id.
673
+ ```ruby
674
+ Tmdb::TV.content_ratings(1396)
675
+ ```
676
+
677
+ #### Cast
678
+
679
+ Get the cast information for a specific tv id.
680
+ ```ruby
681
+ Tmdb::TV.cast(1396)
682
+ ```
683
+
684
+ #### Crew
685
+
686
+ Get the crew information for a specific tv id.
687
+ ```ruby
688
+ Tmdb::TV.crew(1396)
689
+ ```
690
+
691
+ #### External IDs
692
+
693
+ Get the external ids that we have stored for a TV series.
694
+ ```ruby
695
+ Tmdb::TV.external_ids(1396)
696
+ ```
697
+
698
+ #### Backdrops
699
+
700
+ Get the backdrops for a specific tv id.
701
+ ```ruby
702
+ Tmdb::TV.backdrops(1396)
703
+ ```
704
+
705
+ #### Posters
706
+
707
+ Get the posters for a specific tv id.
708
+ ```ruby
709
+ Tmdb::TV.posters(1396)
710
+ ```
711
+
712
+ #### Keywords
713
+
714
+ Get the plot keywords for a specific tv id.
715
+ ```ruby
716
+ Tmdb::TV.keywords(1396)
717
+ ```
718
+
719
+ #### Similar
720
+
721
+ Get the similar TV shows for a specific tv id.
722
+ ```ruby
723
+ Tmdb::TV.similar(1396)
724
+ ```
725
+
726
+ #### Translations
727
+
728
+ Get the list of translations that exist for a TV series. These translations cascade down to the episode level.
729
+ ```ruby
730
+ Tmdb::TV.translations(1396)
731
+ ```
732
+
733
+ #### Videos
734
+
735
+ Get the videos that have been added to a TV series (trailers, opening credits, etc...)
736
+ ```ruby
737
+ Tmdb::TV.videos(1396)
738
+ ```
739
+
740
+ #### Latest
741
+
742
+ Get the latest TV show id.
743
+ ```ruby
744
+ Tmdb::TV.latest
745
+ ```
746
+
747
+ #### On The Air
748
+
749
+ Get the list of TV shows that are currently on the air. This query looks for any TV show that has an episode with an air date in the next 7 days.
750
+ ```ruby
751
+ Tmdb::TV.on_the_air
752
+ ```
753
+
754
+ #### Airing Today
755
+
756
+ Get the list of TV shows that air today. Without a specified timezone, this query defaults to EST (Eastern Time UTC-05:00).
757
+ ```ruby
758
+ Tmdb::TV.airing_today
759
+ ```
760
+
761
+ #### Top Rated
762
+
763
+ Get the list of top rated TV shows. By default, this list will only include TV shows that have 2 or more votes. This list refreshes every day.
764
+ ```ruby
765
+ Tmdb::TV.top_rated
766
+ ```
767
+
768
+ #### Popular
769
+
770
+ Get the list of popular TV shows. This list refreshes every day.
771
+ ```ruby
772
+ Tmdb::TV.popular
773
+ ```
774
+
775
+ ## TV Seasons
776
+
777
+ #### Detail
778
+
779
+ Get the primary information about a TV season by its season number.
780
+ ```ruby
781
+ Tmdb::Tv::Season.detail(3572, 1)
782
+ ```
783
+
784
+ #### Changes
785
+
786
+ Look up a TV season's changes by season ID. This method is used in conjunction with the /tv/{id}/changes method. This method uses the season_id value found in the change entries.
787
+ ```ruby
788
+ Tmdb::Tv::Season.changes(59905, start_date: '2015-05-23', end_date: '2015-05-26')
789
+ ```
790
+
791
+ #### Cast
792
+
793
+ Get the cast information for a TV season by season number.
794
+ ```ruby
795
+ Tmdb::Tv::Season.cast(3572, 1)
796
+ ```
797
+
798
+ #### Crew
799
+
800
+ Get the crew information for a TV season by season number.
801
+ ```ruby
802
+ Tmdb::Tv::Season.crew(3572, 1)
803
+ ```
804
+
805
+ #### External IDs
806
+
807
+ Get the external ids that we have stored for a TV season by season number.
808
+ ```ruby
809
+ Tmdb::Tv::Season.external_ids(3572, 1)
810
+ ```
811
+
812
+ #### Posters
813
+
814
+ Get the images (posters) that we have stored for a TV season by season number.
815
+ ```ruby
816
+ Tmdb::Tv::Season.posters(1399, 1)
817
+ ```
818
+
819
+ #### Videos
820
+
821
+ Get the videos that have been added to a TV season (trailers, teasers, etc...)
822
+ ```ruby
823
+ Tmdb::Tv::Season.videos(1399, 1)
824
+ ```
825
+
826
+ ## TV Episodes
827
+
828
+ #### Detail
829
+
830
+ Get the primary information about a TV episode by combination of a season and episode number.
831
+ ```ruby
832
+ Tmdb::Tv::Episode.detail(3572, 1, 1)
833
+ ```
834
+
835
+ #### Changes
836
+
837
+ Look up a TV episode's changes by episode ID. This method is used in conjunction with the /tv/{id}/changes method. This method uses the episode_id value found in the change entries.
838
+ ```ruby
839
+ Tmdb::Tv::Episode.changes(63065, start_date: '2015-06-15', end_date: '2015-06-20')
840
+ ```
841
+
842
+ #### Cast
843
+
844
+ Get the cast information by combination of season and episode number.
845
+ ```ruby
846
+ Tmdb::Tv::Episode.cast(3572, 1, 1)
847
+ ```
848
+
849
+ #### Crew
850
+
851
+ Get the crew information by combination of season and episode number.
852
+ ```ruby
853
+ Tmdb::Tv::Episode.crew(3572, 1, 1)
854
+ ```
855
+
856
+ #### Guest Stars
857
+
858
+ Get the guest stars information by combination of season and episode number.
859
+ ```ruby
860
+ Tmdb::Tv::Episode.guest_stars(3572, 1, 1)
861
+ ```
862
+
863
+ #### External IDs
864
+
865
+ Get the external ids for a TV episode by comabination of a season and episode number.
866
+ ```ruby
867
+ Tmdb::Tv::Episode.external_ids(3572, 1, 1)
868
+ ```
869
+
870
+ #### Posters
871
+
872
+ Get the images (episode stills) for a TV episode by combination of a season and episode number. Since episode stills don't have a language, this call will always return all images.
873
+ ```ruby
874
+ Tmdb::Tv::Episode.posters(1399, 1, 1)
875
+ ```
876
+
877
+ #### Videos
878
+
879
+ Get the videos that have been added to a TV episode (teasers, clips, etc...)
880
+ ```ruby
881
+ Tmdb::Tv::Episode.videos(1399, 1, 1)
882
+ ```
883
+
884
+ ## Contributing
885
+
886
+ We love pull requests! Here's a quick guide for contributing:
887
+
888
+ 1. Fork the repo.
889
+
890
+ 2. Run the existing test suite:
891
+ ```
892
+ $ bundle exec rspec
893
+ ```
894
+ 3. Add tests for your change.
895
+
896
+ 4. Add your changes and make your test(s) pass. Following the conventions you
897
+ see used in the source will increase the chance that your pull request is
898
+ accepted right away.
899
+
900
+ 5. Update the README if necessary.
901
+
902
+ 6. Add a line to the CHANGELOG for your bug fix or feature.
903
+
904
+ 7. Push to your fork and submit a pull request.
12
905
 
13
906
  ## License
14
907
 
data/lib/tmdb/credit.rb CHANGED
@@ -9,12 +9,16 @@ module Tmdb
9
9
  credit = self.new(result.except('media', 'person'))
10
10
  credit.media = Media.new(media.except('episodes', 'seasons'))
11
11
 
12
- credit.media.episodes = media['episodes'].map do |episode|
13
- Tv::Episode.new(episode)
12
+ if media['episodes'].present?
13
+ credit.media.episodes = media['episodes'].map do |episode|
14
+ Tv::Episode.new(episode)
15
+ end
14
16
  end
15
17
 
16
- credit.media.seasons = media['seasons'].map do |season|
17
- Tv::Season.new(season)
18
+ if media['seasons'].present?
19
+ credit.media.seasons = media['seasons'].map do |season|
20
+ Tv::Season.new(season)
21
+ end
18
22
  end
19
23
 
20
24
  credit.person = Person.new(result['person'])
data/lib/tmdb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tmdb
2
- VERSION = '0.7.1'
2
+ VERSION = '1.0.0'
3
3
  end
data/spec/credit_spec.rb CHANGED
@@ -21,7 +21,7 @@ describe Tmdb::Credit do
21
21
  context '#detail' do
22
22
  let(:detail) do
23
23
  VCR.use_cassette 'credit/detail' do
24
- Tmdb::Credit.detail('525333fb19c295794002c720')
24
+ Tmdb::Credit.detail('5256c8b219c2956ff6047cd8')
25
25
  end
26
26
  end
27
27
 
@@ -33,14 +33,6 @@ describe Tmdb::Credit do
33
33
  expect(subject.media).to be_an_instance_of(Tmdb::Media)
34
34
  end
35
35
 
36
- it 'should have media with episodes of kind Tmdb::Tv::Episode' do
37
- expect(subject.media.episodes.sample).to be_an_instance_of(Tmdb::Tv::Episode)
38
- end
39
-
40
- it 'should have media with seasons of kind Array' do
41
- expect(subject.media.seasons).to be_an_instance_of(Array)
42
- end
43
-
44
36
  it 'should have a person associated of kind Tmdb::Person' do
45
37
  expect(subject.person).to be_an_instance_of(Tmdb::Person)
46
38
  end
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://api.themoviedb.org/3/credit/525333fb19c295794002c720?api_key=c29379565234e20d7cbf4f2e835c3e41&language=en
5
+ uri: http://api.themoviedb.org/3/credit/5256c8b219c2956ff6047cd8?api_key=c29379565234e20d7cbf4f2e835c3e41&language=en
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -23,9 +23,9 @@ http_interactions:
23
23
  Content-Type:
24
24
  - application/json;charset=utf-8
25
25
  Date:
26
- - Fri, 26 Jun 2015 15:17:11 GMT
26
+ - Fri, 03 Jul 2015 15:47:32 GMT
27
27
  Etag:
28
- - '"91e6fb4cf5dbe0feb7980360f50dd481"'
28
+ - '"82f0d8f32e49b2138b5cf99431df1d5d"'
29
29
  Server:
30
30
  - openresty
31
31
  Status:
@@ -33,29 +33,25 @@ http_interactions:
33
33
  X-Memc:
34
34
  - HIT
35
35
  X-Memc-Age:
36
- - '642'
36
+ - '771'
37
37
  X-Memc-Expires:
38
- - '20958'
38
+ - '20829'
39
39
  X-Memc-Key:
40
- - 2c179f100ab60972426f560557aa0533
40
+ - 2417434868a2ae7b00cdb95c690418fa
41
41
  X-Ratelimit-Limit:
42
42
  - '40'
43
43
  X-Ratelimit-Remaining:
44
- - '28'
44
+ - '39'
45
45
  X-Ratelimit-Reset:
46
- - '1435331837'
46
+ - '1435938462'
47
47
  Content-Length:
48
- - '685'
48
+ - '165'
49
49
  Connection:
50
50
  - keep-alive
51
51
  body:
52
52
  encoding: UTF-8
53
- string: '{"credit_type":"cast","department":"Actors","job":"Actor","media":{"id":54,"name":"Growing
54
- Pains","original_name":"Growing Pains","character":"","episodes":[{"air_date":"1989-02-08","episode_number":14,"name":"Feet
55
- of Clay","overview":"Maggie arranges for Ben to meet his favorite rock musician.","season_number":4,"still_path":null},{"air_date":"1987-11-10","episode_number":9,"name":"Who''s
56
- Zoomin'' Who?","overview":"Bobby''s annoying habits make Carol look elsewhere
57
- for the man of her dreams -- just in time for her to notice a new student.","season_number":3,"still_path":null}],"seasons":[]},"media_type":"tv","id":"525333fb19c295794002c720","person":{"name":"Brad
58
- Pitt","id":287}}'
53
+ string: '{"credit_type":"cast","department":"Actors","job":"Actor","media":{},"media_type":"tv","id":"5256c8b219c2956ff6047cd8","person":{"name":"Peter
54
+ Dinklage","id":22970}}'
59
55
  http_version:
60
- recorded_at: Fri, 26 Jun 2015 15:17:14 GMT
56
+ recorded_at: Fri, 03 Jul 2015 15:47:32 GMT
61
57
  recorded_with: VCR 2.9.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: themoviedb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 18Months
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-03 00:00:00.000000000 Z
11
+ date: 2015-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -183,6 +183,7 @@ files:
183
183
  - ".ruby-gemset"
184
184
  - ".ruby-version"
185
185
  - ".travis.yml"
186
+ - CHANGELOG.md
186
187
  - Gemfile
187
188
  - Gemfile.lock
188
189
  - LICENSE