Class: Savon::Client
- Inherits:
-
Object
- Object
- Savon::Client
- Defined in:
- lib/savon/client.rb
Instance Attribute Summary collapse
-
#globals ⇒ Object
readonly
Returns the value of attribute globals.
Instance Method Summary collapse
- #call(operation_name, locals = {}, &block) ⇒ Object
-
#initialize(globals = {}, &block) ⇒ Client
constructor
A new instance of Client.
- #operation(operation_name) ⇒ Object
- #operations ⇒ Object
Constructor Details
#initialize(globals = {}, &block) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/savon/client.rb', line 9 def initialize(globals = {}, &block) @globals = GlobalOptions.new(globals) BlockInterface.new(@globals).evaluate(block) if block unless wsdl_or_endpoint_and_namespace_specified? raise_initialization_error! end @wsdl = Wasabi::Document.new @wsdl.document = @globals[:wsdl] if @globals.include? :wsdl @wsdl.endpoint = @globals[:endpoint] if @globals.include? :endpoint @wsdl.namespace = @globals[:namespace] if @globals.include? :namespace end |
Instance Attribute Details
#globals ⇒ Object (readonly)
Returns the value of attribute globals.
24 25 26 |
# File 'lib/savon/client.rb', line 24 def globals @globals end |
Instance Method Details
#call(operation_name, locals = {}, &block) ⇒ Object
35 36 37 38 39 |
# File 'lib/savon/client.rb', line 35 def call(operation_name, locals = {}, &block) response = operation(operation_name).call(locals, &block) persist_last_response(response) response end |
#operation(operation_name) ⇒ Object
31 32 33 |
# File 'lib/savon/client.rb', line 31 def operation(operation_name) Operation.create(operation_name, @wsdl, @globals) end |
#operations ⇒ Object
26 27 28 29 |
# File 'lib/savon/client.rb', line 26 def operations raise_missing_wsdl_error! unless @wsdl.document? @wsdl.soap_actions end |