Class: ContextIO::Webhook
- Inherits:
-
Object
- Object
- ContextIO::Webhook
- Includes:
- CallHelpers
- Defined in:
- lib/context_io/shared/webhook.rb
Constant Summary collapse
- WEBHOOK_READERS =
%I(callback_url active webhook_id resource_url)
Instance Attribute Summary collapse
-
#api_call_made ⇒ Object
Returns the value of attribute api_call_made.
Instance Method Summary collapse
- #call_url ⇒ Object
-
#initialize(parent:, identifier: nil, response: nil, status: nil, success: nil, api_call_made: nil) ⇒ Webhook
constructor
A new instance of Webhook.
- #post(**kwargs) ⇒ Object
Methods included from CallHelpers
#build_url, #call_api_return_new_object, #call_api_return_updated_object, #delete, #get, #get_request, #parse_response, #return_post_api_call_made, #success?, #validate_params
Methods included from CollectionHelper
#collection_return, #contact_collection_return
Constructor Details
#initialize(parent:, identifier: nil, response: nil, status: nil, success: nil, api_call_made: nil) ⇒ Webhook
Returns a new instance of Webhook.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/context_io/shared/webhook.rb', line 12 def initialize(parent:, identifier: nil, response: nil, status: nil, success: nil, api_call_made: nil) @parent = parent @connection = parent.connection @webhook_id = identifier @status = status @success = success @api_call_made = api_call_made if response parse_response(response) end end |
Instance Attribute Details
#api_call_made ⇒ Object
Returns the value of attribute api_call_made.
10 11 12 |
# File 'lib/context_io/shared/webhook.rb', line 10 def api_call_made @api_call_made end |
Instance Method Details
#call_url ⇒ Object
29 30 31 |
# File 'lib/context_io/shared/webhook.rb', line 29 def call_url build_url("webhooks", webhook_id) end |
#post(**kwargs) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/context_io/shared/webhook.rb', line 33 def post(**kwargs) webhook = call_api_return_updated_object(klass: Webhook, url: call_url, identifier: webhook_id, method: :post, valid_params: ValidPostParams::WEBHOOK, given_params: kwargs) return_post_api_call_made(webhook) end |