Class: Laundry::PaymentsGateway::MerchantAuthenticatableDriver

Inherits:
Object
  • Object
show all
Extended by:
SOAPModel
Defined in:
lib/laundry/payments_gateway/drivers/merchant_authenticatable_driver.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SOAPModel

actions, extended, setup

Constructor Details

#initialize(merchant) ⇒ MerchantAuthenticatableDriver

Returns a new instance of MerchantAuthenticatableDriver.



9
10
11
12
13
# File 'lib/laundry/payments_gateway/drivers/merchant_authenticatable_driver.rb', line 9

def initialize(merchant)
  # Save the merchant.
  self.merchant = merchant
  setup_client!
end

Instance Attribute Details

#merchantObject

Returns the value of attribute merchant.



7
8
9
# File 'lib/laundry/payments_gateway/drivers/merchant_authenticatable_driver.rb', line 7

def merchant
  @merchant
end

Class Method Details

.prettifiable_fieldsObject



24
25
26
# File 'lib/laundry/payments_gateway/drivers/merchant_authenticatable_driver.rb', line 24

def self.prettifiable_fields
  []
end

.uglify_hash(hash) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/laundry/payments_gateway/drivers/merchant_authenticatable_driver.rb', line 28

def self.uglify_hash(hash)
  translation = {}
  self.prettifiable_fields.each do |f|
    translation[f.snakecase.to_sym] = f
  end
  ugly_hash = {}
  hash.each do |k, v|
    if translation.has_key?(k)
      ugly_hash[translation[k]] = v
    else
      ugly_hash[k] = v
    end
  end
  ugly_hash
end

Instance Method Details

#default_bodyObject



19
20
21
22
# File 'lib/laundry/payments_gateway/drivers/merchant_authenticatable_driver.rb', line 19

def default_body
  # Log in via the merchant's login credentials.
  self.merchant..merge("MerchantID" => self.merchant.id)
end

#setup_client!Object



15
16
17
# File 'lib/laundry/payments_gateway/drivers/merchant_authenticatable_driver.rb', line 15

def setup_client!
  self.class.client.wsdl.document = self.class.wsdl if self.class.respond_to?(:wsdl)
end