Class: RmsApiRuby::Chain::SoapClient

Inherits:
RmsApiRuby::Chain show all
Defined in:
lib/rms_api_ruby/chain/soap_client.rb

Constant Summary collapse

SUCCESS =
200

Instance Method Summary collapse

Constructor Details

#initialize(wsdl, operation, message) ⇒ SoapClient

Returns a new instance of SoapClient.



9
10
11
12
13
# File 'lib/rms_api_ruby/chain/soap_client.rb', line 9

def initialize(wsdl, operation, message)
  @client    = Savon.client(wsdl: wsdl)
  @operation = operation
  @message   = message
end

Instance Method Details

#callObject



15
16
17
18
19
20
# File 'lib/rms_api_ruby/chain/soap_client.rb', line 15

def call
  chain { @response = @client.call(@operation, message: @message) }
  when_falsy { status_code == SUCCESS }.
    dam { handle_http_error }
  chain(:response) { parse_to_mash }
end