Class: Ingenico::Connect::SDK::Merchant::Sessions::SessionsClient

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

parent

ApiResource

path_context

Hash of String to String



19
20
21
# File 'lib/ingenico/connect/sdk/merchant/sessions/sessions_client.rb', line 19

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

Instance Method Details

#create(body, context = nil) ⇒ Object

Resource /{merchantId}/sessions

Create session

body

Domain::Sessions::SessionRequest

context

CallContext

Returns

Domain::Sessions::SessionResponse

Raises

ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)

Raises

AuthorizationException if the request was not allowed (HTTP status code 403)

Raises

IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)

Raises

ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,

or there was a conflict (HTTP status code 404, 409 or 410)

Raises

GlobalCollectException if something went wrong at the Ingenico ePayments platform,

the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,

or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Raises

ApiException if the Ingenico ePayments platform returned any other error



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

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