Class: Verizon::EtxID

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/etx_id.rb

Overview

EtxID Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(device_id = SKIP, imei = SKIP, iccid = SKIP, imsi = SKIP) ⇒ EtxID

Returns a new instance of EtxID.



57
58
59
60
61
62
# File 'lib/verizon/models/etx_id.rb', line 57

def initialize(device_id = SKIP, imei = SKIP, iccid = SKIP, imsi = SKIP)
  @device_id = device_id unless device_id == SKIP
  @imei = imei unless imei == SKIP
  @iccid = iccid unless iccid == SKIP
  @imsi = imsi unless imsi == SKIP
end

Instance Attribute Details

#device_idUUID | String

The generated ID (UUID v4) for the device. It can be used as:

- the MQTT Client ID when connecting to the Message Exchange system
- a parameter when asking for the connection endpoint
- a parameter when finishing the device registration
- a parameter when unregistering the device

Returns:

  • (UUID | String)


18
19
20
# File 'lib/verizon/models/etx_id.rb', line 18

def device_id
  @device_id
end

#iccidString

The ICCID number of the device.

Returns:

  • (String)


26
27
28
# File 'lib/verizon/models/etx_id.rb', line 26

def iccid
  @iccid
end

#imeiString

The IMEI number of the device.

Returns:

  • (String)


22
23
24
# File 'lib/verizon/models/etx_id.rb', line 22

def imei
  @imei
end

#imsiString

The IMSI number of the device.

Returns:

  • (String)


30
31
32
# File 'lib/verizon/models/etx_id.rb', line 30

def imsi
  @imsi
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/verizon/models/etx_id.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('DeviceID') ? hash['DeviceID'] : SKIP
  imei = hash.key?('IMEI') ? hash['IMEI'] : SKIP
  iccid = hash.key?('ICCID') ? hash['ICCID'] : SKIP
  imsi = hash.key?('IMSI') ? hash['IMSI'] : SKIP

  # Create object from extracted values.
  EtxID.new(device_id,
            imei,
            iccid,
            imsi)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
# File 'lib/verizon/models/etx_id.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'DeviceID'
  @_hash['imei'] = 'IMEI'
  @_hash['iccid'] = 'ICCID'
  @_hash['imsi'] = 'IMSI'
  @_hash
end

.nullablesObject

An array for nullable fields



53
54
55
# File 'lib/verizon/models/etx_id.rb', line 53

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
46
47
48
49
50
# File 'lib/verizon/models/etx_id.rb', line 43

def self.optionals
  %w[
    device_id
    imei
    iccid
    imsi
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



89
90
91
92
93
# File 'lib/verizon/models/etx_id.rb', line 89

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id.inspect}, imei: #{@imei.inspect}, iccid:"\
  " #{@iccid.inspect}, imsi: #{@imsi.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



82
83
84
85
86
# File 'lib/verizon/models/etx_id.rb', line 82

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id}, imei: #{@imei}, iccid: #{@iccid}, imsi:"\
  " #{@imsi}>"
end