Class: Verizon::DeviceGroup
- Defined in:
- lib/verizon/models/device_group.rb
Overview
Returns a list of all device groups in a specified account.
Instance Attribute Summary collapse
-
#description ⇒ String
The description of the device group.
-
#extended_attributes ⇒ Array[CustomFields]
Any extended attributes for the device group, as Key and Value pairs.
-
#is_default_group ⇒ TrueClass | FalseClass
Identifies the default device group.
-
#name ⇒ String
The name of the 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(description = SKIP, extended_attributes = SKIP, is_default_group = SKIP, name = SKIP) ⇒ DeviceGroup
constructor
A new instance of DeviceGroup.
Methods inherited from BaseModel
Constructor Details
#initialize(description = SKIP, extended_attributes = SKIP, is_default_group = SKIP, name = SKIP) ⇒ DeviceGroup
Returns a new instance of DeviceGroup.
53 54 55 56 57 58 59 60 61 |
# File 'lib/verizon/models/device_group.rb', line 53 def initialize(description = SKIP, extended_attributes = SKIP, is_default_group = SKIP, name = SKIP) @description = description unless description == SKIP @extended_attributes = extended_attributes unless extended_attributes == SKIP @is_default_group = is_default_group unless is_default_group == SKIP @name = name unless name == SKIP end |
Instance Attribute Details
#description ⇒ String
The description of the device group.
14 15 16 |
# File 'lib/verizon/models/device_group.rb', line 14 def description @description end |
#extended_attributes ⇒ Array[CustomFields]
Any extended attributes for the device group, as Key and Value pairs.
18 19 20 |
# File 'lib/verizon/models/device_group.rb', line 18 def extended_attributes @extended_attributes end |
#is_default_group ⇒ TrueClass | FalseClass
Identifies the default device group.
22 23 24 |
# File 'lib/verizon/models/device_group.rb', line 22 def is_default_group @is_default_group end |
#name ⇒ String
The name of the device group.
26 27 28 |
# File 'lib/verizon/models/device_group.rb', line 26 def name @name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/verizon/models/device_group.rb', line 64 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 extended_attributes = nil unless hash['extendedAttributes'].nil? extended_attributes = [] hash['extendedAttributes'].each do |structure| extended_attributes << (CustomFields.from_hash(structure) if structure) end end extended_attributes = SKIP unless hash.key?('extendedAttributes') is_default_group = hash.key?('isDefaultGroup') ? hash['isDefaultGroup'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP # Create object from extracted values. DeviceGroup.new(description, extended_attributes, is_default_group, name) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/verizon/models/device_group.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['description'] = 'description' @_hash['extended_attributes'] = 'extendedAttributes' @_hash['is_default_group'] = 'isDefaultGroup' @_hash['name'] = 'name' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/verizon/models/device_group.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/verizon/models/device_group.rb', line 39 def self.optionals %w[ description extended_attributes is_default_group name ] end |