Class: EmmyExtends::Savon::Operation
- Inherits:
-
Object
- Object
- EmmyExtends::Savon::Operation
- Defined in:
- lib/emmy_extends/savon/operation.rb
Instance Attribute Summary collapse
-
#globals ⇒ Object
readonly
Returns the value of attribute globals.
-
#httpi ⇒ Object
readonly
Returns the value of attribute httpi.
-
#locals ⇒ Object
readonly
Returns the value of attribute locals.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(httpi, globals, locals) ⇒ Operation
constructor
A new instance of Operation.
- #setup ⇒ Object
- #sync ⇒ Object
Constructor Details
#initialize(httpi, globals, locals) ⇒ Operation
Returns a new instance of Operation.
13 14 15 16 17 18 19 |
# File 'lib/emmy_extends/savon/operation.rb', line 13 def initialize(httpi, globals, locals) @httpi = httpi @request = httpi.request @globals = globals @locals = locals setup end |
Instance Attribute Details
#globals ⇒ Object (readonly)
Returns the value of attribute globals.
8 9 10 |
# File 'lib/emmy_extends/savon/operation.rb', line 8 def globals @globals end |
#httpi ⇒ Object (readonly)
Returns the value of attribute httpi.
7 8 9 |
# File 'lib/emmy_extends/savon/operation.rb', line 7 def httpi @httpi end |
#locals ⇒ Object (readonly)
Returns the value of attribute locals.
9 10 11 |
# File 'lib/emmy_extends/savon/operation.rb', line 9 def locals @locals end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
5 6 7 |
# File 'lib/emmy_extends/savon/operation.rb', line 5 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/emmy_extends/savon/operation.rb', line 6 def response @response end |
Instance Method Details
#connect ⇒ Object
21 22 23 |
# File 'lib/emmy_extends/savon/operation.rb', line 21 def connect @httpi.connect end |
#setup ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/emmy_extends/savon/operation.rb', line 40 def setup @httpi.on :success do |response, httpi, conn| @response = ::Savon::Response.new(response, globals, locals) unless @response.soap_fault unless @response.http_error success!(@response, self, conn) else error!("HTTP error (#{@response.http.code})", self, conn) end else error!("SOAP error (#{@response.soap_fault.to_s})", self, conn) end end @httpi.on :error do |error, httpi, conn| @connection = conn error!(error, self, conn) end end |
#sync ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/emmy_extends/savon/operation.rb', line 25 def sync Fiber.sync do |fiber| connect on :success do |response, savon, conn| fiber.resume response end on :error do |error, savon, conn| # FIXME: TimeoutError separate fiber.leave EmmyHttp::ConnectionError, error.to_s end end end |