Class: RmsApiRuby::Chain::SoapClient

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

Constant Summary collapse

SUCCESS =
200
FAILURE =
500

Instance Method Summary collapse

Constructor Details

#initialize(wsdl, operation, message, return_method) ⇒ SoapClient

Returns a new instance of SoapClient.



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

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

Instance Method Details

#callObject



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

def call
  chain { execute_request }
  when_falsy { status_code == SUCCESS }.
    dam { handle_http_error }
  chain(:response) { parse_to_mash }
end