Class: TmdbApiClient::AccountRatedTvResponseResultsItem

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adult: OMIT, backdrop_path: OMIT, genre_ids: OMIT, id: OMIT, origin_country: OMIT, original_language: OMIT, original_name: OMIT, overview: OMIT, popularity: OMIT, poster_path: OMIT, first_air_date: OMIT, name: OMIT, vote_average: OMIT, vote_count: OMIT, account_rating: OMIT, additional_properties: nil) ⇒ TmdbApiClient::AccountRatedTvResponseResultsItem

Parameters:

  • adult (Boolean) (defaults to: OMIT)
  • backdrop_path (String) (defaults to: OMIT)
  • genre_ids (Array<Integer>) (defaults to: OMIT)
  • id (Integer) (defaults to: OMIT)
  • origin_country (Array<String>) (defaults to: OMIT)
  • original_language (String) (defaults to: OMIT)
  • original_name (String) (defaults to: OMIT)
  • overview (String) (defaults to: OMIT)
  • popularity (Float) (defaults to: OMIT)
  • poster_path (String) (defaults to: OMIT)
  • first_air_date (String) (defaults to: OMIT)
  • name (String) (defaults to: OMIT)
  • vote_average (Float) (defaults to: OMIT)
  • vote_count (Integer) (defaults to: OMIT)
  • account_rating (TmdbApiClient::AccountRatedTvResponseResultsItemAccountRating) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 64

def initialize(adult: OMIT, backdrop_path: OMIT, genre_ids: OMIT, id: OMIT, origin_country: OMIT,
               original_language: OMIT, original_name: OMIT, overview: OMIT, popularity: OMIT, poster_path: OMIT, first_air_date: OMIT, name: OMIT, vote_average: OMIT, vote_count: OMIT, account_rating: OMIT, additional_properties: nil)
  @adult = adult if adult != OMIT
  @backdrop_path = backdrop_path if backdrop_path != OMIT
  @genre_ids = genre_ids if genre_ids != OMIT
  @id = id if id != OMIT
  @origin_country = origin_country if origin_country != OMIT
  @original_language = original_language if original_language != OMIT
  @original_name = original_name if original_name != OMIT
  @overview = overview if overview != OMIT
  @popularity = popularity if popularity != OMIT
  @poster_path = poster_path if poster_path != OMIT
  @first_air_date = first_air_date if first_air_date != OMIT
  @name = name if name != OMIT
  @vote_average = vote_average if vote_average != OMIT
  @vote_count = vote_count if vote_count != OMIT
  @account_rating =  if  != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "adult": adult,
    "backdrop_path": backdrop_path,
    "genre_ids": genre_ids,
    "id": id,
    "origin_country": origin_country,
    "original_language": original_language,
    "original_name": original_name,
    "overview": overview,
    "popularity": popularity,
    "poster_path": poster_path,
    "first_air_date": first_air_date,
    "name": name,
    "vote_average": vote_average,
    "vote_count": vote_count,
    "account_rating": 
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#account_rating ⇒ TmdbApiClient::AccountRatedTvResponseResultsItemAccountRating (readonly)



38
39
40
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 38

def 
  @account_rating
end

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



40
41
42
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 40

def additional_properties
  @additional_properties
end

#adult ⇒ Boolean (readonly)

Returns:

  • (Boolean)


10
11
12
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 10

def adult
  @adult
end

#backdrop_path ⇒ String (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 12

def backdrop_path
  @backdrop_path
end

#first_air_date ⇒ String (readonly)

Returns:

  • (String)


30
31
32
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 30

def first_air_date
  @first_air_date
end

#genre_ids ⇒ Array<Integer> (readonly)

Returns:

  • (Array<Integer>)


14
15
16
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 14

def genre_ids
  @genre_ids
end

#id ⇒ Integer (readonly)

Returns:

  • (Integer)


16
17
18
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 16

def id
  @id
end

#name ⇒ String (readonly)

Returns:

  • (String)


32
33
34
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 32

def name
  @name
end

#origin_country ⇒ Array<String> (readonly)

Returns:

  • (Array<String>)


18
19
20
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 18

def origin_country
  @origin_country
end

#original_language ⇒ String (readonly)

Returns:

  • (String)


20
21
22
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 20

def original_language
  @original_language
end

#original_name ⇒ String (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 22

def original_name
  @original_name
end

#overview ⇒ String (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 24

def overview
  @overview
end

#popularity ⇒ Float (readonly)

Returns:

  • (Float)


26
27
28
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 26

def popularity
  @popularity
end

#poster_path ⇒ String (readonly)

Returns:

  • (String)


28
29
30
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 28

def poster_path
  @poster_path
end

#vote_average ⇒ Float (readonly)

Returns:

  • (Float)


34
35
36
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 34

def vote_average
  @vote_average
end

#vote_count ⇒ Integer (readonly)

Returns:

  • (Integer)


36
37
38
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 36

def vote_count
  @vote_count
end

Class Method Details

.from_json(json_object:) ⇒ TmdbApiClient::AccountRatedTvResponseResultsItem

Deserialize a JSON object to an instance of AccountRatedTvResponseResultsItem

Parameters:

  • json_object (String)

Returns:



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 107

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  adult = parsed_json["adult"]
  backdrop_path = parsed_json["backdrop_path"]
  genre_ids = parsed_json["genre_ids"]
  id = parsed_json["id"]
  origin_country = parsed_json["origin_country"]
  original_language = parsed_json["original_language"]
  original_name = parsed_json["original_name"]
  overview = parsed_json["overview"]
  popularity = parsed_json["popularity"]
  poster_path = parsed_json["poster_path"]
  first_air_date = parsed_json["first_air_date"]
  name = parsed_json["name"]
  vote_average = parsed_json["vote_average"]
  vote_count = parsed_json["vote_count"]
  if parsed_json["account_rating"].nil?
     = nil
  else
     = parsed_json["account_rating"].to_json
     = TmdbApiClient::AccountRatedTvResponseResultsItemAccountRating.from_json(json_object: )
  end
  new(
    adult: adult,
    backdrop_path: backdrop_path,
    genre_ids: genre_ids,
    id: id,
    origin_country: origin_country,
    original_language: original_language,
    original_name: original_name,
    overview: overview,
    popularity: popularity,
    poster_path: poster_path,
    first_air_date: first_air_date,
    name: name,
    vote_average: vote_average,
    vote_count: vote_count,
    account_rating: ,
    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)


163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 163

def self.validate_raw(obj:)
  obj.adult&.is_a?(Boolean) != false || raise("Passed value for field obj.adult 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.genre_ids&.is_a?(Array) != false || raise("Passed value for field obj.genre_ids 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.origin_country&.is_a?(Array) != false || raise("Passed value for field obj.origin_country is not the expected type, validation failed.")
  obj.original_language&.is_a?(String) != false || raise("Passed value for field obj.original_language is not the expected type, validation failed.")
  obj.original_name&.is_a?(String) != false || raise("Passed value for field obj.original_name is not the expected type, validation failed.")
  obj.overview&.is_a?(String) != false || raise("Passed value for field obj.overview is not the expected type, validation failed.")
  obj.popularity&.is_a?(Float) != false || raise("Passed value for field obj.popularity 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.first_air_date&.is_a?(String) != false || raise("Passed value for field obj.first_air_date 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.vote_average&.is_a?(Float) != false || raise("Passed value for field obj.vote_average is not the expected type, validation failed.")
  obj.vote_count&.is_a?(Integer) != false || raise("Passed value for field obj.vote_count is not the expected type, validation failed.")
  obj..nil? || TmdbApiClient::AccountRatedTvResponseResultsItemAccountRating.validate_raw(obj: obj.)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AccountRatedTvResponseResultsItem to a JSON object

Returns:

  • (String)


153
154
155
# File 'lib/tmdb_ryanstep/types/account_rated_tv_response_results_item.rb', line 153

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