Class: Verizon::AccountDeviceListRequest

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

Overview

Request for listing account devices.

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, device_id = SKIP, filter = SKIP, current_state = SKIP, custom_fields = SKIP, earliest = SKIP, group_name = SKIP, latest = SKIP, service_plan = SKIP, max_number_of_devices = SKIP, largest_device_id_seen = SKIP) ⇒ AccountDeviceListRequest

Returns a new instance of AccountDeviceListRequest.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/verizon/models/account_device_list_request.rb', line 98

def initialize( = SKIP, device_id = SKIP, filter = SKIP,
               current_state = SKIP, custom_fields = SKIP, earliest = SKIP,
               group_name = SKIP, latest = SKIP, service_plan = SKIP,
               max_number_of_devices = SKIP, largest_device_id_seen = SKIP)
  @account_name =  unless  == SKIP
  @device_id = device_id unless device_id == SKIP
  @filter = filter unless filter == SKIP
  @current_state = current_state unless current_state == SKIP
  @custom_fields = custom_fields unless custom_fields == SKIP
  @earliest = earliest unless earliest == SKIP
  @group_name = group_name unless group_name == SKIP
  @latest = latest unless latest == SKIP
  @service_plan = service_plan unless service_plan == SKIP
  @max_number_of_devices = max_number_of_devices unless max_number_of_devices == SKIP
  @largest_device_id_seen = largest_device_id_seen unless largest_device_id_seen == SKIP
end

Instance Attribute Details

#account_nameString

The billing account for which a list of devices is returned. If you don’t specify an accountName, the list includes all devices to which you have access.

Returns:

  • (String)


16
17
18
# File 'lib/verizon/models/account_device_list_request.rb', line 16

def 
  @account_name
end

#current_stateString

The name of a device state, to only include devices in that state.

Returns:

  • (String)


28
29
30
# File 'lib/verizon/models/account_device_list_request.rb', line 28

def current_state
  @current_state
end

#custom_fieldsArray[CustomFields]

Custom field names and values, if you want to only include devices that have matching values.

Returns:



33
34
35
# File 'lib/verizon/models/account_device_list_request.rb', line 33

def custom_fields
  @custom_fields
end

#device_idDeviceId

An identifier for a single device.

Returns:



20
21
22
# File 'lib/verizon/models/account_device_list_request.rb', line 20

def device_id
  @device_id
end

#earliestString

Only include devices that were added after this date and time.

Returns:

  • (String)


37
38
39
# File 'lib/verizon/models/account_device_list_request.rb', line 37

def earliest
  @earliest
end

#filterAccountDeviceListFilter

Filter for a list of devices.



24
25
26
# File 'lib/verizon/models/account_device_list_request.rb', line 24

def filter
  @filter
end

#group_nameString

Only include devices that are in this device group.

Returns:

  • (String)


41
42
43
# File 'lib/verizon/models/account_device_list_request.rb', line 41

def group_name
  @group_name
end

#largest_device_id_seenInteger

Only include devices that have this service plan.

Returns:

  • (Integer)


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

def largest_device_id_seen
  @largest_device_id_seen
end

#latestString

Only include devices that were added before this date and time.

Returns:

  • (String)


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

def latest
  @latest
end

#max_number_of_devicesInteger

Only include devices that have this service plan.

Returns:

  • (Integer)


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

def max_number_of_devices
  @max_number_of_devices
end

#service_planString

Only include devices that have this service plan.

Returns:

  • (String)


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

def service_plan
  @service_plan
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/verizon/models/account_device_list_request.rb', line 116

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  device_id = DeviceId.from_hash(hash['deviceId']) if hash['deviceId']
  filter = AccountDeviceListFilter.from_hash(hash['filter']) if hash['filter']
  current_state = hash.key?('currentState') ? hash['currentState'] : 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')
  earliest = hash.key?('earliest') ? hash['earliest'] : SKIP
  group_name = hash.key?('groupName') ? hash['groupName'] : SKIP
  latest = hash.key?('latest') ? hash['latest'] : SKIP
  service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP
  max_number_of_devices =
    hash.key?('maxNumberOfDevices') ? hash['maxNumberOfDevices'] : SKIP
  largest_device_id_seen =
    hash.key?('largestDeviceIdSeen') ? hash['largestDeviceIdSeen'] : SKIP

  # Create object from extracted values.
  AccountDeviceListRequest.new(,
                               device_id,
                               filter,
                               current_state,
                               custom_fields,
                               earliest,
                               group_name,
                               latest,
                               service_plan,
                               max_number_of_devices,
                               largest_device_id_seen)
end

.namesObject

A mapping from model property names to API property names.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/verizon/models/account_device_list_request.rb', line 60

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['device_id'] = 'deviceId'
  @_hash['filter'] = 'filter'
  @_hash['current_state'] = 'currentState'
  @_hash['custom_fields'] = 'customFields'
  @_hash['earliest'] = 'earliest'
  @_hash['group_name'] = 'groupName'
  @_hash['latest'] = 'latest'
  @_hash['service_plan'] = 'servicePlan'
  @_hash['max_number_of_devices'] = 'maxNumberOfDevices'
  @_hash['largest_device_id_seen'] = 'largestDeviceIdSeen'
  @_hash
end

.nullablesObject

An array for nullable fields



94
95
96
# File 'lib/verizon/models/account_device_list_request.rb', line 94

def self.nullables
  []
end

.optionalsObject

An array for optional fields



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/verizon/models/account_device_list_request.rb', line 77

def self.optionals
  %w[
    account_name
    device_id
    filter
    current_state
    custom_fields
    earliest
    group_name
    latest
    service_plan
    max_number_of_devices
    largest_device_id_seen
  ]
end