Class: Rmoolah::Transaction
- Inherits:
-
Object
- Object
- Rmoolah::Transaction
- Includes:
- HTTParty
- Defined in:
- lib/rmoolah/transaction.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#amount_requested ⇒ Object
readonly
Returns the value of attribute amount_requested.
-
#amount_to_pay ⇒ Object
readonly
Returns the value of attribute amount_to_pay.
-
#currency_requested ⇒ Object
readonly
Returns the value of attribute currency_requested.
-
#currency_to_pay ⇒ Object
readonly
Returns the value of attribute currency_to_pay.
-
#guid ⇒ Object
readonly
Returns the value of attribute guid.
-
#ipn ⇒ Object
readonly
Returns the value of attribute ipn.
-
#product ⇒ Object
readonly
Returns the value of attribute product.
-
#received ⇒ Object
readonly
Returns the value of attribute received.
-
#return_url ⇒ Object
readonly
Returns the value of attribute return_url.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tx ⇒ Object
readonly
Returns the value of attribute tx.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
- #fetch(tx = @tx) ⇒ Object
-
#initialize(guid, amount_requested, currency_requested, product, return_url, ipn = nil) ⇒ Transaction
constructor
A new instance of Transaction.
Constructor Details
#initialize(guid, amount_requested, currency_requested, product, return_url, ipn = nil) ⇒ Transaction
Returns a new instance of Transaction.
31 32 33 34 35 36 37 38 |
# File 'lib/rmoolah/transaction.rb', line 31 def initialize(guid, amount_requested, currency_requested, product, return_url, ipn = nil) @guid = guid @amount_requested = amount_requested @currency_requested = currency_requested @product = product @return_url = return_url @ipn = ipn end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def address @address end |
#amount_requested ⇒ Object (readonly)
Returns the value of attribute amount_requested.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def amount_requested @amount_requested end |
#amount_to_pay ⇒ Object (readonly)
Returns the value of attribute amount_to_pay.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def amount_to_pay @amount_to_pay end |
#currency_requested ⇒ Object (readonly)
Returns the value of attribute currency_requested.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def currency_requested @currency_requested end |
#currency_to_pay ⇒ Object (readonly)
Returns the value of attribute currency_to_pay.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def currency_to_pay @currency_to_pay end |
#guid ⇒ Object (readonly)
Returns the value of attribute guid.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def guid @guid end |
#ipn ⇒ Object (readonly)
Returns the value of attribute ipn.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def ipn @ipn end |
#product ⇒ Object (readonly)
Returns the value of attribute product.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def product @product end |
#received ⇒ Object (readonly)
Returns the value of attribute received.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def received @received end |
#return_url ⇒ Object (readonly)
Returns the value of attribute return_url.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def return_url @return_url end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def status @status end |
#tx ⇒ Object (readonly)
Returns the value of attribute tx.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def tx @tx end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
17 18 19 |
# File 'lib/rmoolah/transaction.rb', line 17 def url @url end |
Class Method Details
.fetch(tx) ⇒ Object
12 13 14 |
# File 'lib/rmoolah/transaction.rb', line 12 def fetch(tx) self.new(nil, nil, nil, nil, nil).fetch(tx) end |
Instance Method Details
#create ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rmoolah/transaction.rb', line 40 def create response = self.class.get("/api/pay", query: { guid: guid, amount: amount_requested, currency: currency_requested, product: product, return: return_url }) update!(response.body) self end |
#fetch(tx = @tx) ⇒ Object
52 53 54 55 56 |
# File 'lib/rmoolah/transaction.rb', line 52 def fetch(tx = @tx) response = self.class.get("/api/pay/check/#{tx}") update!(response.body) self end |