Class: TresDelta::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/tres_delta/client.rb

Direct Known Subclasses

Gateway, Vault

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.wsdlObject

Returns the value of attribute wsdl.



6
7
8
# File 'lib/tres_delta/client.rb', line 6

def wsdl
  @wsdl
end

Class Method Details

.clientObject



27
28
29
30
# File 'lib/tres_delta/client.rb', line 27

def client
  # TODO: Make this configurable via file. Because right now this ain't secure. -_-
  @client ||= ::Savon.client(savon_options)
end

.client_credentialsObject



12
13
14
15
16
17
18
# File 'lib/tres_delta/client.rb', line 12

def client_credentials
  {
    "ClientCode" => config["client_code"],
    "Password" => config["password"],
    "UserName" => config["user_name"]
  }
end

.configObject



42
43
44
# File 'lib/tres_delta/client.rb', line 42

def config
  Config.config
end

.default_savon_optionsObject



36
37
38
# File 'lib/tres_delta/client.rb', line 36

def default_savon_options
  { wsdl: wsdl, ssl_verify_mode: :none, log: false, open_timeout: 120, read_timeout: 120 }
end

.location_identifierObject



20
21
22
23
24
25
# File 'lib/tres_delta/client.rb', line 20

def location_identifier
  {
    'LocationCode' => config["location_code"],
    'MerchantCode' => config["merchant_code"]
  }
end

.request(action, soap_body) ⇒ Object



8
9
10
# File 'lib/tres_delta/client.rb', line 8

def request(action, soap_body)
  Response.create_from_action(action, client.call(action, message: soap_body))
end

.savon_optionsObject



32
33
34
# File 'lib/tres_delta/client.rb', line 32

def savon_options
  default_savon_options.merge(savon_overrides || {})
end

.savon_overridesObject



40
# File 'lib/tres_delta/client.rb', line 40

def savon_overrides; end