Module: Libis::Services::SoapClient

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



13
14
15
# File 'lib/libis/services/soap_client.rb', line 13

def client
  @client
end

Instance Method Details

#configure(wsdl, options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/libis/services/soap_client.rb', line 15

def configure(wsdl, options = {})
  opts = {
      wsdl: wsdl,
      raise_errors: false,
      soap_version: 1,
      filters: [:password],
      pretty_print_xml: true,
  }.merge options

  @client = Savon.client(opts) { yield if block_given? }
end

#operationsObject



27
28
29
# File 'lib/libis/services/soap_client.rb', line 27

def operations
  @client.operations
end

#request(method, message = {}, call_options = {}, parse_options = {}) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/libis/services/soap_client.rb', line 31

def request(method, message = {}, call_options = {}, parse_options = {})
  response = client.call(method, message: message) do |locals|
    call_options.each do |key, value|
      locals.send(key, value)
    end
  end

  return yield(response) if block_given?
  parse_result(response, parse_options)
end