class IatsPayments::Client

Attributes

agent_code[RW]
password[RW]
test_mode[RW]

Public Class Methods

new(test_mode=false) click to toggle source
# File lib/iats_payments/client.rb, line 8
def initialize(test_mode=false)
  self.test_mode = test_mode
end
wsdl_endpoint_url() click to toggle source
# File lib/iats_payments/client.rb, line 5
def self.wsdl_endpoint_url
end

Public Instance Methods

call(operation_name, locals = {}, &block) click to toggle source
# File lib/iats_payments/client.rb, line 17
def call(operation_name, locals = {}, &block)
  locals[:message][:agent_code] = agent_code if locals[:message] && locals[:message][:agent_code].blank?
  locals[:message][:password] = password if locals[:message] && locals[:message][:password].blank?
  response = soap_client.call(operation_name, locals, &block)
  if response.body["#{operation_name}v1_response".to_sym].present?
    response.body["#{operation_name}v1_response".to_sym]["#{operation_name}v1_result".to_sym][:iatsresponse]
  else
    response.body["#{operation_name}_v1_response".to_sym]["#{operation_name}_v1_result".to_sym][:iatsresponse]
  end
end
methods() click to toggle source
# File lib/iats_payments/client.rb, line 28
def methods
  soap_client.operations
end

Private Instance Methods

soap_client() click to toggle source
# File lib/iats_payments/client.rb, line 38
def soap_client
  @soap_client ||= Savon.client(wsdl: self.class.wsdl_endpoint_url)
end