Class: MistApi::WebhookMinisReachability
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- MistApi::WebhookMinisReachability
- Defined in:
- lib/mist_api/models/webhook_minis_reachability.rb
Overview
Sample of the ‘minis-reachability` webhook payload.
Instance Attribute Summary collapse
-
#events ⇒ Array[WebhookMinisReachabilityEvent]
TODO: Write general description for this method.
-
#topic ⇒ String
readonly
enum: ‘minis-reachability`.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(events = nil) ⇒ WebhookMinisReachability
constructor
A new instance of WebhookMinisReachability.
-
#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(events = nil) ⇒ WebhookMinisReachability
Returns a new instance of WebhookMinisReachability.
38 39 40 41 |
# File 'lib/mist_api/models/webhook_minis_reachability.rb', line 38 def initialize(events = nil) @events = events @topic = 'minis-reachability' end |
Instance Attribute Details
#events ⇒ Array[WebhookMinisReachabilityEvent]
TODO: Write general description for this method
14 15 16 |
# File 'lib/mist_api/models/webhook_minis_reachability.rb', line 14 def events @events end |
#topic ⇒ String (readonly)
enum: ‘minis-reachability`
18 19 20 |
# File 'lib/mist_api/models/webhook_minis_reachability.rb', line 18 def topic @topic end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/mist_api/models/webhook_minis_reachability.rb', line 44 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it events = nil unless hash['events'].nil? events = [] hash['events'].each do |structure| events << (WebhookMinisReachabilityEvent.from_hash(structure) if structure) end end events = nil unless hash.key?('events') # Create object from extracted values. WebhookMinisReachability.new(events) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 26 |
# File 'lib/mist_api/models/webhook_minis_reachability.rb', line 21 def self.names @_hash = {} if @_hash.nil? @_hash['events'] = 'events' @_hash['topic'] = 'topic' @_hash end |
.nullables ⇒ Object
An array for nullable fields
34 35 36 |
# File 'lib/mist_api/models/webhook_minis_reachability.rb', line 34 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
29 30 31 |
# File 'lib/mist_api/models/webhook_minis_reachability.rb', line 29 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/mist_api/models/webhook_minis_reachability.rb', line 65 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.events, ->(val) { WebhookMinisReachabilityEvent.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value.topic, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['events'], ->(val) { WebhookMinisReachabilityEvent.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value['topic'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
96 97 98 99 |
# File 'lib/mist_api/models/webhook_minis_reachability.rb', line 96 def inspect class_name = self.class.name.split('::').last "<#{class_name} events: #{@events.inspect}, topic: #{@topic.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
90 91 92 93 |
# File 'lib/mist_api/models/webhook_minis_reachability.rb', line 90 def to_s class_name = self.class.name.split('::').last "<#{class_name} events: #{@events}, topic: #{@topic}>" end |