Class: Savon::Client
Overview
Savon::Client
Heavy metal Ruby SOAP client library. Minimizes the overhead of working with SOAP services and XML.
Constant Summary collapse
- @@wsdl =
Global setting of whether to use Savon::WSDL.
true
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the Savon::Request.
-
#wsdl ⇒ Object
Accessor for Savon::WSDL.
Class Method Summary collapse
-
.wsdl=(wsdl) ⇒ Object
Sets the global setting of whether to use Savon::WSDL.
-
.wsdl? ⇒ Boolean
Returns the global setting of whether to use Savon::WSDL.
Instance Method Summary collapse
-
#initialize(endpoint, options = {}) ⇒ Client
constructor
Expects a SOAP
endpoint
String. -
#respond_to?(method) ⇒ Boolean
Returns
true
for available methods and SOAP actions. -
#wsdl? ⇒ Boolean
Returns whether to use Savon::WSDL.
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.
24 25 26 27 |
# File 'lib/savon/client.rb', line 24 def initialize(endpoint, = {}) @request = Request.new endpoint, @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.
49 50 51 52 53 54 |
# File 'lib/savon/client.rb', line 49 def method_missing(method, *args, &block) #:doc: super if wsdl? && !@wsdl.respond_to?(method) setup operation_from(method), &block dispatch method end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the Savon::Request.
33 34 35 |
# File 'lib/savon/client.rb', line 33 def request @request end |
#wsdl ⇒ Object
Accessor for Savon::WSDL.
30 31 32 |
# File 'lib/savon/client.rb', line 30 def wsdl @wsdl end |
Class Method Details
.wsdl=(wsdl) ⇒ Object
Sets the global setting of whether to use Savon::WSDL.
13 14 15 |
# File 'lib/savon/client.rb', line 13 def self.wsdl=(wsdl) @@wsdl = wsdl end |
.wsdl? ⇒ Boolean
Returns the global setting of whether to use Savon::WSDL.
18 19 20 |
# File 'lib/savon/client.rb', line 18 def self.wsdl? @@wsdl end |
Instance Method Details
#respond_to?(method) ⇒ Boolean
Returns true
for available methods and SOAP actions.
41 42 43 44 |
# File 'lib/savon/client.rb', line 41 def respond_to?(method) return true if @wsdl.respond_to? method super end |
#wsdl? ⇒ Boolean
Returns whether to use Savon::WSDL.
36 37 38 |
# File 'lib/savon/client.rb', line 36 def wsdl? self.class.wsdl? && @wsdl end |