Class: Rerout::CreateWebhookInput
- Inherits:
-
Object
- Object
- Rerout::CreateWebhookInput
- Defined in:
- lib/rerout/create_webhook_input.rb
Overview
Request body for ‘POST /v1/projects/me/webhooks`. `name`, `url`, and `events` are required; `is_active` and `payload_format` are optional and omitted from the payload when not set (server defaults apply).
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#is_active ⇒ Object
readonly
Returns the value of attribute is_active.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#payload_format ⇒ Object
readonly
Returns the value of attribute payload_format.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(name:, url:, events:, is_active: nil, payload_format: nil) ⇒ CreateWebhookInput
constructor
A new instance of CreateWebhookInput.
-
#to_h ⇒ Object
Serialize for the wire.
Constructor Details
#initialize(name:, url:, events:, is_active: nil, payload_format: nil) ⇒ CreateWebhookInput
Returns a new instance of CreateWebhookInput.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rerout/create_webhook_input.rb', line 18 def initialize(name:, url:, events:, is_active: nil, payload_format: nil) raise ArgumentError, 'name is required' if name.nil? || name.to_s.empty? raise ArgumentError, 'url is required' if url.nil? || url.to_s.empty? if events.nil? || !events.is_a?(Array) || events.empty? raise ArgumentError, 'events is required and must be a non-empty Array' end @name = name @url = url @events = events @is_active = is_active @payload_format = payload_format freeze end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
8 9 10 |
# File 'lib/rerout/create_webhook_input.rb', line 8 def events @events end |
#is_active ⇒ Object (readonly)
Returns the value of attribute is_active.
8 9 10 |
# File 'lib/rerout/create_webhook_input.rb', line 8 def is_active @is_active end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/rerout/create_webhook_input.rb', line 8 def name @name end |
#payload_format ⇒ Object (readonly)
Returns the value of attribute payload_format.
8 9 10 |
# File 'lib/rerout/create_webhook_input.rb', line 8 def payload_format @payload_format end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/rerout/create_webhook_input.rb', line 8 def url @url end |
Instance Method Details
#to_h ⇒ Object
Serialize for the wire. Optional fields are only included when set.
34 35 36 37 38 39 |
# File 'lib/rerout/create_webhook_input.rb', line 34 def to_h hash = { 'name' => name, 'url' => url, 'events' => events } hash['is_active'] = is_active unless is_active.nil? hash['payload_format'] = payload_format unless payload_format.nil? hash end |