Class: Verizon::AccountLabels
- Defined in:
- lib/verizon/models/account_labels.rb
Overview
Maximum of 2,000 objects are allowed in the array.
Instance Attribute Summary collapse
-
#devices ⇒ Array[DeviceList]
TODO: Write general description for this method.
-
#label ⇒ Array[DeviceLabels]
TODO: Write general description for this method.
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(devices = nil, label = SKIP) ⇒ AccountLabels
constructor
A new instance of AccountLabels.
Methods inherited from BaseModel
Constructor Details
#initialize(devices = nil, label = SKIP) ⇒ AccountLabels
Returns a new instance of AccountLabels.
40 41 42 43 |
# File 'lib/verizon/models/account_labels.rb', line 40 def initialize(devices = nil, label = SKIP) @devices = devices @label = label unless label == SKIP end |
Instance Attribute Details
#devices ⇒ Array[DeviceList]
TODO: Write general description for this method
14 15 16 |
# File 'lib/verizon/models/account_labels.rb', line 14 def devices @devices end |
#label ⇒ Array[DeviceLabels]
TODO: Write general description for this method
18 19 20 |
# File 'lib/verizon/models/account_labels.rb', line 18 def label @label end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/verizon/models/account_labels.rb', line 46 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it devices = nil unless hash['devices'].nil? devices = [] hash['devices'].each do |structure| devices << (DeviceList.from_hash(structure) if structure) end end devices = nil unless hash.key?('devices') # Parameter is an array, so we need to iterate through it label = nil unless hash['label'].nil? label = [] hash['label'].each do |structure| label << (DeviceLabels.from_hash(structure) if structure) end end label = SKIP unless hash.key?('label') # Create object from extracted values. AccountLabels.new(devices, label) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 26 |
# File 'lib/verizon/models/account_labels.rb', line 21 def self.names @_hash = {} if @_hash.nil? @_hash['devices'] = 'devices' @_hash['label'] = 'label' @_hash end |
.nullables ⇒ Object
An array for nullable fields
36 37 38 |
# File 'lib/verizon/models/account_labels.rb', line 36 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
29 30 31 32 33 |
# File 'lib/verizon/models/account_labels.rb', line 29 def self.optionals %w[ label ] end |