class ShipCompliant::Client

Public Instance Methods

call(operation, locals = {}) click to toggle source

Adds the required security credentials and formats the message to match the ShipCompliant structure.

ShipCompliant.client.call(:some_operation, {
  'SomeKey' => 'SomeValue'
})
# File lib/ship_compliant/client.rb, line 35
def call(operation, locals = {})
  locals['Security'] = ShipCompliant.configuration.credentials

  response = savon_call(operation, message: {
    'Request' => locals
  })

  get_result_from_response(operation, response)
end
Also aliased as: savon_call
savon_call(operation, locals = {})

“Backup” original call from Savon::Client

Alias for: call

Private Instance Methods

get_result_from_response(operation, response) click to toggle source
# File lib/ship_compliant/client.rb, line 47
def get_result_from_response(operation, response)
  key = operation.to_s
  resp_key = (key + '_response').to_sym
  result_key = (key + '_result').to_sym
  response.to_hash.fetch(resp_key, {}).fetch(result_key, {})
end