Class: Verizon::AttributeSetting

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

Overview

Describes an attribute being observed and the frequency with which the attribute is being observed.

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, created_on = SKIP, is_observable = SKIP, is_observing = SKIP, frequency = SKIP) ⇒ AttributeSetting

Returns a new instance of AttributeSetting.



67
68
69
70
71
72
73
74
75
# File 'lib/verizon/models/attribute_setting.rb', line 67

def initialize(name = SKIP, value = SKIP, created_on = SKIP,
               is_observable = SKIP, is_observing = SKIP, frequency = SKIP)
  @name = name unless name == SKIP
  @value = value unless value == SKIP
  @created_on = created_on unless created_on == SKIP
  @is_observable = is_observable unless is_observable == SKIP
  @is_observing = is_observing unless is_observing == SKIP
  @frequency = frequency unless frequency == SKIP
end

Instance Attribute Details

#created_onDateTime

Date and time request was created.

Returns:

  • (DateTime)


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

def created_on
  @created_on
end

#frequencyNumericalData

Describes value and unit of time.

Returns:



36
37
38
# File 'lib/verizon/models/attribute_setting.rb', line 36

def frequency
  @frequency
end

#is_observableTrueClass | FalseClass

Is the attribute observable?

Returns:

  • (TrueClass | FalseClass)


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

def is_observable
  @is_observable
end

#is_observingTrueClass | FalseClass

Is the attribute being observed?

Returns:

  • (TrueClass | FalseClass)


32
33
34
# File 'lib/verizon/models/attribute_setting.rb', line 32

def is_observing
  @is_observing
end

#nameAttributeIdentifierEnum

Attribute identifier.



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

def name
  @name
end

#valueString

Attribute value.

Returns:

  • (String)


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

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/verizon/models/attribute_setting.rb', line 78

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
  created_on = if hash.key?('createdOn')
                 (DateTimeHelper.from_rfc3339(hash['createdOn']) if hash['createdOn'])
               else
                 SKIP
               end
  is_observable = hash.key?('isObservable') ? hash['isObservable'] : SKIP
  is_observing = hash.key?('isObserving') ? hash['isObserving'] : SKIP
  frequency = NumericalData.from_hash(hash['frequency']) if hash['frequency']

  # Create object from extracted values.
  AttributeSetting.new(name,
                       value,
                       created_on,
                       is_observable,
                       is_observing,
                       frequency)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
48
# File 'lib/verizon/models/attribute_setting.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['value'] = 'value'
  @_hash['created_on'] = 'createdOn'
  @_hash['is_observable'] = 'isObservable'
  @_hash['is_observing'] = 'isObserving'
  @_hash['frequency'] = 'frequency'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/verizon/models/attribute_setting.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
59
60
# File 'lib/verizon/models/attribute_setting.rb', line 51

def self.optionals
  %w[
    name
    value
    created_on
    is_observable
    is_observing
    frequency
  ]
end

Instance Method Details

#to_custom_created_onObject



102
103
104
# File 'lib/verizon/models/attribute_setting.rb', line 102

def to_custom_created_on
  DateTimeHelper.to_rfc3339(created_on)
end