Class: SaasRunner::Resource::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/saas_runner/resource/transaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Transaction

Returns a new instance of Transaction.



6
7
8
# File 'lib/saas_runner/resource/transaction.rb', line 6

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/saas_runner/resource/transaction.rb', line 4

def client
  @client
end

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/saas_runner/resource/transaction.rb', line 4

def response
  @response
end

Instance Method Details

#charge!(params = {}) ⇒ Object



10
11
12
13
# File 'lib/saas_runner/resource/transaction.rb', line 10

def charge!(params = {})
  @response = client.post('/transactions/charge', { transaction: params })
  @response.body
end

#refund!(params = {}) ⇒ Object



15
16
17
18
# File 'lib/saas_runner/resource/transaction.rb', line 15

def refund!(params = {})
  @response = client.post('/transactions/refund', { transaction: params })
  @response.body
end