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

#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) ⇒ KPIInfo

Returns a new instance of KPIInfo.



77
78
79
80
81
82
83
84
85
86
87
88
# 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)
  @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
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.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/verizon/models/kpi_info.rb', line 91

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 object from extracted values.
  KPIInfo.new(name,
              value,
              node_name,
              node_type,
              description,
              unit,
              category,
              time_of_last_update)
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