Class: Verizon::NumericalData

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

Overview

Describes value and unit of time.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(value = SKIP, unit = SKIP) ⇒ NumericalData

Returns a new instance of NumericalData.



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

def initialize(value = SKIP, unit = SKIP)
  @value = value unless value == SKIP
  @unit = unit unless unit == SKIP
end

Instance Attribute Details

#unitNumericalDataUnitEnum

Unit of time.



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

def unit
  @unit
end

#valueInteger

Numerical value.

Returns:

  • (Integer)


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

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  value = hash.key?('value') ? hash['value'] : SKIP
  unit = hash.key?('unit') ? hash['unit'] : SKIP

  # Create object from extracted values.
  NumericalData.new(value,
                    unit)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
# File 'lib/verizon/models/numerical_data.rb', line 21

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['value'] = 'value'
  @_hash['unit'] = 'unit'
  @_hash
end

.nullablesObject

An array for nullable fields



37
38
39
# File 'lib/verizon/models/numerical_data.rb', line 37

def self.nullables
  []
end

.optionalsObject

An array for optional fields



29
30
31
32
33
34
# File 'lib/verizon/models/numerical_data.rb', line 29

def self.optionals
  %w[
    value
    unit
  ]
end