themoviedb 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +459 -0
  3. data/lib/themoviedb.rb +4 -5
  4. data/lib/themoviedb/api.rb +4 -5
  5. data/lib/themoviedb/collection.rb +6 -7
  6. data/lib/themoviedb/company.rb +7 -8
  7. data/lib/themoviedb/configuration.rb +2 -2
  8. data/lib/themoviedb/episode.rb +16 -17
  9. data/lib/themoviedb/find.rb +11 -12
  10. data/lib/themoviedb/genre.rb +53 -57
  11. data/lib/themoviedb/job.rb +3 -5
  12. data/lib/themoviedb/movie.rb +62 -63
  13. data/lib/themoviedb/person.rb +37 -33
  14. data/lib/themoviedb/resource.rb +19 -21
  15. data/lib/themoviedb/search.rb +30 -30
  16. data/lib/themoviedb/season.rb +16 -17
  17. data/lib/themoviedb/tv.rb +24 -25
  18. data/lib/themoviedb/version.rb +2 -1
  19. data/spec/company_spec.rb +31 -36
  20. data/spec/find_spec.rb +10 -13
  21. data/spec/movie_spec.rb +124 -129
  22. data/spec/person_spec.rb +53 -53
  23. data/spec/spec/vcr/find/search_imdb.yml +39 -0
  24. data/spec/spec_helper.rb +29 -0
  25. data/spec/tv_spec.rb +196 -217
  26. data/spec/vcr/company/detail.yml +67 -0
  27. data/spec/vcr/company/movies.yml +98 -0
  28. data/spec/vcr/find/search_imdb.yml +50 -0
  29. data/spec/vcr/find/search_tvdb.yml +52 -0
  30. data/spec/vcr/movie/alternative_titles_for_id.yml +69 -0
  31. data/spec/vcr/movie/cast_information_for_id.yml +109 -0
  32. data/spec/vcr/movie/changes_made.yml +60 -0
  33. data/spec/vcr/movie/credits_for_id.yml +99 -0
  34. data/spec/vcr/movie/crew_for_id.yml +109 -0
  35. data/spec/vcr/movie/detail.yml +93 -0
  36. data/spec/vcr/movie/detail_with_appended_response.yml +254 -0
  37. data/spec/vcr/movie/images.yml +62 -0
  38. data/spec/vcr/movie/keywords_for_id.yml +62 -0
  39. data/spec/vcr/movie/language_german.yml +112 -0
  40. data/spec/vcr/movie/movie_belongs_for_id.yml +89 -0
  41. data/spec/vcr/movie/now_playing.yml +90 -0
  42. data/spec/vcr/movie/popular.yml +96 -0
  43. data/spec/vcr/movie/releases_for_id.yml +60 -0
  44. data/spec/vcr/movie/return_latest_movie.yml +62 -0
  45. data/spec/vcr/movie/return_upcoming_movie.yml +186 -0
  46. data/spec/vcr/movie/similar_for_id.yml +180 -0
  47. data/spec/vcr/movie/top_rated.yml +190 -0
  48. data/spec/vcr/movie/trailers_for_id.yml +60 -0
  49. data/spec/vcr/movie/translations_for_id.yml +76 -0
  50. data/spec/vcr/person/changes.yml +50 -0
  51. data/spec/vcr/person/credits.yml +459 -0
  52. data/spec/vcr/person/detail.yml +65 -0
  53. data/spec/vcr/person/detail_with_appended_response.yml +762 -0
  54. data/spec/vcr/person/images.yml +50 -0
  55. data/spec/vcr/person/latest.yml +51 -0
  56. data/spec/vcr/person/popular.yml +125 -0
  57. data/spec/vcr/tv/cast.yml +74 -0
  58. data/spec/vcr/tv/crew.yml +74 -0
  59. data/spec/vcr/tv/detail.yml +63 -0
  60. data/spec/vcr/tv/detail_with_appeded_response.yml +76 -0
  61. data/spec/vcr/tv/external_ids.yml +60 -0
  62. data/spec/vcr/tv/images.yml +121 -0
  63. data/spec/vcr/tv/popular.yml +96 -0
  64. data/spec/vcr/tv/test_chuck.yml +52 -0
  65. data/spec/vcr/tv/top_rated.yml +84 -0
  66. data/themoviedb.gemspec +10 -35
  67. metadata +94 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73d05ca26470c6c7ddd743b611c0737f3fcd2f20
4
- data.tar.gz: 7679dd24e5cf956982471028309bc81bf6959a44
3
+ metadata.gz: 166055b6cba5ab74aa7f8959d58f0efd12f908ff
4
+ data.tar.gz: bb037509ef8cde00343b786f92cdf3a048669aab
5
5
  SHA512:
6
- metadata.gz: ecd223e631fb0fab9c1d09e655a12428c3189812babd3c5a66e1defd3e2d33e0ecf7d75740af3281a1b845dede379eef4cdebe691790be16ccf1f0b45b3f7c5a
7
- data.tar.gz: 107bdad32b4a8fc8dc7efafaa7e5cbcdbffde1ba0b9f3dd4978ae23607300580ac5827149e73df19f216b06c463e39d0ea798eedabfdbd07438543f1e7e90689
6
+ metadata.gz: ccf100be48cedee1cc87887f05a15747302b1fdd1ea7dde14090542f7cff16521401cec4adecd0e7903ae77722021a90691ac936b79da5b3bce03fc7fefc8444
7
+ data.tar.gz: ba5b785ec47a6e9f026377281b2753c450ed425656a63dcdbb23e00e048250875056a6799a48ec80a7ad2f38b1781bd5fdebc5f4c7f68738159df4e8d854c4ee
@@ -0,0 +1,459 @@
1
+ ## Information
2
+
3
+ ### themoviedb [![Code Climate](https://codeclimate.com/github/ahmetabdi/themoviedb/badges/gpa.svg)](https://codeclimate.com/github/ahmetabdi/themoviedb) [![Build Status](https://travis-ci.org/ahmetabdi/themoviedb.png?branch=master)](https://travis-ci.org/ahmetabdi/themoviedb) [![Gem Version](https://badge.fury.io/rb/themoviedb.png)](http://badge.fury.io/rb/themoviedb)
4
+
5
+ A Ruby wrapper for the [The Movie Database API](http://docs.themoviedb.apiary.io/).
6
+
7
+ Ruby >= 1.9.3
8
+
9
+ Provides a simple, easy to use interface for the Movie Database API.
10
+
11
+ Get your API key [here](https://www.themoviedb.org/account).
12
+
13
+ ## Getting started
14
+
15
+ ```bash
16
+ $ gem install themoviedb
17
+ ```
18
+
19
+ Example usage of the 'themovedb' gem
20
+
21
+ http://themoviedb.herokuapp.com/
22
+
23
+ https://github.com/ahmetabdi/themoviedb-example
24
+
25
+ ## Configuration
26
+
27
+ ```ruby
28
+ Tmdb::Api.key("KEY_HERE")
29
+ ```
30
+
31
+ You can change the language for the returned data with this:
32
+
33
+ ```ruby
34
+ Tmdb::Api.language("de")
35
+ ```
36
+
37
+ The default language is english.
38
+ The API supports translations just be aware that it does not fall back to English in the event that a field hasn't been translated.
39
+
40
+ ## Resources
41
+
42
+ Current available resources:
43
+ * [Company](#company)
44
+ * [Movie](#movie)
45
+ * [TV](#tv)
46
+ * [TV Seasons](#season)
47
+ * [TV Episodes](#episode)
48
+ * [Collection](#collection)
49
+ * [Person](#person)
50
+ * [Genre](#genre)
51
+ * [Job](#job)
52
+ * [Find](#find)
53
+
54
+ Missing resources:
55
+ * Account
56
+ * Authentication
57
+ * Changes
58
+ * Collections
59
+ * Credits
60
+ * Discover
61
+ * Keywords
62
+ * Lists
63
+ * Networks
64
+ * Reviews
65
+
66
+ ## Example
67
+
68
+ ```ruby
69
+ Tmdb::Movie.find("batman")
70
+ Tmdb::TV.find("fringe")
71
+ Tmdb::Collection.find("spiderman")
72
+ Tmdb::Person.find("samuel jackson")
73
+ Tmdb::Company.find("lucas")
74
+ Tmdb::Genre.find("drama")
75
+ ```
76
+
77
+ ## Search
78
+
79
+ ### Usage
80
+
81
+ resources => person, movie, tv, collection, company
82
+
83
+ ```ruby
84
+ @search = Tmdb::Search.new
85
+ @search.resource('person') # determines type of resource
86
+ @search.query('samuel jackson') # the query to search against
87
+ @search.fetch # makes request
88
+ ```
89
+
90
+ ## Find
91
+
92
+ The supported external sources for each object are as follows:
93
+ Movies: imdb_id
94
+ People: imdb_id, freebase_mid, freebase_id, tvrage_id
95
+ TV Series: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id
96
+
97
+ ```ruby
98
+ Tmdb::Find.imdb_id('id')
99
+ Tmdb::Find.freebase_mid('id')
100
+ Tmdb::Find.freebase_id('id')
101
+ Tmdb::Find.tvrage_id('id')
102
+ Tmdb::Find.tvdb_id('id')
103
+ ```
104
+
105
+ The responses are in the hash with movie_results, person_results and tv_results
106
+
107
+
108
+ ## Configuration
109
+
110
+ Get the system wide configuration information. Some elements of the API require some knowledge of this configuration data. The purpose of this is to try and keep the actual API responses as light as possible.
111
+ This method currently holds the data relevant to building image URLs as well as the change key map.
112
+ 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.
113
+ Here’s an example URL: http://cf2.imgobject.com/t/p/w500/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg
114
+
115
+ ```ruby
116
+ configuration = Tmdb::Configuration.new
117
+ configuration.base_url
118
+ configuration.secure_base_url
119
+ configuration.poster_sizes
120
+ configuration.backdrop_sizes
121
+ configuration.profile_sizes
122
+ configuration.logo_sizes
123
+ ```
124
+
125
+ ## Detail
126
+
127
+ Every example documented below uses the movie Fight Club (id 550), the TV show Breaking Bad (id 1396), and every person uses Brad Pitt (id 287). These are only used as examples to show what a real world request looks like.
128
+
129
+ ### Movie
130
+
131
+ ```ruby
132
+ movie = Tmdb::Movie.detail(550)
133
+ movie.adult => false
134
+ movie.backdrop_path => "/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg"
135
+ movie.belongs_to_collection => nil
136
+ movie.budget => 63000000
137
+ movie.genres => [{"id"=>28, "name"=>"Action"}, {"id"=>18, "name"=>"Drama"}, {"id"=>53, "name"=>"Thriller"}]
138
+ movie.homepage => ""
139
+ movie.id => 550
140
+ movie.imdb_id => "tt0137523"
141
+ movie.original_title => "Fight Club"
142
+ movie.overview => "A ticking-time-bomb insomniac and a slippery soap salesman channel primal male aggression into a shocking new form of therapy. Their concept catches on, with underground \"fight clubs\" forming in every town, until an eccentric gets in the way and ignites an out-of-control spiral toward oblivion."
143
+ movie.popularity => 7.4
144
+ movie.poster_path => "/2lECpi35Hnbpa4y46JX0aY3AWTy.jpg"
145
+ movie.production_companies => [{"name"=>"20th Century Fox", "id"=>25}, {"name"=>"Fox 2000 Pictures", "id"=> 711}, {"name"=>"Regency Enterprises", "id"=>508}]
146
+ movie.production_countries => [{"iso_3166_1"=>"DE", "name"=>"Germany"}, {"iso_3166_1"=>"US", "name"=>"United States of America"}]
147
+ movie.release_date => "1999-10-14"
148
+ movie.revenue => 100853753
149
+ movie.runtime => 139
150
+ movie.spoken_languages => [{"iso_639_1"=>"en", "name"=>"English"}]
151
+ movie.status => "Released"
152
+ movie.tagline => "How much can you know about yourself if you've never been in a fight?"
153
+ movie.title => "Fight Club"
154
+ movie.vote_average => 8.8
155
+ movie.vote_count => 234
156
+ ```
157
+ Get the latest movie id.
158
+ ```ruby
159
+ Tmdb::Movie.latest
160
+ ```
161
+ Get the list of upcoming movies. This list refreshes every day. The maximum number of items this list will include is 100.
162
+ ```ruby
163
+ Tmdb::Movie.upcoming
164
+ ```
165
+ Get the list of movies playing in theatres. This list refreshes every day. The maximum number of items this list will include is 100.
166
+ ```ruby
167
+ Tmdb::Movie.now_playing
168
+ ```
169
+ Get the list of popular movies on The Movie Database. This list refreshes every day.
170
+ ```ruby
171
+ Tmdb::Movie.popular
172
+ ```
173
+ Get the list of top rated movies. By default, this list will only include movies that have 10 or more votes. This list refreshes every day.
174
+ ```ruby
175
+ Tmdb::Movie.top_rated
176
+ ```
177
+ #### Movie - Alternative Titles
178
+ Get the alternative titles for a specific movie id.
179
+ ```ruby
180
+ Tmdb::Movie.alternative_titles(22855)
181
+ ```
182
+ #### Movie - Images
183
+ Get the images (posters and backdrops) for a specific movie id.
184
+ ```ruby
185
+ @movie = Tmdb::Movie.images(22855)
186
+ ```
187
+ Grab Backdrops
188
+ ```ruby
189
+ @movie['backdrops']
190
+ ```
191
+ Grab Posters
192
+ ```ruby
193
+ @movie['posters']
194
+ ```
195
+
196
+ #### Movie - Casts
197
+ Get the cast information for a specific movie id.
198
+ ```ruby
199
+ Tmdb::Movie.casts(22855)
200
+ ```
201
+ #### Movie - Keywords
202
+ Get the plot keywords for a specific movie id.
203
+ ```ruby
204
+ Tmdb::Movie.keywords(22855)
205
+ ```
206
+ #### Movie - Releases
207
+ Get the release date by country for a specific movie id.
208
+ ```ruby
209
+ Tmdb::Movie.releases(22855)
210
+ ```
211
+ #### Movie - Trailers
212
+ Get the trailers for a specific movie id.
213
+ ```ruby
214
+ Tmdb::Movie.trailers(22855)
215
+ ```
216
+ #### Movie - Translations
217
+ Get the translations for a specific movie id.
218
+ ```ruby
219
+ Tmdb::Movie.translations(22855)
220
+ ```
221
+ #### Movie - Similar Movies
222
+ Get the similar movies for a specific movie id.
223
+ ```ruby
224
+ Tmdb::Movie.similar_movies(22855)
225
+ ```
226
+ #### Movie - Lists
227
+ Get the lists that the movie belongs to.
228
+ ```ruby
229
+ Tmdb::Movie.lists(22855)
230
+ ```
231
+ #### Movie - Changes
232
+ Get the changes for a specific movie id.
233
+ ```ruby
234
+ Tmdb::Movie.changes(22855)
235
+ ```
236
+ #### Movie - Credits
237
+ Get the credits for a specific movie id.
238
+ ```ruby
239
+ Tmdb::Movie.credits(22855)
240
+ ```
241
+
242
+ ### TV
243
+
244
+ ```ruby
245
+ show = Tmdb::TV.detail(1396)
246
+ ```
247
+ Get the list of popular TV shows. This list refreshes every day.
248
+ ```ruby
249
+ Tmdb::TV.popular
250
+ ```
251
+ 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.
252
+ ```ruby
253
+ Tmdb::TV.top_rated
254
+ ```
255
+ #### TV - Images
256
+ Get the images (posters and backdrops) for a TV series.
257
+ ```ruby
258
+ @show = Tmdb::TV.images(1396)
259
+ ```
260
+ Grab Backdrops
261
+ ```ruby
262
+ @show['backdrops']
263
+ ```
264
+ Grab Posters
265
+ ```ruby
266
+ @show['posters']
267
+ ```
268
+ #### TV - Cast
269
+ Get the cast information about a TV series.
270
+ ```ruby
271
+ Tmdb::TV.cast(1396)
272
+ ```
273
+ #### TV - Crew
274
+ Get the crew information about a TV series.
275
+ ```ruby
276
+ Tmdb::TV.crew(1396)
277
+ ```
278
+ #### TV - External IDs
279
+ Get the external ids that we have stored for a TV series.
280
+ ```ruby
281
+ Tmdb::TV.external_ids(1396)
282
+ ```
283
+
284
+ ### Season
285
+
286
+ ```ruby
287
+ show = Tmdb::Season.detail(1396, 1)
288
+ ```
289
+ #### Season - Images
290
+ Get the images (posters) that we have stored for a TV season by season number.
291
+ ```ruby
292
+ @season = Tmdb::Season.images(1396, 1)
293
+ ```
294
+ Grab Posters
295
+ ```ruby
296
+ @season['posters']
297
+ ```
298
+ #### Season - Cast
299
+ Get the cast credits for a TV season by season number.
300
+ ```ruby
301
+ Tmdb::Season.cast(1396, 1)
302
+ ```
303
+ #### Season - Crew
304
+ Get the crew credits for a TV season by season number.
305
+ ```ruby
306
+ Tmdb::Season.crew(1396, 1)
307
+ ```
308
+ #### Season - External IDs
309
+ Get the external ids that we have stored for a TV season by season number.
310
+ ```ruby
311
+ Tmdb::Season.external_ids(1396, 1)
312
+ ```
313
+
314
+ ### Episode
315
+
316
+ ```ruby
317
+ episode = Tmdb::Episode.detail(1396, 1, 1)
318
+ ```
319
+ #### Episode - Images
320
+ Get the images (episode stills) for a TV episode by combination of a season and episode number.
321
+ ```ruby
322
+ @episode = Tmdb::Episode.images(1396, 1, 1)
323
+ ```
324
+ Grab Stills
325
+ ```ruby
326
+ @episode['stills']
327
+ ```
328
+ #### Episode - Cast
329
+ Get the TV episode cast credits by combination of season and episode number.
330
+ ```ruby
331
+ Tmdb::Episode.cast(1396, 1, 1)
332
+ ```
333
+ #### Episode - Crew
334
+ Get the TV episode crew credits by combination of season and episode number.
335
+ ```ruby
336
+ Tmdb::Episode.crew(1396, 1, 1)
337
+ ```
338
+ #### Episode - External IDs
339
+ Get the external ids for a TV episode by comabination of a season and episode number.
340
+ ```ruby
341
+ Tmdb::Episode.external_ids(1396, 1, 1)
342
+ ```
343
+
344
+ ### Company
345
+ ```ruby
346
+ company = Tmdb::Company.detail(1)
347
+ company.id => 1
348
+ company.description => nil
349
+ company.homepage => "http://www.lucasfilm.com"
350
+ company.logo_path => "/8rUnVMVZjlmQsJ45UGotDOUznxj.png"
351
+ company.name => "Lucasfilm"
352
+ company.parent_company => nil
353
+ ```
354
+
355
+ Get the list of movies associated with a particular company.
356
+ ```ruby
357
+ Tmdb::Company.movies(1)
358
+ ```
359
+
360
+ ### Collection
361
+ ```ruby
362
+ collection = Tmdb::Collection.detail(51845)
363
+ collection.id => 51845
364
+ collection.backdrop_path => "..."
365
+ collection.parts => "..."
366
+ collection.poster_path => "..."
367
+ collection.name => "DC Universe Animated Original Movies"
368
+ ```
369
+
370
+ Get all of the images for a particular collection by collection id.
371
+ ```ruby
372
+ Tmdb::Collection.images(51845)
373
+ ```
374
+
375
+ ### Person
376
+
377
+ ```ruby
378
+ person = Tmdb::Person.detail(287)
379
+ person.id => 287
380
+ person.name => "Brad Pitt"
381
+ person.place_of_birth => "Shawnee, Oklahoma, United States"
382
+ person.also_known_as => []
383
+ person.adult => false
384
+ person.biography => "From Wikipedia, the free"..
385
+ person.birthday => "1963-12-18"
386
+ person.deathday => ""
387
+ person.homepage => "http://simplybrad.com/"
388
+ person.profile_path => "w8zJQuN7tzlm6FY9mfGKihxp3Cb.jpg"
389
+ ```
390
+
391
+ Get the list of popular people on The Movie Database. This list refreshes every day.
392
+ ```ruby
393
+ Tmdb::Person.popular
394
+ ```
395
+
396
+ Get the latest person id.
397
+ ```ruby
398
+ Tmdb::Person.latest
399
+ ```
400
+
401
+ Get the credits for a specific person id.
402
+ ```ruby
403
+ Tmdb::Person.credits(287)
404
+ ```
405
+
406
+ Get the images for a specific person id.
407
+ ```ruby
408
+ Tmdb::Person.images(287)
409
+ ```
410
+
411
+ Get the changes for a specific person id.
412
+ ```ruby
413
+ Tmdb::Person.changes(287)
414
+ ```
415
+
416
+ ### Genre
417
+
418
+ ```ruby
419
+ genre = Tmdb::Genre.detail(18)
420
+ genre.id => 18
421
+ genre.name => "Drama"
422
+ genre.page => 1
423
+ genre.total_pages => 45
424
+ genre.total_results => 883
425
+ genre.results => [...]
426
+ genre.get_page(page_number) => Returns next set of movies.
427
+ ```
428
+
429
+ Get a list of all genres.
430
+ ```ruby
431
+ Tmdb::Genre.list
432
+ ```
433
+
434
+ ### Job
435
+
436
+ Get a list of all jobs.
437
+ ```ruby
438
+ Tmdb::Job.list
439
+ ```
440
+
441
+ ## License
442
+
443
+ themoviedb - A ruby wrapper for the movie database API
444
+
445
+ Copyright (C) 2014 Ahmet Abdi
446
+
447
+ This program is free software; you can redistribute it and/or
448
+ modify it under the terms of the GNU General Public License
449
+ as published by the Free Software Foundation; either version 2
450
+ of the License, or (at your option) any later version.
451
+
452
+ This program is distributed in the hope that it will be useful,
453
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
454
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
455
+ GNU General Public License for more details.
456
+
457
+ You should have received a copy of the GNU General Public License
458
+ along with this program; if not, write to the Free Software
459
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.