Module: Adyen::REST

Defined in:
lib/adyen/rest.rb,
lib/adyen/rest/client.rb,
lib/adyen/rest/errors.rb,
lib/adyen/rest/request.rb,
lib/adyen/rest/response.rb,
lib/adyen/rest/signature.rb,
lib/adyen/rest/modify_payment.rb,
lib/adyen/rest/authorise_payment.rb,
lib/adyen/rest/authorise_recurring_payment.rb

Overview

The Adyen::REST module allows you to interact with Adyen’s REST API.

The primary method here is REST.session, which will yield a Client which you can use to send API requests.

If you need more than one client instance, for instance because you have multiple acounts set up with different permissions, you can instantiate clients yourself using Client.new

Examples:

Using the singleton Client instance


Adyen::REST.session do |client|
  client.http.read_timeout = 5
  response = client.api_request(...)
  # ...
end

Using a your own Client instance


Adyen::REST::Client.new('test', 'username', 'password').session do |client|
  client.http.read_timeout = 5
  response = client.api_request(...)
  # ...
end

See Also:

Defined Under Namespace

Modules: AuthorisePayment, AuthoriseRecurringPayment, ListRecurringDetailsPayment, ModifyPayment, ReauthoriseRecurringPayment, Signature Classes: Client, Error, Request, RequestValidationFailed, Response, ResponseError

Class Method Summary collapse

Class Method Details

.clientAdyen::REST::Client

Provides a singelton REST API client this is configured using the values in Adyen.configuration.

Parameters:

  • options (Hash)

    (see Adyen::REST::Client#initialize)

Returns:

See Also:

  • session
  • To instantiate Clients yourself, in case you need more than one.


44
45
46
47
48
49
50
51
# File 'lib/adyen/rest.rb', line 44

def self.client
  Adyen::REST::Client.new(
    Adyen.configuration.environment,
    Adyen.configuration.api_username,
    Adyen.configuration.api_password,
    Adyen.configuration.merchant_specific_endpoint
  )
end

.session(client = self.client) {|client| ... } ⇒ void

This method returns an undefined value.

Exectutes a session against the Adyen REST API.

It will use a standard client from client, or it uses a provided client. The client will be yielded to the block, and will be closed after the block is finisged

Parameters:

  • client (Adyen::REST::Client) (defaults to: self.client)

    A custom API client if a default one won’t do.

Yields:

  • The provided block will be called in which you can interact with the API using the provided client. The client will be closed after the block returns.

Yield Parameters:

See Also:



64
65
66
# File 'lib/adyen/rest.rb', line 64

def self.session(client = self.client, &block)
  client.session(&block)
end