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
@@ -0,0 +1,67 @@
1
+ module Tmdby
2
+ class Lists < Wrapper
3
+
4
+ @root = "list"
5
+
6
+ # Get a list by id.
7
+ def self.get(id)
8
+ self.fetch id
9
+ end
10
+
11
+ # Delete a list by id.
12
+ def self.delete(id, session_id)
13
+ self.fetch id,
14
+ method: "delete",
15
+ session_id: session_id,
16
+ authorized_params: ["session_id"]
17
+ end
18
+
19
+ # Check to see if a movie ID is already added to a list.
20
+ def self.item_status(id, movie_id)
21
+ self.fetch "#{id}/item_status",
22
+ movie_id: movie_id,
23
+ authorized_params: ["movie_id"]
24
+ end
25
+
26
+ # This method lets users create a new list.
27
+ def self.new(session_id, name, description, optional_params = {})
28
+ self.fetch "",
29
+ optional_params,
30
+ method: 'post',
31
+ session_id: session_id,
32
+ name: name,
33
+ description: description,
34
+ post_params: ["name", "description", "language"],
35
+ authorized_params: ["session_id", "name", "description", "language"]
36
+ end
37
+
38
+ # This method lets users add new movies to a list that they created.
39
+ def self.add_item(id, session_id, media_id)
40
+ self.fetch "#{id}/add_item",
41
+ method: 'post',
42
+ media_id: media_id,
43
+ session_id: session_id,
44
+ post_params: ["media_id"],
45
+ authorized_params: ["session_id", "media_id"]
46
+ end
47
+
48
+ # This method lets users delete movies from a list that they created.
49
+ def self.remove_item(id, session_id, media_id)
50
+ self.fetch "#{id}/remove_item",
51
+ method: 'post',
52
+ media_id: media_id,
53
+ session_id: session_id,
54
+ post_params: ["media_id"],
55
+ authorized_params: ["session_id", "media_id"]
56
+ end
57
+
58
+ # Clear all of the items within a list.
59
+ def self.clear(id, session_id, confirm = true)
60
+ self.fetch "#{id}/clear",
61
+ method: 'post',
62
+ session_id: session_id,
63
+ confirm: confirm,
64
+ authorized_params: ["session_id", "confirm"]
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,143 @@
1
+ module Tmdby
2
+ class Movies < Wrapper
3
+
4
+ @root = "movie"
5
+
6
+ # Get the basic movie information for a specific movie 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
+ # This method lets a TMDb user account get the status of whether or not the movie has been rated or added to their favourite or movie watch list.
14
+ def self.account_states(id, session_id)
15
+ self.fetch "#{id}/account_states",
16
+ session_id: session_id,
17
+ authorized_params: ["session_id"]
18
+ end
19
+
20
+ # Get the alternative titles for a specific movie id.
21
+ def self.alternative_titles(id, optional_params = {})
22
+ self.fetch "#{id}/alternative_titles",
23
+ optional_params,
24
+ authorized_params: ["country", "append_to_response"]
25
+ end
26
+
27
+ # Get the cast and crew information for a specific movie id.
28
+ def self.credits(id, optional_params = {})
29
+ self.fetch "#{id}/credits",
30
+ optional_params,
31
+ authorized_params: ["append_to_response"]
32
+ end
33
+
34
+ # Get the images (posters and backdrops) for a specific movie id.
35
+ def self.images(id, optional_params = {})
36
+ self.fetch "#{id}/images",
37
+ optional_params,
38
+ authorized_params: ["language", "append_to_response", "include_image_language"]
39
+ end
40
+
41
+ # Get the plot keywords for a specific movie id.
42
+ def self.keywords(id, optional_params = {})
43
+ self.fetch "#{id}/keywords",
44
+ optional_params,
45
+ authorized_params: ["append_to_response"]
46
+ end
47
+
48
+ # Get the release date and certification information by country for a specific movie id.
49
+ def self.releases(id, optional_params = {})
50
+ self.fetch "#{id}/releases",
51
+ optional_params,
52
+ authorized_params: ["append_to_response"]
53
+ end
54
+
55
+ # Get the videos (trailers, teasers, clips, etc...) for a specific movie id.
56
+ def self.videos(id, optional_params = {})
57
+ self.fetch "#{id}/videos",
58
+ optional_params,
59
+ authorized_params: ["language", "append_to_response"]
60
+ end
61
+
62
+ # Get the translations for a specific movie id.
63
+ def self.translations(id, optional_params = {})
64
+ self.fetch "#{id}/translations",
65
+ optional_params,
66
+ authorized_params: ["append_to_response"]
67
+ end
68
+
69
+ # Get the similar movies for a specific movie id.
70
+ def self.similar(id, optional_params = {})
71
+ self.fetch "#{id}/similar",
72
+ optional_params,
73
+ authorized_params: ["page", "language", "append_to_response"]
74
+ end
75
+
76
+ # Get the reviews for a particular movie id.
77
+ def self.reviews(id, optional_params = {})
78
+ self.fetch "#{id}/reviews",
79
+ optional_params,
80
+ authorized_params: ["page", "language", "append_to_response"]
81
+ end
82
+
83
+ # Get the lists that the movie belongs to.
84
+ def self.lists(id, optional_params = {})
85
+ self.fetch "#{id}/lists",
86
+ optional_params,
87
+ authorized_params: ["page", "language", "append_to_response"]
88
+ end
89
+
90
+ # Get the changes for a specific movie id.
91
+ def self.changes(id, optional_params = {})
92
+ self.fetch "#{id}/changes",
93
+ optional_params,
94
+ authorized_params: ["start_date", "end_date"]
95
+ end
96
+
97
+ # This method lets users rate a movie.
98
+ def self.rating(id, value, session_id, guest_session_id = nil)
99
+ self.fetch "#{id}/rating",
100
+ method: 'post',
101
+ value: value,
102
+ session_id: session_id,
103
+ guest_session_id: guest_session_id,
104
+ post_params: ["value"],
105
+ authorized_params: ["session_id", "guest_session_id", "value"]
106
+ end
107
+
108
+ # Get the latest movie id.
109
+ def self.latest
110
+ self.fetch "latest"
111
+ end
112
+
113
+ # Get the list of upcoming movies by release date.
114
+ def self.upcoming(optional_params = {})
115
+ self.fetch "upcoming",
116
+ optional_params,
117
+ authorized_params: ["page", "language"]
118
+ end
119
+
120
+ # Get the list of movies playing that have been, or are being released this week.
121
+ def self.now_playing(optional_params = {})
122
+ self.fetch "now_playing",
123
+ optional_params,
124
+ authorized_params: ["page", "language"]
125
+ end
126
+
127
+ # Get the list of popular movies on The Movie Database.
128
+ def self.popular(optional_params = {})
129
+ self.fetch "popular",
130
+ optional_params,
131
+ authorized_params: ["page", "language"]
132
+ end
133
+
134
+ # Get the list of top rated movies.
135
+ def self.top_rated(optional_params = {})
136
+ self.fetch "top_rated",
137
+ optional_params,
138
+ authorized_params: ["page", "language"]
139
+ end
140
+
141
+
142
+ end
143
+ end
@@ -0,0 +1,11 @@
1
+ module Tmdby
2
+ class Networks < Wrapper
3
+
4
+ @root = "network"
5
+
6
+ # This method is used to retrieve the basic information about a TV network
7
+ def self.get(id)
8
+ self.fetch id
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,71 @@
1
+ module Tmdby
2
+ class People < Wrapper
3
+
4
+ @root = "person"
5
+
6
+ # Get the general person information for a specific id.
7
+ def self.get(id, optional_params = {})
8
+ self.fetch id,
9
+ optional_params,
10
+ authorized_params: ["append_to_response"]
11
+ end
12
+
13
+ # Get the movie credits for a specific person id.
14
+ def self.movie_credits(id, optional_params = {})
15
+ self.fetch "#{id}/movie_credits",
16
+ optional_params,
17
+ authorized_params: ["language", "append_to_response"]
18
+ end
19
+
20
+ # Get the TV credits for a specific person id.
21
+ def self.tv_credits(id, optional_params = {})
22
+ self.fetch "#{id}/tv_credits",
23
+ optional_params,
24
+ authorized_params: ["language", "append_to_response"]
25
+ end
26
+
27
+ # Get the combined (movie and TV) credits for a specific person id.
28
+ def self.combined_credits(id, optional_params = {})
29
+ self.fetch "#{id}/combined_credits",
30
+ optional_params,
31
+ authorized_params: ["language", "append_to_response"]
32
+ end
33
+
34
+ # Get the external ids for a specific person id.
35
+ def self.external_ids(id)
36
+ self.fetch "#{id}/external_ids"
37
+ end
38
+
39
+ # Get the images for a specific person id.
40
+ def self.images(id)
41
+ self.fetch "#{id}/images"
42
+ end
43
+
44
+ # Get the images that have been tagged with a specific person id.
45
+ def self.tagged_images(id, optional_params = {})
46
+ self.fetch "#{id}/tagged_images",
47
+ optional_params,
48
+ authorized_params: ["language", "page"]
49
+ end
50
+
51
+ # Get the changes for a specific person id.
52
+ def self.changes(id, optional_params = {})
53
+ self.fetch "#{id}/changes",
54
+ optional_params,
55
+ authorized_params: ["start_date", "end_date"]
56
+ end
57
+
58
+ # Get the list of popular people on The Movie Database.
59
+ def self.popular(optional_params = {})
60
+ self.fetch "popular",
61
+ optional_params,
62
+ authorized_params: ["page"]
63
+ end
64
+
65
+ # Get the latest person id.
66
+ def self.latest
67
+ self.fetch "latest"
68
+ end
69
+
70
+ end
71
+ end
@@ -0,0 +1,11 @@
1
+ module Tmdby
2
+ class Reviews < Wrapper
3
+
4
+ @root = "review"
5
+
6
+ # Get the full details of a review by ID
7
+ def self.get(id)
8
+ self.fetch id
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,71 @@
1
+ module Tmdby
2
+ class Search < Wrapper
3
+
4
+ @root = "search"
5
+
6
+ # Search for companies by name.
7
+ def self.company(query, optional_params = {})
8
+ self.fetch "company",
9
+ optional_params,
10
+ query: query,
11
+ authorized_params: ["query", "page"]
12
+ end
13
+
14
+ # Search for collections by name.
15
+ def self.collection(query, optional_params = {})
16
+ self.fetch "collection",
17
+ optional_params,
18
+ query: query,
19
+ authorized_params: ["query", "page", "language"]
20
+ end
21
+
22
+ # Search for keywords by name.
23
+ def self.keyword(query, optional_params = {})
24
+ self.fetch "keyword",
25
+ optional_params,
26
+ query: query,
27
+ authorized_params: ["query", "page"]
28
+ end
29
+
30
+ # Search for lists by name and description.
31
+ def self.list(query, optional_params = {})
32
+ self.fetch "list",
33
+ optional_params,
34
+ query: query,
35
+ authorized_params: ["query", "page", "include_adult"]
36
+ end
37
+
38
+ # Search for movies by title.
39
+ def self.movie(query, optional_params = {})
40
+ self.fetch "movie",
41
+ optional_params,
42
+ query: query,
43
+ authorized_params: ["query", "page", "language", "include_adult", "year", "primary_release_year", "search_type"]
44
+ end
45
+
46
+ # Search the movie, tv show and person collections with a single query.
47
+ def self.multi(query, optional_params = {})
48
+ self.fetch "multi",
49
+ optional_params,
50
+ query: query,
51
+ authorized_params: ["query", "page", "language", "include_adult"]
52
+ end
53
+
54
+ # Search for people by name.
55
+ def self.person(query, optional_params = {})
56
+ self.fetch "person",
57
+ optional_params,
58
+ query: query,
59
+ authorized_params: ["query", "page", "include_adult", "search_type"]
60
+ end
61
+
62
+ # Search for TV shows by title.
63
+ def self.tv(query, optional_params = {})
64
+ self.fetch "tv",
65
+ optional_params,
66
+ query: query,
67
+ authorized_params: ["query", "page", "language", "first_aid_date_year", "search_type"]
68
+ end
69
+
70
+ end
71
+ end
@@ -0,0 +1,11 @@
1
+ module Tmdby
2
+ class Timezones < Wrapper
3
+
4
+ @root = "timezones"
5
+
6
+ # Get the list of supported timezones for the API methods that support them
7
+ def self.list
8
+ self.fetch "list"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,131 @@
1
+ module Tmdby
2
+ class Tv < Wrapper
3
+
4
+ @root = "tv"
5
+
6
+ # Get the primary information about a TV series by 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
+ # This method lets users get the status of whether or not the TV show has been rated or added to their favourite or watch lists.
14
+ def self.account_states(id, session_id)
15
+ self.fetch "#{id}/account_states",
16
+ session_id: session_id,
17
+ authorized_params: ["session_id"]
18
+ end
19
+
20
+ # Get the alternative titles for a specific show ID.
21
+ def self.alternative_titles(id, optional_params = {})
22
+ self.fetch "#{id}/alternative_titles",
23
+ optional_params,
24
+ authorized_params: ["country", "append_to_response"]
25
+ end
26
+
27
+ # Get the changes for a specific TV show id.
28
+ def self.changes(id, optional_params = {})
29
+ self.fetch "#{id}/changes",
30
+ optional_params,
31
+ authorized_params: ["start_date", "end_date"]
32
+ end
33
+
34
+ # Get the content ratings for a specific TV show id.
35
+ def self.content_ratings(id)
36
+ self.fetch "#{id}/content_ratings"
37
+ end
38
+
39
+ # Get the cast & crew information about a TV series.
40
+ def self.credits(id, optional_params = {})
41
+ self.fetch "#{id}/credits",
42
+ optional_params,
43
+ authorized_params: ["append_to_response"]
44
+ end
45
+
46
+ # Get the external ids that we have stored for a TV series.
47
+ def self.external_ids(id, optional_params = {})
48
+ self.fetch "#{id}/external_ids",
49
+ optional_params,
50
+ authorized_params: ["language"]
51
+ end
52
+
53
+ # Get the images (posters and backdrops) for a TV series.
54
+ def self.images(id, optional_params = {})
55
+ self.fetch "#{id}/images",
56
+ optional_params,
57
+ authorized_params: ["language", "include_image_language"]
58
+ end
59
+
60
+ # Get the plot keywords for a specific TV show id.
61
+ def self.keywords(id, optional_params = {})
62
+ self.fetch "#{id}/keywords",
63
+ optional_params,
64
+ authorized_params: ["append_to_response"]
65
+ end
66
+
67
+ # This method lets users rate a TV show.
68
+ def self.rating(id, value, session_id, guest_session_id = nil)
69
+ self.fetch "#{id}/rating",
70
+ method: 'post',
71
+ value: value,
72
+ session_id: session_id,
73
+ guest_session_id: guest_session_id,
74
+ post_params: ["value"],
75
+ authorized_params: ["session_id", "guest_session_id", "value"]
76
+ end
77
+
78
+ # Get the similar TV shows for a specific tv id.
79
+ def self.similar(id, optional_params = {})
80
+ self.fetch "#{id}/similar",
81
+ optional_params,
82
+ authorized_params: ["page", "language", "append_to_response"]
83
+ end
84
+
85
+ # Get the list of translations that exist for a TV series.
86
+ def self.translations(id)
87
+ self.fetch "#{id}/translations"
88
+ end
89
+
90
+ # Get the videos that have been added to a TV series (trailers, opening credits, etc...)
91
+ def self.videos(id, optional_params = {})
92
+ self.fetch "#{id}/videos",
93
+ optional_params,
94
+ authorized_params: ["language"]
95
+ end
96
+
97
+ # Get the latest TV show id.
98
+ def self.latest
99
+ self.fetch "latest"
100
+ end
101
+
102
+ # Get the list of TV shows that are currently on the air.
103
+ def self.on_the_air(optional_params = {})
104
+ self.fetch "on_the_air",
105
+ optional_params,
106
+ authorized_params: ["page", "language"]
107
+ end
108
+
109
+ # Get the list of TV shows that air today.
110
+ def self.airing_today(optional_params = {})
111
+ self.fetch "airing_today",
112
+ optional_params,
113
+ authorized_params: ["page", "language", "timezone"]
114
+ end
115
+
116
+ # Get the list of top rated TV shows.
117
+ def self.top_rated(optional_params = {})
118
+ self.fetch "top_rated",
119
+ optional_params,
120
+ authorized_params: ["page", "language"]
121
+ end
122
+
123
+ # Get the list of popular TV shows.
124
+ def self.popular(optional_params = {})
125
+ self.fetch "popular",
126
+ optional_params,
127
+ authorized_params: ["page", "language"]
128
+ end
129
+
130
+ end
131
+ end
@@ -0,0 +1,63 @@
1
+ module Tmdby
2
+ class TvEpisodes < Wrapper
3
+
4
+ @root = "tv"
5
+
6
+ # Get the primary information about a TV episode by combination of a season and episode number.
7
+ def self.get(id, season_number, episode_number, optional_params = {})
8
+ self.fetch "#{id}/season/#{season_number}/episode/#{episode_number}",
9
+ optional_params,
10
+ authorized_params: ["language", "append_to_response"]
11
+ end
12
+
13
+ # Look up a TV episode's changes by episode ID.
14
+ def self.changes(id, optional_params = {})
15
+ self.fetch "episode/#{id}/changes",
16
+ optional_params,
17
+ authorized_params: ["start_date", "end_date"]
18
+ end
19
+
20
+ # This method lets users get the status of whether or not the TV episode has been rated.
21
+ def self.account_states(id, season_number, episode_number, session_id)
22
+ self.fetch "#{id}/season/#{season_number}/episode/#{episode_number}/account_states",
23
+ session_id: session_id,
24
+ authorized_params: ["session_id"]
25
+ end
26
+
27
+ # Get the TV episode credits by combination of season and episode number.
28
+ def self.credits(id, season_number, episode_number)
29
+ self.fetch "#{id}/season/#{season_number}/episode/#{episode_number}/credits"
30
+ end
31
+
32
+ # Get the external ids for a TV episode by comabination of a season and episode number.
33
+ def self.external_ids(id, season_number, episode_number, optional_params = {})
34
+ self.fetch "#{id}/season/#{season_number}/episode/#{episode_number}/external_ids",
35
+ optional_params,
36
+ authorized_params: ["language"]
37
+ end
38
+
39
+ # Get the images (episode stills) for a TV episode by combination of a season and episode number.
40
+ def self.images(id, season_number, episode_number)
41
+ self.fetch "#{id}/season/#{season_number}/episode/#{episode_number}/images"
42
+ end
43
+
44
+ # This method lets users rate a TV episode.
45
+ def self.rating(id, season_number, episode_number, value, session_id, guest_session_id = nil)
46
+ self.fetch "#{id}/season/#{season_number}/episode/#{episode_number}/rating",
47
+ method: 'post',
48
+ value: value,
49
+ session_id: session_id,
50
+ guest_session_id: guest_session_id,
51
+ post_params: ["value"],
52
+ authorized_params: ["session_id", "guest_session_id", "value"]
53
+ end
54
+
55
+ # Get the videos that have been added to a TV episode (teasers, clips, etc...)
56
+ def self.videos(id, season_number, episode_number, optional_params = {})
57
+ self.fetch "#{id}/season/#{season_number}/episode/#{episode_number}/videos",
58
+ optional_params,
59
+ authorized_params: ["language"]
60
+ end
61
+
62
+ end
63
+ end
@@ -0,0 +1,54 @@
1
+ module Tmdby
2
+ class TvSeasons < Wrapper
3
+
4
+ @root = "tv"
5
+
6
+ # Get the primary information about a TV season by its season number.
7
+ def self.get(id, season_id, optional_params = {})
8
+ self.fetch "#{id}/season/#{season_id}",
9
+ optional_params,
10
+ authorized_params: ["language", "append_to_response"]
11
+ end
12
+
13
+ # Look up a TV season's changes by season ID.
14
+ def self.changes(id, optional_params = {})
15
+ self.fetch "season/#{id}/changes",
16
+ optional_params,
17
+ authorized_params: ["start_date", "end_date"]
18
+ end
19
+
20
+ # This method lets users get the status of whether or not the TV episodes of a season have been rated.
21
+ def self.account_states(id, season_number, session_id)
22
+ self.fetch "#{id}/season/#{season_number}/account_states",
23
+ session_id: session_id,
24
+ authorized_params: ["session_id"]
25
+ end
26
+
27
+ # Get the cast & crew credits for a TV season by season number.
28
+ def self.credits(id, season_number)
29
+ self.fetch "#{id}/season/#{season_number}/credits"
30
+ end
31
+
32
+ # Get the primary information about a TV season by its season number.
33
+ def self.external_ids(id, season_number, optional_params = {})
34
+ self.fetch "#{id}/season/#{season_number}/external_ids",
35
+ optional_params,
36
+ authorized_params: ["external_ids"]
37
+ end
38
+
39
+ # Get the images (posters) that we have stored for a TV season by season number.
40
+ def self.images(id, season_number, optional_params = {})
41
+ self.fetch "#{id}/season/#{season_number}/images",
42
+ optional_params,
43
+ authorized_params: ["language", "include_image_language"]
44
+ end
45
+
46
+ # Get the videos that have been added to a TV season (trailers, teasers, etc...)
47
+ def self.videos(id, season_number, optional_params = {})
48
+ self.fetch "#{id}/season/#{season_number}/videos",
49
+ optional_params,
50
+ authorized_params: ["language"]
51
+ end
52
+
53
+ end
54
+ end
data/lib/tmdby.rb ADDED
@@ -0,0 +1,47 @@
1
+ require "tmdby/version"
2
+
3
+ require_relative 'tmdby/wrapper'
4
+ require_relative 'tmdby/client'
5
+ Dir[File.join(File.dirname(__FILE__), 'tmdby', 'wrappers', '*.rb')].each {|file| require file }
6
+ Dir[File.join(File.dirname(__FILE__), 'tmdby', 'helpers', '*.rb')].each {|file| require file }
7
+
8
+
9
+ module Tmdby
10
+ class Setup
11
+ @@api_key = nil
12
+ @@default_language = nil
13
+ @@api_scheme = 'http'
14
+
15
+ # Set TMDB API Key
16
+ def self.key=(key)
17
+ @@api_key = key
18
+ end
19
+
20
+ def self.key
21
+ @@api_key
22
+ end
23
+
24
+ # Set default language
25
+ def self.default_language=(language)
26
+ @@default_language = language
27
+ end
28
+
29
+ def self.default_language
30
+ @@default_language
31
+ end
32
+
33
+ def self.api_scheme
34
+ @@api_scheme
35
+ end
36
+
37
+ # Set secure mode OFF
38
+ def self.secure=(secure)
39
+ @@api_scheme =
40
+ if not secure
41
+ 'http'
42
+ else
43
+ 'https'
44
+ end
45
+ end
46
+ end
47
+ end