Class: PokeApiClient::PokemonSpeciesDetail
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- PokeApiClient::PokemonSpeciesDetail
- Defined in:
- lib/pokeapi_client/models/pokemon_species_detail.rb
Instance Attribute Summary collapse
-
#base_happiness ⇒ Object
Returns the value of attribute base_happiness.
-
#capture_rate ⇒ Object
Returns the value of attribute capture_rate.
-
#color ⇒ Object
Returns the value of attribute color.
-
#egg_groups ⇒ Object
Returns the value of attribute egg_groups.
-
#evolution_chain ⇒ Object
Returns the value of attribute evolution_chain.
-
#evolves_from_species ⇒ Object
Returns the value of attribute evolves_from_species.
-
#flavor_text_entries ⇒ Object
Returns the value of attribute flavor_text_entries.
-
#form_descriptions ⇒ Object
Returns the value of attribute form_descriptions.
-
#forms_switchable ⇒ Object
Returns the value of attribute forms_switchable.
-
#gender_rate ⇒ Object
Returns the value of attribute gender_rate.
-
#genera ⇒ Object
Returns the value of attribute genera.
-
#generation ⇒ Object
Returns the value of attribute generation.
-
#growth_rate ⇒ Object
Returns the value of attribute growth_rate.
-
#habitat ⇒ Object
Returns the value of attribute habitat.
-
#has_gender_differences ⇒ Object
Returns the value of attribute has_gender_differences.
-
#hatch_counter ⇒ Object
Returns the value of attribute hatch_counter.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_baby ⇒ Object
Returns the value of attribute is_baby.
-
#is_legendary ⇒ Object
Returns the value of attribute is_legendary.
-
#is_mythical ⇒ Object
Returns the value of attribute is_mythical.
-
#name ⇒ Object
Returns the value of attribute name.
-
#names ⇒ Object
Returns the value of attribute names.
-
#order ⇒ Object
Returns the value of attribute order.
-
#pal_park_encounters ⇒ Object
Returns the value of attribute pal_park_encounters.
-
#pokedex_numbers ⇒ Object
Returns the value of attribute pokedex_numbers.
-
#shape ⇒ Object
Returns the value of attribute shape.
-
#varieties ⇒ Object
Returns the value of attribute varieties.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.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
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ PokemonSpeciesDetail
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ PokemonSpeciesDetail
Initializes the object
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 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 285 286 287 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 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 161 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `PokeApiClient::PokemonSpeciesDetail` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `PokeApiClient::PokemonSpeciesDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'order') self.order = attributes[:'order'] end if attributes.key?(:'gender_rate') self.gender_rate = attributes[:'gender_rate'] end if attributes.key?(:'capture_rate') self.capture_rate = attributes[:'capture_rate'] end if attributes.key?(:'base_happiness') self.base_happiness = attributes[:'base_happiness'] end if attributes.key?(:'is_baby') self.is_baby = attributes[:'is_baby'] end if attributes.key?(:'is_legendary') self.is_legendary = attributes[:'is_legendary'] end if attributes.key?(:'is_mythical') self.is_mythical = attributes[:'is_mythical'] end if attributes.key?(:'hatch_counter') self.hatch_counter = attributes[:'hatch_counter'] end if attributes.key?(:'has_gender_differences') self.has_gender_differences = attributes[:'has_gender_differences'] end if attributes.key?(:'forms_switchable') self.forms_switchable = attributes[:'forms_switchable'] end if attributes.key?(:'growth_rate') self.growth_rate = attributes[:'growth_rate'] else self.growth_rate = nil end if attributes.key?(:'pokedex_numbers') if (value = attributes[:'pokedex_numbers']).is_a?(Array) self.pokedex_numbers = value end else self.pokedex_numbers = nil end if attributes.key?(:'egg_groups') if (value = attributes[:'egg_groups']).is_a?(Array) self.egg_groups = value end else self.egg_groups = nil end if attributes.key?(:'color') self.color = attributes[:'color'] else self.color = nil end if attributes.key?(:'shape') self.shape = attributes[:'shape'] else self.shape = nil end if attributes.key?(:'evolves_from_species') self.evolves_from_species = attributes[:'evolves_from_species'] else self.evolves_from_species = nil end if attributes.key?(:'evolution_chain') self.evolution_chain = attributes[:'evolution_chain'] else self.evolution_chain = nil end if attributes.key?(:'habitat') self.habitat = attributes[:'habitat'] else self.habitat = nil end if attributes.key?(:'generation') self.generation = attributes[:'generation'] else self.generation = nil end if attributes.key?(:'names') if (value = attributes[:'names']).is_a?(Array) self.names = value end else self.names = nil end if attributes.key?(:'pal_park_encounters') if (value = attributes[:'pal_park_encounters']).is_a?(Array) self.pal_park_encounters = value end else self.pal_park_encounters = nil end if attributes.key?(:'form_descriptions') if (value = attributes[:'form_descriptions']).is_a?(Array) self.form_descriptions = value end else self.form_descriptions = nil end if attributes.key?(:'flavor_text_entries') if (value = attributes[:'flavor_text_entries']).is_a?(Array) self.flavor_text_entries = value end else self.flavor_text_entries = nil end if attributes.key?(:'genera') if (value = attributes[:'genera']).is_a?(Array) self.genera = value end else self.genera = nil end if attributes.key?(:'varieties') if (value = attributes[:'varieties']).is_a?(Array) self.varieties = value end else self.varieties = nil end end |
Instance Attribute Details
#base_happiness ⇒ Object
Returns the value of attribute base_happiness.
28 29 30 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 28 def base_happiness @base_happiness end |
#capture_rate ⇒ Object
Returns the value of attribute capture_rate.
26 27 28 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 26 def capture_rate @capture_rate end |
#color ⇒ Object
Returns the value of attribute color.
48 49 50 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 48 def color @color end |
#egg_groups ⇒ Object
Returns the value of attribute egg_groups.
46 47 48 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 46 def egg_groups @egg_groups end |
#evolution_chain ⇒ Object
Returns the value of attribute evolution_chain.
54 55 56 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 54 def evolution_chain @evolution_chain end |
#evolves_from_species ⇒ Object
Returns the value of attribute evolves_from_species.
52 53 54 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 52 def evolves_from_species @evolves_from_species end |
#flavor_text_entries ⇒ Object
Returns the value of attribute flavor_text_entries.
66 67 68 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 66 def flavor_text_entries @flavor_text_entries end |
#form_descriptions ⇒ Object
Returns the value of attribute form_descriptions.
64 65 66 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 64 def form_descriptions @form_descriptions end |
#forms_switchable ⇒ Object
Returns the value of attribute forms_switchable.
40 41 42 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 40 def forms_switchable @forms_switchable end |
#gender_rate ⇒ Object
Returns the value of attribute gender_rate.
24 25 26 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 24 def gender_rate @gender_rate end |
#genera ⇒ Object
Returns the value of attribute genera.
68 69 70 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 68 def genera @genera end |
#generation ⇒ Object
Returns the value of attribute generation.
58 59 60 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 58 def generation @generation end |
#growth_rate ⇒ Object
Returns the value of attribute growth_rate.
42 43 44 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 42 def growth_rate @growth_rate end |
#habitat ⇒ Object
Returns the value of attribute habitat.
56 57 58 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 56 def habitat @habitat end |
#has_gender_differences ⇒ Object
Returns the value of attribute has_gender_differences.
38 39 40 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 38 def has_gender_differences @has_gender_differences end |
#hatch_counter ⇒ Object
Returns the value of attribute hatch_counter.
36 37 38 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 36 def hatch_counter @hatch_counter end |
#id ⇒ Object
Returns the value of attribute id.
18 19 20 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 18 def id @id end |
#is_baby ⇒ Object
Returns the value of attribute is_baby.
30 31 32 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 30 def is_baby @is_baby end |
#is_legendary ⇒ Object
Returns the value of attribute is_legendary.
32 33 34 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 32 def is_legendary @is_legendary end |
#is_mythical ⇒ Object
Returns the value of attribute is_mythical.
34 35 36 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 34 def is_mythical @is_mythical end |
#name ⇒ Object
Returns the value of attribute name.
20 21 22 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 20 def name @name end |
#names ⇒ Object
Returns the value of attribute names.
60 61 62 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 60 def names @names end |
#order ⇒ Object
Returns the value of attribute order.
22 23 24 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 22 def order @order end |
#pal_park_encounters ⇒ Object
Returns the value of attribute pal_park_encounters.
62 63 64 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 62 def pal_park_encounters @pal_park_encounters end |
#pokedex_numbers ⇒ Object
Returns the value of attribute pokedex_numbers.
44 45 46 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 44 def pokedex_numbers @pokedex_numbers end |
#shape ⇒ Object
Returns the value of attribute shape.
50 51 52 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 50 def shape @shape end |
#varieties ⇒ Object
Returns the value of attribute varieties.
70 71 72 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 70 def varieties @varieties end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
106 107 108 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 106 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
111 112 113 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 111 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 102 103 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 73 def self.attribute_map { :'id' => :'id', :'name' => :'name', :'order' => :'order', :'gender_rate' => :'gender_rate', :'capture_rate' => :'capture_rate', :'base_happiness' => :'base_happiness', :'is_baby' => :'is_baby', :'is_legendary' => :'is_legendary', :'is_mythical' => :'is_mythical', :'hatch_counter' => :'hatch_counter', :'has_gender_differences' => :'has_gender_differences', :'forms_switchable' => :'forms_switchable', :'growth_rate' => :'growth_rate', :'pokedex_numbers' => :'pokedex_numbers', :'egg_groups' => :'egg_groups', :'color' => :'color', :'shape' => :'shape', :'evolves_from_species' => :'evolves_from_species', :'evolution_chain' => :'evolution_chain', :'habitat' => :'habitat', :'generation' => :'generation', :'names' => :'names', :'pal_park_encounters' => :'pal_park_encounters', :'form_descriptions' => :'form_descriptions', :'flavor_text_entries' => :'flavor_text_entries', :'genera' => :'genera', :'varieties' => :'varieties' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 662 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{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[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
149 150 151 152 153 154 155 156 157 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 149 def self.openapi_nullable Set.new([ :'order', :'gender_rate', :'capture_rate', :'base_happiness', :'hatch_counter', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 116 def self.openapi_types { :'id' => :'Integer', :'name' => :'String', :'order' => :'Integer', :'gender_rate' => :'Integer', :'capture_rate' => :'Integer', :'base_happiness' => :'Integer', :'is_baby' => :'Boolean', :'is_legendary' => :'Boolean', :'is_mythical' => :'Boolean', :'hatch_counter' => :'Integer', :'has_gender_differences' => :'Boolean', :'forms_switchable' => :'Boolean', :'growth_rate' => :'GrowthRateSummary', :'pokedex_numbers' => :'Array<PokemonDexEntry>', :'egg_groups' => :'Array<AbilityDetailPokemonInnerPokemon>', :'color' => :'PokemonColorSummary', :'shape' => :'PokemonShapeSummary', :'evolves_from_species' => :'PokemonSpeciesSummary', :'evolution_chain' => :'EvolutionChainSummary', :'habitat' => :'PokemonHabitatSummary', :'generation' => :'GenerationSummary', :'names' => :'Array<PokemonFormDetailFormNamesInner>', :'pal_park_encounters' => :'Array<PokemonSpeciesDetailPalParkEncountersInner>', :'form_descriptions' => :'Array<PokemonSpeciesDescription>', :'flavor_text_entries' => :'Array<PokemonSpeciesFlavorText>', :'genera' => :'Array<PokemonSpeciesDetailGeneraInner>', :'varieties' => :'Array<PokemonSpeciesDetailVarietiesInner>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 615 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && name == o.name && order == o.order && gender_rate == o.gender_rate && capture_rate == o.capture_rate && base_happiness == o.base_happiness && is_baby == o.is_baby && is_legendary == o.is_legendary && is_mythical == o.is_mythical && hatch_counter == o.hatch_counter && has_gender_differences == o.has_gender_differences && forms_switchable == o.forms_switchable && growth_rate == o.growth_rate && pokedex_numbers == o.pokedex_numbers && egg_groups == o.egg_groups && color == o.color && shape == o.shape && evolves_from_species == o.evolves_from_species && evolution_chain == o.evolution_chain && habitat == o.habitat && generation == o.generation && names == o.names && pal_park_encounters == o.pal_park_encounters && form_descriptions == o.form_descriptions && flavor_text_entries == o.flavor_text_entries && genera == o.genera && varieties == o.varieties end |
#eql?(o) ⇒ Boolean
649 650 651 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 649 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
655 656 657 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 655 def hash [id, name, order, gender_rate, capture_rate, base_happiness, is_baby, is_legendary, is_mythical, hatch_counter, has_gender_differences, forms_switchable, growth_rate, pokedex_numbers, egg_groups, color, shape, evolves_from_species, evolution_chain, habitat, generation, names, pal_park_encounters, form_descriptions, flavor_text_entries, genera, varieties].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 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 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 336 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @name.to_s.length > 100 invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.') end if @growth_rate.nil? invalid_properties.push('invalid value for "growth_rate", growth_rate cannot be nil.') end if @pokedex_numbers.nil? invalid_properties.push('invalid value for "pokedex_numbers", pokedex_numbers cannot be nil.') end if @egg_groups.nil? invalid_properties.push('invalid value for "egg_groups", egg_groups cannot be nil.') end if @color.nil? invalid_properties.push('invalid value for "color", color cannot be nil.') end if @shape.nil? invalid_properties.push('invalid value for "shape", shape cannot be nil.') end if @evolves_from_species.nil? invalid_properties.push('invalid value for "evolves_from_species", evolves_from_species cannot be nil.') end if @evolution_chain.nil? invalid_properties.push('invalid value for "evolution_chain", evolution_chain cannot be nil.') end if @habitat.nil? invalid_properties.push('invalid value for "habitat", habitat cannot be nil.') end if @generation.nil? invalid_properties.push('invalid value for "generation", generation cannot be nil.') end if @names.nil? invalid_properties.push('invalid value for "names", names cannot be nil.') end if @pal_park_encounters.nil? invalid_properties.push('invalid value for "pal_park_encounters", pal_park_encounters cannot be nil.') end if @form_descriptions.nil? invalid_properties.push('invalid value for "form_descriptions", form_descriptions cannot be nil.') end if @flavor_text_entries.nil? invalid_properties.push('invalid value for "flavor_text_entries", flavor_text_entries cannot be nil.') end if @genera.nil? invalid_properties.push('invalid value for "genera", genera cannot be nil.') end if @varieties.nil? invalid_properties.push('invalid value for "varieties", varieties cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
684 685 686 687 688 689 690 691 692 693 694 695 696 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 684 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.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 |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/pokeapi_client/models/pokemon_species_detail.rb', line 416 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @name.nil? return false if @name.to_s.length > 100 return false if @growth_rate.nil? return false if @pokedex_numbers.nil? return false if @egg_groups.nil? return false if @color.nil? return false if @shape.nil? return false if @evolves_from_species.nil? return false if @evolution_chain.nil? return false if @habitat.nil? return false if @generation.nil? return false if @names.nil? return false if @pal_park_encounters.nil? return false if @form_descriptions.nil? return false if @flavor_text_entries.nil? return false if @genera.nil? return false if @varieties.nil? true end |