Class: ESI::SovereigntyCampaignsGetInner

Inherits:
ApiModelBase show all
Defined in:
lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb

Defined Under Namespace

Classes: EnumAttributeValidator

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 = {}) ⇒ SovereigntyCampaignsGetInner

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#attackers_scoreObject

Score for all attacking parties, only present in Defense Events.



19
20
21
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 19

def attackers_score
  @attackers_score
end

#campaign_idObject

Unique ID for this campaign.



22
23
24
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 22

def campaign_id
  @campaign_id
end

#constellation_idObject

The constellation in which the campaign will take place.



25
26
27
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 25

def constellation_id
  @constellation_id
end

#defender_idObject

Defending alliance, only present in Defense Events



28
29
30
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 28

def defender_id
  @defender_id
end

#defender_scoreObject

Score for the defending alliance, only present in Defense Events.



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

def defender_score
  @defender_score
end

#event_typeObject

Type of event this campaign is for. tcu_defense, ihub_defense and station_defense are referred to as \“Defense Events\”, station_freeport as \“Freeport Events\”.



34
35
36
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 34

def event_type
  @event_type
end

#participantsObject

Alliance participating and their respective scores, only present in Freeport Events.



37
38
39
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 37

def participants
  @participants
end

#solar_system_idObject

The solar system the structure is located in.



40
41
42
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 40

def solar_system_id
  @solar_system_id
end

#start_timeObject

Time the event is scheduled to start.



43
44
45
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 43

def start_time
  @start_time
end

#structure_idObject

The structure item ID that is related to this campaign.



46
47
48
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 46

def structure_id
  @structure_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



87
88
89
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 87

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



92
93
94
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 92

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 71

def self.attribute_map
  {
    :'attackers_score' => :'attackers_score',
    :'campaign_id' => :'campaign_id',
    :'constellation_id' => :'constellation_id',
    :'defender_id' => :'defender_id',
    :'defender_score' => :'defender_score',
    :'event_type' => :'event_type',
    :'participants' => :'participants',
    :'solar_system_id' => :'solar_system_id',
    :'start_time' => :'start_time',
    :'structure_id' => :'structure_id'
  }
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



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 328

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



113
114
115
116
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 113

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

.openapi_typesObject

Attribute type mapping.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 97

def self.openapi_types
  {
    :'attackers_score' => :'Float',
    :'campaign_id' => :'Integer',
    :'constellation_id' => :'Integer',
    :'defender_id' => :'Integer',
    :'defender_score' => :'Float',
    :'event_type' => :'String',
    :'participants' => :'Array<SovereigntyCampaignsGetInnerParticipantsInner>',
    :'solar_system_id' => :'Integer',
    :'start_time' => :'Time',
    :'structure_id' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 298

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      attackers_score == o.attackers_score &&
      campaign_id == o.campaign_id &&
      constellation_id == o.constellation_id &&
      defender_id == o.defender_id &&
      defender_score == o.defender_score &&
      event_type == o.event_type &&
      participants == o.participants &&
      solar_system_id == o.solar_system_id &&
      start_time == o.start_time &&
      structure_id == o.structure_id
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


315
316
317
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 315

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



321
322
323
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 321

def hash
  [attackers_score, campaign_id, constellation_id, defender_id, defender_score, event_type, participants, solar_system_id, start_time, structure_id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @campaign_id.nil?
    invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.')
  end

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

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

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

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

  if @structure_id.nil?
    invalid_properties.push('invalid value for "structure_id", structure_id 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



350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/ruby-esi/models/sovereignty_campaigns_get_inner.rb', line 350

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



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

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @campaign_id.nil?
  return false if @constellation_id.nil?
  return false if @event_type.nil?
  event_type_validator = EnumAttributeValidator.new('String', ["tcu_defense", "ihub_defense", "station_defense", "station_freeport"])
  return false unless event_type_validator.valid?(@event_type)
  return false if @solar_system_id.nil?
  return false if @start_time.nil?
  return false if @structure_id.nil?
  true
end