tmdb_ryanstep 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.
- checksums.yaml +7 -0
- data/lib/environment.rb +7 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/requests.rb +163 -0
- data/lib/tmdb_ryanstep/types/account_favorite_movies_request_sort_by.rb +8 -0
- data/lib/tmdb_ryanstep/types/account_favorite_movies_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/account_favorite_movies_response_results_item.rb +169 -0
- data/lib/tmdb_ryanstep/types/account_favorite_tv_request_sort_by.rb +8 -0
- data/lib/tmdb_ryanstep/types/account_favorite_tv_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/account_favorite_tv_response_results_item.rb +167 -0
- data/lib/tmdb_ryanstep/types/account_lists_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/account_lists_response_results_item.rb +183 -0
- data/lib/tmdb_ryanstep/types/account_movie_recommendations_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/account_movie_recommendations_response_results_item.rb +177 -0
- data/lib/tmdb_ryanstep/types/account_movie_watchlist_request_sort_by.rb +8 -0
- data/lib/tmdb_ryanstep/types/account_movie_watchlist_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/account_movie_watchlist_response_results_item.rb +177 -0
- data/lib/tmdb_ryanstep/types/account_rated_movies_request_sort_by.rb +8 -0
- data/lib/tmdb_ryanstep/types/account_rated_movies_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/account_rated_movies_response_results_item.rb +182 -0
- data/lib/tmdb_ryanstep/types/account_rated_movies_response_results_item_account_rating.rb +69 -0
- data/lib/tmdb_ryanstep/types/account_rated_tv_request_sort_by.rb +8 -0
- data/lib/tmdb_ryanstep/types/account_rated_tv_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb +181 -0
- data/lib/tmdb_ryanstep/types/account_rated_tv_response_results_item_account_rating.rb +69 -0
- data/lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/account_tv_recommendations_response_results_item.rb +177 -0
- data/lib/tmdb_ryanstep/types/account_tv_watchlist_request_sort_by.rb +8 -0
- data/lib/tmdb_ryanstep/types/account_tv_watchlist_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/account_tv_watchlist_response_results_item.rb +176 -0
- data/lib/tmdb_ryanstep/types/auth_create_access_token_response.rb +95 -0
- data/lib/tmdb_ryanstep/types/auth_create_request_token_response.rb +87 -0
- data/lib/tmdb_ryanstep/types/auth_logout_response.rb +78 -0
- data/lib/tmdb_ryanstep/types/list_add_items_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/list_add_items_response_results_item.rb +74 -0
- data/lib/tmdb_ryanstep/types/list_clear_response.rb +95 -0
- data/lib/tmdb_ryanstep/types/list_create_response.rb +86 -0
- data/lib/tmdb_ryanstep/types/list_delete_response.rb +78 -0
- data/lib/tmdb_ryanstep/types/list_details_response.rb +237 -0
- data/lib/tmdb_ryanstep/types/list_details_response_comments.rb +215 -0
- data/lib/tmdb_ryanstep/types/list_details_response_created_by.rb +95 -0
- data/lib/tmdb_ryanstep/types/list_details_response_object_ids.rb +47 -0
- data/lib/tmdb_ryanstep/types/list_details_response_results_item.rb +175 -0
- data/lib/tmdb_ryanstep/types/list_item_status_request_media_type.rb +9 -0
- data/lib/tmdb_ryanstep/types/list_item_status_response.rb +103 -0
- data/lib/tmdb_ryanstep/types/list_remove_items_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/list_remove_items_response_results_item.rb +74 -0
- data/lib/tmdb_ryanstep/types/list_update_items_response.rb +90 -0
- data/lib/tmdb_ryanstep/types/list_update_items_response_results_item.rb +74 -0
- data/lib/tmdb_ryanstep/types/list_update_response.rb +78 -0
- data/lib/tmdb_ryanstep.rb +1557 -0
- data/lib/types_export.rb +48 -0
- metadata +175 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ee31b90a248f845fb16c38c963eb2963f14f4e14173467b4df4c98ef7e5d97e5
|
4
|
+
data.tar.gz: 76540d25df7a6a6081cafdbde46c372af1e406ab40285d083871e28ea55bfcb0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4920c042e6e63656984df7782880d2c4fb5623453614c3bd5d2c11ca8a0b3db964071de3afd26f0bc10ceb8de743bc163ab8f31ae52fe4b709cedec2737970d7
|
7
|
+
data.tar.gz: '0868c31f7edfc261c6548cc9f4b3435bcf8314bd23401d7894a4901c586af7f19b5fd0616770afc652ffcc8f803eb59b6d4e48083336d52f11464d276c2a45c7'
|
data/lib/environment.rb
ADDED
data/lib/gemconfig.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TmdbApiClient
|
4
|
+
module Gemconfig
|
5
|
+
VERSION = ""
|
6
|
+
AUTHORS = [""].freeze
|
7
|
+
EMAIL = ""
|
8
|
+
SUMMARY = ""
|
9
|
+
DESCRIPTION = ""
|
10
|
+
HOMEPAGE = "https://github.com/Ryan-Amirthan/MovieAPI-RubySDK"
|
11
|
+
SOURCE_CODE_URI = "https://github.com/Ryan-Amirthan/MovieAPI-RubySDK"
|
12
|
+
CHANGELOG_URI = "https://github.com/Ryan-Amirthan/MovieAPI-RubySDK/blob/master/CHANGELOG.md"
|
13
|
+
end
|
14
|
+
end
|
data/lib/requests.rb
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "environment"
|
4
|
+
require "faraday"
|
5
|
+
require "faraday/retry"
|
6
|
+
require "async/http/faraday"
|
7
|
+
|
8
|
+
module TmdbApiClient
|
9
|
+
class RequestClient
|
10
|
+
# @return [Faraday]
|
11
|
+
attr_reader :conn
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :base_url
|
14
|
+
# @return [String]
|
15
|
+
attr_reader :api_key
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :default_environment
|
18
|
+
|
19
|
+
# @param base_url [String]
|
20
|
+
# @param environment [TmdbApiClient::Environment]
|
21
|
+
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
22
|
+
# @param timeout_in_seconds [Long]
|
23
|
+
# @param api_key [String]
|
24
|
+
# @return [TmdbApiClient::RequestClient]
|
25
|
+
def initialize(api_key:, base_url: nil, environment: TmdbApiClient::Environment::DEFAULT, max_retries: nil,
|
26
|
+
timeout_in_seconds: nil)
|
27
|
+
@default_environment = environment
|
28
|
+
@base_url = environment || base_url
|
29
|
+
@api_key = "Bearer #{api_key}"
|
30
|
+
@conn = Faraday.new do |faraday|
|
31
|
+
faraday.request :json
|
32
|
+
faraday.response :raise_error, include_request: true
|
33
|
+
faraday.request :retry, { max: max_retries } unless max_retries.nil?
|
34
|
+
faraday.options.timeout = timeout_in_seconds unless timeout_in_seconds.nil?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# @param request_options [TmdbApiClient::RequestOptions]
|
39
|
+
# @return [String]
|
40
|
+
def get_url(request_options: nil)
|
41
|
+
request_options&.base_url || @default_environment || @base_url
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [Hash{String => String}]
|
45
|
+
def get_headers
|
46
|
+
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "tmdb_ryanstep", "X-Fern-SDK-Version": "1.0.0" }
|
47
|
+
headers["Authorization"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
|
48
|
+
headers
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class AsyncRequestClient
|
53
|
+
# @return [Faraday]
|
54
|
+
attr_reader :conn
|
55
|
+
# @return [String]
|
56
|
+
attr_reader :base_url
|
57
|
+
# @return [String]
|
58
|
+
attr_reader :api_key
|
59
|
+
# @return [String]
|
60
|
+
attr_reader :default_environment
|
61
|
+
|
62
|
+
# @param base_url [String]
|
63
|
+
# @param environment [TmdbApiClient::Environment]
|
64
|
+
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
65
|
+
# @param timeout_in_seconds [Long]
|
66
|
+
# @param api_key [String]
|
67
|
+
# @return [TmdbApiClient::AsyncRequestClient]
|
68
|
+
def initialize(api_key:, base_url: nil, environment: TmdbApiClient::Environment::DEFAULT, max_retries: nil,
|
69
|
+
timeout_in_seconds: nil)
|
70
|
+
@default_environment = environment
|
71
|
+
@base_url = environment || base_url
|
72
|
+
@api_key = "Bearer #{api_key}"
|
73
|
+
@conn = Faraday.new do |faraday|
|
74
|
+
faraday.request :json
|
75
|
+
faraday.response :raise_error, include_request: true
|
76
|
+
faraday.adapter :async_http
|
77
|
+
faraday.request :retry, { max: max_retries } unless max_retries.nil?
|
78
|
+
faraday.options.timeout = timeout_in_seconds unless timeout_in_seconds.nil?
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# @param request_options [TmdbApiClient::RequestOptions]
|
83
|
+
# @return [String]
|
84
|
+
def get_url(request_options: nil)
|
85
|
+
request_options&.base_url || @default_environment || @base_url
|
86
|
+
end
|
87
|
+
|
88
|
+
# @return [Hash{String => String}]
|
89
|
+
def get_headers
|
90
|
+
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "tmdb_ryanstep", "X-Fern-SDK-Version": "1.0.0" }
|
91
|
+
headers["Authorization"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
|
92
|
+
headers
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Additional options for request-specific configuration when calling APIs via the
|
97
|
+
# SDK.
|
98
|
+
class RequestOptions
|
99
|
+
# @return [String]
|
100
|
+
attr_reader :base_url
|
101
|
+
# @return [String]
|
102
|
+
attr_reader :api_key
|
103
|
+
# @return [Hash{String => Object}]
|
104
|
+
attr_reader :additional_headers
|
105
|
+
# @return [Hash{String => Object}]
|
106
|
+
attr_reader :additional_query_parameters
|
107
|
+
# @return [Hash{String => Object}]
|
108
|
+
attr_reader :additional_body_parameters
|
109
|
+
# @return [Long]
|
110
|
+
attr_reader :timeout_in_seconds
|
111
|
+
|
112
|
+
# @param base_url [String]
|
113
|
+
# @param api_key [String]
|
114
|
+
# @param additional_headers [Hash{String => Object}]
|
115
|
+
# @param additional_query_parameters [Hash{String => Object}]
|
116
|
+
# @param additional_body_parameters [Hash{String => Object}]
|
117
|
+
# @param timeout_in_seconds [Long]
|
118
|
+
# @return [TmdbApiClient::RequestOptions]
|
119
|
+
def initialize(base_url: nil, api_key: nil, additional_headers: nil, additional_query_parameters: nil,
|
120
|
+
additional_body_parameters: nil, timeout_in_seconds: nil)
|
121
|
+
@base_url = base_url
|
122
|
+
@api_key = api_key
|
123
|
+
@additional_headers = additional_headers
|
124
|
+
@additional_query_parameters = additional_query_parameters
|
125
|
+
@additional_body_parameters = additional_body_parameters
|
126
|
+
@timeout_in_seconds = timeout_in_seconds
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# Additional options for request-specific configuration when calling APIs via the
|
131
|
+
# SDK.
|
132
|
+
class IdempotencyRequestOptions
|
133
|
+
# @return [String]
|
134
|
+
attr_reader :base_url
|
135
|
+
# @return [String]
|
136
|
+
attr_reader :api_key
|
137
|
+
# @return [Hash{String => Object}]
|
138
|
+
attr_reader :additional_headers
|
139
|
+
# @return [Hash{String => Object}]
|
140
|
+
attr_reader :additional_query_parameters
|
141
|
+
# @return [Hash{String => Object}]
|
142
|
+
attr_reader :additional_body_parameters
|
143
|
+
# @return [Long]
|
144
|
+
attr_reader :timeout_in_seconds
|
145
|
+
|
146
|
+
# @param base_url [String]
|
147
|
+
# @param api_key [String]
|
148
|
+
# @param additional_headers [Hash{String => Object}]
|
149
|
+
# @param additional_query_parameters [Hash{String => Object}]
|
150
|
+
# @param additional_body_parameters [Hash{String => Object}]
|
151
|
+
# @param timeout_in_seconds [Long]
|
152
|
+
# @return [TmdbApiClient::IdempotencyRequestOptions]
|
153
|
+
def initialize(base_url: nil, api_key: nil, additional_headers: nil, additional_query_parameters: nil,
|
154
|
+
additional_body_parameters: nil, timeout_in_seconds: nil)
|
155
|
+
@base_url = base_url
|
156
|
+
@api_key = api_key
|
157
|
+
@additional_headers = additional_headers
|
158
|
+
@additional_query_parameters = additional_query_parameters
|
159
|
+
@additional_body_parameters = additional_body_parameters
|
160
|
+
@timeout_in_seconds = timeout_in_seconds
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "account_favorite_movies_response_results_item"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module TmdbApiClient
|
8
|
+
class AccountFavoriteMoviesResponse
|
9
|
+
# @return [Integer]
|
10
|
+
attr_reader :page
|
11
|
+
# @return [Array<TmdbApiClient::AccountFavoriteMoviesResponseResultsItem>]
|
12
|
+
attr_reader :results
|
13
|
+
# @return [Integer]
|
14
|
+
attr_reader :total_pages
|
15
|
+
# @return [Integer]
|
16
|
+
attr_reader :total_results
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
attr_reader :additional_properties
|
19
|
+
# @return [Object]
|
20
|
+
attr_reader :_field_set
|
21
|
+
protected :_field_set
|
22
|
+
|
23
|
+
OMIT = Object.new
|
24
|
+
|
25
|
+
# @param page [Integer]
|
26
|
+
# @param results [Array<TmdbApiClient::AccountFavoriteMoviesResponseResultsItem>]
|
27
|
+
# @param total_pages [Integer]
|
28
|
+
# @param total_results [Integer]
|
29
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
30
|
+
# @return [TmdbApiClient::AccountFavoriteMoviesResponse]
|
31
|
+
def initialize(page: OMIT, results: OMIT, total_pages: OMIT, total_results: OMIT, additional_properties: nil)
|
32
|
+
@page = page if page != OMIT
|
33
|
+
@results = results if results != OMIT
|
34
|
+
@total_pages = total_pages if total_pages != OMIT
|
35
|
+
@total_results = total_results if total_results != OMIT
|
36
|
+
@additional_properties = additional_properties
|
37
|
+
@_field_set = {
|
38
|
+
"page": page,
|
39
|
+
"results": results,
|
40
|
+
"total_pages": total_pages,
|
41
|
+
"total_results": total_results
|
42
|
+
}.reject do |_k, v|
|
43
|
+
v == OMIT
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Deserialize a JSON object to an instance of AccountFavoriteMoviesResponse
|
48
|
+
#
|
49
|
+
# @param json_object [String]
|
50
|
+
# @return [TmdbApiClient::AccountFavoriteMoviesResponse]
|
51
|
+
def self.from_json(json_object:)
|
52
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
53
|
+
parsed_json = JSON.parse(json_object)
|
54
|
+
page = parsed_json["page"]
|
55
|
+
results = parsed_json["results"]&.map do |item|
|
56
|
+
item = item.to_json
|
57
|
+
TmdbApiClient::AccountFavoriteMoviesResponseResultsItem.from_json(json_object: item)
|
58
|
+
end
|
59
|
+
total_pages = parsed_json["total_pages"]
|
60
|
+
total_results = parsed_json["total_results"]
|
61
|
+
new(
|
62
|
+
page: page,
|
63
|
+
results: results,
|
64
|
+
total_pages: total_pages,
|
65
|
+
total_results: total_results,
|
66
|
+
additional_properties: struct
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Serialize an instance of AccountFavoriteMoviesResponse to a JSON object
|
71
|
+
#
|
72
|
+
# @return [String]
|
73
|
+
def to_json(*_args)
|
74
|
+
@_field_set&.to_json
|
75
|
+
end
|
76
|
+
|
77
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
78
|
+
# hash and check each fields type against the current object's property
|
79
|
+
# definitions.
|
80
|
+
#
|
81
|
+
# @param obj [Object]
|
82
|
+
# @return [Void]
|
83
|
+
def self.validate_raw(obj:)
|
84
|
+
obj.page&.is_a?(Integer) != false || raise("Passed value for field obj.page is not the expected type, validation failed.")
|
85
|
+
obj.results&.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
|
86
|
+
obj.total_pages&.is_a?(Integer) != false || raise("Passed value for field obj.total_pages is not the expected type, validation failed.")
|
87
|
+
obj.total_results&.is_a?(Integer) != false || raise("Passed value for field obj.total_results is not the expected type, validation failed.")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module TmdbApiClient
|
7
|
+
class AccountFavoriteMoviesResponseResultsItem
|
8
|
+
# @return [Boolean]
|
9
|
+
attr_reader :adult
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :backdrop_path
|
12
|
+
# @return [Array<Integer>]
|
13
|
+
attr_reader :genre_ids
|
14
|
+
# @return [Integer]
|
15
|
+
attr_reader :id
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :original_language
|
18
|
+
# @return [String]
|
19
|
+
attr_reader :original_title
|
20
|
+
# @return [String]
|
21
|
+
attr_reader :overview
|
22
|
+
# @return [Float]
|
23
|
+
attr_reader :popularity
|
24
|
+
# @return [String]
|
25
|
+
attr_reader :poster_path
|
26
|
+
# @return [String]
|
27
|
+
attr_reader :release_date
|
28
|
+
# @return [String]
|
29
|
+
attr_reader :title
|
30
|
+
# @return [Boolean]
|
31
|
+
attr_reader :video
|
32
|
+
# @return [Float]
|
33
|
+
attr_reader :vote_average
|
34
|
+
# @return [Integer]
|
35
|
+
attr_reader :vote_count
|
36
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
37
|
+
attr_reader :additional_properties
|
38
|
+
# @return [Object]
|
39
|
+
attr_reader :_field_set
|
40
|
+
protected :_field_set
|
41
|
+
|
42
|
+
OMIT = Object.new
|
43
|
+
|
44
|
+
# @param adult [Boolean]
|
45
|
+
# @param backdrop_path [String]
|
46
|
+
# @param genre_ids [Array<Integer>]
|
47
|
+
# @param id [Integer]
|
48
|
+
# @param original_language [String]
|
49
|
+
# @param original_title [String]
|
50
|
+
# @param overview [String]
|
51
|
+
# @param popularity [Float]
|
52
|
+
# @param poster_path [String]
|
53
|
+
# @param release_date [String]
|
54
|
+
# @param title [String]
|
55
|
+
# @param video [Boolean]
|
56
|
+
# @param vote_average [Float]
|
57
|
+
# @param vote_count [Integer]
|
58
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
59
|
+
# @return [TmdbApiClient::AccountFavoriteMoviesResponseResultsItem]
|
60
|
+
def initialize(adult: OMIT, backdrop_path: OMIT, genre_ids: OMIT, id: OMIT, original_language: OMIT,
|
61
|
+
original_title: OMIT, overview: OMIT, popularity: OMIT, poster_path: OMIT, release_date: OMIT, title: OMIT, video: OMIT, vote_average: OMIT, vote_count: OMIT, additional_properties: nil)
|
62
|
+
@adult = adult if adult != OMIT
|
63
|
+
@backdrop_path = backdrop_path if backdrop_path != OMIT
|
64
|
+
@genre_ids = genre_ids if genre_ids != OMIT
|
65
|
+
@id = id if id != OMIT
|
66
|
+
@original_language = original_language if original_language != OMIT
|
67
|
+
@original_title = original_title if original_title != OMIT
|
68
|
+
@overview = overview if overview != OMIT
|
69
|
+
@popularity = popularity if popularity != OMIT
|
70
|
+
@poster_path = poster_path if poster_path != OMIT
|
71
|
+
@release_date = release_date if release_date != OMIT
|
72
|
+
@title = title if title != OMIT
|
73
|
+
@video = video if video != OMIT
|
74
|
+
@vote_average = vote_average if vote_average != OMIT
|
75
|
+
@vote_count = vote_count if vote_count != OMIT
|
76
|
+
@additional_properties = additional_properties
|
77
|
+
@_field_set = {
|
78
|
+
"adult": adult,
|
79
|
+
"backdrop_path": backdrop_path,
|
80
|
+
"genre_ids": genre_ids,
|
81
|
+
"id": id,
|
82
|
+
"original_language": original_language,
|
83
|
+
"original_title": original_title,
|
84
|
+
"overview": overview,
|
85
|
+
"popularity": popularity,
|
86
|
+
"poster_path": poster_path,
|
87
|
+
"release_date": release_date,
|
88
|
+
"title": title,
|
89
|
+
"video": video,
|
90
|
+
"vote_average": vote_average,
|
91
|
+
"vote_count": vote_count
|
92
|
+
}.reject do |_k, v|
|
93
|
+
v == OMIT
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Deserialize a JSON object to an instance of
|
98
|
+
# AccountFavoriteMoviesResponseResultsItem
|
99
|
+
#
|
100
|
+
# @param json_object [String]
|
101
|
+
# @return [TmdbApiClient::AccountFavoriteMoviesResponseResultsItem]
|
102
|
+
def self.from_json(json_object:)
|
103
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
104
|
+
parsed_json = JSON.parse(json_object)
|
105
|
+
adult = parsed_json["adult"]
|
106
|
+
backdrop_path = parsed_json["backdrop_path"]
|
107
|
+
genre_ids = parsed_json["genre_ids"]
|
108
|
+
id = parsed_json["id"]
|
109
|
+
original_language = parsed_json["original_language"]
|
110
|
+
original_title = parsed_json["original_title"]
|
111
|
+
overview = parsed_json["overview"]
|
112
|
+
popularity = parsed_json["popularity"]
|
113
|
+
poster_path = parsed_json["poster_path"]
|
114
|
+
release_date = parsed_json["release_date"]
|
115
|
+
title = parsed_json["title"]
|
116
|
+
video = parsed_json["video"]
|
117
|
+
vote_average = parsed_json["vote_average"]
|
118
|
+
vote_count = parsed_json["vote_count"]
|
119
|
+
new(
|
120
|
+
adult: adult,
|
121
|
+
backdrop_path: backdrop_path,
|
122
|
+
genre_ids: genre_ids,
|
123
|
+
id: id,
|
124
|
+
original_language: original_language,
|
125
|
+
original_title: original_title,
|
126
|
+
overview: overview,
|
127
|
+
popularity: popularity,
|
128
|
+
poster_path: poster_path,
|
129
|
+
release_date: release_date,
|
130
|
+
title: title,
|
131
|
+
video: video,
|
132
|
+
vote_average: vote_average,
|
133
|
+
vote_count: vote_count,
|
134
|
+
additional_properties: struct
|
135
|
+
)
|
136
|
+
end
|
137
|
+
|
138
|
+
# Serialize an instance of AccountFavoriteMoviesResponseResultsItem to a JSON
|
139
|
+
# object
|
140
|
+
#
|
141
|
+
# @return [String]
|
142
|
+
def to_json(*_args)
|
143
|
+
@_field_set&.to_json
|
144
|
+
end
|
145
|
+
|
146
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
147
|
+
# hash and check each fields type against the current object's property
|
148
|
+
# definitions.
|
149
|
+
#
|
150
|
+
# @param obj [Object]
|
151
|
+
# @return [Void]
|
152
|
+
def self.validate_raw(obj:)
|
153
|
+
obj.adult&.is_a?(Boolean) != false || raise("Passed value for field obj.adult is not the expected type, validation failed.")
|
154
|
+
obj.backdrop_path&.is_a?(String) != false || raise("Passed value for field obj.backdrop_path is not the expected type, validation failed.")
|
155
|
+
obj.genre_ids&.is_a?(Array) != false || raise("Passed value for field obj.genre_ids is not the expected type, validation failed.")
|
156
|
+
obj.id&.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
157
|
+
obj.original_language&.is_a?(String) != false || raise("Passed value for field obj.original_language is not the expected type, validation failed.")
|
158
|
+
obj.original_title&.is_a?(String) != false || raise("Passed value for field obj.original_title is not the expected type, validation failed.")
|
159
|
+
obj.overview&.is_a?(String) != false || raise("Passed value for field obj.overview is not the expected type, validation failed.")
|
160
|
+
obj.popularity&.is_a?(Float) != false || raise("Passed value for field obj.popularity is not the expected type, validation failed.")
|
161
|
+
obj.poster_path&.is_a?(String) != false || raise("Passed value for field obj.poster_path is not the expected type, validation failed.")
|
162
|
+
obj.release_date&.is_a?(String) != false || raise("Passed value for field obj.release_date is not the expected type, validation failed.")
|
163
|
+
obj.title&.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.")
|
164
|
+
obj.video&.is_a?(Boolean) != false || raise("Passed value for field obj.video is not the expected type, validation failed.")
|
165
|
+
obj.vote_average&.is_a?(Float) != false || raise("Passed value for field obj.vote_average is not the expected type, validation failed.")
|
166
|
+
obj.vote_count&.is_a?(Integer) != false || raise("Passed value for field obj.vote_count is not the expected type, validation failed.")
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "account_favorite_tv_response_results_item"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module TmdbApiClient
|
8
|
+
class AccountFavoriteTvResponse
|
9
|
+
# @return [Integer]
|
10
|
+
attr_reader :page
|
11
|
+
# @return [Array<TmdbApiClient::AccountFavoriteTvResponseResultsItem>]
|
12
|
+
attr_reader :results
|
13
|
+
# @return [Integer]
|
14
|
+
attr_reader :total_pages
|
15
|
+
# @return [Integer]
|
16
|
+
attr_reader :total_results
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
attr_reader :additional_properties
|
19
|
+
# @return [Object]
|
20
|
+
attr_reader :_field_set
|
21
|
+
protected :_field_set
|
22
|
+
|
23
|
+
OMIT = Object.new
|
24
|
+
|
25
|
+
# @param page [Integer]
|
26
|
+
# @param results [Array<TmdbApiClient::AccountFavoriteTvResponseResultsItem>]
|
27
|
+
# @param total_pages [Integer]
|
28
|
+
# @param total_results [Integer]
|
29
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
30
|
+
# @return [TmdbApiClient::AccountFavoriteTvResponse]
|
31
|
+
def initialize(page: OMIT, results: OMIT, total_pages: OMIT, total_results: OMIT, additional_properties: nil)
|
32
|
+
@page = page if page != OMIT
|
33
|
+
@results = results if results != OMIT
|
34
|
+
@total_pages = total_pages if total_pages != OMIT
|
35
|
+
@total_results = total_results if total_results != OMIT
|
36
|
+
@additional_properties = additional_properties
|
37
|
+
@_field_set = {
|
38
|
+
"page": page,
|
39
|
+
"results": results,
|
40
|
+
"total_pages": total_pages,
|
41
|
+
"total_results": total_results
|
42
|
+
}.reject do |_k, v|
|
43
|
+
v == OMIT
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Deserialize a JSON object to an instance of AccountFavoriteTvResponse
|
48
|
+
#
|
49
|
+
# @param json_object [String]
|
50
|
+
# @return [TmdbApiClient::AccountFavoriteTvResponse]
|
51
|
+
def self.from_json(json_object:)
|
52
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
53
|
+
parsed_json = JSON.parse(json_object)
|
54
|
+
page = parsed_json["page"]
|
55
|
+
results = parsed_json["results"]&.map do |item|
|
56
|
+
item = item.to_json
|
57
|
+
TmdbApiClient::AccountFavoriteTvResponseResultsItem.from_json(json_object: item)
|
58
|
+
end
|
59
|
+
total_pages = parsed_json["total_pages"]
|
60
|
+
total_results = parsed_json["total_results"]
|
61
|
+
new(
|
62
|
+
page: page,
|
63
|
+
results: results,
|
64
|
+
total_pages: total_pages,
|
65
|
+
total_results: total_results,
|
66
|
+
additional_properties: struct
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Serialize an instance of AccountFavoriteTvResponse to a JSON object
|
71
|
+
#
|
72
|
+
# @return [String]
|
73
|
+
def to_json(*_args)
|
74
|
+
@_field_set&.to_json
|
75
|
+
end
|
76
|
+
|
77
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
78
|
+
# hash and check each fields type against the current object's property
|
79
|
+
# definitions.
|
80
|
+
#
|
81
|
+
# @param obj [Object]
|
82
|
+
# @return [Void]
|
83
|
+
def self.validate_raw(obj:)
|
84
|
+
obj.page&.is_a?(Integer) != false || raise("Passed value for field obj.page is not the expected type, validation failed.")
|
85
|
+
obj.results&.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
|
86
|
+
obj.total_pages&.is_a?(Integer) != false || raise("Passed value for field obj.total_pages is not the expected type, validation failed.")
|
87
|
+
obj.total_results&.is_a?(Integer) != false || raise("Passed value for field obj.total_results is not the expected type, validation failed.")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|