Class: PokeApiClient::PokemonFormDetail
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- PokeApiClient::PokemonFormDetail
- Defined in:
- lib/pokeapi_client/models/pokemon_form_detail.rb
Instance Attribute Summary collapse
-
#form_name ⇒ Object
Returns the value of attribute form_name.
-
#form_names ⇒ Object
Returns the value of attribute form_names.
-
#form_order ⇒ Object
Returns the value of attribute form_order.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_battle_only ⇒ Object
Returns the value of attribute is_battle_only.
-
#is_default ⇒ Object
Returns the value of attribute is_default.
-
#is_mega ⇒ Object
Returns the value of attribute is_mega.
-
#name ⇒ Object
Returns the value of attribute name.
-
#names ⇒ Object
Returns the value of attribute names.
-
#order ⇒ Object
Returns the value of attribute order.
-
#pokemon ⇒ Object
Returns the value of attribute pokemon.
-
#sprites ⇒ Object
Returns the value of attribute sprites.
-
#types ⇒ Object
Returns the value of attribute types.
-
#version_group ⇒ Object
Returns the value of attribute version_group.
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 = {}) ⇒ PokemonFormDetail
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 = {}) ⇒ PokemonFormDetail
Initializes the object
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 132 133 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 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/pokeapi_client/models/pokemon_form_detail.rb', line 106 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `PokeApiClient::PokemonFormDetail` 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::PokemonFormDetail`. 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?(:'form_order') self.form_order = attributes[:'form_order'] end if attributes.key?(:'is_default') self.is_default = attributes[:'is_default'] end if attributes.key?(:'is_battle_only') self.is_battle_only = attributes[:'is_battle_only'] end if attributes.key?(:'is_mega') self.is_mega = attributes[:'is_mega'] end if attributes.key?(:'form_name') self.form_name = attributes[:'form_name'] else self.form_name = nil end if attributes.key?(:'pokemon') self.pokemon = attributes[:'pokemon'] else self.pokemon = nil end if attributes.key?(:'sprites') self.sprites = attributes[:'sprites'] else self.sprites = nil end if attributes.key?(:'version_group') self.version_group = attributes[:'version_group'] else self.version_group = nil end if attributes.key?(:'form_names') if (value = attributes[:'form_names']).is_a?(Array) self.form_names = value end else self.form_names = 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?(:'types') if (value = attributes[:'types']).is_a?(Array) self.types = value end else self.types = nil end end |
Instance Attribute Details
#form_name ⇒ Object
Returns the value of attribute form_name.
32 33 34 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 32 def form_name @form_name end |
#form_names ⇒ Object
Returns the value of attribute form_names.
40 41 42 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 40 def form_names @form_names end |
#form_order ⇒ Object
Returns the value of attribute form_order.
24 25 26 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 24 def form_order @form_order end |
#id ⇒ Object
Returns the value of attribute id.
18 19 20 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 18 def id @id end |
#is_battle_only ⇒ Object
Returns the value of attribute is_battle_only.
28 29 30 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 28 def is_battle_only @is_battle_only end |
#is_default ⇒ Object
Returns the value of attribute is_default.
26 27 28 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 26 def is_default @is_default end |
#is_mega ⇒ Object
Returns the value of attribute is_mega.
30 31 32 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 30 def is_mega @is_mega end |
#name ⇒ Object
Returns the value of attribute name.
20 21 22 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 20 def name @name end |
#names ⇒ Object
Returns the value of attribute names.
42 43 44 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 42 def names @names end |
#order ⇒ Object
Returns the value of attribute order.
22 23 24 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 22 def order @order end |
#pokemon ⇒ Object
Returns the value of attribute pokemon.
34 35 36 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 34 def pokemon @pokemon end |
#sprites ⇒ Object
Returns the value of attribute sprites.
36 37 38 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 36 def sprites @sprites end |
#types ⇒ Object
Returns the value of attribute types.
44 45 46 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 44 def types @types end |
#version_group ⇒ Object
Returns the value of attribute version_group.
38 39 40 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 38 def version_group @version_group end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
67 68 69 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 67 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
72 73 74 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 72 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 47 def self.attribute_map { :'id' => :'id', :'name' => :'name', :'order' => :'order', :'form_order' => :'form_order', :'is_default' => :'is_default', :'is_battle_only' => :'is_battle_only', :'is_mega' => :'is_mega', :'form_name' => :'form_name', :'pokemon' => :'pokemon', :'sprites' => :'sprites', :'version_group' => :'version_group', :'form_names' => :'form_names', :'names' => :'names', :'types' => :'types' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 405 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
97 98 99 100 101 102 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 97 def self.openapi_nullable Set.new([ :'order', :'form_order', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 77 def self.openapi_types { :'id' => :'Integer', :'name' => :'String', :'order' => :'Integer', :'form_order' => :'Integer', :'is_default' => :'Boolean', :'is_battle_only' => :'Boolean', :'is_mega' => :'Boolean', :'form_name' => :'String', :'pokemon' => :'PokemonSummary', :'sprites' => :'PokemonFormDetailSprites', :'version_group' => :'VersionGroupSummary', :'form_names' => :'Array<PokemonFormDetailFormNamesInner>', :'names' => :'Array<PokemonFormDetailFormNamesInner>', :'types' => :'Array<PokemonDetailTypesInner>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 371 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && name == o.name && order == o.order && form_order == o.form_order && is_default == o.is_default && is_battle_only == o.is_battle_only && is_mega == o.is_mega && form_name == o.form_name && pokemon == o.pokemon && sprites == o.sprites && version_group == o.version_group && form_names == o.form_names && names == o.names && types == o.types end |
#eql?(o) ⇒ Boolean
392 393 394 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 392 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
398 399 400 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 398 def hash [id, name, order, form_order, is_default, is_battle_only, is_mega, form_name, pokemon, sprites, version_group, form_names, names, types].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 203 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 @form_name.nil? invalid_properties.push('invalid value for "form_name", form_name cannot be nil.') end if @form_name.to_s.length > 30 invalid_properties.push('invalid value for "form_name", the character length must be smaller than or equal to 30.') end if @pokemon.nil? invalid_properties.push('invalid value for "pokemon", pokemon cannot be nil.') end if @sprites.nil? invalid_properties.push('invalid value for "sprites", sprites cannot be nil.') end if @version_group.nil? invalid_properties.push('invalid value for "version_group", version_group cannot be nil.') end if @form_names.nil? invalid_properties.push('invalid value for "form_names", form_names cannot be nil.') end if @names.nil? invalid_properties.push('invalid value for "names", names cannot be nil.') end if @types.nil? invalid_properties.push('invalid value for "types", types cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 427 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
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/pokeapi_client/models/pokemon_form_detail.rb', line 255 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 @form_name.nil? return false if @form_name.to_s.length > 30 return false if @pokemon.nil? return false if @sprites.nil? return false if @version_group.nil? return false if @form_names.nil? return false if @names.nil? return false if @types.nil? true end |