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 ⇒ AttributeIdentifier
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, additional_properties: nil) ⇒ AttributeSetting
constructor
A new instance of AttributeSetting.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_on ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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, created_on: SKIP, is_observable: SKIP, is_observing: SKIP, frequency: SKIP, additional_properties: nil) ⇒ AttributeSetting
Returns a new instance of AttributeSetting.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# 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, 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 @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 @additional_properties = additional_properties 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 ⇒ AttributeIdentifier
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.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/verizon/models/attribute_setting.rb', line 83 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 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. AttributeSetting.new(name: name, value: value, created_on: created_on, is_observable: is_observable, is_observing: is_observing, frequency: frequency, additional_properties: additional_properties) 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
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
128 129 130 131 132 133 134 |
# File 'lib/verizon/models/attribute_setting.rb', line 128 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, value: #{@value.inspect}, created_on:"\ " #{@created_on.inspect}, is_observable: #{@is_observable.inspect}, is_observing:"\ " #{@is_observing.inspect}, frequency: #{@frequency.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_created_on ⇒ Object
115 116 117 |
# File 'lib/verizon/models/attribute_setting.rb', line 115 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
120 121 122 123 124 125 |
# File 'lib/verizon/models/attribute_setting.rb', line 120 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, value: #{@value}, created_on: #{@created_on},"\ " is_observable: #{@is_observable}, is_observing: #{@is_observing}, frequency:"\ " #{@frequency}, additional_properties: #{@additional_properties}>" end |