Class: TmdbApiClient::ListDetailsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/tmdb_ryanstep/types/list_details_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(average_rating: OMIT, backdrop_path: OMIT, results: OMIT, comments: OMIT, created_by: OMIT, description: OMIT, id: OMIT, iso_3166_1: OMIT, iso_639_1: OMIT, item_count: OMIT, name: OMIT, object_ids: OMIT, page: OMIT, poster_path: OMIT, public: OMIT, revenue: OMIT, runtime: OMIT, sort_by: OMIT, total_pages: OMIT, total_results: OMIT, additional_properties: nil) ⇒ TmdbApiClient::ListDetailsResponse

Parameters:

  • average_rating (Float) (defaults to: OMIT)
  • backdrop_path (String) (defaults to: OMIT)
  • results (Array<TmdbApiClient::ListDetailsResponseResultsItem>) (defaults to: OMIT)
  • comments (TmdbApiClient::ListDetailsResponseComments) (defaults to: OMIT)
  • created_by (TmdbApiClient::ListDetailsResponseCreatedBy) (defaults to: OMIT)
  • description (String) (defaults to: OMIT)
  • id (Integer) (defaults to: OMIT)
  • iso_3166_1 (String) (defaults to: OMIT)
  • iso_639_1 (String) (defaults to: OMIT)
  • item_count (Integer) (defaults to: OMIT)
  • name (String) (defaults to: OMIT)
  • object_ids (TmdbApiClient::ListDetailsResponseObjectIds) (defaults to: OMIT)
  • page (Integer) (defaults to: OMIT)
  • poster_path (String) (defaults to: OMIT)
  • public (Boolean) (defaults to: OMIT)
  • revenue (Integer) (defaults to: OMIT)
  • runtime (Integer) (defaults to: OMIT)
  • sort_by (String) (defaults to: OMIT)
  • total_pages (Integer) (defaults to: OMIT)
  • total_results (Integer) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 82

def initialize(average_rating: OMIT, backdrop_path: OMIT, results: OMIT, comments: OMIT, created_by: OMIT,
               description: OMIT, id: OMIT, iso_3166_1: OMIT, iso_639_1: OMIT, item_count: OMIT, name: OMIT, object_ids: OMIT, page: OMIT, poster_path: OMIT, public: OMIT, revenue: OMIT, runtime: OMIT, sort_by: OMIT, total_pages: OMIT, total_results: OMIT, additional_properties: nil)
  @average_rating = average_rating if average_rating != OMIT
  @backdrop_path = backdrop_path if backdrop_path != OMIT
  @results = results if results != OMIT
  @comments = comments if comments != OMIT
  @created_by = created_by if created_by != OMIT
  @description = description if description != OMIT
  @id = id if id != OMIT
  @iso_3166_1 = iso_3166_1 if iso_3166_1 != OMIT
  @iso_639_1 = iso_639_1 if iso_639_1 != OMIT
  @item_count = item_count if item_count != OMIT
  @name = name if name != OMIT
  @object_ids = object_ids if object_ids != OMIT
  @page = page if page != OMIT
  @poster_path = poster_path if poster_path != OMIT
  @public = public if public != OMIT
  @revenue = revenue if revenue != OMIT
  @runtime = runtime if runtime != OMIT
  @sort_by = sort_by if sort_by != OMIT
  @total_pages = total_pages if total_pages != OMIT
  @total_results = total_results if total_results != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "average_rating": average_rating,
    "backdrop_path": backdrop_path,
    "results": results,
    "comments": comments,
    "created_by": created_by,
    "description": description,
    "id": id,
    "iso_3166_1": iso_3166_1,
    "iso_639_1": iso_639_1,
    "item_count": item_count,
    "name": name,
    "object_ids": object_ids,
    "page": page,
    "poster_path": poster_path,
    "public": public,
    "revenue": revenue,
    "runtime": runtime,
    "sort_by": sort_by,
    "total_pages": total_pages,
    "total_results": total_results
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



53
54
55
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 53

def additional_properties
  @additional_properties
end

#average_ratingFloat (readonly)

Returns:

  • (Float)


13
14
15
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 13

def average_rating
  @average_rating
end

#backdrop_pathString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 15

def backdrop_path
  @backdrop_path
end

#commentsTmdbApiClient::ListDetailsResponseComments (readonly)



19
20
21
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 19

def comments
  @comments
end

#created_byTmdbApiClient::ListDetailsResponseCreatedBy (readonly)



21
22
23
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 21

def created_by
  @created_by
end

#descriptionString (readonly)

Returns:

  • (String)


23
24
25
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 23

def description
  @description
end

#idInteger (readonly)

Returns:

  • (Integer)


25
26
27
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 25

def id
  @id
end

#iso_3166_1String (readonly)

Returns:

  • (String)


27
28
29
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 27

def iso_3166_1
  @iso_3166_1
end

#iso_639_1String (readonly)

Returns:

  • (String)


29
30
31
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 29

def iso_639_1
  @iso_639_1
end

#item_countInteger (readonly)

Returns:

  • (Integer)


31
32
33
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 31

def item_count
  @item_count
end

#nameString (readonly)

Returns:

  • (String)


33
34
35
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 33

def name
  @name
end

#object_idsTmdbApiClient::ListDetailsResponseObjectIds (readonly)



35
36
37
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 35

def object_ids
  @object_ids
end

#pageInteger (readonly)

Returns:

  • (Integer)


37
38
39
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 37

def page
  @page
end

#poster_pathString (readonly)

Returns:

  • (String)


39
40
41
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 39

def poster_path
  @poster_path
end

#publicBoolean (readonly)

Returns:

  • (Boolean)


41
42
43
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 41

def public
  @public
end

#resultsArray<TmdbApiClient::ListDetailsResponseResultsItem> (readonly)



17
18
19
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 17

def results
  @results
end

#revenueInteger (readonly)

Returns:

  • (Integer)


43
44
45
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 43

def revenue
  @revenue
end

#runtimeInteger (readonly)

Returns:

  • (Integer)


45
46
47
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 45

def runtime
  @runtime
end

#sort_byString (readonly)

Returns:

  • (String)


47
48
49
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 47

def sort_by
  @sort_by
end

#total_pagesInteger (readonly)

Returns:

  • (Integer)


49
50
51
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 49

def total_pages
  @total_pages
end

#total_resultsInteger (readonly)

Returns:

  • (Integer)


51
52
53
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 51

def total_results
  @total_results
end

Class Method Details

.from_json(json_object:) ⇒ TmdbApiClient::ListDetailsResponse

Deserialize a JSON object to an instance of ListDetailsResponse

Parameters:

  • json_object (String)

Returns:



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 135

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  average_rating = parsed_json["average_rating"]
  backdrop_path = parsed_json["backdrop_path"]
  results = parsed_json["results"]&.map do |item|
    item = item.to_json
    TmdbApiClient::ListDetailsResponseResultsItem.from_json(json_object: item)
  end
  if parsed_json["comments"].nil?
    comments = nil
  else
    comments = parsed_json["comments"].to_json
    comments = TmdbApiClient::ListDetailsResponseComments.from_json(json_object: comments)
  end
  if parsed_json["created_by"].nil?
    created_by = nil
  else
    created_by = parsed_json["created_by"].to_json
    created_by = TmdbApiClient::ListDetailsResponseCreatedBy.from_json(json_object: created_by)
  end
  description = parsed_json["description"]
  id = parsed_json["id"]
  iso_3166_1 = parsed_json["iso_3166_1"]
  iso_639_1 = parsed_json["iso_639_1"]
  item_count = parsed_json["item_count"]
  name = parsed_json["name"]
  if parsed_json["object_ids"].nil?
    object_ids = nil
  else
    object_ids = parsed_json["object_ids"].to_json
    object_ids = TmdbApiClient::ListDetailsResponseObjectIds.from_json(json_object: object_ids)
  end
  page = parsed_json["page"]
  poster_path = parsed_json["poster_path"]
  public = parsed_json["public"]
  revenue = parsed_json["revenue"]
  runtime = parsed_json["runtime"]
  sort_by = parsed_json["sort_by"]
  total_pages = parsed_json["total_pages"]
  total_results = parsed_json["total_results"]
  new(
    average_rating: average_rating,
    backdrop_path: backdrop_path,
    results: results,
    comments: comments,
    created_by: created_by,
    description: description,
    id: id,
    iso_3166_1: iso_3166_1,
    iso_639_1: iso_639_1,
    item_count: item_count,
    name: name,
    object_ids: object_ids,
    page: page,
    poster_path: poster_path,
    public: public,
    revenue: revenue,
    runtime: runtime,
    sort_by: sort_by,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 214

def self.validate_raw(obj:)
  obj.average_rating&.is_a?(Float) != false || raise("Passed value for field obj.average_rating is not the expected type, validation failed.")
  obj.backdrop_path&.is_a?(String) != false || raise("Passed value for field obj.backdrop_path 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.comments.nil? || TmdbApiClient::ListDetailsResponseComments.validate_raw(obj: obj.comments)
  obj.created_by.nil? || TmdbApiClient::ListDetailsResponseCreatedBy.validate_raw(obj: obj.created_by)
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.id&.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.iso_3166_1&.is_a?(String) != false || raise("Passed value for field obj.iso_3166_1 is not the expected type, validation failed.")
  obj.iso_639_1&.is_a?(String) != false || raise("Passed value for field obj.iso_639_1 is not the expected type, validation failed.")
  obj.item_count&.is_a?(Integer) != false || raise("Passed value for field obj.item_count is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.object_ids.nil? || TmdbApiClient::ListDetailsResponseObjectIds.validate_raw(obj: obj.object_ids)
  obj.page&.is_a?(Integer) != false || raise("Passed value for field obj.page is not the expected type, validation failed.")
  obj.poster_path&.is_a?(String) != false || raise("Passed value for field obj.poster_path is not the expected type, validation failed.")
  obj.public&.is_a?(Boolean) != false || raise("Passed value for field obj.public is not the expected type, validation failed.")
  obj.revenue&.is_a?(Integer) != false || raise("Passed value for field obj.revenue is not the expected type, validation failed.")
  obj.runtime&.is_a?(Integer) != false || raise("Passed value for field obj.runtime is not the expected type, validation failed.")
  obj.sort_by&.is_a?(String) != false || raise("Passed value for field obj.sort_by 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 ListDetailsResponse to a JSON object

Returns:

  • (String)


204
205
206
# File 'lib/tmdb_ryanstep/types/list_details_response.rb', line 204

def to_json(*_args)
  @_field_set&.to_json
end