Class: Cardgate::Transaction
- Inherits:
-
Object
- Object
- Cardgate::Transaction
- Defined in:
- lib/cardgate/transaction.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#company_name ⇒ Object
readonly
Returns the value of attribute company_name.
-
#country_code ⇒ Object
readonly
Returns the value of attribute country_code.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#payment_method ⇒ Object
readonly
Returns the value of attribute payment_method.
-
#phone_number ⇒ Object
readonly
Returns the value of attribute phone_number.
-
#postal_code ⇒ Object
readonly
Returns the value of attribute postal_code.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
-
#site_id ⇒ Object
readonly
Returns the value of attribute site_id.
-
#site_name ⇒ Object
readonly
Returns the value of attribute site_name.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Transaction
constructor
A new instance of Transaction.
- #successful? ⇒ Boolean
Constructor Details
#initialize(attributes = {}) ⇒ Transaction
Returns a new instance of Transaction.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/cardgate/transaction.rb', line 8 def initialize(attributes = {}) attributes.map do |attribute, value| if attribute == 'customer' && !value.nil? attributes['customer'].map do |attribute, value| set_variable_from_attribute(attribute, value) end else set_variable_from_attribute(attribute, value) end end end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def address @address end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def amount @amount end |
#city ⇒ Object (readonly)
Returns the value of attribute city.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def city @city end |
#company_name ⇒ Object (readonly)
Returns the value of attribute company_name.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def company_name @company_name end |
#country_code ⇒ Object (readonly)
Returns the value of attribute country_code.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def country_code @country_code end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def currency @currency end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def email @email end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def first_name @first_name end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def last_name @last_name end |
#payment_method ⇒ Object (readonly)
Returns the value of attribute payment_method.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def payment_method @payment_method end |
#phone_number ⇒ Object (readonly)
Returns the value of attribute phone_number.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def phone_number @phone_number end |
#postal_code ⇒ Object (readonly)
Returns the value of attribute postal_code.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def postal_code @postal_code end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def ref @ref end |
#site_id ⇒ Object (readonly)
Returns the value of attribute site_id.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def site_id @site_id end |
#site_name ⇒ Object (readonly)
Returns the value of attribute site_name.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def site_name @site_name end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def state @state end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def status @status end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
5 6 7 |
# File 'lib/cardgate/transaction.rb', line 5 def transaction_id @transaction_id end |
Instance Method Details
#successful? ⇒ Boolean
20 21 22 |
# File 'lib/cardgate/transaction.rb', line 20 def successful? [200, 210].include?(self.status.to_i) end |