Class: Pluggy::Resources::Account
Constant Summary
Constants inherited
from PluggyObject
PluggyObject::ISO8601, PluggyObject::RESERVED, PluggyObject::TEMPORAL_KEYS
Instance Attribute Summary
Attributes inherited from PluggyObject
#client
Instance Method Summary
collapse
#==, #[], #as_json, declared_fields, define_field, #each_pair, fields, #hash, #initialize, #inspect, #key?, #keys, #method_missing, nested, nested_types, #read, #respond_to_missing?, #to_h, #to_json, #values
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Pluggy::PluggyObject
Instance Method Details
#bank? ⇒ Boolean
51
|
# File 'lib/pluggy/resources/account.rb', line 51
def bank? = self["type"] == "BANK"
|
#bills(**filters) ⇒ Object
Credit-card statements. Only CREDIT accounts have them, so say so
clearly rather than returning a confusing empty list.
63
64
65
66
67
68
69
70
71
|
# File 'lib/pluggy/resources/account.rb', line 63
def bills(**filters)
unless credit?
raise Error,
"account #{self["id"]} has type #{self["type"].inspect}, not \"CREDIT\"; " \
"bills exist only for credit-card accounts"
end
ensure_client!.bills.list(account_id: self["id"], **filters)
end
|
#checking? ⇒ Boolean
54
|
# File 'lib/pluggy/resources/account.rb', line 54
def checking? = self["subtype"] == "CHECKING_ACCOUNT"
|
#credit? ⇒ Boolean
52
|
# File 'lib/pluggy/resources/account.rb', line 52
def credit? = self["type"] == "CREDIT"
|
#credit_card? ⇒ Boolean
53
|
# File 'lib/pluggy/resources/account.rb', line 53
def credit_card? = self["subtype"] == "CREDIT_CARD"
|
#item ⇒ Object
79
|
# File 'lib/pluggy/resources/account.rb', line 79
def item = ensure_client!.items.retrieve(self["itemId"])
|
#live_balance ⇒ Object
GET /accounts/id/balance -- fetched live from the institution rather
than from the last sync, so it is slower and can 429 or 502.
75
|
# File 'lib/pluggy/resources/account.rb', line 75
def live_balance = ensure_client!.accounts.balance(self["id"])
|
#refresh ⇒ Object
81
|
# File 'lib/pluggy/resources/account.rb', line 81
def refresh = ensure_client!.accounts.retrieve(self["id"])
|
#savings? ⇒ Boolean
55
|
# File 'lib/pluggy/resources/account.rb', line 55
def savings? = self["subtype"] == "SAVINGS_ACCOUNT"
|
#statements ⇒ Object
77
|
# File 'lib/pluggy/resources/account.rb', line 77
def statements = ensure_client!.accounts.statements(self["id"])
|
#transactions(**filters) ⇒ Object
57
58
59
|
# File 'lib/pluggy/resources/account.rb', line 57
def transactions(**filters)
ensure_client!.transactions.list(account_id: self["id"], **filters)
end
|