Class: Verizon::ThingspaceDevice

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

Overview

Device that exist in Verizon Mobile Device Management (MDM).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(account_name = SKIP, billing_cycle_end_date = SKIP, carrier_informations = SKIP, connected = SKIP, created_at = SKIP, custom_fields = SKIP, device_ids = SKIP, extended_attributes = SKIP, group_names = SKIP, ipaddress = SKIP, last_activation_by = SKIP, last_activation_date = SKIP, last_connection_date = SKIP) ⇒ ThingspaceDevice

Returns a new instance of ThingspaceDevice.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/verizon/models/thingspace_device.rb', line 110

def initialize( = SKIP, billing_cycle_end_date = SKIP,
               carrier_informations = SKIP, connected = SKIP,
               created_at = SKIP, custom_fields = SKIP, device_ids = SKIP,
               extended_attributes = SKIP, group_names = SKIP,
               ipaddress = SKIP, last_activation_by = SKIP,
               last_activation_date = SKIP, last_connection_date = SKIP)
  @account_name =  unless  == SKIP
  @billing_cycle_end_date = billing_cycle_end_date unless billing_cycle_end_date == SKIP
  @carrier_informations = carrier_informations unless carrier_informations == SKIP
  @connected = connected unless connected == SKIP
  @created_at = created_at unless created_at == SKIP
  @custom_fields = custom_fields unless custom_fields == SKIP
  @device_ids = device_ids unless device_ids == SKIP
  @extended_attributes = extended_attributes unless extended_attributes == SKIP
  @group_names = group_names unless group_names == SKIP
  @ipaddress = ipaddress unless ipaddress == SKIP
  @last_activation_by = last_activation_by unless last_activation_by == SKIP
  @last_activation_date = last_activation_date unless last_activation_date == SKIP
  @last_connection_date = last_connection_date unless last_connection_date == SKIP
end

Instance Attribute Details

#account_nameString

The billing account that the device is associated with.

Returns:

  • (String)


14
15
16
# File 'lib/verizon/models/thingspace_device.rb', line 14

def 
  @account_name
end

#billing_cycle_end_dateString

The date that the device’s current billing cycle ends.

Returns:

  • (String)


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

def billing_cycle_end_date
  @billing_cycle_end_date
end

#carrier_informationsArray[CarrierInformation]

The carrier information associated with the device.

Returns:



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

def carrier_informations
  @carrier_informations
end

#connectedTrueClass | FalseClass

True if the device is connected; false if it is not.

Returns:

  • (TrueClass | FalseClass)


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

def connected
  @connected
end

#created_atString

The date and time that the device was added to the system.

Returns:

  • (String)


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

def created_at
  @created_at
end

#custom_fieldsArray[CustomFields]

The custom fields and values that have been set for the device.

Returns:



34
35
36
# File 'lib/verizon/models/thingspace_device.rb', line 34

def custom_fields
  @custom_fields
end

#device_idsArray[DeviceId]

All identifiers for the device.

Returns:



38
39
40
# File 'lib/verizon/models/thingspace_device.rb', line 38

def device_ids
  @device_ids
end

#extended_attributesArray[CustomFields]

Any extended attributes for the device, as Key and Value pairs. The pairs listed below are returned as part of the response for a single device, but are not included if the request was for information about multiple devices.

Returns:



45
46
47
# File 'lib/verizon/models/thingspace_device.rb', line 45

def extended_attributes
  @extended_attributes
end

#group_namesArray[String]

The device groups that the device belongs to.

Returns:

  • (Array[String])


49
50
51
# File 'lib/verizon/models/thingspace_device.rb', line 49

def group_names
  @group_names
end

#ipaddressString

The IP address of the device.

Returns:

  • (String)


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

def ipaddress
  @ipaddress
end

#last_activation_byString

The user who last activated the device.

Returns:

  • (String)


57
58
59
# File 'lib/verizon/models/thingspace_device.rb', line 57

def last_activation_by
  @last_activation_by
end

#last_activation_dateString

The date and time that the device was last activated.

Returns:

  • (String)


61
62
63
# File 'lib/verizon/models/thingspace_device.rb', line 61

def last_activation_date
  @last_activation_date
end

#last_connection_dateString

The most recent connection date and time.

Returns:

  • (String)


65
66
67
# File 'lib/verizon/models/thingspace_device.rb', line 65

def last_connection_date
  @last_connection_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



132
133
134
135
136
137
138
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
# File 'lib/verizon/models/thingspace_device.rb', line 132

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  billing_cycle_end_date =
    hash.key?('billingCycleEndDate') ? hash['billingCycleEndDate'] : SKIP
  # Parameter is an array, so we need to iterate through it
  carrier_informations = nil
  unless hash['carrierInformations'].nil?
    carrier_informations = []
    hash['carrierInformations'].each do |structure|
      carrier_informations << (CarrierInformation.from_hash(structure) if structure)
    end
  end

  carrier_informations = SKIP unless hash.key?('carrierInformations')
  connected = hash.key?('connected') ? hash['connected'] : SKIP
  created_at = hash.key?('createdAt') ? hash['createdAt'] : SKIP
  # Parameter is an array, so we need to iterate through it
  custom_fields = nil
  unless hash['customFields'].nil?
    custom_fields = []
    hash['customFields'].each do |structure|
      custom_fields << (CustomFields.from_hash(structure) if structure)
    end
  end

  custom_fields = SKIP unless hash.key?('customFields')
  # Parameter is an array, so we need to iterate through it
  device_ids = nil
  unless hash['deviceIds'].nil?
    device_ids = []
    hash['deviceIds'].each do |structure|
      device_ids << (DeviceId.from_hash(structure) if structure)
    end
  end

  device_ids = SKIP unless hash.key?('deviceIds')
  # Parameter is an array, so we need to iterate through it
  extended_attributes = nil
  unless hash['extendedAttributes'].nil?
    extended_attributes = []
    hash['extendedAttributes'].each do |structure|
      extended_attributes << (CustomFields.from_hash(structure) if structure)
    end
  end

  extended_attributes = SKIP unless hash.key?('extendedAttributes')
  group_names = hash.key?('groupNames') ? hash['groupNames'] : SKIP
  ipaddress = hash.key?('ipAddress') ? hash['ipAddress'] : SKIP
  last_activation_by =
    hash.key?('lastActivationBy') ? hash['lastActivationBy'] : SKIP
  last_activation_date =
    hash.key?('lastActivationDate') ? hash['lastActivationDate'] : SKIP
  last_connection_date =
    hash.key?('lastConnectionDate') ? hash['lastConnectionDate'] : SKIP

  # Create object from extracted values.
  ThingspaceDevice.new(,
                       billing_cycle_end_date,
                       carrier_informations,
                       connected,
                       created_at,
                       custom_fields,
                       device_ids,
                       extended_attributes,
                       group_names,
                       ipaddress,
                       last_activation_by,
                       last_activation_date,
                       last_connection_date)
end

.namesObject

A mapping from model property names to API property names.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/verizon/models/thingspace_device.rb', line 68

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['billing_cycle_end_date'] = 'billingCycleEndDate'
  @_hash['carrier_informations'] = 'carrierInformations'
  @_hash['connected'] = 'connected'
  @_hash['created_at'] = 'createdAt'
  @_hash['custom_fields'] = 'customFields'
  @_hash['device_ids'] = 'deviceIds'
  @_hash['extended_attributes'] = 'extendedAttributes'
  @_hash['group_names'] = 'groupNames'
  @_hash['ipaddress'] = 'ipAddress'
  @_hash['last_activation_by'] = 'lastActivationBy'
  @_hash['last_activation_date'] = 'lastActivationDate'
  @_hash['last_connection_date'] = 'lastConnectionDate'
  @_hash
end

.nullablesObject

An array for nullable fields



106
107
108
# File 'lib/verizon/models/thingspace_device.rb', line 106

def self.nullables
  []
end

.optionalsObject

An array for optional fields



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/verizon/models/thingspace_device.rb', line 87

def self.optionals
  %w[
    account_name
    billing_cycle_end_date
    carrier_informations
    connected
    created_at
    custom_fields
    device_ids
    extended_attributes
    group_names
    ipaddress
    last_activation_by
    last_activation_date
    last_connection_date
  ]
end