Class: Ingenico::Connect::SDK::Merchant::Mandates::MandatesClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/ingenico/connect/sdk/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:



20
21
22
# File 'lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb', line 20

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

Instance Method Details

#block(unique_mandate_reference, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse

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

Parameters:

Returns:

Raises:



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb', line 127

def block(unique_mandate_reference, context=nil)
  path_context = {
    'uniqueMandateReference'.freeze => unique_mandate_reference,
  }
  uri = instantiate_uri('/v1/{merchantId}/mandates/{uniqueMandateReference}/block', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

#create(body, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Mandates::CreateMandateResponse

Resource /{merchantId}/mandates - Create mandate

Parameters:

Returns:

Raises:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb', line 37

def create(body, context=nil)
  uri = instantiate_uri('/v1/{merchantId}/mandates', nil)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Mandates::CreateMandateResponse,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

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

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

Parameters:

Returns:

Raises:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb', line 66

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)
  return @communicator.put(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Mandates::CreateMandateResponse,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

#get(unique_mandate_reference, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse

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

Parameters:

Returns:

Raises:



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb', line 97

def get(unique_mandate_reference, context=nil)
  path_context = {
    'uniqueMandateReference'.freeze => unique_mandate_reference,
  }
  uri = instantiate_uri('/v1/{merchantId}/mandates/{uniqueMandateReference}', path_context)
  return @communicator.get(
    uri,
    client_headers,
    nil,
    Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

#revoke(unique_mandate_reference, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse

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

Parameters:

Returns:

Raises:



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb', line 189

def revoke(unique_mandate_reference, context=nil)
  path_context = {
    'uniqueMandateReference'.freeze => unique_mandate_reference,
  }
  uri = instantiate_uri('/v1/{merchantId}/mandates/{uniqueMandateReference}/revoke', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

#unblock(unique_mandate_reference, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse

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

Parameters:

Returns:

Raises:



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb', line 158

def unblock(unique_mandate_reference, context=nil)
  path_context = {
    'uniqueMandateReference'.freeze => unique_mandate_reference,
  }
  uri = instantiate_uri('/v1/{merchantId}/mandates/{uniqueMandateReference}/unblock', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end