Class: Button::Accounts

Inherits:
Resource show all
Defined in:
lib/button/resources/accounts.rb

Overview

Constant Summary

Constants inherited from Resource

Resource::USER_AGENT

Instance Attribute Summary

Attributes inherited from Resource

#config

Instance Method Summary collapse

Methods inherited from Resource

#api_delete, #api_get, #api_post, #initialize, #timeout

Constructor Details

This class inherits a constructor from Button::Resource

Instance Method Details

#allButton::Response

Gets a list of available accounts

Returns:



16
17
18
# File 'lib/button/resources/accounts.rb', line 16

def all
  api_get(path)
end

#path(account_id = nil) ⇒ Object



7
8
9
10
# File 'lib/button/resources/accounts.rb', line 7

def path( = nil)
  return "/v1/affiliation/accounts/#{}/transactions" if 
  '/v1/affiliation/accounts'
end

#transactions(account_id, opts = {}) ⇒ Button::Response

Gets a list of transactions for an account

Parameters:

  • account_id (String)

    the account id to look up transactions for

  • [String] (Hash)

    a customizable set of options

  • [ISO-8601 (Hash)

    a customizable set of options

Returns:



30
31
32
33
34
35
36
37
# File 'lib/button/resources/accounts.rb', line 30

def transactions(, opts = {})
  query = {}
  query['cursor'] = opts[:cursor] if opts[:cursor]
  query['start'] = opts[:start] if opts[:start]
  query['end'] = opts[:end] if opts[:end]

  api_get(path(), query)
end