Class: Worldline::Acquiring::SDK::V1::Ping::PingClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/worldline/acquiring/sdk/v1/ping/ping_client.rb

Overview

Ping client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ PingClient

Returns a new instance of PingClient.

Parameters:



19
20
21
# File 'lib/worldline/acquiring/sdk/v1/ping/ping_client.rb', line 19

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

Instance Method Details

#ping(context = nil) ⇒ Object

Resource /services/v1/ping - Check API connection

Parameters:

Raises:



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/worldline/acquiring/sdk/v1/ping/ping_client.rb', line 34

def ping(context = nil)
  uri = instantiate_uri('/services/v1/ping', nil)
  @communicator.get(
    uri,
    nil,
    nil,
    nil,
    context)
rescue Worldline::Acquiring::SDK::Communication::ResponseException => e
  error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end