tmdby 1.0.0

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.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +3 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +31 -0
  6. data/Rakefile +2 -0
  7. data/lib/tmdby/client.rb +43 -0
  8. data/lib/tmdby/helpers/authentication.rb +17 -0
  9. data/lib/tmdby/response.rb +17 -0
  10. data/lib/tmdby/setup.rb +0 -0
  11. data/lib/tmdby/version.rb +3 -0
  12. data/lib/tmdby/wrapper.rb +62 -0
  13. data/lib/tmdby/wrappers/account.rb +103 -0
  14. data/lib/tmdby/wrappers/authentication.rb +32 -0
  15. data/lib/tmdby/wrappers/certifications.rb +15 -0
  16. data/lib/tmdby/wrappers/changes.rb +31 -0
  17. data/lib/tmdby/wrappers/collections.rb +20 -0
  18. data/lib/tmdby/wrappers/companies.rb +19 -0
  19. data/lib/tmdby/wrappers/configuration.rb +11 -0
  20. data/lib/tmdby/wrappers/credits.rb +13 -0
  21. data/lib/tmdby/wrappers/discover.rb +27 -0
  22. data/lib/tmdby/wrappers/find.rb +21 -0
  23. data/lib/tmdby/wrappers/genres.rb +27 -0
  24. data/lib/tmdby/wrappers/guest_sessions.rb +13 -0
  25. data/lib/tmdby/wrappers/jobs.rb +11 -0
  26. data/lib/tmdby/wrappers/keywords.rb +18 -0
  27. data/lib/tmdby/wrappers/lists.rb +67 -0
  28. data/lib/tmdby/wrappers/movies.rb +143 -0
  29. data/lib/tmdby/wrappers/networks.rb +11 -0
  30. data/lib/tmdby/wrappers/people.rb +71 -0
  31. data/lib/tmdby/wrappers/reviews.rb +11 -0
  32. data/lib/tmdby/wrappers/search.rb +71 -0
  33. data/lib/tmdby/wrappers/timezones.rb +11 -0
  34. data/lib/tmdby/wrappers/tv.rb +131 -0
  35. data/lib/tmdby/wrappers/tv_episodes.rb +63 -0
  36. data/lib/tmdby/wrappers/tv_seasons.rb +54 -0
  37. data/lib/tmdby.rb +47 -0
  38. data/tests/credentials.rb +7 -0
  39. data/tests/minitest/client_test.rb +60 -0
  40. data/tests/minitest/setup_test.rb +35 -0
  41. data/tests/minitest/wrapper_test.rb +64 -0
  42. data/tests/minitest/wrappers/account_test.rb +100 -0
  43. data/tests/minitest/wrappers/authentication_test.rb +50 -0
  44. data/tests/minitest/wrappers/certifications_test.rb +27 -0
  45. data/tests/minitest/wrappers/changes_test.rb +34 -0
  46. data/tests/minitest/wrappers/collections_test.rb +29 -0
  47. data/tests/minitest/wrappers/companies_test.rb +32 -0
  48. data/tests/minitest/wrappers/credits_test.rb +22 -0
  49. data/tests/minitest/wrappers/discover_test.rb +26 -0
  50. data/tests/minitest/wrappers/find_test.rb +18 -0
  51. data/tests/minitest/wrappers/genres_test.rb +35 -0
  52. data/tests/minitest/wrappers/guest_sessions_test.rb +20 -0
  53. data/tests/minitest/wrappers/jobs_test.rb +18 -0
  54. data/tests/minitest/wrappers/keywords_test.rb +27 -0
  55. data/tests/minitest/wrappers/lists_test.rb +124 -0
  56. data/tests/minitest/wrappers/minitest_wrapper.rb +40 -0
  57. data/tests/minitest/wrappers/movies_test.rb +177 -0
  58. data/tests/minitest/wrappers/networks_test.rb +18 -0
  59. data/tests/minitest/wrappers/people_test.rb +99 -0
  60. data/tests/minitest/wrappers/reviews_test.rb +18 -0
  61. data/tests/minitest/wrappers/search_test.rb +74 -0
  62. data/tests/minitest/wrappers/timezones_test.rb +21 -0
  63. data/tests/minitest/wrappers/tv_episodes_test.rb +87 -0
  64. data/tests/minitest/wrappers/tv_seasons_test.rb +76 -0
  65. data/tests/minitest/wrappers/tv_test.rb +171 -0
  66. data/tests/minitest_all.rb +13 -0
  67. data/tmdby.gemspec +24 -0
  68. metadata +152 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 52b4a16f72493c3a91c4c59b4f631b6317c4732d
4
+ data.tar.gz: 90ae3ecd556dccf5ed7562a64f53d83ad26b9b83
5
+ SHA512:
6
+ metadata.gz: e29b083591ffef57db46c09768be50d5a55f0394e019f6242ce56d58b8bce0586c368bc539bf06e8e84ad7b868021114faf7d8b1da8344232ae946ddff9aad10
7
+ data.tar.gz: 12f29f943c0556884bae5ead3d87a1028675cc9c15bbbae15fbf5211d6e6438a767a21ce7c6451c883a29e52faad8f207debc7fe8968b022e5e22285594672ad
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "minitest"
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Tmdby
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'tmdby'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install tmdby
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/tmdby/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,43 @@
1
+ require "net/http"
2
+ require 'uri'
3
+ require_relative 'response'
4
+
5
+ module Tmdby
6
+ class Client
7
+ @@netloc = "api.themoviedb.org/3"
8
+
9
+ # Returns complete api route to call
10
+ def self.get_uri(api_route, params = {})
11
+ params["api_key"] = Tmdby::Setup.key
12
+
13
+ URI("#{Tmdby::Setup.api_scheme}://#{@@netloc}/#{api_route}?#{URI.encode_www_form(params)}")
14
+ end
15
+
16
+
17
+ def self.api_call(method_call, api_route, params = {}, post_params = {})
18
+ if Tmdby::Setup.key
19
+ uri = self.get_uri api_route, params
20
+ # puts "[#{method_call}] #{uri}"
21
+
22
+ case method_call
23
+ when "get"
24
+ response = Net::HTTP.get_response(uri)
25
+ when "post"
26
+ response = Net::HTTP.post_form(uri, post_params)
27
+ when "delete"
28
+ response = Net::HTTP.new(uri.host, uri.port).delete("#{uri.path}?#{uri.query}")
29
+ else
30
+ raise RuntimeError, "An error has occured : \"#{method_call}\" is unknown method_call"
31
+ end
32
+
33
+ if response.is_a? Net::HTTPSuccess
34
+ Tmdby::Response.new(response, uri, method_call, post_params)
35
+ else
36
+ raise RuntimeError, "An error has occured : #{response.body}"
37
+ end
38
+ else
39
+ raise RuntimeError, 'An error has occured : please specify TMDB API KEY'
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,17 @@
1
+ module Tmdby
2
+ class Authentication
3
+
4
+ # Generate a session id using TMDB credentials
5
+ def self.get_session_id(username, password)
6
+ begin
7
+ token = self.token_new.body["request_token"]
8
+ self.token_validate_with_login token, username, password
9
+
10
+ return (self.session_new token).body["session_id"]
11
+ rescue
12
+ return false
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+
3
+ module Tmdby
4
+ class Response
5
+ attr_reader :code, :raw_body, :body, :headers, :uri, :http_verb, :post_params
6
+
7
+ def initialize(response, uri, http_verb, post_params)
8
+ @code = response.code
9
+ @headers = response.to_hash
10
+ @raw_body = response.body
11
+ @body = JSON.parse(response.body)
12
+ @uri = uri
13
+ @http_verb = http_verb.upcase
14
+ @post_params = post_params
15
+ end
16
+ end
17
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ module Tmdby
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,62 @@
1
+ module Tmdby
2
+ class Wrapper
3
+ class << self
4
+ attr_accessor :root, :params, :clean_params, :post_params
5
+ end
6
+
7
+ # Compute api route
8
+ def self.route(route)
9
+ route = route.to_s if route.is_a? Integer
10
+
11
+ if @root and not @root.empty? and not route.empty?
12
+ "#{@root}/#{route}"
13
+ else
14
+ "#{@root}#{route}"
15
+ end
16
+ end
17
+
18
+ # Verify that every parameter is allowed by the api
19
+ def self.verify_params(authorized)
20
+ @params.each do |key, _|
21
+ raise RuntimeError, "Unknown argument : #{key}\nAuthorized arguments : #{authorized.join(', ')}" if not authorized.include? key.to_s
22
+ end
23
+ end
24
+
25
+ # Add default language to parameters if it has been setted
26
+ def self.add_default_language
27
+ default_language = Tmdby::Setup.default_language
28
+
29
+ if default_language && !@params.key?('language') && !@params.key?(:language)
30
+ @params['language'] = default_language
31
+ end
32
+ end
33
+
34
+ # Dispatch params in 2 hashes : one for api url parameters, another on for api post parameters
35
+ def self.handle_post_params(post_param_names)
36
+ @clean_params = {}
37
+ @post_params = {}
38
+
39
+ @params.each do |k, v|
40
+ if post_param_names.include?k or post_param_names.include?k.to_s
41
+ @post_params[k.to_s] = v if v
42
+ else
43
+ @clean_params[k.to_s] = v if v
44
+ end
45
+ end
46
+ end
47
+
48
+ #
49
+ def self.fetch(route = "", *args, method: "get", post_params: [], authorized_params: [], disable_unknown_params: false, **params)
50
+ @params = params
51
+ @params.merge!(args[0]) if not args.empty?
52
+
53
+ self.add_default_language if authorized_params.include?'language'
54
+ self.verify_params authorized_params unless disable_unknown_params or authorized_params.include?"append_to_response"
55
+ self.handle_post_params post_params
56
+
57
+ Tmdby::Client.api_call method, self.route(route), @clean_params, @post_params
58
+ end
59
+
60
+
61
+ end
62
+ end
@@ -0,0 +1,103 @@
1
+ module Tmdby
2
+ class Account < Wrapper
3
+
4
+ @root = "account"
5
+
6
+ # Get the basic information for an account.
7
+ def self.get(session_id)
8
+ self.fetch "",
9
+ session_id: session_id,
10
+ authorized_params: ["session_id"]
11
+ end
12
+
13
+ # Get the lists that you have created and marked as a favorite.
14
+ def self.lists(id, session_id, optional_params = {})
15
+ self.fetch "#{id}/lists",
16
+ optional_params,
17
+ session_id: session_id,
18
+ authorized_params: ['session_id', 'page', 'language']
19
+ end
20
+
21
+ # Get the list of favorite movies for an account.
22
+ def self.favorite_movies(id, session_id, optional_params = {})
23
+ self.fetch "#{id}/favorite/movies",
24
+ optional_params,
25
+ session_id: session_id,
26
+ authorized_params: ['session_id', 'page', 'language', 'sort_by']
27
+ end
28
+
29
+ # Get the list of favorite TV series for an account.
30
+ def self.favorite_tv(id, session_id, optional_params = {})
31
+ self.fetch "#{id}/favorite/tv",
32
+ optional_params,
33
+ session_id: session_id,
34
+ authorized_params: ['session_id', 'page', 'language', 'sort_by']
35
+ end
36
+
37
+ # Add or remove a movie to an accounts favorite list.
38
+ def self.favorite(id, session_id, media_type, media_id, favorite)
39
+ self.fetch "#{id}/favorite",
40
+ method: 'post',
41
+ session_id: session_id,
42
+ media_type: media_type,
43
+ media_id: media_id,
44
+ favorite: favorite,
45
+ post_params: ["media_type", "media_id", "favorite"],
46
+ authorized_params: ['session_id', "media_type", "media_id", "favorite"]
47
+ end
48
+
49
+ # Get the list of rated movies (and associated rating) for an account.
50
+ def self.rated_movies(id, session_id, optional_params = {})
51
+ self.fetch "#{id}/rated/movies",
52
+ optional_params,
53
+ session_id: session_id,
54
+ authorized_params: ['session_id', 'page', 'language', 'sort_by']
55
+ end
56
+
57
+ # Get the list of rated TV shows (and associated rating) for an account.
58
+ def self.rated_tv(id, session_id, optional_params = {})
59
+ self.fetch "#{id}/rated/tv",
60
+ optional_params,
61
+ session_id: session_id,
62
+ authorized_params: ['session_id', 'page', 'language', 'sort_by']
63
+ end
64
+
65
+ # Get the list of rated tv episodes (and associated rating) for an account.
66
+ def self.rated_tv_episodes(id, session_id, optional_params = {})
67
+ self.fetch "#{id}/rated/tv/episodes",
68
+ optional_params,
69
+ session_id: session_id,
70
+ authorized_params: ['session_id', 'page', 'language', 'sort_by']
71
+ end
72
+
73
+ # Get the list of movies on an accounts watchlist.
74
+ def self.watchlist_movies(id, session_id, optional_params = {})
75
+ self.fetch "#{id}/watchlist/movies",
76
+ optional_params,
77
+ session_id: session_id,
78
+ authorized_params: ['session_id', 'page', 'language', 'sort_by']
79
+ end
80
+
81
+ # Get the list of TV series on an accounts watchlist.
82
+ def self.watchlist_tv(id, session_id, optional_params = {})
83
+ self.fetch "#{id}/watchlist/tv",
84
+ optional_params,
85
+ session_id: session_id,
86
+ authorized_params: ['session_id', 'page', 'language', 'sort_by']
87
+ end
88
+
89
+ # Add or remove a movie to an accounts watch list.
90
+ def self.watchlist(id, session_id, media_type, media_id, watchlist)
91
+ self.fetch "#{id}/watchlist",
92
+ method: 'post',
93
+ session_id: session_id,
94
+ media_type: media_type,
95
+ media_id: media_id,
96
+ watchlist: watchlist,
97
+ post_params: ["media_type", "media_id", "watchlist"],
98
+ authorized_params: ['session_id', "media_type", "media_id", "watchlist"]
99
+ end
100
+
101
+
102
+ end
103
+ end
@@ -0,0 +1,32 @@
1
+ module Tmdby
2
+ class Authentication < Wrapper
3
+
4
+ @root = "authentication"
5
+
6
+ # This method is used to generate a valid request token for user based authentication.
7
+ def self.token_new
8
+ self.fetch "token/new"
9
+ end
10
+
11
+ # Once you have a valid request token you can use this method to authenticate a user with a TMDb username and password.
12
+ def self.token_validate_with_login(request_token, username, password)
13
+ self.fetch "token/validate_with_login",
14
+ request_token: request_token,
15
+ username: username,
16
+ password: password,
17
+ authorized_params: ["request_token", "username", "password"]
18
+ end
19
+
20
+ # This method is used to generate a session id for user based authentication.
21
+ def self.session_new(request_token)
22
+ self.fetch "session/new",
23
+ request_token: request_token,
24
+ authorized_params: ["request_token"]
25
+ end
26
+
27
+ # This method is used to generate a guest session id.
28
+ def self.guest_session_new
29
+ self.fetch "guest_session/new"
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,15 @@
1
+ module Tmdby
2
+ class Certifications < Wrapper
3
+ @root = 'certification'
4
+
5
+ # Get the list of supported certifications for movies
6
+ def self.movie_list
7
+ self.fetch "movie/list"
8
+ end
9
+
10
+ # Get the list of supported certifications for tv shows
11
+ def self.tv_list
12
+ self.fetch "tv/list"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,31 @@
1
+ module Tmdby
2
+ class Changes < Wrapper
3
+
4
+ # Get a list of movie ids that have been edited
5
+ # Authorized params : page | start_date | end_date
6
+ # Example : Tmdby::Changes.movie_changes page:2
7
+ def self.movie(optional_params = {})
8
+ self.fetch "movie/changes",
9
+ optional_params,
10
+ authorized_params: ['page', 'start_date', 'end_date']
11
+ end
12
+
13
+ # Get a list of people ids that have been edited
14
+ # Authorized params : page | start_date | end_date
15
+ # Example : Tmdby::Changes.person_changes page:2
16
+ def self.person(optional_params = {})
17
+ self.fetch "person/changes",
18
+ optional_params,
19
+ authorized_params: ['page', 'start_date', 'end_date']
20
+ end
21
+
22
+ # Get a list of TV show ids that have been edited
23
+ # Authorized params : page | start_date | end_date
24
+ # Example : Tmdby::Changes.tv_changes page:2
25
+ def self.tv(optional_params = {})
26
+ self.fetch "tv/changes",
27
+ optional_params,
28
+ authorized_params: ['page', 'start_date', 'end_date']
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,20 @@
1
+ module Tmdby
2
+ class Collections < Wrapper
3
+
4
+ @root = "collection"
5
+
6
+ # Get the basic collection information for a specific collection id.
7
+ def self.get(id, optional_params = {})
8
+ self.fetch id,
9
+ optional_params,
10
+ authorized_params: ["language", "append_to_response"]
11
+ end
12
+
13
+ # Get all of the images for a particular collection by collection id.
14
+ def self.images(id, optional_params = {})
15
+ self.fetch "#{id}/images",
16
+ optional_params,
17
+ authorized_params: ["language","append_to_response", "include_image_language"]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ module Tmdby
2
+ class Companies < Wrapper
3
+
4
+ @root = "company"
5
+
6
+ # This method is used to retrieve all of the basic information about a company.
7
+ def self.get(id, optional_params = {})
8
+ self.fetch id,
9
+ optional_params,
10
+ authorized_params: ["append_to_response"]
11
+ end
12
+
13
+ def self.movies(id, optional_params = {})
14
+ self.fetch "#{id}/movies",
15
+ optional_params,
16
+ authorized_params: ["page", "language", "append_to_response"]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ module Tmdby
2
+ class Configuration < Wrapper
3
+ @root = 'configuration'
4
+
5
+ # Get the system wide configuration information
6
+ # API reference : Updated on Dec. 13, 2013
7
+ def self.get()
8
+ self.fetch
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ module Tmdby
2
+ class Credits < Wrapper
3
+
4
+ @root = 'credit'
5
+
6
+ # Get the detailed information about a particular credit record
7
+ def self.get(credit_id, optional_params = {})
8
+ self.fetch credit_id,
9
+ optional_params,
10
+ authorized_params: ["language"]
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,27 @@
1
+ module Tmdby
2
+ class Discover < Wrapper
3
+
4
+ @root = "discover"
5
+
6
+ # Discover movies by different types of data like average rating, number of votes, genres and certifications.
7
+ def self.movie(optional_params = {})
8
+ self.fetch "movie",
9
+ optional_params,
10
+ authorized_params: [ "certification_country", "certification", "certification.lte", "include_adult", "include_video",
11
+ "language", "page", "primary_release_year", "primary_release_date.gte", "primary_release_date.lte",
12
+ "release_date.gte", "release_date.lte", "sort_by", "vote_count.gte", "vote_count.lte",
13
+ "vote_average.gte", "vote_average.lte", "with_cast", "with_crew", "with_companies",
14
+ "with_genres", "with_keywords", "with_people", "year"
15
+ ]
16
+ end
17
+
18
+ # Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates.
19
+ def self.tv(optional_params = {})
20
+ self.fetch "tv",
21
+ optional_params,
22
+ authorized_params: [ "page", "language", "sort_by", "first_air_date_year", "vote_count.gte",
23
+ "vote_average.gte", "with_genres", "with_networks", "first_air_date.gte", "first_air_date.lte"
24
+ ]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ module Tmdby
2
+ class Find < Wrapper
3
+
4
+ @root = 'find'
5
+
6
+ # The find method makes it easy to search for objects in our database by an external id
7
+ #
8
+ # The supported external sources for each object are as follows:
9
+ # Movies: imdb_id
10
+ # People: imdb_id, freebase_mid, freebase_id, tvrage_id
11
+ # TVSeries: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id
12
+ # TVSeasons: freebase_mid, freebase_id, tvdb_id, tvrage_id
13
+ # TVEpisodes: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id
14
+ def self.get(id, external_source, optional_params = {})
15
+ self.fetch id,
16
+ optional_params,
17
+ external_source: external_source,
18
+ authorized_params: ["external_source", "language"]
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ module Tmdby
2
+ class Genres < Wrapper
3
+
4
+ @root = "genre"
5
+
6
+ # Get the list of movie genres.
7
+ def self.movie_list(optional_params = {})
8
+ self.fetch 'movie/list',
9
+ optional_params,
10
+ authorized_params: ["language"]
11
+ end
12
+
13
+ # Get the list of TV genres.
14
+ def self.tv_list(optional_params = {})
15
+ self.fetch 'tv/list',
16
+ optional_params,
17
+ authorized_params: ["language"]
18
+ end
19
+
20
+ # Get the list of movies for a particular genre by id. By default, only movies with 10 or more votes are included.
21
+ def self.movies(id, optional_params = {})
22
+ self.fetch "#{id}/movies",
23
+ optional_params,
24
+ authorized_params: ["page", "language", "include_all_movies", "include_adult"]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,13 @@
1
+ module Tmdby
2
+ class GuestSessions < Wrapper
3
+
4
+ @root = "guest_session"
5
+
6
+ # Get a list of rated movies for a specific guest session id.
7
+ def self.rated_movies(guest_session_id, optional_params = {})
8
+ self.fetch "#{guest_session_id}/rated_movies",
9
+ optional_params,
10
+ authorized_params: ["page", "language", "sort_by", "sort_order"]
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module Tmdby
2
+ class Jobs < Wrapper
3
+
4
+ @root = 'job'
5
+
6
+ # Get a list of valid jobs
7
+ def self.list
8
+ self.fetch "list"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ module Tmdby
2
+ class Keywords < Wrapper
3
+
4
+ @root = "keyword"
5
+
6
+ # Get the basic information for a specific keyword id.
7
+ def self.get(id)
8
+ self.fetch id
9
+ end
10
+
11
+ # Get the list of movies for a particular keyword by id.
12
+ def self.movies(id, optional_params = {})
13
+ self.fetch "#{id}/movies",
14
+ optional_params,
15
+ authorized_params: ["page", "language"]
16
+ end
17
+ end
18
+ end