Class: SpreedlyCore::Transaction
- Defined in:
- lib/spreedly_core/transactions.rb
Overview
Abstract class for all the different spreedly core transactions
Direct Known Subclasses
AuthorizeTransaction, CaptureTransaction, CreditTransaction, PurchaseTransaction, RedactTransaction, RetainTransaction, VoidedTransaction
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency_code ⇒ Object
readonly
Returns the value of attribute currency_code.
-
#gateway_token ⇒ Object
readonly
Returns the value of attribute gateway_token.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#on_test_gateway ⇒ Object
readonly
Returns the value of attribute on_test_gateway.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#succeeded ⇒ Object
(also: #succeeded?)
readonly
Returns the value of attribute succeeded.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#transaction_type ⇒ Object
readonly
Returns the value of attribute transaction_type.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Class Method Summary collapse
-
.find(token) ⇒ Object
Lookup the transaction by its token.
-
.handles(transaction_type) ⇒ Object
Breaks enacapsulation a bit, but allow subclasses to register the ‘transaction_type’ they handle.
Methods inherited from Base
configure, gateway_token, #initialize, login, verify_get, verify_options, verify_post, verify_put, verify_request
Constructor Details
This class inherits a constructor from SpreedlyCore::Base
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def amount @amount end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def created_at @created_at end |
#currency_code ⇒ Object (readonly)
Returns the value of attribute currency_code.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def currency_code @currency_code end |
#gateway_token ⇒ Object (readonly)
Returns the value of attribute gateway_token.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def gateway_token @gateway_token end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def @message end |
#on_test_gateway ⇒ Object (readonly)
Returns the value of attribute on_test_gateway.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def on_test_gateway @on_test_gateway end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def response @response end |
#succeeded ⇒ Object (readonly) Also known as: succeeded?
Returns the value of attribute succeeded.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def succeeded @succeeded end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def token @token end |
#transaction_type ⇒ Object (readonly)
Returns the value of attribute transaction_type.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def transaction_type @transaction_type end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
4 5 6 |
# File 'lib/spreedly_core/transactions.rb', line 4 def updated_at @updated_at end |
Class Method Details
.find(token) ⇒ Object
Lookup the transaction by its token. Returns the correct subclass
17 18 19 20 21 22 23 24 |
# File 'lib/spreedly_core/transactions.rb', line 17 def self.find(token) return nil if token.nil? verify_get("/transactions/#{token}.xml", :has_key => "transaction") do |response| attrs = response.parsed_response["transaction"] klass = @@transaction_type_to_class[attrs["transaction_type"]] || self klass.new(attrs) end end |
.handles(transaction_type) ⇒ Object
Breaks enacapsulation a bit, but allow subclasses to register the ‘transaction_type’ they handle.
11 12 13 14 |
# File 'lib/spreedly_core/transactions.rb', line 11 def self.handles(transaction_type) @@transaction_type_to_class ||= {} @@transaction_type_to_class[transaction_type] = self end |