Class: Verizon::AttributeSetting
- 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
-
#created_on ⇒ DateTime
Date and time request was created.
-
#frequency ⇒ NumericalData
Describes value and unit of time.
-
#is_observable ⇒ TrueClass | FalseClass
Is the attribute observable?.
-
#is_observing ⇒ TrueClass | FalseClass
Is the attribute being observed?.
-
#name ⇒ AttributeIdentifierEnum
Attribute identifier.
-
#value ⇒ String
Attribute value.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(name = SKIP, value = SKIP, created_on = SKIP, is_observable = SKIP, is_observing = SKIP, frequency = SKIP) ⇒ AttributeSetting
constructor
A new instance of AttributeSetting.
- #to_custom_created_on ⇒ Object
Methods inherited from BaseModel
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 76 77 78 79 |
# 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_on ⇒ DateTime
Date and time request was created.
24 25 26 |
# File 'lib/verizon/models/attribute_setting.rb', line 24 def created_on @created_on end |
#frequency ⇒ NumericalData
Describes value and unit of time.
36 37 38 |
# File 'lib/verizon/models/attribute_setting.rb', line 36 def frequency @frequency end |
#is_observable ⇒ TrueClass | FalseClass
Is the attribute observable?
28 29 30 |
# File 'lib/verizon/models/attribute_setting.rb', line 28 def is_observable @is_observable end |
#is_observing ⇒ TrueClass | FalseClass
Is the attribute being observed?
32 33 34 |
# File 'lib/verizon/models/attribute_setting.rb', line 32 def is_observing @is_observing end |
#name ⇒ AttributeIdentifierEnum
Attribute identifier.
16 17 18 |
# File 'lib/verizon/models/attribute_setting.rb', line 16 def name @name end |
#value ⇒ String
Attribute value.
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.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/verizon/models/attribute_setting.rb', line 82 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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
63 64 65 |
# File 'lib/verizon/models/attribute_setting.rb', line 63 def self.nullables [] end |
.optionals ⇒ Object
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_on ⇒ Object
106 107 108 |
# File 'lib/verizon/models/attribute_setting.rb', line 106 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |