Class: Ethikdo::Transaction

Inherits:
BaseModel show all
Defined in:
lib/ethikdo/transaction.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from BaseModel

#initialize

Constructor Details

This class inherits a constructor from Ethikdo::BaseModel

Instance Attribute Details

#amount_debitedObject

Returns the value of attribute amount_debited.



9
10
11
# File 'lib/ethikdo/transaction.rb', line 9

def amount_debited
  @amount_debited
end

#amount_purchasedObject

Returns the value of attribute amount_purchased.



8
9
10
# File 'lib/ethikdo/transaction.rb', line 8

def amount_purchased
  @amount_purchased
end

#cancelledObject

Returns the value of attribute cancelled.



10
11
12
# File 'lib/ethikdo/transaction.rb', line 10

def cancelled
  @cancelled
end

#card_numberObject

Returns the value of attribute card_number.



7
8
9
# File 'lib/ethikdo/transaction.rb', line 7

def card_number
  @card_number
end

#countObject

Returns the value of attribute count.



14
15
16
# File 'lib/ethikdo/transaction.rb', line 14

def count
  @count
end

#customer_emailObject

Returns the value of attribute customer_email.



18
19
20
# File 'lib/ethikdo/transaction.rb', line 18

def customer_email
  @customer_email
end

#dateObject

Returns the value of attribute date.



11
12
13
# File 'lib/ethikdo/transaction.rb', line 11

def date
  @date
end

#messageObject

Returns the value of attribute message.



13
14
15
# File 'lib/ethikdo/transaction.rb', line 13

def message
  @message
end

#nextObject

Returns the value of attribute next.



15
16
17
# File 'lib/ethikdo/transaction.rb', line 15

def next
  @next
end

#previousObject

Returns the value of attribute previous.



16
17
18
# File 'lib/ethikdo/transaction.rb', line 16

def previous
  @previous
end

#refund_amountObject

Returns the value of attribute refund_amount.



12
13
14
# File 'lib/ethikdo/transaction.rb', line 12

def refund_amount
  @refund_amount
end

#resultsObject

Returns the value of attribute results.



17
18
19
# File 'lib/ethikdo/transaction.rb', line 17

def results
  @results
end

#transaction_idObject

Returns the value of attribute transaction_id.



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

def transaction_id
  @transaction_id
end

#urlObject

Returns the value of attribute url.



5
6
7
# File 'lib/ethikdo/transaction.rb', line 5

def url
  @url
end

Class Method Details

.allObject



36
37
38
39
# File 'lib/ethikdo/transaction.rb', line 36

def self.all
  response = execute('get', '/sales/')
  self.new(response.parsed_response)
end

.cancel(transaction_id:) ⇒ Object



31
32
33
34
# File 'lib/ethikdo/transaction.rb', line 31

def self.cancel(transaction_id:)
  response = execute('get', "/sales/#{transaction_id}/cancel")
  self.new(response.parsed_response)
end

.create(capture_token:, amount_requested:, amount_purchased: 0, transaction_id:, customer_email: nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/ethikdo/transaction.rb', line 20

def self.create(capture_token:, amount_requested:, amount_purchased: 0, transaction_id:, customer_email: nil)
  response = execute('post', '/sales/', body: {
                        capture_token: capture_token,
                        amount_requested: amount_requested,
                        amount_purchased: amount_purchased,
                        transaction_id: transaction_id,
                        customer_email: customer_email
                      })
  self.new(response.parsed_response)
end