Class: Ingenico::Direct::SDK::CallContext

Inherits:
Object
  • Object
show all
Defined in:
lib/ingenico/direct/sdk/call_context.rb

Overview

A CallContext is used to identify requests and manage idempotent requests. A CallContext contains the following:

idempotence_key

A randomly generated key used to identify requests

idempotence_request_timestamp

If a previous request arrived with the same idempotence key, this value will be set to a timestamp of that request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(idempotence_key = nil) ⇒ CallContext

Returns a new instance of CallContext.



19
20
21
# File 'lib/ingenico/direct/sdk/call_context.rb', line 19

def initialize(idempotence_key = nil)
  @idempotence_key = idempotence_key
end

Instance Attribute Details

#idempotence_keyString (readonly)

The idempotence key used to identify this request. If two requests share the same idempotence_key, they are considered to be the same request and only the first request will be processed.

Returns:

  • (String)

    the current value of idempotence_key



15
16
17
# File 'lib/ingenico/direct/sdk/call_context.rb', line 15

def idempotence_key
  @idempotence_key
end

#idempotence_request_timestampInteger

If two or more requests arrive at the Ingenico ePayments platform with the same idempotence_key, the idempotence_request_timestamp will be set to the arrival time of the first of these requests.

Returns:

  • (Integer)

    the current value of idempotence_request_timestamp



15
16
17
# File 'lib/ingenico/direct/sdk/call_context.rb', line 15

def idempotence_request_timestamp
  @idempotence_request_timestamp
end