Class: Mosaic::Sdk::Client

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

Overview

Singleton HTTP entry point for the Mosaic API.

Delegates every request to Fluence::Gateway::Client with tenant: Mosaic::Sdk.config.tenant (default :mosaic) so paths are routed through the Fluence API gateway and OAuth2 authentication is 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('/v2/banks')

Perform a POST request

Client.post('/v2/banks', body: { name: 'My Bank' })

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