Class: Verizon::CreateDeviceGroupRequest

Inherits:
BaseModel
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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( = nil, group_description = nil,
               group_name = nil, devices_to_add = SKIP)
  @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_nameString

The Verizon billing account that the device group will belong to. An account name is usually numeric, and must include any leading zeros.

Returns:

  • (String)


16
17
18
# File 'lib/verizon/models/create_device_group_request.rb', line 16

def 
  @account_name
end

#devices_to_addArray[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.

Returns:



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

def devices_to_add
  @devices_to_add
end

#group_descriptionString

A description for the device group.

Returns:

  • (String)


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

def group_description
  @group_description
end

#group_nameString

The name for the new device group. This name must be unique within the specified account.

Returns:

  • (String)


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.
   = 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(,
                               group_description,
                               group_name,
                               devices_to_add)
end

.namesObject

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

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