Class: Worldline::Connect::SDK::V1::Merchant::Mandates::MandatesClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/worldline/connect/sdk/v1/merchant/mandates/mandates_client.rb

Overview

Mandates client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ MandatesClient

Returns a new instance of MandatesClient.

Parameters:



23
24
25
# File 'lib/worldline/connect/sdk/v1/merchant/mandates/mandates_client.rb', line 23

def initialize(parent, path_context)
  super(parent: parent, path_context: path_context)
end

Instance Method Details

#block(unique_mandate_reference, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::GetMandateResponse

Resource /{merchantId}/mandates/{uniqueMandateReference}/block - Block mandate

Parameters:

Returns:

Raises:



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/worldline/connect/sdk/v1/merchant/mandates/mandates_client.rb', line 134

def block(unique_mandate_reference, context = nil)
  path_context = {
    'uniqueMandateReference'.freeze => unique_mandate_reference,
  }
  uri = instantiate_uri('/v1/{merchantId}/mandates/{uniqueMandateReference}/block', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Worldline::Connect::SDK::V1::Domain::GetMandateResponse,
    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

#create(body, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::CreateMandateResponse

Resource /{merchantId}/mandates - Create mandate

Parameters:

Returns:

Raises:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/worldline/connect/sdk/v1/merchant/mandates/mandates_client.rb', line 41

def create(body, context = nil)
  uri = instantiate_uri('/v1/{merchantId}/mandates', nil)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Worldline::Connect::SDK::V1::Domain::CreateMandateResponse,
    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

#create_with_mandate_reference(unique_mandate_reference, body, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::CreateMandateResponse

Resource /{merchantId}/mandates/{uniqueMandateReference} - Create mandate with mandatereference

Parameters:

Returns:

Raises:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/worldline/connect/sdk/v1/merchant/mandates/mandates_client.rb', line 71

def create_with_mandate_reference(unique_mandate_reference, body, context = nil)
  path_context = {
    'uniqueMandateReference'.freeze => unique_mandate_reference,
  }
  uri = instantiate_uri('/v1/{merchantId}/mandates/{uniqueMandateReference}', path_context)
  @communicator.put(
    uri,
    client_headers,
    nil,
    body,
    Worldline::Connect::SDK::V1::Domain::CreateMandateResponse,
    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(unique_mandate_reference, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::GetMandateResponse

Resource /{merchantId}/mandates/{uniqueMandateReference} - Get mandate

Parameters:

Returns:

Raises:



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/worldline/connect/sdk/v1/merchant/mandates/mandates_client.rb', line 103

def get(unique_mandate_reference, context = nil)
  path_context = {
    'uniqueMandateReference'.freeze => unique_mandate_reference,
  }
  uri = instantiate_uri('/v1/{merchantId}/mandates/{uniqueMandateReference}', path_context)
  @communicator.get(
    uri,
    client_headers,
    nil,
    Worldline::Connect::SDK::V1::Domain::GetMandateResponse,
    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

#revoke(unique_mandate_reference, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::GetMandateResponse

Resource /{merchantId}/mandates/{uniqueMandateReference}/revoke - Revoke mandate

Parameters:

Returns:

Raises:



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/worldline/connect/sdk/v1/merchant/mandates/mandates_client.rb', line 198

def revoke(unique_mandate_reference, context = nil)
  path_context = {
    'uniqueMandateReference'.freeze => unique_mandate_reference,
  }
  uri = instantiate_uri('/v1/{merchantId}/mandates/{uniqueMandateReference}/revoke', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Worldline::Connect::SDK::V1::Domain::GetMandateResponse,
    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

#unblock(unique_mandate_reference, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::GetMandateResponse

Resource /{merchantId}/mandates/{uniqueMandateReference}/unblock - Unblock mandate

Parameters:

Returns:

Raises:



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/worldline/connect/sdk/v1/merchant/mandates/mandates_client.rb', line 166

def unblock(unique_mandate_reference, context = nil)
  path_context = {
    'uniqueMandateReference'.freeze => unique_mandate_reference,
  }
  uri = instantiate_uri('/v1/{merchantId}/mandates/{uniqueMandateReference}/unblock', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Worldline::Connect::SDK::V1::Domain::GetMandateResponse,
    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