Class: RmsApiRuby::Orders::Client

Inherits:
Object
  • Object
show all
Includes:
Waterfall
Defined in:
lib/rms_api_ruby/orders.rb

Constant Summary collapse

AUTH_ERRORCODE =
/^E02-00/

Instance Method Summary collapse

Constructor Details

#initialize(operation, args) ⇒ Client

Returns a new instance of Client.



52
53
54
55
# File 'lib/rms_api_ruby/orders.rb', line 52

def initialize(operation, args)
  @operation = operation
  @args = args
end

Instance Method Details

#callObject

rubocop:disable Metrics/AbcSize



57
58
59
60
61
62
63
64
65
# File 'lib/rms_api_ruby/orders.rb', line 57

def call # rubocop:disable Metrics/AbcSize
  chain { RmsApiRuby::Chain::Logger.new(:info, start_message) }
  chain(response: :response) do
    RmsApiRuby::Chain::SoapClient.new(wsdl, @operation, message)
  end
  when_truthy { |outflow| outflow.response.error_code =~ AUTH_ERRORCODE }.
    dam { |outflow| auth_error(outflow.response) }
  chain { RmsApiRuby::Chain::Logger.new(:info, complete_message) }
end