Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transactions API - support more parameters as additional parameters #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/figo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,10 @@ def find_bank(bank_code, country_code)
# in the response; pending transactions are always included as a complete set, regardless of
# the `since` parameter
# @return [Array] an array of `Transaction` objects, one for each transaction of the user
def transactions(account_id = nil, since = nil, count = 1000, offset = 0, include_pending = false)
def transactions(account_id = nil, since = nil, count = 1000, offset = 0, include_pending = false, additional_params = {})
data = {"count" => count.to_s, "offset" => offset.to_s, "include_pending" => include_pending ? "1" : "0"}
data["since"] = ((since.is_a?(Date) ? since.to_s : since) unless since.nil?)
data.merge!(additional_params)

query_api_object Transaction, (account_id.nil? ? "/rest/transactions?" : "/rest/accounts/#{account_id}/transactions?") + URI.encode_www_form(data), nil, "GET", "transactions"
end
Expand Down
4 changes: 2 additions & 2 deletions lib/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ class Account < Base
# in the response; pending transactions are always included as a complete set, regardless of
# the `since` parameter
# @return [Array] an array of `Transaction` objects, one for each transaction of this account
def transactions(since = nil, count = 1000, offset = 0, include_pending = false)
@session.transactions @account_id, since, count, offset, include_pending
def transactions(since = nil, count = 1000, offset = 0, include_pending = false, additional_parameters = {})
@session.transactions @account_id, since, count, offset, include_pending, additional_parameters
end

# Request specific transaction.
Expand Down