Class: Worldline::Connect::SDK::V1::Merchant::Refunds::RefundsClient
- Inherits:
-
ApiResource
- Object
- ApiResource
- Worldline::Connect::SDK::V1::Merchant::Refunds::RefundsClient
- Defined in:
- lib/worldline/connect/sdk/v1/merchant/refunds/refunds_client.rb
Overview
Refunds client. Thread-safe.
Instance Attribute Summary
Attributes inherited from ApiResource
#client_meta_info, #communicator
Instance Method Summary collapse
-
#approve(refund_id, body, context = nil) ⇒ Object
Resource /{merchantId}/refunds/{refundId}/approve - Approve refund.
-
#cancel(refund_id, context = nil) ⇒ Object
Resource /{merchantId}/refunds/{refundId}/cancel - Cancel refund.
-
#cancelapproval(refund_id, context = nil) ⇒ Object
Resource /{merchantId}/refunds/{refundId}/cancelapproval - Undo approve refund.
-
#find(query, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::FindRefundsResponse
Resource /{merchantId}/refunds - Find refunds.
-
#get(refund_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::RefundResponse
Resource /{merchantId}/refunds/{refundId} - Get refund.
-
#initialize(parent, path_context) ⇒ RefundsClient
constructor
A new instance of RefundsClient.
Constructor Details
#initialize(parent, path_context) ⇒ RefundsClient
Returns a new instance of RefundsClient.
23 24 25 |
# File 'lib/worldline/connect/sdk/v1/merchant/refunds/refunds_client.rb', line 23 def initialize(parent, path_context) super(parent: parent, path_context: path_context) end |
Instance Method Details
#approve(refund_id, body, context = nil) ⇒ Object
Resource /{merchantId}/refunds/{refundId}/approve - Approve refund
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/worldline/connect/sdk/v1/merchant/refunds/refunds_client.rb', line 100 def approve(refund_id, body, context = nil) path_context = { 'refundId'.freeze => refund_id, } uri = instantiate_uri('/v1/{merchantId}/refunds/{refundId}/approve', path_context) @communicator.post( uri, client_headers, nil, body, nil, context) rescue ResponseException => e error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |
#cancel(refund_id, context = nil) ⇒ Object
Resource /{merchantId}/refunds/{refundId}/cancel - Cancel refund
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/worldline/connect/sdk/v1/merchant/refunds/refunds_client.rb', line 131 def cancel(refund_id, context = nil) path_context = { 'refundId'.freeze => refund_id, } uri = instantiate_uri('/v1/{merchantId}/refunds/{refundId}/cancel', path_context) @communicator.post( uri, client_headers, nil, nil, nil, context) rescue ResponseException => e error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |
#cancelapproval(refund_id, context = nil) ⇒ Object
Resource /{merchantId}/refunds/{refundId}/cancelapproval - Undo approve refund
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/worldline/connect/sdk/v1/merchant/refunds/refunds_client.rb', line 162 def cancelapproval(refund_id, context = nil) path_context = { 'refundId'.freeze => refund_id, } uri = instantiate_uri('/v1/{merchantId}/refunds/{refundId}/cancelapproval', path_context) @communicator.post( uri, client_headers, nil, nil, nil, context) rescue ResponseException => e error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |
#find(query, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::FindRefundsResponse
Resource /{merchantId}/refunds - Find refunds
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/worldline/connect/sdk/v1/merchant/refunds/refunds_client.rb', line 41 def find(query, context = nil) uri = instantiate_uri('/v1/{merchantId}/refunds', nil) @communicator.get( uri, client_headers, query, Worldline::Connect::SDK::V1::Domain::FindRefundsResponse, context) rescue ResponseException => e error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |
#get(refund_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::RefundResponse
Resource /{merchantId}/refunds/{refundId} - Get refund
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/worldline/connect/sdk/v1/merchant/refunds/refunds_client.rb', line 69 def get(refund_id, context = nil) path_context = { 'refundId'.freeze => refund_id, } uri = instantiate_uri('/v1/{merchantId}/refunds/{refundId}', path_context) @communicator.get( uri, client_headers, nil, Worldline::Connect::SDK::V1::Domain::RefundResponse, context) rescue ResponseException => e error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |