Class: Ledger::Sdk::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/ledger/sdk/client.rb

Overview

Singleton HTTP entry point for the Ledger API.

Delegates every request to Fluence::Gateway::Client with service: Ledger::Sdk.config.service (default :ledger) so paths are prefixed with /backend/ledger/ and routed through the Fluence API gateway, with OAuth2 authentication handled by the gateway client (see fluence-gateway-client).

HTTP methods (+get+, post, put, patch, delete) are accessible on both the instance and the class.

Examples:

Perform a GET request

Client.get('/containers')

Instance Method Summary collapse

Instance Method Details

#delete(path) ⇒ Hash

Performs a DELETE request on the API.

Parameters:

  • path (String)

    the resource path

Returns:

  • (Hash)

    the parsed API response

#get(path) ⇒ Hash, Array

Performs a GET request on the API.

Parameters:

  • path (String)

    the resource path

Returns:

  • (Hash, Array)

    the parsed API response

#patch(path, body:) ⇒ Hash

Performs a PATCH request on the API.

Parameters:

  • path (String)

    the resource path

  • body (Hash)

    the request body

Returns:

  • (Hash)

    the parsed API response

#post(path, body:) ⇒ Hash

Performs a POST request on the API.

Parameters:

  • path (String)

    the resource path

  • body (Hash)

    the request body

Returns:

  • (Hash)

    the parsed API response

#put(path, body:) ⇒ Hash

Performs a PUT request on the API.

Parameters:

  • path (String)

    the resource path

  • body (Hash)

    the request body

Returns:

  • (Hash)

    the parsed API response