Class: Verizon::ConfigurationListItem

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

Overview

The ConfigurationList’s item that contains the configuration identifier, name, description and the active flag.

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(id:, is_active:, name: SKIP, description: SKIP) ⇒ ConfigurationListItem

Returns a new instance of ConfigurationListItem.



53
54
55
56
57
58
# File 'lib/verizon/models/configuration_list_item.rb', line 53

def initialize(id:, is_active:, name: SKIP, description: SKIP)
  @id = id
  @name = name unless name == SKIP
  @description = description unless description == SKIP
  @is_active = is_active
end

Instance Attribute Details

#descriptionString

Description of the configuration.

Returns:

  • (String)


24
25
26
# File 'lib/verizon/models/configuration_list_item.rb', line 24

def description
  @description
end

#idString

The generated ID (UUID v4) for the configuration. It has to be used when asking for changing any of the configuration parameters.

Returns:

  • (String)


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

def id
  @id
end

#is_activeTrueClass | FalseClass

Description of the configuration.

Returns:

  • (TrueClass | FalseClass)


28
29
30
# File 'lib/verizon/models/configuration_list_item.rb', line 28

def is_active
  @is_active
end

#nameString

Name of the configuration.

Returns:

  • (String)


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

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/verizon/models/configuration_list_item.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  is_active = hash.key?('isActive') ? hash['isActive'] : nil
  name = hash.key?('name') ? hash['name'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP

  # Create object from extracted values.
  ConfigurationListItem.new(id: id,
                            is_active: is_active,
                            name: name,
                            description: description)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['description'] = 'description'
  @_hash['is_active'] = 'isActive'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/verizon/models/configuration_list_item.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    name
    description
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



85
86
87
88
89
# File 'lib/verizon/models/configuration_list_item.rb', line 85

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

#to_sObject

Provides a human-readable string representation of the object.



78
79
80
81
82
# File 'lib/verizon/models/configuration_list_item.rb', line 78

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