Class: MParticle::DeviceInformation

Inherits:
Object
  • Object
show all
Defined in:
lib/mparticle/models/device_information.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DeviceInformation

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'brand')
    self.brand = attributes[:'brand']
  end

  if attributes.has_key?(:'product')
    self.product = attributes[:'product']
  end

  if attributes.has_key?(:'device')
    self.device = attributes[:'device']
  end

  if attributes.has_key?(:'android_uuid')
    self.android_uuid = attributes[:'android_uuid']
  end

  if attributes.has_key?(:'device_manufacturer')
    self.device_manufacturer = attributes[:'device_manufacturer']
  end

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

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

  if attributes.has_key?(:'device_model')
    self.device_model = attributes[:'device_model']
  end

  if attributes.has_key?(:'screen_height')
    self.screen_height = attributes[:'screen_height']
  end

  if attributes.has_key?(:'screen_width')
    self.screen_width = attributes[:'screen_width']
  end

  if attributes.has_key?(:'screen_dpi')
    self.screen_dpi = attributes[:'screen_dpi']
  end

  if attributes.has_key?(:'device_country')
    self.device_country = attributes[:'device_country']
  end

  if attributes.has_key?(:'locale_language')
    self.locale_language = attributes[:'locale_language']
  end

  if attributes.has_key?(:'locale_country')
    self.locale_country = attributes[:'locale_country']
  end

  if attributes.has_key?(:'network_country')
    self.network_country = attributes[:'network_country']
  end

  if attributes.has_key?(:'network_carrier')
    self.network_carrier = attributes[:'network_carrier']
  end

  if attributes.has_key?(:'network_code')
    self.network_code = attributes[:'network_code']
  end

  if attributes.has_key?(:'network_mobile_country_code')
    self.network_mobile_country_code = attributes[:'network_mobile_country_code']
  end

  if attributes.has_key?(:'timezone_offset')
    self.timezone_offset = attributes[:'timezone_offset']
  end

  if attributes.has_key?(:'build_identifier')
    self.build_identifier = attributes[:'build_identifier']
  end

  if attributes.has_key?(:'http_header_user_agent')
    self.http_header_user_agent = attributes[:'http_header_user_agent']
  end

  if attributes.has_key?(:'ios_advertising_id')
    self.ios_advertising_id = attributes[:'ios_advertising_id']
  end

  if attributes.has_key?(:'push_token')
    self.push_token = attributes[:'push_token']
  end

  if attributes.has_key?(:'cpu_architecture')
    self.cpu_architecture = attributes[:'cpu_architecture']
  end

  if attributes.has_key?(:'is_tablet')
    self.is_tablet = attributes[:'is_tablet']
  end

  if attributes.has_key?(:'push_notification_sound_enabled')
    self.push_notification_sound_enabled = attributes[:'push_notification_sound_enabled']
  end

  if attributes.has_key?(:'push_notification_vibrate_enabled')
    self.push_notification_vibrate_enabled = attributes[:'push_notification_vibrate_enabled']
  end

  if attributes.has_key?(:'radio_access_technology')
    self.radio_access_technology = attributes[:'radio_access_technology']
  end

  if attributes.has_key?(:'supports_telephony')
    self.supports_telephony = attributes[:'supports_telephony']
  end

  if attributes.has_key?(:'has_nfc')
    self.has_nfc = attributes[:'has_nfc']
  end

  if attributes.has_key?(:'bluetooth_enabled')
    self.bluetooth_enabled = attributes[:'bluetooth_enabled']
  end

  if attributes.has_key?(:'bluetooth_version')
    self.bluetooth_version = attributes[:'bluetooth_version']
  end

  if attributes.has_key?(:'att_timestamp_unixtime_ms')
    self.att_timestamp_unixtime_ms = attributes[:'att_timestamp_unixtime_ms']
  end

  if attributes.has_key?(:'att_authorization_status')
    self.att_authorization_status = attributes[:'att_authorization_status']
  end

  if attributes.has_key?(:'ios_idfv')
    self.ios_idfv = attributes[:'ios_idfv']
  end

  if attributes.has_key?(:'android_advertising_id')
    self.android_advertising_id = attributes[:'android_advertising_id']
  end

end

Instance Attribute Details

#android_advertising_idObject

Returns the value of attribute android_advertising_id.



76
77
78
# File 'lib/mparticle/models/device_information.rb', line 76

def android_advertising_id
  @android_advertising_id
end

#android_uuidObject

Returns the value of attribute android_uuid.



12
13
14
# File 'lib/mparticle/models/device_information.rb', line 12

def android_uuid
  @android_uuid
end

#att_authorization_statusObject

Returns the value of attribute att_authorization_status.



72
73
74
# File 'lib/mparticle/models/device_information.rb', line 72

def att_authorization_status
  @att_authorization_status
end

#att_timestamp_unixtime_msObject

Returns the value of attribute att_timestamp_unixtime_ms.



70
71
72
# File 'lib/mparticle/models/device_information.rb', line 70

def att_timestamp_unixtime_ms
  @att_timestamp_unixtime_ms
end

#bluetooth_enabledObject

Returns the value of attribute bluetooth_enabled.



66
67
68
# File 'lib/mparticle/models/device_information.rb', line 66

def bluetooth_enabled
  @bluetooth_enabled
end

#bluetooth_versionObject

Returns the value of attribute bluetooth_version.



68
69
70
# File 'lib/mparticle/models/device_information.rb', line 68

def bluetooth_version
  @bluetooth_version
end

#brandObject

Returns the value of attribute brand.



6
7
8
# File 'lib/mparticle/models/device_information.rb', line 6

def brand
  @brand
end

#build_identifierObject

Returns the value of attribute build_identifier.



44
45
46
# File 'lib/mparticle/models/device_information.rb', line 44

def build_identifier
  @build_identifier
end

#cpu_architectureObject

Returns the value of attribute cpu_architecture.



52
53
54
# File 'lib/mparticle/models/device_information.rb', line 52

def cpu_architecture
  @cpu_architecture
end

#deviceObject

Returns the value of attribute device.



10
11
12
# File 'lib/mparticle/models/device_information.rb', line 10

def device
  @device
end

#device_countryObject

Returns the value of attribute device_country.



28
29
30
# File 'lib/mparticle/models/device_information.rb', line 28

def device_country
  @device_country
end

#device_manufacturerObject

Returns the value of attribute device_manufacturer.



14
15
16
# File 'lib/mparticle/models/device_information.rb', line 14

def device_manufacturer
  @device_manufacturer
end

#device_modelObject

Returns the value of attribute device_model.



20
21
22
# File 'lib/mparticle/models/device_information.rb', line 20

def device_model
  @device_model
end

#has_nfcObject

Returns the value of attribute has_nfc.



64
65
66
# File 'lib/mparticle/models/device_information.rb', line 64

def has_nfc
  @has_nfc
end

#http_header_user_agentObject

Returns the value of attribute http_header_user_agent.



46
47
48
# File 'lib/mparticle/models/device_information.rb', line 46

def http_header_user_agent
  @http_header_user_agent
end

#ios_advertising_idObject

Returns the value of attribute ios_advertising_id.



48
49
50
# File 'lib/mparticle/models/device_information.rb', line 48

def ios_advertising_id
  @ios_advertising_id
end

#ios_idfvObject

Returns the value of attribute ios_idfv.



74
75
76
# File 'lib/mparticle/models/device_information.rb', line 74

def ios_idfv
  @ios_idfv
end

#is_tabletObject

Returns the value of attribute is_tablet.



54
55
56
# File 'lib/mparticle/models/device_information.rb', line 54

def is_tablet
  @is_tablet
end

#locale_countryObject

Returns the value of attribute locale_country.



32
33
34
# File 'lib/mparticle/models/device_information.rb', line 32

def locale_country
  @locale_country
end

#locale_languageObject

Returns the value of attribute locale_language.



30
31
32
# File 'lib/mparticle/models/device_information.rb', line 30

def locale_language
  @locale_language
end

#network_carrierObject

Returns the value of attribute network_carrier.



36
37
38
# File 'lib/mparticle/models/device_information.rb', line 36

def network_carrier
  @network_carrier
end

#network_codeObject

Returns the value of attribute network_code.



38
39
40
# File 'lib/mparticle/models/device_information.rb', line 38

def network_code
  @network_code
end

#network_countryObject

Returns the value of attribute network_country.



34
35
36
# File 'lib/mparticle/models/device_information.rb', line 34

def network_country
  @network_country
end

#network_mobile_country_codeObject

Returns the value of attribute network_mobile_country_code.



40
41
42
# File 'lib/mparticle/models/device_information.rb', line 40

def network_mobile_country_code
  @network_mobile_country_code
end

#os_versionObject

Returns the value of attribute os_version.



18
19
20
# File 'lib/mparticle/models/device_information.rb', line 18

def os_version
  @os_version
end

#platformObject

Returns the value of attribute platform.



16
17
18
# File 'lib/mparticle/models/device_information.rb', line 16

def platform
  @platform
end

#productObject

Returns the value of attribute product.



8
9
10
# File 'lib/mparticle/models/device_information.rb', line 8

def product
  @product
end

#push_notification_sound_enabledObject

Returns the value of attribute push_notification_sound_enabled.



56
57
58
# File 'lib/mparticle/models/device_information.rb', line 56

def push_notification_sound_enabled
  @push_notification_sound_enabled
end

#push_notification_vibrate_enabledObject

Returns the value of attribute push_notification_vibrate_enabled.



58
59
60
# File 'lib/mparticle/models/device_information.rb', line 58

def push_notification_vibrate_enabled
  @push_notification_vibrate_enabled
end

#push_tokenObject

Returns the value of attribute push_token.



50
51
52
# File 'lib/mparticle/models/device_information.rb', line 50

def push_token
  @push_token
end

#radio_access_technologyObject

Returns the value of attribute radio_access_technology.



60
61
62
# File 'lib/mparticle/models/device_information.rb', line 60

def radio_access_technology
  @radio_access_technology
end

#screen_dpiObject

Returns the value of attribute screen_dpi.



26
27
28
# File 'lib/mparticle/models/device_information.rb', line 26

def screen_dpi
  @screen_dpi
end

#screen_heightObject

Returns the value of attribute screen_height.



22
23
24
# File 'lib/mparticle/models/device_information.rb', line 22

def screen_height
  @screen_height
end

#screen_widthObject

Returns the value of attribute screen_width.



24
25
26
# File 'lib/mparticle/models/device_information.rb', line 24

def screen_width
  @screen_width
end

#supports_telephonyObject

Returns the value of attribute supports_telephony.



62
63
64
# File 'lib/mparticle/models/device_information.rb', line 62

def supports_telephony
  @supports_telephony
end

#timezone_offsetObject

Returns the value of attribute timezone_offset.



42
43
44
# File 'lib/mparticle/models/device_information.rb', line 42

def timezone_offset
  @timezone_offset
end

Class Method Details

.attribute_mapObject

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



101
102
103
104
105
106
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
135
136
137
138
139
140
# File 'lib/mparticle/models/device_information.rb', line 101

def self.attribute_map
  {
    :'brand' => :'brand',
    :'product' => :'product',
    :'device' => :'device',
    :'android_uuid' => :'android_uuid',
    :'device_manufacturer' => :'device_manufacturer',
    :'platform' => :'platform',
    :'os_version' => :'os_version',
    :'device_model' => :'device_model',
    :'screen_height' => :'screen_height',
    :'screen_width' => :'screen_width',
    :'screen_dpi' => :'screen_dpi',
    :'device_country' => :'device_country',
    :'locale_language' => :'locale_language',
    :'locale_country' => :'locale_country',
    :'network_country' => :'network_country',
    :'network_carrier' => :'network_carrier',
    :'network_code' => :'network_code',
    :'network_mobile_country_code' => :'network_mobile_country_code',
    :'timezone_offset' => :'timezone_offset',
    :'build_identifier' => :'build_identifier',
    :'http_header_user_agent' => :'http_header_user_agent',
    :'ios_advertising_id' => :'ios_advertising_id',
    :'push_token' => :'push_token',
    :'cpu_architecture' => :'cpu_architecture',
    :'is_tablet' => :'is_tablet',
    :'push_notification_sound_enabled' => :'push_notification_sound_enabled',
    :'push_notification_vibrate_enabled' => :'push_notification_vibrate_enabled',
    :'radio_access_technology' => :'radio_access_technology',
    :'supports_telephony' => :'supports_telephony',
    :'has_nfc' => :'has_nfc',
    :'bluetooth_enabled' => :'bluetooth_enabled',
    :'bluetooth_version' => :'bluetooth_version',
    :'att_timestamp_unixtime_ms' => :'att_timestamp_unixtime_ms',
    :'att_authorization_status' => :'att_authorization_status',
    :'ios_idfv' => :'ios_idfv',
    :'android_advertising_id' => :'android_advertising_id'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/mparticle/models/device_information.rb', line 143

def self.swagger_types
  {
    :'brand' => :'String',
    :'product' => :'String',
    :'device' => :'String',
    :'android_uuid' => :'String',
    :'device_manufacturer' => :'String',
    :'platform' => :'String',
    :'os_version' => :'String',
    :'device_model' => :'String',
    :'screen_height' => :'Integer',
    :'screen_width' => :'Integer',
    :'screen_dpi' => :'Integer',
    :'device_country' => :'String',
    :'locale_language' => :'String',
    :'locale_country' => :'String',
    :'network_country' => :'String',
    :'network_carrier' => :'String',
    :'network_code' => :'String',
    :'network_mobile_country_code' => :'String',
    :'timezone_offset' => :'Integer',
    :'build_identifier' => :'String',
    :'http_header_user_agent' => :'String',
    :'ios_advertising_id' => :'String',
    :'push_token' => :'String',
    :'cpu_architecture' => :'String',
    :'is_tablet' => :'BOOLEAN',
    :'push_notification_sound_enabled' => :'BOOLEAN',
    :'push_notification_vibrate_enabled' => :'BOOLEAN',
    :'radio_access_technology' => :'String',
    :'supports_telephony' => :'BOOLEAN',
    :'has_nfc' => :'BOOLEAN',
    :'bluetooth_enabled' => :'BOOLEAN',
    :'bluetooth_version' => :'String',
    :'att_timestamp_unixtime_ms' => :'Integer',
    :'att_authorization_status' => :'String',
    :'ios_idfv' => :'String',
    :'android_advertising_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/mparticle/models/device_information.rb', line 377

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      brand == o.brand &&
      product == o.product &&
      device == o.device &&
      android_uuid == o.android_uuid &&
      device_manufacturer == o.device_manufacturer &&
      platform == o.platform &&
      os_version == o.os_version &&
      device_model == o.device_model &&
      screen_height == o.screen_height &&
      screen_width == o.screen_width &&
      screen_dpi == o.screen_dpi &&
      device_country == o.device_country &&
      locale_language == o.locale_language &&
      locale_country == o.locale_country &&
      network_country == o.network_country &&
      network_carrier == o.network_carrier &&
      network_code == o.network_code &&
      network_mobile_country_code == o.network_mobile_country_code &&
      timezone_offset == o.timezone_offset &&
      build_identifier == o.build_identifier &&
      http_header_user_agent == o.http_header_user_agent &&
      ios_advertising_id == o.ios_advertising_id &&
      push_token == o.push_token &&
      cpu_architecture == o.cpu_architecture &&
      is_tablet == o.is_tablet &&
      push_notification_sound_enabled == o.push_notification_sound_enabled &&
      push_notification_vibrate_enabled == o.push_notification_vibrate_enabled &&
      radio_access_technology == o.radio_access_technology &&
      supports_telephony == o.supports_telephony &&
      has_nfc == o.has_nfc &&
      bluetooth_enabled == o.bluetooth_enabled &&
      bluetooth_version == o.bluetooth_version &&
      att_timestamp_unixtime_ms == o.att_timestamp_unixtime_ms &&
      att_authorization_status == o.att_authorization_status &&
      ios_idfv == o.ios_idfv &&
      android_advertising_id == o.android_advertising_id
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



454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/mparticle/models/device_information.rb', line 454

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    temp_model = MParticle.const_get(type).new
    temp_model.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



520
521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/mparticle/models/device_information.rb', line 520

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



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/mparticle/models/device_information.rb', line 433

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


420
421
422
# File 'lib/mparticle/models/device_information.rb', line 420

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



426
427
428
# File 'lib/mparticle/models/device_information.rb', line 426

def hash
  [brand, product, device, android_uuid, device_manufacturer, platform, os_version, device_model, screen_height, screen_width, screen_dpi, device_country, locale_language, locale_country, network_country, network_carrier, network_code, network_mobile_country_code, timezone_offset, build_identifier, http_header_user_agent, ios_advertising_id, push_token, cpu_architecture, is_tablet, push_notification_sound_enabled, push_notification_vibrate_enabled, radio_access_technology, supports_telephony, has_nfc, bluetooth_enabled, bluetooth_version, att_timestamp_unixtime_ms, att_authorization_status, ios_idfv, android_advertising_id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



340
341
342
343
# File 'lib/mparticle/models/device_information.rb', line 340

def list_invalid_properties
  invalid_properties = Array.new
  return 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



500
501
502
# File 'lib/mparticle/models/device_information.rb', line 500

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



506
507
508
509
510
511
512
513
514
# File 'lib/mparticle/models/device_information.rb', line 506

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



494
495
496
# File 'lib/mparticle/models/device_information.rb', line 494

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



347
348
349
350
351
352
353
# File 'lib/mparticle/models/device_information.rb', line 347

def valid?
  platform_validator = EnumAttributeValidator.new('String', ["Unknown", "iOS", "Android", "web", "tvOS", "roku", "out_of_band", "alexa", "smart_tv", "fire_tv", "xbox"])
  att_validator = EnumAttributeValidator.new('String', ["authorized", "denied", "not_determined", "restricted"])
  return false unless platform_validator.valid?(@platform)
  return false unless att_validator.valid?(@att_authorization_status)
  return true
end