Class: Versapay::Transactions

Inherits:
Object
  • Object
show all
Defined in:
lib/versapay/transactions.rb

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Transactions

Returns a new instance of Transactions.

Yields:

  • (_self)

Yield Parameters:



6
7
8
# File 'lib/versapay/transactions.rb', line 6

def initialize(&block)
  yield self if block_given?
end

Instance Method Details

#approve(token) ⇒ Object



23
24
25
# File 'lib/versapay/transactions.rb', line 23

def approve(token)
  Versapay::make_request(:post, "/api/transactions/#{token}/approve.json")
end

#cancel(token) ⇒ Object



27
28
29
# File 'lib/versapay/transactions.rb', line 27

def cancel(token)
  Versapay::make_request(:post, "/api/transactions/#{token}/cancel.json")
end

#create(args) ⇒ Object



10
11
12
# File 'lib/versapay/transactions.rb', line 10

def create(args)
  Versapay::make_request(:post, "/api/transactions.json", args)
end

#list(page = nil) ⇒ Object



14
15
16
17
# File 'lib/versapay/transactions.rb', line 14

def list(page = nil)
  args = page.nil? ? {} : { :page => page }
  Versapay::make_request(:get, "/api/transactions/sent.json", args)
end

#view(token) ⇒ Object



19
20
21
# File 'lib/versapay/transactions.rb', line 19

def view(token)
  Versapay::make_request(:get, "/api/transactions/#{token}.json")
end