Class: Verizon::KpiInfo

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

Overview

KPI Info Object

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(name: SKIP, value: SKIP, node_name: SKIP, node_type: SKIP, description: SKIP, unit: SKIP, category: SKIP, time_of_last_update: SKIP, additional_properties: nil) ⇒ KpiInfo

Returns a new instance of KpiInfo.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/verizon/models/kpi_info.rb', line 77

def initialize(name: SKIP, value: SKIP, node_name: SKIP, node_type: SKIP,
               description: SKIP, unit: SKIP, category: SKIP,
               time_of_last_update: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @name = name unless name == SKIP
  @value = value unless value == SKIP
  @node_name = node_name unless node_name == SKIP
  @node_type = node_type unless node_type == SKIP
  @description = description unless description == SKIP
  @unit = unit unless unit == SKIP
  @category = category unless category == SKIP
  @time_of_last_update = time_of_last_update unless time_of_last_update == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#categoryString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/verizon/models/kpi_info.rb', line 38

def category
  @category
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/verizon/models/kpi_info.rb', line 30

def description
  @description
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#node_nameString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/verizon/models/kpi_info.rb', line 22

def node_name
  @node_name
end

#node_typeString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/verizon/models/kpi_info.rb', line 26

def node_type
  @node_type
end

#time_of_last_updateString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/verizon/models/kpi_info.rb', line 42

def time_of_last_update
  @time_of_last_update
end

#unitString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/verizon/models/kpi_info.rb', line 34

def unit
  @unit
end

#valueString

TODO: Write general description for this method

Returns:

  • (String)


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

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/verizon/models/kpi_info.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  value = hash.key?('value') ? hash['value'] : SKIP
  node_name = hash.key?('nodeName') ? hash['nodeName'] : SKIP
  node_type = hash.key?('nodeType') ? hash['nodeType'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  unit = hash.key?('unit') ? hash['unit'] : SKIP
  category = hash.key?('category') ? hash['category'] : SKIP
  time_of_last_update =
    hash.key?('timeOfLastUpdate') ? hash['timeOfLastUpdate'] : 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.
  KpiInfo.new(name: name,
              value: value,
              node_name: node_name,
              node_type: node_type,
              description: description,
              unit: unit,
              category: category,
              time_of_last_update: time_of_last_update,
              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/verizon/models/kpi_info.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['value'] = 'value'
  @_hash['node_name'] = 'nodeName'
  @_hash['node_type'] = 'nodeType'
  @_hash['description'] = 'description'
  @_hash['unit'] = 'unit'
  @_hash['category'] = 'category'
  @_hash['time_of_last_update'] = 'timeOfLastUpdate'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/verizon/models/kpi_info.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/verizon/models/kpi_info.rb', line 59

def self.optionals
  %w[
    name
    value
    node_name
    node_type
    description
    unit
    category
    time_of_last_update
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



138
139
140
141
142
143
144
145
# File 'lib/verizon/models/kpi_info.rb', line 138

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, value: #{@value.inspect}, node_name:"\
  " #{@node_name.inspect}, node_type: #{@node_type.inspect}, description:"\
  " #{@description.inspect}, unit: #{@unit.inspect}, category: #{@category.inspect},"\
  " time_of_last_update: #{@time_of_last_update.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



129
130
131
132
133
134
135
# File 'lib/verizon/models/kpi_info.rb', line 129

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, value: #{@value}, node_name: #{@node_name}, node_type:"\
  " #{@node_type}, description: #{@description}, unit: #{@unit}, category: #{@category},"\
  " time_of_last_update: #{@time_of_last_update}, additional_properties:"\
  " #{@additional_properties}>"
end