Class: BMLConnect::Models::Transaction
- Inherits:
-
Object
- Object
- BMLConnect::Models::Transaction
- Includes:
- Crypt::Signature
- Defined in:
- lib/bml_connect/models/transaction.rb
Constant Summary collapse
- REQUIRED_FIELDS =
Set[:amount, :currency]
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#customerReference ⇒ Object
Returns the value of attribute customerReference.
-
#isPreauthorization ⇒ Object
Returns the value of attribute isPreauthorization.
-
#localId ⇒ Object
Returns the value of attribute localId.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#redirectUrl ⇒ Object
Returns the value of attribute redirectUrl.
Attributes included from Crypt::Signature
Instance Method Summary collapse
-
#initialize(fields) ⇒ Transaction
constructor
A new instance of Transaction.
- #to_hash ⇒ Object
Methods included from Crypt::Signature
Constructor Details
#initialize(fields) ⇒ Transaction
Returns a new instance of Transaction.
15 16 17 18 19 20 21 |
# File 'lib/bml_connect/models/transaction.rb', line 15 def initialize(fields) # check for required fields raise ArgumentError.new("Missing Required Fields: [#{REQUIRED_FIELDS.join(', ')}]") unless REQUIRED_FIELDS.subset?(fields.keys.to_set) #initialize transaction props fields.each { |k,v| public_send("#{k}=", v) } end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
13 14 15 |
# File 'lib/bml_connect/models/transaction.rb', line 13 def amount @amount end |
#currency ⇒ Object
Returns the value of attribute currency.
13 14 15 |
# File 'lib/bml_connect/models/transaction.rb', line 13 def currency @currency end |
#customerReference ⇒ Object
Returns the value of attribute customerReference.
13 14 15 |
# File 'lib/bml_connect/models/transaction.rb', line 13 def customerReference @customerReference end |
#isPreauthorization ⇒ Object
Returns the value of attribute isPreauthorization.
13 14 15 |
# File 'lib/bml_connect/models/transaction.rb', line 13 def @isPreauthorization end |
#localId ⇒ Object
Returns the value of attribute localId.
13 14 15 |
# File 'lib/bml_connect/models/transaction.rb', line 13 def localId @localId end |
#provider ⇒ Object
Returns the value of attribute provider.
13 14 15 |
# File 'lib/bml_connect/models/transaction.rb', line 13 def provider @provider end |
#redirectUrl ⇒ Object
Returns the value of attribute redirectUrl.
13 14 15 |
# File 'lib/bml_connect/models/transaction.rb', line 13 def redirectUrl @redirectUrl end |
Instance Method Details
#to_hash ⇒ Object
23 24 25 |
# File 'lib/bml_connect/models/transaction.rb', line 23 def to_hash() instance_variables.each_with_object({}) { |var, hash| hash[var.to_s.delete("@")] = instance_variable_get(var) } end |