Class: Savon::Client

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

Overview

Savon::Client

Heavy metal Ruby SOAP client library. Minimizes the overhead of working with SOAP services and XML.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, options = {}) ⇒ Client

Expects a SOAP endpoint String. Also accepts an optional Hash of options for specifying a proxy server and SSL client authentication.



11
12
13
14
# File 'lib/savon/client.rb', line 11

def initialize(endpoint, options = {})
  @request = Request.new endpoint, options
  @wsdl = WSDL.new @request
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)

Dispatches requests to SOAP actions matching a given method name.



31
32
33
34
35
36
37
# File 'lib/savon/client.rb', line 31

def method_missing(method, *args, &block) #:doc:
  soap_call = soap_call_from method.to_s
  super if @wsdl.enabled? && !@wsdl.respond_to?(soap_call)

  setup_objects operation_from(soap_call), &block
  Response.new @request.soap(@soap)
end

Instance Attribute Details

#requestObject (readonly)

Returns the Savon::Request.



20
21
22
# File 'lib/savon/client.rb', line 20

def request
  @request
end

#wsdlObject (readonly)

Returns the Savon::WSDL.



17
18
19
# File 'lib/savon/client.rb', line 17

def wsdl
  @wsdl
end

Instance Method Details

#respond_to?(method) ⇒ Boolean

Returns true for available methods and SOAP actions.

Returns:

  • (Boolean)


23
24
25
26
# File 'lib/savon/client.rb', line 23

def respond_to?(method)
  return true if @wsdl.respond_to? method
  super
end