Class: Verizon::CreateDeviceGroupRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- Verizon::CreateDeviceGroupRequest
- Defined in:
- lib/verizon/models/create_device_group_request.rb
Overview
Create request for a new device group and optionally add devices to the group.
Instance Attribute Summary collapse
-
#account_name ⇒ String
The Verizon billing account that the device group will belong to.
-
#devices_to_add ⇒ Array[DeviceId]
Zero or more devices to add to the device group.
-
#group_description ⇒ String
A description for the device group.
-
#group_name ⇒ String
The name for the new device 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(account_name = nil, group_description = nil, group_name = nil, devices_to_add = SKIP) ⇒ CreateDeviceGroupRequest
constructor
A new instance of CreateDeviceGroupRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(account_name = nil, group_description = nil, group_name = nil, devices_to_add = SKIP) ⇒ CreateDeviceGroupRequest
Returns a new instance of CreateDeviceGroupRequest.
54 55 56 57 58 59 60 |
# File 'lib/verizon/models/create_device_group_request.rb', line 54 def initialize(account_name = nil, group_description = nil, group_name = nil, devices_to_add = SKIP) @account_name = account_name @group_description = group_description @group_name = group_name @devices_to_add = devices_to_add unless devices_to_add == SKIP end |
Instance Attribute Details
#account_name ⇒ String
The Verizon billing account that the device group will belong to. An account name is usually numeric, and must include any leading zeros.
16 17 18 |
# File 'lib/verizon/models/create_device_group_request.rb', line 16 def account_name @account_name end |
#devices_to_add ⇒ Array[DeviceId]
Zero or more devices to add to the device group. You can use POST /devices/actions/list to get a list of all devices in the account.
30 31 32 |
# File 'lib/verizon/models/create_device_group_request.rb', line 30 def devices_to_add @devices_to_add end |
#group_description ⇒ String
A description for the device group.
20 21 22 |
# File 'lib/verizon/models/create_device_group_request.rb', line 20 def group_description @group_description end |
#group_name ⇒ String
The name for the new device group. This name must be unique within the specified account.
25 26 27 |
# File 'lib/verizon/models/create_device_group_request.rb', line 25 def group_name @group_name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/verizon/models/create_device_group_request.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_name = hash.key?('accountName') ? hash['accountName'] : nil group_description = hash.key?('groupDescription') ? hash['groupDescription'] : nil group_name = hash.key?('groupName') ? hash['groupName'] : nil # Parameter is an array, so we need to iterate through it devices_to_add = nil unless hash['devicesToAdd'].nil? devices_to_add = [] hash['devicesToAdd'].each do |structure| devices_to_add << (DeviceId.from_hash(structure) if structure) end end devices_to_add = SKIP unless hash.key?('devicesToAdd') # Create object from extracted values. CreateDeviceGroupRequest.new(account_name, group_description, group_name, devices_to_add) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/verizon/models/create_device_group_request.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['account_name'] = 'accountName' @_hash['group_description'] = 'groupDescription' @_hash['group_name'] = 'groupName' @_hash['devices_to_add'] = 'devicesToAdd' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/verizon/models/create_device_group_request.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 |
# File 'lib/verizon/models/create_device_group_request.rb', line 43 def self.optionals %w[ devices_to_add ] end |