Class: PokeApiClient::MoveDetail

Inherits:
ApiModelBase show all
Defined in:
lib/pokeapi_client/models/move_detail.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ MoveDetail

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
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
# File 'lib/pokeapi_client/models/move_detail.rb', line 148

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `PokeApiClient::MoveDetail` 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::MoveDetail`. 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?(:'accuracy')
    self.accuracy = attributes[:'accuracy']
  end

  if attributes.key?(:'effect_chance')
    self.effect_chance = attributes[:'effect_chance']
  else
    self.effect_chance = nil
  end

  if attributes.key?(:'pp')
    self.pp = attributes[:'pp']
  end

  if attributes.key?(:'priority')
    self.priority = attributes[:'priority']
  end

  if attributes.key?(:'power')
    self.power = attributes[:'power']
  end

  if attributes.key?(:'contest_combos')
    self.contest_combos = attributes[:'contest_combos']
  else
    self.contest_combos = nil
  end

  if attributes.key?(:'contest_type')
    self.contest_type = attributes[:'contest_type']
  else
    self.contest_type = nil
  end

  if attributes.key?(:'contest_effect')
    self.contest_effect = attributes[:'contest_effect']
  else
    self.contest_effect = nil
  end

  if attributes.key?(:'damage_class')
    self.damage_class = attributes[:'damage_class']
  else
    self.damage_class = nil
  end

  if attributes.key?(:'effect_entries')
    if (value = attributes[:'effect_entries']).is_a?(Array)
      self.effect_entries = value
    end
  else
    self.effect_entries = nil
  end

  if attributes.key?(:'effect_changes')
    if (value = attributes[:'effect_changes']).is_a?(Array)
      self.effect_changes = value
    end
  else
    self.effect_changes = nil
  end

  if attributes.key?(:'generation')
    self.generation = attributes[:'generation']
  else
    self.generation = nil
  end

  if attributes.key?(:'meta')
    self.meta = attributes[:'meta']
  else
    self.meta = 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?(:'past_values')
    if (value = attributes[:'past_values']).is_a?(Array)
      self.past_values = value
    end
  else
    self.past_values = nil
  end

  if attributes.key?(:'stat_changes')
    if (value = attributes[:'stat_changes']).is_a?(Array)
      self.stat_changes = value
    end
  else
    self.stat_changes = nil
  end

  if attributes.key?(:'super_contest_effect')
    self.super_contest_effect = attributes[:'super_contest_effect']
  else
    self.super_contest_effect = nil
  end

  if attributes.key?(:'target')
    self.target = attributes[:'target']
  else
    self.target = nil
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  else
    self.type = nil
  end

  if attributes.key?(:'machines')
    if (value = attributes[:'machines']).is_a?(Array)
      self.machines = value
    end
  else
    self.machines = 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?(:'learned_by_pokemon')
    if (value = attributes[:'learned_by_pokemon']).is_a?(Array)
      self.learned_by_pokemon = value
    end
  else
    self.learned_by_pokemon = nil
  end
end

Instance Attribute Details

#accuracyObject

Returns the value of attribute accuracy.



22
23
24
# File 'lib/pokeapi_client/models/move_detail.rb', line 22

def accuracy
  @accuracy
end

#contest_combosObject

Returns the value of attribute contest_combos.



32
33
34
# File 'lib/pokeapi_client/models/move_detail.rb', line 32

def contest_combos
  @contest_combos
end

#contest_effectObject

Returns the value of attribute contest_effect.



36
37
38
# File 'lib/pokeapi_client/models/move_detail.rb', line 36

def contest_effect
  @contest_effect
end

#contest_typeObject

Returns the value of attribute contest_type.



34
35
36
# File 'lib/pokeapi_client/models/move_detail.rb', line 34

def contest_type
  @contest_type
end

#damage_classObject

Returns the value of attribute damage_class.



38
39
40
# File 'lib/pokeapi_client/models/move_detail.rb', line 38

def damage_class
  @damage_class
end

#effect_chanceObject

Returns the value of attribute effect_chance.



24
25
26
# File 'lib/pokeapi_client/models/move_detail.rb', line 24

def effect_chance
  @effect_chance
end

#effect_changesObject

Returns the value of attribute effect_changes.



42
43
44
# File 'lib/pokeapi_client/models/move_detail.rb', line 42

def effect_changes
  @effect_changes
end

#effect_entriesObject

Returns the value of attribute effect_entries.



40
41
42
# File 'lib/pokeapi_client/models/move_detail.rb', line 40

def effect_entries
  @effect_entries
end

#flavor_text_entriesObject

Returns the value of attribute flavor_text_entries.



62
63
64
# File 'lib/pokeapi_client/models/move_detail.rb', line 62

def flavor_text_entries
  @flavor_text_entries
end

#generationObject

Returns the value of attribute generation.



44
45
46
# File 'lib/pokeapi_client/models/move_detail.rb', line 44

def generation
  @generation
end

#idObject

Returns the value of attribute id.



18
19
20
# File 'lib/pokeapi_client/models/move_detail.rb', line 18

def id
  @id
end

#learned_by_pokemonObject

Returns the value of attribute learned_by_pokemon.



64
65
66
# File 'lib/pokeapi_client/models/move_detail.rb', line 64

def learned_by_pokemon
  @learned_by_pokemon
end

#machinesObject

Returns the value of attribute machines.



60
61
62
# File 'lib/pokeapi_client/models/move_detail.rb', line 60

def machines
  @machines
end

#metaObject

Returns the value of attribute meta.



46
47
48
# File 'lib/pokeapi_client/models/move_detail.rb', line 46

def meta
  @meta
end

#nameObject

Returns the value of attribute name.



20
21
22
# File 'lib/pokeapi_client/models/move_detail.rb', line 20

def name
  @name
end

#namesObject

Returns the value of attribute names.



48
49
50
# File 'lib/pokeapi_client/models/move_detail.rb', line 48

def names
  @names
end

#past_valuesObject

Returns the value of attribute past_values.



50
51
52
# File 'lib/pokeapi_client/models/move_detail.rb', line 50

def past_values
  @past_values
end

#powerObject

Returns the value of attribute power.



30
31
32
# File 'lib/pokeapi_client/models/move_detail.rb', line 30

def power
  @power
end

#ppObject

Returns the value of attribute pp.



26
27
28
# File 'lib/pokeapi_client/models/move_detail.rb', line 26

def pp
  @pp
end

#priorityObject

Returns the value of attribute priority.



28
29
30
# File 'lib/pokeapi_client/models/move_detail.rb', line 28

def priority
  @priority
end

#stat_changesObject

Returns the value of attribute stat_changes.



52
53
54
# File 'lib/pokeapi_client/models/move_detail.rb', line 52

def stat_changes
  @stat_changes
end

#super_contest_effectObject

Returns the value of attribute super_contest_effect.



54
55
56
# File 'lib/pokeapi_client/models/move_detail.rb', line 54

def super_contest_effect
  @super_contest_effect
end

#targetObject

Returns the value of attribute target.



56
57
58
# File 'lib/pokeapi_client/models/move_detail.rb', line 56

def target
  @target
end

#typeObject

Returns the value of attribute type.



58
59
60
# File 'lib/pokeapi_client/models/move_detail.rb', line 58

def type
  @type
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



97
98
99
# File 'lib/pokeapi_client/models/move_detail.rb', line 97

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



102
103
104
# File 'lib/pokeapi_client/models/move_detail.rb', line 102

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/pokeapi_client/models/move_detail.rb', line 67

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'accuracy' => :'accuracy',
    :'effect_chance' => :'effect_chance',
    :'pp' => :'pp',
    :'priority' => :'priority',
    :'power' => :'power',
    :'contest_combos' => :'contest_combos',
    :'contest_type' => :'contest_type',
    :'contest_effect' => :'contest_effect',
    :'damage_class' => :'damage_class',
    :'effect_entries' => :'effect_entries',
    :'effect_changes' => :'effect_changes',
    :'generation' => :'generation',
    :'meta' => :'meta',
    :'names' => :'names',
    :'past_values' => :'past_values',
    :'stat_changes' => :'stat_changes',
    :'super_contest_effect' => :'super_contest_effect',
    :'target' => :'target',
    :'type' => :'type',
    :'machines' => :'machines',
    :'flavor_text_entries' => :'flavor_text_entries',
    :'learned_by_pokemon' => :'learned_by_pokemon'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
# File 'lib/pokeapi_client/models/move_detail.rb', line 685

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_nullableObject

List of attributes with nullable: true



137
138
139
140
141
142
143
144
# File 'lib/pokeapi_client/models/move_detail.rb', line 137

def self.openapi_nullable
  Set.new([
    :'accuracy',
    :'pp',
    :'priority',
    :'power',
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/pokeapi_client/models/move_detail.rb', line 107

def self.openapi_types
  {
    :'id' => :'Integer',
    :'name' => :'String',
    :'accuracy' => :'Integer',
    :'effect_chance' => :'Integer',
    :'pp' => :'Integer',
    :'priority' => :'Integer',
    :'power' => :'Integer',
    :'contest_combos' => :'MoveDetailContestCombos',
    :'contest_type' => :'ContestTypeSummary',
    :'contest_effect' => :'ContestEffectSummary',
    :'damage_class' => :'MoveDamageClassSummary',
    :'effect_entries' => :'Array<MoveChangeEffectEntriesInner>',
    :'effect_changes' => :'Array<MoveDetailEffectChangesInner>',
    :'generation' => :'GenerationSummary',
    :'meta' => :'MoveMeta',
    :'names' => :'Array<MoveName>',
    :'past_values' => :'Array<MoveChange>',
    :'stat_changes' => :'Array<MoveDetailStatChangesInner>',
    :'super_contest_effect' => :'SuperContestEffectSummary',
    :'target' => :'MoveTargetSummary',
    :'type' => :'TypeSummary',
    :'machines' => :'Array<MoveDetailMachinesInner>',
    :'flavor_text_entries' => :'Array<MoveFlavorText>',
    :'learned_by_pokemon' => :'Array<AbilityDetailPokemonInnerPokemon>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
# File 'lib/pokeapi_client/models/move_detail.rb', line 641

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      accuracy == o.accuracy &&
      effect_chance == o.effect_chance &&
      pp == o.pp &&
      priority == o.priority &&
      power == o.power &&
      contest_combos == o.contest_combos &&
      contest_type == o.contest_type &&
      contest_effect == o.contest_effect &&
      damage_class == o.damage_class &&
      effect_entries == o.effect_entries &&
      effect_changes == o.effect_changes &&
      generation == o.generation &&
      meta == o.meta &&
      names == o.names &&
      past_values == o.past_values &&
      stat_changes == o.stat_changes &&
      super_contest_effect == o.super_contest_effect &&
      target == o.target &&
      type == o.type &&
      machines == o.machines &&
      flavor_text_entries == o.flavor_text_entries &&
      learned_by_pokemon == o.learned_by_pokemon
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


672
673
674
# File 'lib/pokeapi_client/models/move_detail.rb', line 672

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



678
679
680
# File 'lib/pokeapi_client/models/move_detail.rb', line 678

def hash
  [id, name, accuracy, effect_chance, pp, priority, power, contest_combos, contest_type, contest_effect, damage_class, effect_entries, effect_changes, generation, meta, names, past_values, stat_changes, super_contest_effect, target, type, machines, flavor_text_entries, learned_by_pokemon].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
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
# File 'lib/pokeapi_client/models/move_detail.rb', line 317

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 @effect_chance.nil?
    invalid_properties.push('invalid value for "effect_chance", effect_chance cannot be nil.')
  end

  if @contest_combos.nil?
    invalid_properties.push('invalid value for "contest_combos", contest_combos cannot be nil.')
  end

  if @contest_type.nil?
    invalid_properties.push('invalid value for "contest_type", contest_type cannot be nil.')
  end

  if @contest_effect.nil?
    invalid_properties.push('invalid value for "contest_effect", contest_effect cannot be nil.')
  end

  if @damage_class.nil?
    invalid_properties.push('invalid value for "damage_class", damage_class cannot be nil.')
  end

  if @effect_entries.nil?
    invalid_properties.push('invalid value for "effect_entries", effect_entries cannot be nil.')
  end

  if @effect_changes.nil?
    invalid_properties.push('invalid value for "effect_changes", effect_changes cannot be nil.')
  end

  if @generation.nil?
    invalid_properties.push('invalid value for "generation", generation cannot be nil.')
  end

  if @meta.nil?
    invalid_properties.push('invalid value for "meta", meta cannot be nil.')
  end

  if @names.nil?
    invalid_properties.push('invalid value for "names", names cannot be nil.')
  end

  if @past_values.nil?
    invalid_properties.push('invalid value for "past_values", past_values cannot be nil.')
  end

  if @stat_changes.nil?
    invalid_properties.push('invalid value for "stat_changes", stat_changes cannot be nil.')
  end

  if @super_contest_effect.nil?
    invalid_properties.push('invalid value for "super_contest_effect", super_contest_effect cannot be nil.')
  end

  if @target.nil?
    invalid_properties.push('invalid value for "target", target cannot be nil.')
  end

  if @type.nil?
    invalid_properties.push('invalid value for "type", type cannot be nil.')
  end

  if @machines.nil?
    invalid_properties.push('invalid value for "machines", machines 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 @learned_by_pokemon.nil?
    invalid_properties.push('invalid value for "learned_by_pokemon", learned_by_pokemon cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



707
708
709
710
711
712
713
714
715
716
717
718
719
# File 'lib/pokeapi_client/models/move_detail.rb', line 707

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

Returns:

  • (Boolean)

    true if the model is valid



409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/pokeapi_client/models/move_detail.rb', line 409

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 @effect_chance.nil?
  return false if @contest_combos.nil?
  return false if @contest_type.nil?
  return false if @contest_effect.nil?
  return false if @damage_class.nil?
  return false if @effect_entries.nil?
  return false if @effect_changes.nil?
  return false if @generation.nil?
  return false if @meta.nil?
  return false if @names.nil?
  return false if @past_values.nil?
  return false if @stat_changes.nil?
  return false if @super_contest_effect.nil?
  return false if @target.nil?
  return false if @type.nil?
  return false if @machines.nil?
  return false if @flavor_text_entries.nil?
  return false if @learned_by_pokemon.nil?
  true
end