Class: Muhimbi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/muhimbi/client.rb

Class Method Summary collapse

Class Method Details

.clientObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/muhimbi/client.rb', line 6

def self.client
  Savon.client do
    wsdl Muhimbi::Config.wsdl
    open_timeout Muhimbi::Config.timeout || 30
    read_timeout Muhimbi::Config.timeout || 30
    namespaces(
      "xmlns:ns" =>"http://services.muhimbi.com/2009/10/06",
      "xmlns:ns1"=>"http://types.muhimbi.com/2009/10/06",
      "xmlns:ns2"=>"http://types.muhimbi.com/2010/05/17"
    )
    namespace_identifier :ns
    #element_form_default :qualified
    env_namespace :soapenv
  end
end

.get_configurationObject



22
23
24
25
# File 'lib/muhimbi/client.rb', line 22

def self.get_configuration
  wsdl_res = Muhimbi::Client.client.call(:get_configuration )
  wsdl_res.to_hash[:get_configuration_response][:get_configuration_result]
end

.get_diagnostics(opts = []) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/muhimbi/client.rb', line 27

def self.get_diagnostics(opts=[])

  arr = []

  opts.each do |opt|
    arr << {"ns1:DiagnosticRequestItem"=> { "ns1:ConverterName" => opt }}
  end

  msg_options = {"ns:convertersToDiagnose"=> arr  }

  wsdl_res = Muhimbi::Client.client.call(:get_diagnostics, message: msg_options )
  wsdl_res.to_hash[:get_diagnostics_response][:get_diagnostics_result]
end