Class: MistApi::WebhookPing
- Defined in:
- lib/mist_api/models/webhook_ping.rb
Overview
Sample of the ‘ping` webhook payload.nnThe `ping` webhook can be manually sent with the following API calls:n- for a Site level webhook with the [Ping Site Webhook]($e/Orgs%20Webhooks/pingOrgWebhook) endpointn- for an Org level webhook with the [Ping Org Webhook]($e/Orgs%20Webhooks/pingOrgWebhook) endpoint
Instance Attribute Summary collapse
-
#events ⇒ Array[WebhookPingEvent]
TODO: Write general description for this method.
-
#topic ⇒ String
readonly
enum: ‘ping`.
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) ⇒ WebhookPing
constructor
A new instance of WebhookPing.
-
#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) ⇒ WebhookPing
Returns a new instance of WebhookPing.
42 43 44 45 |
# File 'lib/mist_api/models/webhook_ping.rb', line 42 def initialize(events = nil) @events = events @topic = 'ping' end |
Instance Attribute Details
#events ⇒ Array[WebhookPingEvent]
TODO: Write general description for this method
18 19 20 |
# File 'lib/mist_api/models/webhook_ping.rb', line 18 def events @events end |
#topic ⇒ String (readonly)
enum: ‘ping`
22 23 24 |
# File 'lib/mist_api/models/webhook_ping.rb', line 22 def topic @topic end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/mist_api/models/webhook_ping.rb', line 48 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 << (WebhookPingEvent.from_hash(structure) if structure) end end events = nil unless hash.key?('events') # Create object from extracted values. WebhookPing.new(events) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 |
# File 'lib/mist_api/models/webhook_ping.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['events'] = 'events' @_hash['topic'] = 'topic' @_hash end |
.nullables ⇒ Object
An array for nullable fields
38 39 40 |
# File 'lib/mist_api/models/webhook_ping.rb', line 38 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
33 34 35 |
# File 'lib/mist_api/models/webhook_ping.rb', line 33 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/mist_api/models/webhook_ping.rb', line 69 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.events, ->(val) { WebhookPingEvent.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) { WebhookPingEvent.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.
100 101 102 103 |
# File 'lib/mist_api/models/webhook_ping.rb', line 100 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.
94 95 96 97 |
# File 'lib/mist_api/models/webhook_ping.rb', line 94 def to_s class_name = self.class.name.split('::').last "<#{class_name} events: #{@events}, topic: #{@topic}>" end |