Class: Verizon::DeviceCostCenterRequest

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

Overview

Request to retrieve cost center value of a device.

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, cost_center = SKIP, custom_fields = SKIP, devices = SKIP, group_name = SKIP, primary_place_of_use = SKIP, remove_cost_center = SKIP, service_plan = SKIP) ⇒ DeviceCostCenterRequest

Returns a new instance of DeviceCostCenterRequest.



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

def initialize( = SKIP, cost_center = SKIP,
               custom_fields = SKIP, devices = SKIP, group_name = SKIP,
               primary_place_of_use = SKIP, remove_cost_center = SKIP,
               service_plan = SKIP)
  @account_name =  unless  == SKIP
  @cost_center = cost_center unless cost_center == SKIP
  @custom_fields = custom_fields unless custom_fields == SKIP
  @devices = devices unless devices == SKIP
  @group_name = group_name unless group_name == SKIP
  @primary_place_of_use = primary_place_of_use unless primary_place_of_use == SKIP
  @remove_cost_center = remove_cost_center unless remove_cost_center == SKIP
  @service_plan = service_plan unless service_plan == SKIP
end

Instance Attribute Details

#account_nameString

The name of a billing account.

Returns:

  • (String)


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

def 
  @account_name
end

#cost_centerString

The new cost center code. Valid values are any string of up to 36 alphanumeric characters, space, dash, exclamation point, and pound sign.

Returns:

  • (String)


19
20
21
# File 'lib/verizon/models/device_cost_center_request.rb', line 19

def cost_center
  @cost_center
end

#custom_fieldsArray[CustomFields]

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

Returns:



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

def custom_fields
  @custom_fields
end

#devicesArray[AccountDeviceList]

A list of the devices that you want to change, specified by device identifier. Do not include accountName, groupName, customFields, or servicePlan if you use this parameter.

Returns:



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

def devices
  @devices
end

#group_nameString

The name of a device group, if you want to only include devices in that group.

Returns:

  • (String)


35
36
37
# File 'lib/verizon/models/device_cost_center_request.rb', line 35

def group_name
  @group_name
end

#primary_place_of_useObject

The customer name and the address of the device’s primary place of use. These values are applied to all devices in the request.The Primary Place of Use location may affect taxation or have other legal implications. You may want to speak with legal and/or financial advisers before entering values for these fields.

Returns:

  • (Object)


43
44
45
# File 'lib/verizon/models/device_cost_center_request.rb', line 43

def primary_place_of_use
  @primary_place_of_use
end

#remove_cost_centerTrueClass | FalseClass

Set to true to remove the cost center code value. This flag takes precedence over a new costCenter value. If this flag is true and costCenter has a value, the cost center code is removed. Do not include this parameter, or set it to false to change the costCenter value.

Returns:

  • (TrueClass | FalseClass)


50
51
52
# File 'lib/verizon/models/device_cost_center_request.rb', line 50

def remove_cost_center
  @remove_cost_center
end

#service_planString

The name of a service plan, if you want to only include devices that have that service plan.

Returns:

  • (String)


55
56
57
# File 'lib/verizon/models/device_cost_center_request.rb', line 55

def service_plan
  @service_plan
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
145
146
147
# File 'lib/verizon/models/device_cost_center_request.rb', line 105

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  cost_center = hash.key?('costCenter') ? hash['costCenter'] : 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
  primary_place_of_use =
    hash.key?('primaryPlaceOfUse') ? hash['primaryPlaceOfUse'] : SKIP
  remove_cost_center =
    hash.key?('removeCostCenter') ? hash['removeCostCenter'] : SKIP
  service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP

  # Create object from extracted values.
  DeviceCostCenterRequest.new(,
                              cost_center,
                              custom_fields,
                              devices,
                              group_name,
                              primary_place_of_use,
                              remove_cost_center,
                              service_plan)
end

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/verizon/models/device_cost_center_request.rb', line 58

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['cost_center'] = 'costCenter'
  @_hash['custom_fields'] = 'customFields'
  @_hash['devices'] = 'devices'
  @_hash['group_name'] = 'groupName'
  @_hash['primary_place_of_use'] = 'primaryPlaceOfUse'
  @_hash['remove_cost_center'] = 'removeCostCenter'
  @_hash['service_plan'] = 'servicePlan'
  @_hash
end

.nullablesObject

An array for nullable fields



86
87
88
# File 'lib/verizon/models/device_cost_center_request.rb', line 86

def self.nullables
  []
end

.optionalsObject

An array for optional fields



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/verizon/models/device_cost_center_request.rb', line 72

def self.optionals
  %w[
    account_name
    cost_center
    custom_fields
    devices
    group_name
    primary_place_of_use
    remove_cost_center
    service_plan
  ]
end