Class: Verizon::MismatchedDevice

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

Overview

4G devices with an ICCID (SIM) that was not activated with the expected IMEI (hardware) during a specified time frame.

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(account_name: SKIP, mdn: SKIP, activation_date: SKIP, iccid: SKIP, pre_imei: SKIP, post_imei: SKIP, sim_ota_date: SKIP, additional_properties: nil) ⇒ MismatchedDevice

Returns a new instance of MismatchedDevice.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/verizon/models/mismatched_device.rb', line 72

def initialize(account_name: SKIP, mdn: SKIP, activation_date: SKIP,
               iccid: SKIP, pre_imei: SKIP, post_imei: SKIP,
               sim_ota_date: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_name =  unless  == SKIP
  @mdn = mdn unless mdn == SKIP
  @activation_date = activation_date unless activation_date == SKIP
  @iccid = iccid unless iccid == SKIP
  @pre_imei = pre_imei unless pre_imei == SKIP
  @post_imei = post_imei unless post_imei == SKIP
  @sim_ota_date = sim_ota_date unless sim_ota_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_nameString

The account that the device is associated with.

Returns:

  • (String)


15
16
17
# File 'lib/verizon/models/mismatched_device.rb', line 15

def 
  @account_name
end

#activation_dateString

The date and time when the SIM was last activated.

Returns:

  • (String)


23
24
25
# File 'lib/verizon/models/mismatched_device.rb', line 23

def activation_date
  @activation_date
end

#iccidString

The ID of the SIM.

Returns:

  • (String)


27
28
29
# File 'lib/verizon/models/mismatched_device.rb', line 27

def iccid
  @iccid
end

#mdnString

The assigned phone number of the device.

Returns:

  • (String)


19
20
21
# File 'lib/verizon/models/mismatched_device.rb', line 19

def mdn
  @mdn
end

#post_imeiString

The IMEI of the device after the SIM OTA activation on simOtaDate.

Returns:

  • (String)


35
36
37
# File 'lib/verizon/models/mismatched_device.rb', line 35

def post_imei
  @post_imei
end

#pre_imeiString

The IMEI of the device prior to the SIM OTA activation on simOtaDate.

Returns:

  • (String)


31
32
33
# File 'lib/verizon/models/mismatched_device.rb', line 31

def pre_imei
  @pre_imei
end

#sim_ota_dateString

The date and time of the SIM OTA activation.

Returns:

  • (String)


39
40
41
# File 'lib/verizon/models/mismatched_device.rb', line 39

def sim_ota_date
  @sim_ota_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/verizon/models/mismatched_device.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  mdn = hash.key?('mdn') ? hash['mdn'] : SKIP
  activation_date =
    hash.key?('activationDate') ? hash['activationDate'] : SKIP
  iccid = hash.key?('iccid') ? hash['iccid'] : SKIP
  pre_imei = hash.key?('preImei') ? hash['preImei'] : SKIP
  post_imei = hash.key?('postImei') ? hash['postImei'] : SKIP
  sim_ota_date = hash.key?('simOtaDate') ? hash['simOtaDate'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  MismatchedDevice.new(account_name: ,
                       mdn: mdn,
                       activation_date: activation_date,
                       iccid: iccid,
                       pre_imei: pre_imei,
                       post_imei: post_imei,
                       sim_ota_date: sim_ota_date,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/verizon/models/mismatched_device.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['mdn'] = 'mdn'
  @_hash['activation_date'] = 'activationDate'
  @_hash['iccid'] = 'iccid'
  @_hash['pre_imei'] = 'preImei'
  @_hash['post_imei'] = 'postImei'
  @_hash['sim_ota_date'] = 'simOtaDate'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/verizon/models/mismatched_device.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/verizon/models/mismatched_device.rb', line 55

def self.optionals
  %w[
    account_name
    mdn
    activation_date
    iccid
    pre_imei
    post_imei
    sim_ota_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



129
130
131
132
133
134
135
# File 'lib/verizon/models/mismatched_device.rb', line 129

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name.inspect}, mdn: #{@mdn.inspect},"\
  " activation_date: #{@activation_date.inspect}, iccid: #{@iccid.inspect}, pre_imei:"\
  " #{@pre_imei.inspect}, post_imei: #{@post_imei.inspect}, sim_ota_date:"\
  " #{@sim_ota_date.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
126
# File 'lib/verizon/models/mismatched_device.rb', line 121

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name}, mdn: #{@mdn}, activation_date:"\
  " #{@activation_date}, iccid: #{@iccid}, pre_imei: #{@pre_imei}, post_imei: #{@post_imei},"\
  " sim_ota_date: #{@sim_ota_date}, additional_properties: #{@additional_properties}>"
end