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:

  • (defaults to: nil)

Raises:

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

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

  • 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)

  • if something went wrong at the Worldline Acquiring platform, the Worldline Acquiring 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)

  • if the Worldline Acquiring platform returned any other error



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