Class: Starling::Services::AccountService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/starling/services/account_service.rb

Overview

A service for accessing the Account API's Get Account endpoint

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Starling::Services::BaseService

Instance Method Details

#balanceServices::AccountBalanceService

Returns a configured service for accessing the Account Balance API.

Returns:


21
22
23
# File 'lib/starling/services/account_service.rb', line 21

def balance
  Services::AccountBalanceService.new(api_service)
end

#get(params: {}, headers: {}) ⇒ Resources::AccountResource

Parameters:

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

    Parameters which will be included in the HTTP request, included in the URL as a query string

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

    Headers which be included in the HTTP request, merged on top of the headers set at the Client level

Returns:

Raises:

  • (Errors::ApiError)

    if the HTTP request returns a status indicating that it was unsuccessful


12
13
14
15
16
17
# File 'lib/starling/services/account_service.rb', line 12

def get(params: {}, headers: {})
  response = api_service.make_request(:get, '/accounts', params: params,
                                                         headers: headers)

  resource.new(response: response)
end