Class: Worldline::Connect::SDK::V1::Merchant::Sessions::SessionsClient

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

Overview

Sessions client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ SessionsClient

Returns a new instance of SessionsClient.

Parameters:



22
23
24
# File 'lib/worldline/connect/sdk/v1/merchant/sessions/sessions_client.rb', line 22

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

Instance Method Details

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

Resource /{merchantId}/sessions - Create session

Parameters:

Returns:

Raises:



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

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