Class: Kuapir::Film
- Inherits:
-
Object
- Object
- Kuapir::Film
- Defined in:
- lib/kuapir/models/film.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#completed ⇒ Object
Returns the value of attribute completed.
-
#countries ⇒ Object
Returns the value of attribute countries.
-
#description ⇒ Object
Returns the value of attribute description.
-
#editor_annotation ⇒ Object
Returns the value of attribute editor_annotation.
-
#end_year ⇒ Object
Returns the value of attribute end_year.
-
#film_length ⇒ Object
Returns the value of attribute film_length.
-
#genres ⇒ Object
Returns the value of attribute genres.
-
#has3_d ⇒ Object
Returns the value of attribute has3_d.
-
#has_imax ⇒ Object
Returns the value of attribute has_imax.
-
#imdb_id ⇒ Object
Returns the value of attribute imdb_id.
-
#is_tickets_available ⇒ Object
Returns the value of attribute is_tickets_available.
-
#kinopoisk_id ⇒ Object
Returns the value of attribute kinopoisk_id.
-
#last_sync ⇒ Object
Returns the value of attribute last_sync.
-
#name_en ⇒ Object
Returns the value of attribute name_en.
-
#name_original ⇒ Object
Returns the value of attribute name_original.
-
#name_ru ⇒ Object
Returns the value of attribute name_ru.
-
#poster_url ⇒ Object
Returns the value of attribute poster_url.
-
#poster_url_preview ⇒ Object
Returns the value of attribute poster_url_preview.
-
#production_status ⇒ Object
Returns the value of attribute production_status.
-
#rating_age_limits ⇒ Object
Returns the value of attribute rating_age_limits.
-
#rating_await ⇒ Object
Returns the value of attribute rating_await.
-
#rating_await_count ⇒ Object
Returns the value of attribute rating_await_count.
-
#rating_film_critics ⇒ Object
Returns the value of attribute rating_film_critics.
-
#rating_film_critics_vote_count ⇒ Object
Returns the value of attribute rating_film_critics_vote_count.
-
#rating_good_review ⇒ Object
Returns the value of attribute rating_good_review.
-
#rating_good_review_vote_count ⇒ Object
Returns the value of attribute rating_good_review_vote_count.
-
#rating_imdb ⇒ Object
Returns the value of attribute rating_imdb.
-
#rating_imdb_vote_count ⇒ Object
Returns the value of attribute rating_imdb_vote_count.
-
#rating_kinopoisk ⇒ Object
Returns the value of attribute rating_kinopoisk.
-
#rating_kinopoisk_vote_count ⇒ Object
Returns the value of attribute rating_kinopoisk_vote_count.
-
#rating_mpaa ⇒ Object
Returns the value of attribute rating_mpaa.
-
#rating_rf_critics ⇒ Object
Returns the value of attribute rating_rf_critics.
-
#rating_rf_critics_vote_count ⇒ Object
Returns the value of attribute rating_rf_critics_vote_count.
-
#reviews_count ⇒ Object
Returns the value of attribute reviews_count.
-
#serial ⇒ Object
Returns the value of attribute serial.
-
#short_description ⇒ Object
Returns the value of attribute short_description.
-
#short_film ⇒ Object
Returns the value of attribute short_film.
-
#slogan ⇒ Object
Returns the value of attribute slogan.
-
#start_year ⇒ Object
Returns the value of attribute start_year.
-
#type ⇒ Object
Returns the value of attribute type.
-
#web_url ⇒ Object
Returns the value of attribute web_url.
-
#year ⇒ Object
Returns the value of attribute year.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Film
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Film
Initializes the object
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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/kuapir/models/film.rb', line 173 def initialize(attributes = {}) unless attributes.is_a?(Hash) raise ArgumentError, "The input argument (attributes) must be a hash in `Kuapir::Film` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) do |(k, v), h| unless self.class.attribute_map.key?(k.to_sym) raise ArgumentError, "`#{k}` is not a valid attribute in `Kuapir::Film`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v end self.kinopoisk_id = attributes[:kinopoisk_id] if attributes.key?(:kinopoisk_id) self.imdb_id = attributes[:imdb_id] if attributes.key?(:imdb_id) self.name_ru = attributes[:name_ru] if attributes.key?(:name_ru) self.name_en = attributes[:name_en] if attributes.key?(:name_en) self.name_original = attributes[:name_original] if attributes.key?(:name_original) self.poster_url = attributes[:poster_url] if attributes.key?(:poster_url) self.poster_url_preview = attributes[:poster_url_preview] if attributes.key?(:poster_url_preview) self.reviews_count = attributes[:reviews_count] if attributes.key?(:reviews_count) self. = attributes[:rating_good_review] if attributes.key?(:rating_good_review) if attributes.key?(:rating_good_review_vote_count) self. = attributes[:rating_good_review_vote_count] end self. = attributes[:rating_kinopoisk] if attributes.key?(:rating_kinopoisk) if attributes.key?(:rating_kinopoisk_vote_count) self. = attributes[:rating_kinopoisk_vote_count] end self. = attributes[:rating_imdb] if attributes.key?(:rating_imdb) self. = attributes[:rating_imdb_vote_count] if attributes.key?(:rating_imdb_vote_count) self. = attributes[:rating_film_critics] if attributes.key?(:rating_film_critics) if attributes.key?(:rating_film_critics_vote_count) self. = attributes[:rating_film_critics_vote_count] end self. = attributes[:rating_await] if attributes.key?(:rating_await) self. = attributes[:rating_await_count] if attributes.key?(:rating_await_count) self. = attributes[:rating_rf_critics] if attributes.key?(:rating_rf_critics) if attributes.key?(:rating_rf_critics_vote_count) self. = attributes[:rating_rf_critics_vote_count] end self.web_url = attributes[:web_url] if attributes.key?(:web_url) self.year = attributes[:year] if attributes.key?(:year) self.film_length = attributes[:film_length] if attributes.key?(:film_length) self.slogan = attributes[:slogan] if attributes.key?(:slogan) self.description = attributes[:description] if attributes.key?(:description) self.short_description = attributes[:short_description] if attributes.key?(:short_description) self.editor_annotation = attributes[:editor_annotation] if attributes.key?(:editor_annotation) self.is_tickets_available = attributes[:is_tickets_available] if attributes.key?(:is_tickets_available) self.production_status = attributes[:production_status] if attributes.key?(:production_status) self.type = attributes[:type] if attributes.key?(:type) self. = attributes[:rating_mpaa] if attributes.key?(:rating_mpaa) self. = attributes[:rating_age_limits] if attributes.key?(:rating_age_limits) self.has_imax = attributes[:has_imax] if attributes.key?(:has_imax) self.has3_d = attributes[:has3_d] if attributes.key?(:has3_d) self.last_sync = attributes[:last_sync] if attributes.key?(:last_sync) if attributes.key?(:countries) && (value = attributes[:countries]).is_a?(Array) self.countries = value end if attributes.key?(:genres) && (value = attributes[:genres]).is_a?(Array) self.genres = value end self.start_year = attributes[:start_year] if attributes.key?(:start_year) self.end_year = attributes[:end_year] if attributes.key?(:end_year) self.serial = attributes[:serial] if attributes.key?(:serial) self.short_film = attributes[:short_film] if attributes.key?(:short_film) self.completed = attributes[:completed] if attributes.key?(:completed) end |
Instance Attribute Details
#completed ⇒ Object
Returns the value of attribute completed.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def completed @completed end |
#countries ⇒ Object
Returns the value of attribute countries.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def countries @countries end |
#description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def description @description end |
#editor_annotation ⇒ Object
Returns the value of attribute editor_annotation.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def editor_annotation @editor_annotation end |
#end_year ⇒ Object
Returns the value of attribute end_year.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def end_year @end_year end |
#film_length ⇒ Object
Returns the value of attribute film_length.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def film_length @film_length end |
#genres ⇒ Object
Returns the value of attribute genres.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def genres @genres end |
#has3_d ⇒ Object
Returns the value of attribute has3_d.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def has3_d @has3_d end |
#has_imax ⇒ Object
Returns the value of attribute has_imax.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def has_imax @has_imax end |
#imdb_id ⇒ Object
Returns the value of attribute imdb_id.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def imdb_id @imdb_id end |
#is_tickets_available ⇒ Object
Returns the value of attribute is_tickets_available.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def is_tickets_available @is_tickets_available end |
#kinopoisk_id ⇒ Object
Returns the value of attribute kinopoisk_id.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def kinopoisk_id @kinopoisk_id end |
#last_sync ⇒ Object
Returns the value of attribute last_sync.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def last_sync @last_sync end |
#name_en ⇒ Object
Returns the value of attribute name_en.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def name_en @name_en end |
#name_original ⇒ Object
Returns the value of attribute name_original.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def name_original @name_original end |
#name_ru ⇒ Object
Returns the value of attribute name_ru.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def name_ru @name_ru end |
#poster_url ⇒ Object
Returns the value of attribute poster_url.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def poster_url @poster_url end |
#poster_url_preview ⇒ Object
Returns the value of attribute poster_url_preview.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def poster_url_preview @poster_url_preview end |
#production_status ⇒ Object
Returns the value of attribute production_status.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def production_status @production_status end |
#rating_age_limits ⇒ Object
Returns the value of attribute rating_age_limits.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_age_limits end |
#rating_await ⇒ Object
Returns the value of attribute rating_await.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_await end |
#rating_await_count ⇒ Object
Returns the value of attribute rating_await_count.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_await_count end |
#rating_film_critics ⇒ Object
Returns the value of attribute rating_film_critics.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_film_critics end |
#rating_film_critics_vote_count ⇒ Object
Returns the value of attribute rating_film_critics_vote_count.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_film_critics_vote_count end |
#rating_good_review ⇒ Object
Returns the value of attribute rating_good_review.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_good_review end |
#rating_good_review_vote_count ⇒ Object
Returns the value of attribute rating_good_review_vote_count.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_good_review_vote_count end |
#rating_imdb ⇒ Object
Returns the value of attribute rating_imdb.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_imdb end |
#rating_imdb_vote_count ⇒ Object
Returns the value of attribute rating_imdb_vote_count.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_imdb_vote_count end |
#rating_kinopoisk ⇒ Object
Returns the value of attribute rating_kinopoisk.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_kinopoisk end |
#rating_kinopoisk_vote_count ⇒ Object
Returns the value of attribute rating_kinopoisk_vote_count.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_kinopoisk_vote_count end |
#rating_mpaa ⇒ Object
Returns the value of attribute rating_mpaa.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_mpaa end |
#rating_rf_critics ⇒ Object
Returns the value of attribute rating_rf_critics.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_rf_critics end |
#rating_rf_critics_vote_count ⇒ Object
Returns the value of attribute rating_rf_critics_vote_count.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def @rating_rf_critics_vote_count end |
#reviews_count ⇒ Object
Returns the value of attribute reviews_count.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def reviews_count @reviews_count end |
#serial ⇒ Object
Returns the value of attribute serial.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def serial @serial end |
#short_description ⇒ Object
Returns the value of attribute short_description.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def short_description @short_description end |
#short_film ⇒ Object
Returns the value of attribute short_film.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def short_film @short_film end |
#slogan ⇒ Object
Returns the value of attribute slogan.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def slogan @slogan end |
#start_year ⇒ Object
Returns the value of attribute start_year.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def start_year @start_year end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def type @type end |
#web_url ⇒ Object
Returns the value of attribute web_url.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def web_url @web_url end |
#year ⇒ Object
Returns the value of attribute year.
8 9 10 |
# File 'lib/kuapir/models/film.rb', line 8 def year @year end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
81 82 83 |
# File 'lib/kuapir/models/film.rb', line 81 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/kuapir/models/film.rb', line 33 def self.attribute_map { 'kinopoisk_id': :kinopoiskId, 'imdb_id': :imdbId, 'name_ru': :nameRu, 'name_en': :nameEn, 'name_original': :nameOriginal, 'poster_url': :posterUrl, 'poster_url_preview': :posterUrlPreview, 'reviews_count': :reviewsCount, 'rating_good_review': :ratingGoodReview, 'rating_good_review_vote_count': :ratingGoodReviewVoteCount, 'rating_kinopoisk': :ratingKinopoisk, 'rating_kinopoisk_vote_count': :ratingKinopoiskVoteCount, 'rating_imdb': :ratingImdb, 'rating_imdb_vote_count': :ratingImdbVoteCount, 'rating_film_critics': :ratingFilmCritics, 'rating_film_critics_vote_count': :ratingFilmCriticsVoteCount, 'rating_await': :ratingAwait, 'rating_await_count': :ratingAwaitCount, 'rating_rf_critics': :ratingRfCritics, 'rating_rf_critics_vote_count': :ratingRfCriticsVoteCount, 'web_url': :webUrl, 'year': :year, 'film_length': :filmLength, 'slogan': :slogan, 'description': :description, 'short_description': :shortDescription, 'editor_annotation': :editorAnnotation, 'is_tickets_available': :isTicketsAvailable, 'production_status': :productionStatus, 'type': :type, 'rating_mpaa': :ratingMpaa, 'rating_age_limits': :ratingAgeLimits, 'has_imax': :hasImax, 'has3_d': :has3D, 'last_sync': :lastSync, 'countries': :countries, 'genres': :genres, 'start_year': :startYear, 'end_year': :endYear, 'serial': :serial, 'short_film': :shortFilm, 'completed': :completed } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
433 434 435 |
# File 'lib/kuapir/models/film.rb', line 433 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
134 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 |
# File 'lib/kuapir/models/film.rb', line 134 def self.openapi_nullable Set.new(%i[ imdb_id name_ru name_en name_original rating_good_review rating_good_review_vote_count rating_kinopoisk rating_kinopoisk_vote_count rating_imdb rating_imdb_vote_count rating_film_critics rating_film_critics_vote_count rating_await rating_await_count rating_rf_critics rating_rf_critics_vote_count year film_length slogan description short_description editor_annotation production_status rating_mpaa rating_age_limits has_imax has3_d start_year end_year serial short_film completed ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 130 131 |
# File 'lib/kuapir/models/film.rb', line 86 def self.openapi_types { 'kinopoisk_id': :Integer, 'imdb_id': :String, 'name_ru': :String, 'name_en': :String, 'name_original': :String, 'poster_url': :String, 'poster_url_preview': :String, 'reviews_count': :Integer, 'rating_good_review': :Float, 'rating_good_review_vote_count': :Integer, 'rating_kinopoisk': :Float, 'rating_kinopoisk_vote_count': :Integer, 'rating_imdb': :Float, 'rating_imdb_vote_count': :Integer, 'rating_film_critics': :Float, 'rating_film_critics_vote_count': :Integer, 'rating_await': :Float, 'rating_await_count': :Integer, 'rating_rf_critics': :Float, 'rating_rf_critics_vote_count': :Integer, 'web_url': :String, 'year': :Integer, 'film_length': :Integer, 'slogan': :String, 'description': :String, 'short_description': :String, 'editor_annotation': :String, 'is_tickets_available': :Boolean, 'production_status': :String, 'type': :String, 'rating_mpaa': :String, 'rating_age_limits': :String, 'has_imax': :Boolean, 'has3_d': :Boolean, 'last_sync': :String, 'countries': :'Array<Country>', 'genres': :'Array<Genre>', 'start_year': :Integer, 'end_year': :Integer, 'serial': :Boolean, 'short_film': :Boolean, 'completed': :Boolean } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/kuapir/models/film.rb', line 369 def ==(other) return true if equal?(other) self.class == other.class && kinopoisk_id == other.kinopoisk_id && imdb_id == other.imdb_id && name_ru == other.name_ru && name_en == other.name_en && name_original == other.name_original && poster_url == other.poster_url && poster_url_preview == other.poster_url_preview && reviews_count == other.reviews_count && == other. && == other. && == other. && == other. && == other. && == other. && == other. && == other. && == other. && == other. && == other. && == other. && web_url == other.web_url && year == other.year && film_length == other.film_length && slogan == other.slogan && description == other.description && short_description == other.short_description && editor_annotation == other.editor_annotation && is_tickets_available == other.is_tickets_available && production_status == other.production_status && type == other.type && == other. && == other. && has_imax == other.has_imax && has3_d == other.has3_d && last_sync == other.last_sync && countries == other.countries && genres == other.genres && start_year == other.start_year && end_year == other.end_year && serial == other.serial && short_film == other.short_film && completed == other.completed end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File 'lib/kuapir/models/film.rb', line 466 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Kuapir.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
537 538 539 540 541 542 543 544 545 546 547 548 549 |
# File 'lib/kuapir/models/film.rb', line 537 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/kuapir/models/film.rb', line 440 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) send("#{key}=", attributes[self.class.attribute_map[key]].map do |v| _deserialize(Regexp.last_match(1), v) end) end elsif !attributes[self.class.attribute_map[key]].nil? send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(other) ⇒ Boolean
419 420 421 |
# File 'lib/kuapir/models/film.rb', line 419 def eql?(other) self == other end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
425 426 427 428 |
# File 'lib/kuapir/models/film.rb', line 425 def hash [kinopoisk_id, imdb_id, name_ru, name_en, name_original, poster_url, poster_url_preview, reviews_count, , , , , , , , , , , , , web_url, year, film_length, slogan, description, short_description, editor_annotation, is_tickets_available, production_status, type, , , has_imax, has3_d, last_sync, countries, genres, start_year, end_year, serial, short_film, completed].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/kuapir/models/film.rb', line 288 def list_invalid_properties invalid_properties = [] invalid_properties.push('invalid value for "kinopoisk_id", kinopoisk_id cannot be nil.') if @kinopoisk_id.nil? invalid_properties.push('invalid value for "poster_url", poster_url cannot be nil.') if @poster_url.nil? if @poster_url_preview.nil? invalid_properties.push('invalid value for "poster_url_preview", poster_url_preview cannot be nil.') end invalid_properties.push('invalid value for "reviews_count", reviews_count cannot be nil.') if @reviews_count.nil? invalid_properties.push('invalid value for "web_url", web_url cannot be nil.') if @web_url.nil? if @is_tickets_available.nil? invalid_properties.push('invalid value for "is_tickets_available", is_tickets_available cannot be nil.') end invalid_properties.push('invalid value for "type", type cannot be nil.') if @type.nil? invalid_properties.push('invalid value for "last_sync", last_sync cannot be nil.') if @last_sync.nil? invalid_properties.push('invalid value for "countries", countries cannot be nil.') if @countries.nil? invalid_properties.push('invalid value for "genres", genres cannot be nil.') if @genres.nil? invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
513 514 515 |
# File 'lib/kuapir/models/film.rb', line 513 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
519 520 521 522 523 524 525 526 527 528 529 530 531 |
# File 'lib/kuapir/models/film.rb', line 519 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
507 508 509 |
# File 'lib/kuapir/models/film.rb', line 507 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/kuapir/models/film.rb', line 319 def valid? return false if @kinopoisk_id.nil? return false if @poster_url.nil? return false if @poster_url_preview.nil? return false if @reviews_count.nil? return false if @web_url.nil? return false if @is_tickets_available.nil? production_status_validator = EnumAttributeValidator.new("String", %w[FILMING PRE_PRODUCTION COMPLETED ANNOUNCED UNKNOWN POST_PRODUCTION]) return false unless production_status_validator.valid?(@production_status) return false if @type.nil? type_validator = EnumAttributeValidator.new("String", %w[FILM VIDEO TV_SERIES MINI_SERIES TV_SHOW]) return false unless type_validator.valid?(@type) return false if @last_sync.nil? return false if @countries.nil? return false if @genres.nil? true end |