class Scene7::Client
Constants
- CONFIG_FIELDS
- NAMESPACE
Public Class Methods
client()
click to toggle source
# File lib/scene7/client.rb, line 24 def client Savon::Client.new do wsdl.namespace = NAMESPACE wsdl.endpoint = configuration.endpoint end end
company_handle()
click to toggle source
# File lib/scene7/client.rb, line 47 def company_handle @@company_handle ||= Company.find_by_name(configuration.app_name).handle end
configure(options)
click to toggle source
# File lib/scene7/client.rb, line 11 def configure(options) params = CONFIG_FIELDS.map { |field| options[field] } @@configuration = Config.new(*params) self end
header()
click to toggle source
# File lib/scene7/client.rb, line 39 def header if configuration.blank? raise 'Call Scene7::Client.configure with your configuration first.' else configuration.header end end
input_for_action(action)
click to toggle source
# File lib/scene7/client.rb, line 51 def input_for_action(action) action.to_s.camelize(:lower) + 'Param' end
perform_request(action, body_params)
click to toggle source
# File lib/scene7/client.rb, line 31 def perform_request(action, body_params) client.request(:ns, action) do soap.input = [input_for_action(action), {:xmlns => "http://www.scene7.com/IpsApi/xsd/2010-01-31" }] soap.header = header soap.body = body_params end end
reset_configuration()
click to toggle source
# File lib/scene7/client.rb, line 19 def reset_configuration @@configuration = nil @@company_handle = nil end