Class: MistApi::AlarmTemplate
- Defined in:
- lib/mist_api/models/alarm_template.rb
Overview
Alarm Template
Instance Attribute Summary collapse
-
#created_time ⇒ Float
When the object has been created, in epoch.
-
#delivery ⇒ Delivery
Delivery object to configure the alarm delivery.
-
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization.
-
#modified_time ⇒ Float
When the object has been modified for the last time, in epoch.
-
#name ⇒ String
Some string to name the alarm template.
-
#org_id ⇒ UUID | String
Some string to name the alarm template.
-
#rules ⇒ Hash[String, AlarmTemplateRule]
Alarm Rules object to configure the individual alarm keys/types.
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(delivery = nil, rules = nil, created_time = SKIP, id = SKIP, modified_time = SKIP, name = SKIP, org_id = SKIP, additional_properties = nil) ⇒ AlarmTemplate
constructor
A new instance of AlarmTemplate.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(delivery = nil, rules = nil, created_time = SKIP, id = SKIP, modified_time = SKIP, name = SKIP, org_id = SKIP, additional_properties = nil) ⇒ AlarmTemplate
Returns a new instance of AlarmTemplate.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/mist_api/models/alarm_template.rb', line 70 def initialize(delivery = nil, rules = nil, created_time = SKIP, id = SKIP, modified_time = SKIP, name = SKIP, org_id = SKIP, additional_properties = nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @created_time = created_time unless created_time == SKIP @delivery = delivery @id = id unless id == SKIP @modified_time = modified_time unless modified_time == SKIP @name = name unless name == SKIP @org_id = org_id unless org_id == SKIP @rules = rules @additional_properties = additional_properties end |
Instance Attribute Details
#created_time ⇒ Float
When the object has been created, in epoch
14 15 16 |
# File 'lib/mist_api/models/alarm_template.rb', line 14 def created_time @created_time end |
#delivery ⇒ Delivery
Delivery object to configure the alarm delivery
18 19 20 |
# File 'lib/mist_api/models/alarm_template.rb', line 18 def delivery @delivery end |
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization
22 23 24 |
# File 'lib/mist_api/models/alarm_template.rb', line 22 def id @id end |
#modified_time ⇒ Float
When the object has been modified for the last time, in epoch
26 27 28 |
# File 'lib/mist_api/models/alarm_template.rb', line 26 def modified_time @modified_time end |
#name ⇒ String
Some string to name the alarm template
30 31 32 |
# File 'lib/mist_api/models/alarm_template.rb', line 30 def name @name end |
#org_id ⇒ UUID | String
Some string to name the alarm template
34 35 36 |
# File 'lib/mist_api/models/alarm_template.rb', line 34 def org_id @org_id end |
#rules ⇒ Hash[String, AlarmTemplateRule]
Alarm Rules object to configure the individual alarm keys/types. Property key is the alarm name.
39 40 41 |
# File 'lib/mist_api/models/alarm_template.rb', line 39 def rules @rules end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 114 115 116 117 |
# File 'lib/mist_api/models/alarm_template.rb', line 87 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. delivery = Delivery.from_hash(hash['delivery']) if hash['delivery'] rules = AlarmTemplateRule.from_hash(hash['rules']) if hash['rules'] rules = nil unless hash.key?('rules') created_time = hash.key?('created_time') ? hash['created_time'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP org_id = hash.key?('org_id') ? hash['org_id'] : SKIP # 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. AlarmTemplate.new(delivery, rules, created_time, id, modified_time, name, org_id, additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mist_api/models/alarm_template.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['created_time'] = 'created_time' @_hash['delivery'] = 'delivery' @_hash['id'] = 'id' @_hash['modified_time'] = 'modified_time' @_hash['name'] = 'name' @_hash['org_id'] = 'org_id' @_hash['rules'] = 'rules' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 |
# File 'lib/mist_api/models/alarm_template.rb', line 66 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 62 63 |
# File 'lib/mist_api/models/alarm_template.rb', line 55 def self.optionals %w[ created_time id modified_time name org_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
128 129 130 131 132 133 134 |
# File 'lib/mist_api/models/alarm_template.rb', line 128 def inspect class_name = self.class.name.split('::').last "<#{class_name} created_time: #{@created_time.inspect}, delivery: #{@delivery.inspect}, id:"\ " #{@id.inspect}, modified_time: #{@modified_time.inspect}, name: #{@name.inspect}, org_id:"\ " #{@org_id.inspect}, rules: #{@rules.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
120 121 122 123 124 125 |
# File 'lib/mist_api/models/alarm_template.rb', line 120 def to_s class_name = self.class.name.split('::').last "<#{class_name} created_time: #{@created_time}, delivery: #{@delivery}, id: #{@id},"\ " modified_time: #{@modified_time}, name: #{@name}, org_id: #{@org_id}, rules: #{@rules},"\ " additional_properties: #{@additional_properties}>" end |