Class: OnlinePayments::SDK::Merchant::Webhooks::WebhooksClient
- Inherits:
-
ApiResource
- Object
- ApiResource
- OnlinePayments::SDK::Merchant::Webhooks::WebhooksClient
- Defined in:
- lib/onlinepayments/sdk/merchant/webhooks/webhooks_client.rb
Overview
Webhooks client. Thread-safe.
Instance Attribute Summary
Attributes inherited from ApiResource
#client_meta_info, #communicator
Instance Method Summary collapse
-
#initialize(parent, path_context) ⇒ WebhooksClient
constructor
A new instance of WebhooksClient.
-
#send_test_webhook(body, context = nil) ⇒ Object
Resource /v2/{merchantId}/webhooks/sendtest - Send test.
-
#validate_webhook_credentials(body, context = nil) ⇒ OnlinePayments::SDK::Domain::ValidateCredentialsResponse
Resource /v2/{merchantId}/webhooks/validateCredentials - Validate credentials.
Constructor Details
#initialize(parent, path_context) ⇒ WebhooksClient
Returns a new instance of WebhooksClient.
19 20 21 |
# File 'lib/onlinepayments/sdk/merchant/webhooks/webhooks_client.rb', line 19 def initialize(parent, path_context) super(parent: parent, path_context: path_context) end |
Instance Method Details
#send_test_webhook(body, context = nil) ⇒ Object
Resource /v2/{merchantId}/webhooks/sendtest - Send test
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/onlinepayments/sdk/merchant/webhooks/webhooks_client.rb', line 65 def send_test_webhook(body, context = nil) uri = instantiate_uri('/v2/{merchantId}/webhooks/sendtest', nil) @communicator.post( uri, client_headers, nil, body, nil, context) rescue OnlinePayments::SDK::Communication::ResponseException => e error_type = OnlinePayments::SDK::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context) end |
#validate_webhook_credentials(body, context = nil) ⇒ OnlinePayments::SDK::Domain::ValidateCredentialsResponse
Resource /v2/{merchantId}/webhooks/validateCredentials - Validate credentials
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/onlinepayments/sdk/merchant/webhooks/webhooks_client.rb', line 37 def validate_webhook_credentials(body, context = nil) uri = instantiate_uri('/v2/{merchantId}/webhooks/validateCredentials', nil) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::ValidateCredentialsResponse, context) rescue OnlinePayments::SDK::Communication::ResponseException => e error_type = OnlinePayments::SDK::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context) end |