class Button::Accounts

www.usebutton.com/developers/api-reference/

Public Instance Methods

all() click to toggle source

Gets a list of available accounts

@return [Button::Response] the API response

# File lib/button/resources/accounts.rb, line 16
def all
  api_get(path)
end
path(account_id = nil) click to toggle source
# File lib/button/resources/accounts.rb, line 7
def path(account_id = nil)
  return "/v1/affiliation/accounts/#{account_id}/transactions" if account_id
  '/v1/affiliation/accounts'
end
transactions(account_id, opts = {}) click to toggle source

Gets a list of transactions for an account

@param [String] account_id the account id to look up transactions for @option [String] cursor the account id to look up transactions for @option [ISO-8601 datetime String] start The start date to filter

transactions

@option [ISO-8601 datetime String] end The end date to filter

transactions

@option [String] time_field time field start and end filter on @return [Button::Response] the API response

# File lib/button/resources/accounts.rb, line 31
def transactions(account_id, opts = {})
  query = {}
  query['cursor'] = opts[:cursor] if opts[:cursor]
  query['start'] = opts[:start] if opts[:start]
  query['end'] = opts[:end] if opts[:end]
  query['time_field'] = opts[:time_field] if opts[:time_field]

  api_get(path(account_id), query)
end