Class: Verizon::ServicePlanUpdateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- Verizon::ServicePlanUpdateRequest
- Defined in:
- lib/verizon/models/service_plan_update_request.rb
Overview
Request to update service plan.
Instance Attribute Summary collapse
-
#account_name ⇒ String
The name of a billing account.
-
#carrier_ip_pool_name ⇒ String
The name of a device group, if you want to restore service for all devices in that group.
-
#current_service_plan ⇒ String
The name of a service plan, if you want to only include devices that have that service plan.
-
#custom_fields ⇒ Array[CustomFields]
Custom field names and values, if you want to only include devices that have matching values.
-
#devices ⇒ Array[AccountDeviceList]
A list of the devices that you want to change, specified by device identifier.
-
#group_name ⇒ String
The name of a device group, if you want to restore service for all devices in that group.
-
#service_plan ⇒ String
The service plan code that you want to assign to all specified devices.
-
#take_effect ⇒ DateTime
The name of a device group, if you want to restore service for all devices in that group.
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(service_plan = nil, account_name = SKIP, current_service_plan = SKIP, custom_fields = SKIP, devices = SKIP, group_name = SKIP, carrier_ip_pool_name = SKIP, take_effect = SKIP) ⇒ ServicePlanUpdateRequest
constructor
A new instance of ServicePlanUpdateRequest.
- #to_custom_take_effect ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(service_plan = nil, account_name = SKIP, current_service_plan = SKIP, custom_fields = SKIP, devices = SKIP, group_name = SKIP, carrier_ip_pool_name = SKIP, take_effect = SKIP) ⇒ ServicePlanUpdateRequest
Returns a new instance of ServicePlanUpdateRequest.
83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 83 def initialize(service_plan = nil, account_name = SKIP, current_service_plan = SKIP, custom_fields = SKIP, devices = SKIP, group_name = SKIP, carrier_ip_pool_name = SKIP, take_effect = SKIP) @service_plan = service_plan @account_name = account_name unless account_name == SKIP @current_service_plan = current_service_plan unless current_service_plan == SKIP @custom_fields = custom_fields unless custom_fields == SKIP @devices = devices unless devices == SKIP @group_name = group_name unless group_name == SKIP @carrier_ip_pool_name = carrier_ip_pool_name unless carrier_ip_pool_name == SKIP @take_effect = take_effect unless take_effect == SKIP end |
Instance Attribute Details
#account_name ⇒ String
The name of a billing account.
19 20 21 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 19 def account_name @account_name end |
#carrier_ip_pool_name ⇒ String
The name of a device group, if you want to restore service for all devices in that group.
44 45 46 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 44 def carrier_ip_pool_name @carrier_ip_pool_name end |
#current_service_plan ⇒ String
The name of a service plan, if you want to only include devices that have that service plan.
24 25 26 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 24 def current_service_plan @current_service_plan end |
#custom_fields ⇒ Array[CustomFields]
Custom field names and values, if you want to only include devices that have matching values.
29 30 31 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 29 def custom_fields @custom_fields end |
#devices ⇒ Array[AccountDeviceList]
A list of the devices that you want to change, specified by device identifier.
34 35 36 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 34 def devices @devices end |
#group_name ⇒ String
The name of a device group, if you want to restore service for all devices in that group.
39 40 41 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 39 def group_name @group_name end |
#service_plan ⇒ String
The service plan code that you want to assign to all specified devices.
15 16 17 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 15 def service_plan @service_plan end |
#take_effect ⇒ DateTime
The name of a device group, if you want to restore service for all devices in that group.
49 50 51 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 49 def take_effect @take_effect end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 98 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : nil account_name = hash.key?('accountName') ? hash['accountName'] : SKIP current_service_plan = hash.key?('currentServicePlan') ? hash['currentServicePlan'] : 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 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 carrier_ip_pool_name = hash.key?('carrierIpPoolName') ? hash['carrierIpPoolName'] : SKIP take_effect = if hash.key?('takeEffect') (DateTimeHelper.from_rfc3339(hash['takeEffect']) if hash['takeEffect']) else SKIP end # Create object from extracted values. ServicePlanUpdateRequest.new(service_plan, account_name, current_service_plan, custom_fields, devices, group_name, carrier_ip_pool_name, take_effect) end |
.names ⇒ Object
A mapping from model property names to API property names.
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 52 def self.names @_hash = {} if @_hash.nil? @_hash['service_plan'] = 'servicePlan' @_hash['account_name'] = 'accountName' @_hash['current_service_plan'] = 'currentServicePlan' @_hash['custom_fields'] = 'customFields' @_hash['devices'] = 'devices' @_hash['group_name'] = 'groupName' @_hash['carrier_ip_pool_name'] = 'carrierIpPoolName' @_hash['take_effect'] = 'takeEffect' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 79 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 66 def self.optionals %w[ account_name current_service_plan custom_fields devices group_name carrier_ip_pool_name take_effect ] end |
Instance Method Details
#to_custom_take_effect ⇒ Object
146 147 148 |
# File 'lib/verizon/models/service_plan_update_request.rb', line 146 def to_custom_take_effect DateTimeHelper.to_rfc3339(take_effect) end |