Class: GpWebpay::Ws::Echo

Inherits:
Service
  • Object
show all
Defined in:
lib/gp_webpay/ws/echo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEcho

Returns a new instance of Echo.



18
19
20
21
# File 'lib/gp_webpay/ws/echo.rb', line 18

def initialize
  super
  @config = GpWebpay.config.default
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



16
17
18
# File 'lib/gp_webpay/ws/echo.rb', line 16

def config
  @config
end

Instance Method Details

#callObject



23
24
25
26
27
28
# File 'lib/gp_webpay/ws/echo.rb', line 23

def call
  res = client.call(:echo)
  res.body && res.body[:echo_response].present?
rescue Savon::HTTPError, Savon::SOAPFault
  false
end

#clientObject



30
31
32
# File 'lib/gp_webpay/ws/echo.rb', line 30

def client
  @client ||= Savon.client(wsdl: config.wsdl_file, endpoint: config.ws_url, pretty_print_xml: true)
end