Class: Falcon::Device3550eb212db1414995c297cdbfe5cc16

Inherits:
Object
  • Object
show all
Defined in:
lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Device3550eb212db1414995c297cdbfe5cc16

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
225
226
227
228
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 142

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Falcon::Device3550eb212db1414995c297cdbfe5cc16` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Falcon::Device3550eb212db1414995c297cdbfe5cc16`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



35
36
37
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 35

def 
  @account_id
end

#apps_countObject

Returns the value of attribute apps_count.



37
38
39
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 37

def apps_count
  @apps_count
end

#device_nameObject

Returns the value of attribute device_name.



39
40
41
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 39

def device_name
  @device_name
end

#globally_compliantObject

Returns the value of attribute globally_compliant.



41
42
43
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 41

def globally_compliant
  @globally_compliant
end

#globally_managedObject

Returns the value of attribute globally_managed.



43
44
45
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 43

def globally_managed
  @globally_managed
end

#has_user_associationObject

Returns the value of attribute has_user_association.



45
46
47
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 45

def has_user_association
  @has_user_association
end

#idObject

Returns the value of attribute id.



47
48
49
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 47

def id
  @id
end

#last_seenObject

Returns the value of attribute last_seen.



49
50
51
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 49

def last_seen
  @last_seen
end

#mac_address_listObject

Returns the value of attribute mac_address_list.



51
52
53
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 51

def mac_address_list
  @mac_address_list
end

#osObject

Returns the value of attribute os.



53
54
55
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 53

def os
  @os
end

#os_versionObject

Returns the value of attribute os_version.



55
56
57
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 55

def os_version
  @os_version
end

#platformObject

Returns the value of attribute platform.



57
58
59
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 57

def platform
  @platform
end

#privileged_roles_countObject

Returns the value of attribute privileged_roles_count.



59
60
61
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 59

def privileged_roles_count
  @privileged_roles_count
end

#reported_appsObject

Returns the value of attribute reported_apps.



61
62
63
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 61

def reported_apps
  @reported_apps
end

#reportersObject

Returns the value of attribute reporters.



63
64
65
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 63

def reporters
  @reporters
end

#user_emailObject

Returns the value of attribute user_email.



65
66
67
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 65

def user_email
  @user_email
end

#user_existsObject

Returns the value of attribute user_exists.



67
68
69
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 67

def user_exists
  @user_exists
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



93
94
95
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 93

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 70

def self.attribute_map
  {
    :'account_id' => :'account_id',
    :'apps_count' => :'apps_count',
    :'device_name' => :'device_name',
    :'globally_compliant' => :'globally_compliant',
    :'globally_managed' => :'globally_managed',
    :'has_user_association' => :'has_user_association',
    :'id' => :'id',
    :'last_seen' => :'last_seen',
    :'mac_address_list' => :'mac_address_list',
    :'os' => :'os',
    :'os_version' => :'os_version',
    :'platform' => :'platform',
    :'privileged_roles_count' => :'privileged_roles_count',
    :'reported_apps' => :'reported_apps',
    :'reporters' => :'reporters',
    :'user_email' => :'user_email',
    :'user_exists' => :'user_exists'
  }
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



436
437
438
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 436

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 121

def self.openapi_nullable
  Set.new([
    :'apps_count',
    :'device_name',
    :'globally_compliant',
    :'globally_managed',
    :'has_user_association',
    :'last_seen',
    :'mac_address_list',
    :'os',
    :'os_version',
    :'platform',
    :'privileged_roles_count',
    :'reported_apps',
    :'user_email',
    :'user_exists'
  ])
end

.openapi_typesObject

Attribute type mapping.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 98

def self.openapi_types
  {
    :'account_id' => :'String',
    :'apps_count' => :'Integer',
    :'device_name' => :'String',
    :'globally_compliant' => :'String',
    :'globally_managed' => :'String',
    :'has_user_association' => :'Boolean',
    :'id' => :'String',
    :'last_seen' => :'String',
    :'mac_address_list' => :'Array<String>',
    :'os' => :'String',
    :'os_version' => :'String',
    :'platform' => :'String',
    :'privileged_roles_count' => :'Integer',
    :'reported_apps' => :'Array<String>',
    :'reporters' => :'Array<String>',
    :'user_email' => :'String',
    :'user_exists' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 399

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      apps_count == o.apps_count &&
      device_name == o.device_name &&
      globally_compliant == o.globally_compliant &&
      globally_managed == o.globally_managed &&
      has_user_association == o.has_user_association &&
      id == o.id &&
      last_seen == o.last_seen &&
      mac_address_list == o.mac_address_list &&
      os == o.os &&
      os_version == o.os_version &&
      platform == o.platform &&
      privileged_roles_count == o.privileged_roles_count &&
      reported_apps == o.reported_apps &&
      reporters == o.reporters &&
      user_email == o.user_email &&
      user_exists == o.user_exists
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 467

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

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



538
539
540
541
542
543
544
545
546
547
548
549
550
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 538

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

#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



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 443

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


423
424
425
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 423

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



429
430
431
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 429

def hash
  [, apps_count, device_name, globally_compliant, globally_managed, has_user_association, id, last_seen, mac_address_list, os, os_version, platform, privileged_roles_count, reported_apps, reporters, user_email, user_exists].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 232

def list_invalid_properties
  invalid_properties = Array.new
  if @account_id.nil?
    invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
  end

  if @device_name.to_s.length < 1
    invalid_properties.push('invalid value for "device_name", the character length must be great than or equal to 1.')
  end

  if @globally_compliant.to_s.length < 1
    invalid_properties.push('invalid value for "globally_compliant", the character length must be great than or equal to 1.')
  end

  if @globally_managed.to_s.length < 1
    invalid_properties.push('invalid value for "globally_managed", the character length must be great than or equal to 1.')
  end

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

  if @id.to_s.length < 1
    invalid_properties.push('invalid value for "id", the character length must be great than or equal to 1.')
  end

  if @last_seen.to_s.length < 1
    invalid_properties.push('invalid value for "last_seen", the character length must be great than or equal to 1.')
  end

  if @os.to_s.length < 1
    invalid_properties.push('invalid value for "os", the character length must be great than or equal to 1.')
  end

  if @os_version.to_s.length < 1
    invalid_properties.push('invalid value for "os_version", the character length must be great than or equal to 1.')
  end

  if @platform.to_s.length < 1
    invalid_properties.push('invalid value for "platform", the character length must be great than or equal to 1.')
  end

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

  if @user_email.to_s.length < 1
    invalid_properties.push('invalid value for "user_email", the character length must be great than or equal to 1.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



514
515
516
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 514

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



520
521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 520

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)

    String presentation of the object



508
509
510
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 508

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/crimson-falcon/models/device3550eb212db1414995c297cdbfe5cc16.rb', line 287

def valid?
  return false if @account_id.nil?
  return false if @device_name.to_s.length < 1
  return false if @globally_compliant.to_s.length < 1
  return false if @globally_managed.to_s.length < 1
  return false if @id.nil?
  return false if @id.to_s.length < 1
  return false if @last_seen.to_s.length < 1
  return false if @os.to_s.length < 1
  return false if @os_version.to_s.length < 1
  return false if @platform.to_s.length < 1
  return false if @reporters.nil?
  return false if @user_email.to_s.length < 1
  true
end