class Starling::Services::DirectDebitTransactionsService

A service for accessing the Transaction Direct Debit API

Public Instance Methods

get(id, params: {}, headers: {}) click to toggle source

@param id [String] The Starling internal ID of the transaction @param params [Hash] Parameters which will be included in the HTTP request,

included in the URL as a query string

@param headers [Hash] Headers which be included in the HTTP request, merged on

top of the headers set at the {Client} level

@return [Resources::DirectDebitTransactionResource] @raise [Errors::ApiError] if the HTTP request returns a status indicating that it

was unsuccessful
# File lib/starling/services/direct_debit_transactions_service.rb, line 13
def get(id, params: {}, headers: {})
  response = api_service.make_request(:get,
                                      "/transactions/direct-debit/#{id}",
                                      params: params,
                                      headers: headers)
  resource.new(response: response)
end
list(params: {}, headers: {}) click to toggle source

@param params [Hash] Parameters which will be included in the HTTP request,

included in the URL as a query string

@param headers [Hash] Headers which be included in the HTTP request, merged on

top of the headers set at the {Client} level

@return [Array<Resources::DirectDebitTransactionResource>] @raise [Errors::ApiError] if the HTTP request returns a status indicating that it

was unsuccessful
# File lib/starling/services/direct_debit_transactions_service.rb, line 28
def list(params: {}, headers: {})
  response = api_service.make_request(:get,
                                      '/transactions/direct-debit',
                                      params: params,
                                      headers: headers)

  build_collection_from_embedded_key(response,
                                     key: 'transactions',
                                     resource: resource)
end

Private Instance Methods

resource() click to toggle source
# File lib/starling/services/direct_debit_transactions_service.rb, line 41
def resource
  Resources::DirectDebitTransactionResource
end