Class: Zm::Client::SoapBaseConnector

Inherits:
Object
  • Object
show all
Includes:
ZmLogger
Defined in:
lib/zm/client/connector/soap_base.rb

Direct Known Subclasses

SoapAccountConnector, SoapAdminConnector

Constant Summary collapse

BASESPACE =
'urn:zimbra'
HTTP_HEADERS =
{
  'Content-Type' => 'application/json; charset=utf-8'
}.freeze

Instance Attribute Summary collapse

Attributes included from ZmLogger

#logger, #logger_file_path, #logger_level

Instance Method Summary collapse

Methods included from ZmLogger

#init_logger

Constructor Details

#initialize(scheme, host, port, soap_path) ⇒ SoapBaseConnector

Returns a new instance of SoapBaseConnector.



22
23
24
25
26
27
# File 'lib/zm/client/connector/soap_base.rb', line 22

def initialize(scheme, host, port, soap_path)
  @verbose = false
  @uri = URI::HTTP.new(scheme, nil, host, port, nil, soap_path, nil, nil, nil)
  @context = SoapContext.new
  init_curl_client
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



20
21
22
# File 'lib/zm/client/connector/soap_base.rb', line 20

def context
  @context
end

Instance Method Details

#invoke(soap_element, error_handler = SoapError) ⇒ Object



34
35
36
# File 'lib/zm/client/connector/soap_base.rb', line 34

def invoke(soap_element, error_handler = SoapError)
  curl_request(envelope(soap_element), error_handler)[:Body]
end

#target_invoke(soap_element, target_id, error_handler = SoapError) ⇒ Object



38
39
40
41
42
43
# File 'lib/zm/client/connector/soap_base.rb', line 38

def target_invoke(soap_element, target_id, error_handler = SoapError)
  @context.target_server(target_id)
  resp = invoke(soap_element, error_handler)
  @context.target_server(nil)
  resp
end

#verbose!Object



29
30
31
32
# File 'lib/zm/client/connector/soap_base.rb', line 29

def verbose!
  @verbose = true
  @curl.verbose = @verbose
end