Class: Worldline::Connect::SDK::V1::Merchant::Tokens::TokensClient

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

Overview

Tokens client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ TokensClient

Returns a new instance of TokensClient.

Parameters:



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

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

Instance Method Details

#approvesepadirectdebit(token_id, body, context = nil) ⇒ Object

Resource /{merchantId}/tokens/{tokenId}/approvesepadirectdebit - Approve SEPA DD mandate

Parameters:

Raises:



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/worldline/connect/sdk/v1/merchant/tokens/tokens_client.rb', line 164

def approvesepadirectdebit(token_id, body, context = nil)
  path_context = {
    'tokenId'.freeze => token_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/tokens/{tokenId}/approvesepadirectdebit', 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

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

Resource /{merchantId}/tokens - Create token

Parameters:

Returns:

Raises:



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

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

#delete(token_id, query, context = nil) ⇒ Object

Resource /{merchantId}/tokens/{tokenId} - Delete token

Parameters:

Raises:



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

def delete(token_id, query, context = nil)
  path_context = {
    'tokenId'.freeze => token_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/tokens/{tokenId}', path_context)
  @communicator.delete(
    uri,
    client_headers,
    query,
    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

#get(token_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::TokenResponse

Resource /{merchantId}/tokens/{tokenId} - Get token

Parameters:

Returns:

Raises:



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

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

#update(token_id, body, context = nil) ⇒ Object

Resource /{merchantId}/tokens/{tokenId} - Update token

Parameters:

Raises:



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

def update(token_id, body, context = nil)
  path_context = {
    'tokenId'.freeze => token_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/tokens/{tokenId}', path_context)
  @communicator.put(
    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