Class: GoCardlessPro::Services::PaymentAccountTransactionsService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/gocardless_pro/services/payment_account_transactions_service.rb

Overview

Service for making requests to the PaymentAccountTransaction endpoints

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #make_request, #sub_url

Constructor Details

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

Instance Method Details

#all(identity, options = {}) ⇒ Object

Get a lazily enumerated list of all the items returned. This is similar to the list method but will paginate for you automatically.

(https://developer.gocardless.com/api-reference/#core-endpoints-creditor-bank-accounts) which happens to be the payment account. Otherwise they will be the body of the request.

Parameters:

  • identity

    The unique ID of the bank account

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

    parameters as a hash. If the request is a GET, these will be converted to query parameters.



64
65
66
67
68
69
70
# File 'lib/gocardless_pro/services/payment_account_transactions_service.rb', line 64

def all(identity, options = {})
  Paginator.new(
    service: self,
    options: options,
    identity: identity
  ).enumerator
end

#get(identity, options = {}) ⇒ Object

Retrieves the details of an existing payment account transaction. Example URL: /payment_account_transactions/:identity

(https://developer.gocardless.com/api-reference/#core-endpoints-creditor-bank-accounts) which happens to be the payment account.

Parameters:

  • identity

    The unique ID of the bank account

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

    parameters as a hash, under a params key.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gocardless_pro/services/payment_account_transactions_service.rb', line 20

def get(identity, options = {})
  path = sub_url('/payment_account_transactions/:identity', {
                   'identity' => identity,
                 })

  options[:retry_failures] = true

  response = make_request(:get, path, options)

  return if response.body.nil?

  Resources::PaymentAccountTransaction.new(unenvelope_body(response.body), response)
end

#list(identity, options = {}) ⇒ Object

List transactions for a given payment account. Example URL: /payment_accounts/:identity/transactions

(https://developer.gocardless.com/api-reference/#core-endpoints-creditor-bank-accounts) which happens to be the payment account.

Parameters:

  • identity

    The unique ID of the bank account

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

    parameters as a hash, under a params key.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/gocardless_pro/services/payment_account_transactions_service.rb', line 41

def list(identity, options = {})
  path = sub_url('/payment_accounts/:identity/transactions', {
                   'identity' => identity,
                 })

  options[:retry_failures] = true

  response = make_request(:get, path, options)

  ListResponse.new(
    response: response,
    unenveloped_body: unenvelope_body(response.body),
    resource_class: Resources::PaymentAccountTransaction
  )
end