Class: Verizon::UploadsActivatesDeviceRequest

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

Overview

The request body identifies the devices to upload.

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:, email_address:, device_sku:, upload_type:, service_plan:, mdn_zip_code:, devices:, carrier_ip_pool_name: SKIP, additional_properties: nil) ⇒ UploadsActivatesDeviceRequest

Returns a new instance of UploadsActivatesDeviceRequest.



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

def initialize(account_name:, email_address:, device_sku:, upload_type:,
               service_plan:, mdn_zip_code:, devices:,
               carrier_ip_pool_name: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_name = 
  @email_address = email_address
  @device_sku = device_sku
  @upload_type = upload_type
  @service_plan = service_plan
  @carrier_ip_pool_name = carrier_ip_pool_name unless carrier_ip_pool_name == SKIP
  @mdn_zip_code = mdn_zip_code
  @devices = devices
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_nameString

The name of a billing account. An account name is usually numeric, and must include any leading zeros.

Returns:

  • (String)


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

def 
  @account_name
end

#carrier_ip_pool_nameString

The pool from which your device IP addresses is derived.

Returns:

  • (String)


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

def carrier_ip_pool_name
  @carrier_ip_pool_name
end

#device_skuString

The stock keeping unit that identifies the type of devices in the upload and activation.

Returns:

  • (String)


25
26
27
# File 'lib/verizon/models/uploads_activates_device_request.rb', line 25

def device_sku
  @device_sku
end

#devicesArray[DeviceList]

The devices to upload, specified by device IDs in a format matching uploadType.

Returns:



47
48
49
# File 'lib/verizon/models/uploads_activates_device_request.rb', line 47

def devices
  @devices
end

#email_addressString

The email address that the report should be sent to when the upload is complete.

Returns:

  • (String)


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

def email_address
  @email_address
end

#mdn_zip_codeString

The Zip code of the location where the line of service is primarily used, or a Zip code that you have been told to use with these devices.

Returns:

  • (String)


42
43
44
# File 'lib/verizon/models/uploads_activates_device_request.rb', line 42

def mdn_zip_code
  @mdn_zip_code
end

#service_planString

The service plan code that you want to assign to all specified devices.

Returns:

  • (String)


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

def service_plan
  @service_plan
end

#upload_typeString

The format of the device identifiers in the upload and activation.

Returns:

  • (String)


29
30
31
# File 'lib/verizon/models/uploads_activates_device_request.rb', line 29

def upload_type
  @upload_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
129
130
131
132
133
# File 'lib/verizon/models/uploads_activates_device_request.rb', line 93

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : nil
  email_address = hash.key?('emailAddress') ? hash['emailAddress'] : nil
  device_sku = hash.key?('deviceSku') ? hash['deviceSku'] : nil
  upload_type = hash.key?('uploadType') ? hash['uploadType'] : nil
  service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : nil
  mdn_zip_code = hash.key?('mdnZipCode') ? hash['mdnZipCode'] : nil
  # Parameter is an array, so we need to iterate through it
  devices = nil
  unless hash['devices'].nil?
    devices = []
    hash['devices'].each do |structure|
      devices << (DeviceList.from_hash(structure) if structure)
    end
  end

  devices = nil unless hash.key?('devices')
  carrier_ip_pool_name =
    hash.key?('carrierIpPoolName') ? hash['carrierIpPoolName'] : 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.
  UploadsActivatesDeviceRequest.new(account_name: ,
                                    email_address: email_address,
                                    device_sku: device_sku,
                                    upload_type: upload_type,
                                    service_plan: service_plan,
                                    mdn_zip_code: mdn_zip_code,
                                    devices: devices,
                                    carrier_ip_pool_name: carrier_ip_pool_name,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/verizon/models/uploads_activates_device_request.rb', line 50

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['email_address'] = 'emailAddress'
  @_hash['device_sku'] = 'deviceSku'
  @_hash['upload_type'] = 'uploadType'
  @_hash['service_plan'] = 'servicePlan'
  @_hash['carrier_ip_pool_name'] = 'carrierIpPoolName'
  @_hash['mdn_zip_code'] = 'mdnZipCode'
  @_hash['devices'] = 'devices'
  @_hash
end

.nullablesObject

An array for nullable fields



71
72
73
# File 'lib/verizon/models/uploads_activates_device_request.rb', line 71

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
# File 'lib/verizon/models/uploads_activates_device_request.rb', line 64

def self.optionals
  %w[
    carrier_ip_pool_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



145
146
147
148
149
150
151
152
# File 'lib/verizon/models/uploads_activates_device_request.rb', line 145

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name.inspect}, email_address:"\
  " #{@email_address.inspect}, device_sku: #{@device_sku.inspect}, upload_type:"\
  " #{@upload_type.inspect}, service_plan: #{@service_plan.inspect}, carrier_ip_pool_name:"\
  " #{@carrier_ip_pool_name.inspect}, mdn_zip_code: #{@mdn_zip_code.inspect}, devices:"\
  " #{@devices.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



136
137
138
139
140
141
142
# File 'lib/verizon/models/uploads_activates_device_request.rb', line 136

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name}, email_address: #{@email_address},"\
  " device_sku: #{@device_sku}, upload_type: #{@upload_type}, service_plan: #{@service_plan},"\
  " carrier_ip_pool_name: #{@carrier_ip_pool_name}, mdn_zip_code: #{@mdn_zip_code}, devices:"\
  " #{@devices}, additional_properties: #{@additional_properties}>"
end