Class: Zazu::Resources::Accounts

Inherits:
Base
  • Object
show all
Defined in:
lib/zazu/resources/accounts.rb

Overview

Accounts and their transactions.

Constant Summary

Constants inherited from Base

Base::MAX_PER_PAGE

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Zazu::Resources::Base

Instance Method Details

#get(id) ⇒ Object

GET /api/accounts/:id



25
26
27
# File 'lib/zazu/resources/accounts.rb', line 25

def get(id)
  http_get(encode_path("api/accounts", id))
end

#get_transaction(account_id, transaction_id) ⇒ Object

GET /api/accounts/:account_id/transactions/:id



47
48
49
# File 'lib/zazu/resources/accounts.rb', line 47

def get_transaction(, transaction_id)
  http_get(encode_path("api/accounts", , "transactions", transaction_id))
end

#list(status: nil, currency_code: nil, limit: MAX_PER_PAGE, cursor: nil) ⇒ Zazu::Page

GET /api/accounts

Parameters:

  • status (String, nil) (defaults to: nil)

    filter by account status

  • currency_code (String, nil) (defaults to: nil)

    e.g. “MAD” or “ZAR”

  • limit (Integer) (defaults to: MAX_PER_PAGE)

    page size (max 100)

  • cursor (String, nil) (defaults to: nil)

    pagination cursor

Returns:



14
15
16
17
18
19
20
21
22
# File 'lib/zazu/resources/accounts.rb', line 14

def list(status: nil, currency_code: nil, limit: MAX_PER_PAGE, cursor: nil)
  list_page(
    "api/accounts",
    status: status,
    currency_code: currency_code,
    limit: limit,
    cursor: cursor
  )
end

#list_transactions(account_id, operation: nil, posted_after: nil, posted_before: nil, limit: MAX_PER_PAGE, cursor: nil) ⇒ Object

GET /api/accounts/:account_id/transactions

Parameters:

  • operation (String, nil) (defaults to: nil)

    filter by movement operation

  • posted_after (String, Time, nil) (defaults to: nil)

    ISO-8601 timestamp lower bound

  • posted_before (String, Time, nil) (defaults to: nil)

    ISO-8601 timestamp upper bound



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/zazu/resources/accounts.rb', line 34

def list_transactions(, operation: nil, posted_after: nil, posted_before: nil, limit: MAX_PER_PAGE,
                      cursor: nil)
  list_page(
    encode_path("api/accounts", , "transactions"),
    operation: operation,
    posted_after: serialize_time(posted_after),
    posted_before: serialize_time(posted_before),
    limit: limit,
    cursor: cursor
  )
end