Class: FtcApiV3Client::ApiV3AllianceMatch

Inherits:
ApiModelBase show all
Defined in:
lib/ftc_api_v3_client/models/api_v3_alliance_match.rb

Overview

Match for a traditional event

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 139

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#commit_timeObject

The time the match was last committed. This can change after initial commit/post and can be used to determine if match details are stale.



45
46
47
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 45

def commit_time
  @commit_time
end

#display_nameObject

For display purposes. May include event-specific customization and therefore may not match for equivalent matches between events.



36
37
38
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 36

def display_name
  @display_name
end

#fieldObject

Returns the value of attribute field.



23
24
25
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 23

def field
  @field
end

#match_resultsObject

Returns the value of attribute match_results.



47
48
49
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 47

def match_results
  @match_results
end

#numberObject

For practice and qualification matches, the number of the match as shown on the schedule. For playoff matches, the number within the series (almost always 1 for double-elimination).



42
43
44
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 42

def number
  @number
end

#post_timeObject

Returns the value of attribute post_time.



31
32
33
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 31

def post_time
  @post_time
end

#randomObject

Returns the value of attribute random.



33
34
35
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 33

def random
  @random
end

#scheduled_start_timeObject

Returns the value of attribute scheduled_start_time.



27
28
29
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 27

def scheduled_start_time
  @scheduled_start_time
end

#seriesObject

For practice and qualification matches, this is always 0. For playoff matches, the series number as described in the playoff structure object.



39
40
41
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 39

def series
  @series
end

#short_nameObject

Returns the value of attribute short_name.



21
22
23
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 21

def short_name
  @short_name
end

#start_timeObject

Returns the value of attribute start_time.



29
30
31
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 29

def start_time
  @start_time
end

#teamsObject

Returns the value of attribute teams.



49
50
51
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 49

def teams
  @teams
end

#tournament_levelObject

Returns the value of attribute tournament_level.



25
26
27
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 25

def tournament_level
  @tournament_level
end

#typeObject

Returns the value of attribute type.



19
20
21
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 19

def type
  @type
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



94
95
96
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 94

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



99
100
101
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 99

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 74

def self.attribute_map
  {
    :'type' => :'type',
    :'short_name' => :'shortName',
    :'field' => :'field',
    :'tournament_level' => :'tournamentLevel',
    :'scheduled_start_time' => :'scheduledStartTime',
    :'start_time' => :'startTime',
    :'post_time' => :'postTime',
    :'random' => :'random',
    :'display_name' => :'displayName',
    :'series' => :'series',
    :'number' => :'number',
    :'commit_time' => :'commitTime',
    :'match_results' => :'matchResults',
    :'teams' => :'teams'
  }
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



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 337

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



124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 124

def self.openapi_nullable
  Set.new([
    :'type',
    :'short_name',
    :'tournament_level',
    :'scheduled_start_time',
    :'start_time',
    :'post_time',
    :'display_name',
    :'commit_time',
  ])
end

.openapi_typesObject

Attribute type mapping.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 104

def self.openapi_types
  {
    :'type' => :'String',
    :'short_name' => :'String',
    :'field' => :'Integer',
    :'tournament_level' => :'ApiV3TournamentLevel',
    :'scheduled_start_time' => :'Time',
    :'start_time' => :'Time',
    :'post_time' => :'Time',
    :'random' => :'Integer',
    :'display_name' => :'String',
    :'series' => :'Integer',
    :'number' => :'Integer',
    :'commit_time' => :'Time',
    :'match_results' => :'ApiV3AllianceMatchResults',
    :'teams' => :'ApiV3AllianceMatchParticipants'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 303

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      type == o.type &&
      short_name == o.short_name &&
      field == o.field &&
      tournament_level == o.tournament_level &&
      scheduled_start_time == o.scheduled_start_time &&
      start_time == o.start_time &&
      post_time == o.post_time &&
      random == o.random &&
      display_name == o.display_name &&
      series == o.series &&
      number == o.number &&
      commit_time == o.commit_time &&
      match_results == o.match_results &&
      teams == o.teams
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


324
325
326
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 324

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



330
331
332
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 330

def hash
  [type, short_name, field, tournament_level, scheduled_start_time, start_time, post_time, random, display_name, series, number, commit_time, match_results, teams].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 228

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

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

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

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



359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 359

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



252
253
254
255
256
257
258
259
# File 'lib/ftc_api_v3_client/models/api_v3_alliance_match.rb', line 252

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @field.nil?
  return false if @series.nil?
  return false if @number.nil?
  return false if @teams.nil?
  true
end