Class: CDEKApiClient::Entities::Webhook
- Inherits:
-
Object
- Object
- CDEKApiClient::Entities::Webhook
- Includes:
- Validatable
- Defined in:
- lib/cdek_api_client/entities/webhook.rb
Overview
Represents a webhook entity in the CDEK API. Each webhook includes attributes such as url, type, and event types.
Instance Attribute Summary collapse
-
#event_types ⇒ Object
Returns the value of attribute event_types.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url:, type:, event_types:) ⇒ Webhook
constructor
Initializes a new Webhook object.
-
#to_json(*_args) ⇒ String
Converts the Webhook object to a JSON representation.
Methods included from Validatable
Constructor Details
#initialize(url:, type:, event_types:) ⇒ Webhook
Initializes a new Webhook object.
24 25 26 27 28 29 |
# File 'lib/cdek_api_client/entities/webhook.rb', line 24 def initialize(url:, type:, event_types:) @url = url @type = type @event_types = event_types validate! end |
Instance Attribute Details
#event_types ⇒ Object
Returns the value of attribute event_types.
12 13 14 |
# File 'lib/cdek_api_client/entities/webhook.rb', line 12 def event_types @event_types end |
#type ⇒ Object
Returns the value of attribute type.
12 13 14 |
# File 'lib/cdek_api_client/entities/webhook.rb', line 12 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
12 13 14 |
# File 'lib/cdek_api_client/entities/webhook.rb', line 12 def url @url end |
Instance Method Details
#to_json(*_args) ⇒ String
Converts the Webhook object to a JSON representation.
34 35 36 37 38 39 40 |
# File 'lib/cdek_api_client/entities/webhook.rb', line 34 def to_json(*_args) { url: @url, type: @type, event_types: @event_types }.to_json end |