Class: LemonwayOnboarding::Api::Accounts

Inherits:
Object
  • Object
show all
Defined in:
lib/lemonway_onboarding/api/accounts.rb

Overview

Accounts API for Lemonway Onboarding

Instance Method Summary collapse

Constructor Details

#initialize(client = LemonwayOnboarding::Client.new) ⇒ LemonwayOnboarding::Api::Accounts

Initializes the Accounts API with a client.

Parameters:



11
12
13
# File 'lib/lemonway_onboarding/api/accounts.rb', line 11

def initialize(client = LemonwayOnboarding::Client.new)
  @client = client
end

Instance Method Details

#create(type, body) ⇒ Hash

Creates a new account.

Parameters:

  • type (String)

    The type of account to create

  • body (Hash)

    The body of the request containing account details

Returns:

  • (Hash)

    The response from the API containing the created account details



20
21
22
# File 'lib/lemonway_onboarding/api/accounts.rb', line 20

def create(type, body)
  @client.post("accounts/#{type}", body)
end

#index(params = {}) ⇒ Array<Hash>

Lists all accounts.

Parameters:

  • params (Hash) (defaults to: {})

    Optional parameters to filter the accounts

Returns:

  • (Array<Hash>)

    The list of accounts



28
29
30
# File 'lib/lemonway_onboarding/api/accounts.rb', line 28

def index(params = {})
  @client.get('accounts', params)
end

#show(id) ⇒ Hash

Retrieves a specific account by its ID.

Parameters:

  • id (String)

    The ID of the account to retrieve

Returns:

  • (Hash)

    The details of the specified account



36
37
38
# File 'lib/lemonway_onboarding/api/accounts.rb', line 36

def show(id)
  @client.get("accounts/#{id}")
end