Class: TmdbApiClient::AccountTvRecommendationsResponse
- Inherits:
-
Object
- Object
- TmdbApiClient::AccountTvRecommendationsResponse
- Defined in:
- lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #page ⇒ Integer readonly
- #results ⇒ Array<TmdbApiClient::AccountTvRecommendationsResponseResultsItem> readonly
- #total_pages ⇒ Integer readonly
- #total_results ⇒ Integer readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TmdbApiClient::AccountTvRecommendationsResponse
Deserialize a JSON object to an instance of AccountTvRecommendationsResponse.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(page: OMIT, results: OMIT, total_pages: OMIT, total_results: OMIT, additional_properties: nil) ⇒ TmdbApiClient::AccountTvRecommendationsResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AccountTvRecommendationsResponse to a JSON object.
Constructor Details
#initialize(page: OMIT, results: OMIT, total_pages: OMIT, total_results: OMIT, additional_properties: nil) ⇒ TmdbApiClient::AccountTvRecommendationsResponse
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb', line 31 def initialize(page: OMIT, results: OMIT, total_pages: OMIT, total_results: OMIT, additional_properties: nil) @page = page if page != OMIT @results = results if results != OMIT @total_pages = total_pages if total_pages != OMIT @total_results = total_results if total_results != OMIT @additional_properties = additional_properties @_field_set = { "page": page, "results": results, "total_pages": total_pages, "total_results": total_results }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
18 19 20 |
# File 'lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb', line 18 def additional_properties @additional_properties end |
#page ⇒ Integer (readonly)
10 11 12 |
# File 'lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb', line 10 def page @page end |
#results ⇒ Array<TmdbApiClient::AccountTvRecommendationsResponseResultsItem> (readonly)
12 13 14 |
# File 'lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb', line 12 def results @results end |
#total_pages ⇒ Integer (readonly)
14 15 16 |
# File 'lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb', line 14 def total_pages @total_pages end |
#total_results ⇒ Integer (readonly)
16 17 18 |
# File 'lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb', line 16 def total_results @total_results end |
Class Method Details
.from_json(json_object:) ⇒ TmdbApiClient::AccountTvRecommendationsResponse
Deserialize a JSON object to an instance of AccountTvRecommendationsResponse
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb', line 51 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) page = parsed_json["page"] results = parsed_json["results"]&.map do |item| item = item.to_json TmdbApiClient::AccountTvRecommendationsResponseResultsItem.from_json(json_object: item) end total_pages = parsed_json["total_pages"] total_results = parsed_json["total_results"] new( page: page, results: results, total_pages: total_pages, total_results: total_results, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
83 84 85 86 87 88 |
# File 'lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb', line 83 def self.validate_raw(obj:) obj.page&.is_a?(Integer) != false || raise("Passed value for field obj.page is not the expected type, validation failed.") obj.results&.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.") obj.total_pages&.is_a?(Integer) != false || raise("Passed value for field obj.total_pages is not the expected type, validation failed.") obj.total_results&.is_a?(Integer) != false || raise("Passed value for field obj.total_results is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AccountTvRecommendationsResponse to a JSON object
73 74 75 |
# File 'lib/tmdb_ryanstep/types/account_tv_recommendations_response.rb', line 73 def to_json(*_args) @_field_set&.to_json end |