Class: Verizon::CustomFieldsUpdateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- Verizon::CustomFieldsUpdateRequest
- Defined in:
- lib/verizon/models/custom_fields_update_request.rb
Overview
Request to assign or change custom field values for one or more devices.
Instance Attribute Summary collapse
-
#account_name ⇒ String
The name of a billing account.This parameter is only required if the UWS account used for the current API session has access to multiple billing accounts.An account name is usually numeric, and must include any leading zeros.
-
#custom_fields ⇒ Array[CustomFields]
Custom field names and values, if you want to only include devices that have matching values.
-
#custom_fields_to_update ⇒ Array[CustomFields]
The names and new values of any custom fields that you want to change.
-
#devices ⇒ Array[AccountDeviceList]
The devices that you want to change.
-
#group_name ⇒ String
The name of a device group, if you want to only include devices in that group.
-
#service_plan ⇒ String
The name of a service plan, if you want to only include devices that have that service plan.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(account_name = SKIP, custom_fields = SKIP, custom_fields_to_update = SKIP, devices = SKIP, group_name = SKIP, service_plan = SKIP) ⇒ CustomFieldsUpdateRequest
constructor
A new instance of CustomFieldsUpdateRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(account_name = SKIP, custom_fields = SKIP, custom_fields_to_update = SKIP, devices = SKIP, group_name = SKIP, service_plan = SKIP) ⇒ CustomFieldsUpdateRequest
Returns a new instance of CustomFieldsUpdateRequest.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 71 def initialize(account_name = SKIP, custom_fields = SKIP, custom_fields_to_update = SKIP, devices = SKIP, group_name = SKIP, service_plan = SKIP) @account_name = account_name unless account_name == SKIP @custom_fields = custom_fields unless custom_fields == SKIP @custom_fields_to_update = custom_fields_to_update unless custom_fields_to_update == SKIP @devices = devices unless devices == SKIP @group_name = group_name unless group_name == SKIP @service_plan = service_plan unless service_plan == SKIP end |
Instance Attribute Details
#account_name ⇒ String
The name of a billing account.This parameter is only required if the UWS account used for the current API session has access to multiple billing accounts.An account name is usually numeric, and must include any leading zeros.
17 18 19 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 17 def account_name @account_name end |
#custom_fields ⇒ Array[CustomFields]
Custom field names and values, if you want to only include devices that have matching values.
22 23 24 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 22 def custom_fields @custom_fields end |
#custom_fields_to_update ⇒ Array[CustomFields]
The names and new values of any custom fields that you want to change.
26 27 28 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 26 def custom_fields_to_update @custom_fields_to_update end |
#devices ⇒ Array[AccountDeviceList]
The devices that you want to change.
30 31 32 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 30 def devices @devices end |
#group_name ⇒ String
The name of a device group, if you want to only include devices in that group.
35 36 37 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 35 def group_name @group_name end |
#service_plan ⇒ String
The name of a service plan, if you want to only include devices that have that service plan.
40 41 42 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 40 def service_plan @service_plan end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
83 84 85 86 87 88 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 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 83 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_name = hash.key?('accountName') ? hash['accountName'] : 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 custom_fields_to_update = nil unless hash['customFieldsToUpdate'].nil? custom_fields_to_update = [] hash['customFieldsToUpdate'].each do |structure| custom_fields_to_update << (CustomFields.from_hash(structure) if structure) end end custom_fields_to_update = SKIP unless hash.key?('customFieldsToUpdate') # Parameter is an array, so we need to iterate through it devices = nil unless hash['devices'].nil? devices = [] hash['devices'].each do |structure| devices << (AccountDeviceList.from_hash(structure) if structure) end end devices = SKIP unless hash.key?('devices') group_name = hash.key?('groupName') ? hash['groupName'] : SKIP service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP # Create object from extracted values. CustomFieldsUpdateRequest.new(account_name, custom_fields, custom_fields_to_update, devices, group_name, service_plan) end |
.names ⇒ Object
A mapping from model property names to API property names.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 43 def self.names @_hash = {} if @_hash.nil? @_hash['account_name'] = 'accountName' @_hash['custom_fields'] = 'customFields' @_hash['custom_fields_to_update'] = 'customFieldsToUpdate' @_hash['devices'] = 'devices' @_hash['group_name'] = 'groupName' @_hash['service_plan'] = 'servicePlan' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/verizon/models/custom_fields_update_request.rb', line 55 def self.optionals %w[ account_name custom_fields custom_fields_to_update devices group_name service_plan ] end |