Class: ESI::GetCharactersCharacterIdFwStatsOk

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb

Overview

200 ok object

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GetCharactersCharacterIdFwStatsOk

Initializes the object

Parameters:

  • (defaults to: {})

    Model attributes in the form of hash



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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 77

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

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

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

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

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

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

Instance Attribute Details

#current_rankObject

The given character’s current faction rank



20
21
22
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 20

def current_rank
  @current_rank
end

#enlisted_onObject

The enlistment date of the given character into faction warfare. Will not be included if character is not enlisted in faction warfare



23
24
25
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 23

def enlisted_on
  @enlisted_on
end

#faction_idObject

The faction the given character is enlisted to fight for. Will not be included if character is not enlisted in faction warfare



26
27
28
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 26

def faction_id
  @faction_id
end

#highest_rankObject

The given character’s highest faction rank achieved



29
30
31
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 29

def highest_rank
  @highest_rank
end

#killsObject

Returns the value of attribute kills.



31
32
33
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 31

def kills
  @kills
end

#victory_pointsObject

Returns the value of attribute victory_points.



33
34
35
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 33

def victory_points
  @victory_points
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • type Data type

  • value Value to be deserialized

Returns:

  • Deserialized data



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
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 273

def self._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 = ESI.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



48
49
50
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 48

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



53
54
55
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 53

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



36
37
38
39
40
41
42
43
44
45
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 36

def self.attribute_map
  {
    :'current_rank' => :'current_rank',
    :'enlisted_on' => :'enlisted_on',
    :'faction_id' => :'faction_id',
    :'highest_rank' => :'highest_rank',
    :'kills' => :'kills',
    :'victory_points' => :'victory_points'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • Model attributes in the form of hash

Returns:

  • Returns the model itself



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 249

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



70
71
72
73
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 70

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



58
59
60
61
62
63
64
65
66
67
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 58

def self.openapi_types
  {
    :'current_rank' => :'Integer',
    :'enlisted_on' => :'Time',
    :'faction_id' => :'Integer',
    :'highest_rank' => :'Integer',
    :'kills' => :'GetCharactersCharacterIdFwStatsKills',
    :'victory_points' => :'GetCharactersCharacterIdFwStatsVictoryPoints'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • to be compared



223
224
225
226
227
228
229
230
231
232
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 223

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      current_rank == o.current_rank &&
      enlisted_on == o.enlisted_on &&
      faction_id == o.faction_id &&
      highest_rank == o.highest_rank &&
      kills == o.kills &&
      victory_points == o.victory_points
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • Any valid value

Returns:

  • Returns the value in the form of hash



344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 344

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

#eql?(o) ⇒ Boolean

See Also:

  • `==` method

Parameters:

  • to be compared

Returns:



236
237
238
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 236

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • Hash code



242
243
244
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 242

def hash
  [current_rank, enlisted_on, faction_id, highest_rank, kills, victory_points].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 122

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@current_rank.nil? && @current_rank > 9
    invalid_properties.push('invalid value for "current_rank", must be smaller than or equal to 9.')
  end

  if !@current_rank.nil? && @current_rank < 0
    invalid_properties.push('invalid value for "current_rank", must be greater than or equal to 0.')
  end

  if !@highest_rank.nil? && @highest_rank > 9
    invalid_properties.push('invalid value for "highest_rank", must be smaller than or equal to 9.')
  end

  if !@highest_rank.nil? && @highest_rank < 0
    invalid_properties.push('invalid value for "highest_rank", must be greater than or equal to 0.')
  end

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

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

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • Returns the object in the form of hash



320
321
322
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 320

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • Returns the object in the form of hash



326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 326

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

#to_sString

Returns the string representation of the object

Returns:

  • String presentation of the object



314
315
316
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 314

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • true if the model is valid



154
155
156
157
158
159
160
161
162
163
# File 'lib/ruby-esi/models/get_characters_character_id_fw_stats_ok.rb', line 154

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@current_rank.nil? && @current_rank > 9
  return false if !@current_rank.nil? && @current_rank < 0
  return false if !@highest_rank.nil? && @highest_rank > 9
  return false if !@highest_rank.nil? && @highest_rank < 0
  return false if @kills.nil?
  return false if @victory_points.nil?
  true
end