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

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(description: SKIP, devices: SKIP, has_more_data: SKIP, name: SKIP, additional_properties: nil) ⇒ DeviceGroupDevicesData

Returns a new instance of DeviceGroupDevicesData.



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

def initialize(description: SKIP, devices: SKIP, has_more_data: SKIP,
               name: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @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
  @additional_properties = additional_properties
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.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/verizon/models/device_group_devices_data.rb', line 67

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 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.
  DeviceGroupDevicesData.new(description: description,
                             devices: devices,
                             has_more_data: has_more_data,
                             name: name,
                             additional_properties: additional_properties)
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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
113
# File 'lib/verizon/models/device_group_devices_data.rb', line 108

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description.inspect}, devices: #{@devices.inspect},"\
  " has_more_data: #{@has_more_data.inspect}, name: #{@name.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
# File 'lib/verizon/models/device_group_devices_data.rb', line 101

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description}, devices: #{@devices}, has_more_data:"\
  " #{@has_more_data}, name: #{@name}, additional_properties: #{@additional_properties}>"
end