Class: Verizon::DeviceGroupDevicesData

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

Overview

Returns the name, description, and list of devices in a device group.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(description = SKIP, devices = SKIP, has_more_data = SKIP, name = SKIP) ⇒ DeviceGroupDevicesData

Returns a new instance of DeviceGroupDevicesData.



54
55
56
57
58
59
60
# File 'lib/verizon/models/device_group_devices_data.rb', line 54

def initialize(description = SKIP, devices = SKIP, has_more_data = SKIP,
               name = SKIP)
  @description = description unless description == SKIP
  @devices = devices unless devices == SKIP
  @has_more_data = has_more_data unless has_more_data == SKIP
  @name = name unless name == SKIP
end

Instance Attribute Details

#descriptionString

The description of the device group.

Returns:

  • (String)


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

def description
  @description
end

#devicesArray[AccountDeviceList]

The devices in the device group.

Returns:



18
19
20
# File 'lib/verizon/models/device_group_devices_data.rb', line 18

def devices
  @devices
end

#has_more_dataTrueClass | FalseClass

False for a status 200 response.True for a status 202 response, indicating that there is more data to be retrieved.

Returns:

  • (TrueClass | FalseClass)


23
24
25
# File 'lib/verizon/models/device_group_devices_data.rb', line 23

def has_more_data
  @has_more_data
end

#nameString

The name of the device group.

Returns:

  • (String)


27
28
29
# File 'lib/verizon/models/device_group_devices_data.rb', line 27

def name
  @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
# File 'lib/verizon/models/device_group_devices_data.rb', line 63

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  description = hash.key?('description') ? hash['description'] : SKIP
  # 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')
  has_more_data = hash.key?('hasMoreData') ? hash['hasMoreData'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP

  # Create object from extracted values.
  DeviceGroupDevicesData.new(description,
                             devices,
                             has_more_data,
                             name)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/verizon/models/device_group_devices_data.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['description'] = 'description'
  @_hash['devices'] = 'devices'
  @_hash['has_more_data'] = 'hasMoreData'
  @_hash['name'] = 'name'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/verizon/models/device_group_devices_data.rb', line 40

def self.optionals
  %w[
    description
    devices
    has_more_data
    name
  ]
end