Method: Exchange#response

Defined in:
lib/soaspec/exchange/exchange.rb

#responseRestClient::Response, Savon::Response

Returns response object from Api. Will make the request if not made and then cache it for later on

Examples:

For SOAP it will be a Savon response

response.body (body of response as Hash)
response.header (head of response as Hash)

For REST it will be a RestClient::Response


Returns:

  • (RestClient::Response, Savon::Response)

    Returns response object from Api. Will make the request if not made and then cache it for later on



98
99
100
101
102
103
104
105
106
# File 'lib/soaspec/exchange/exchange.rb', line 98

def response
  require 'forwardable'
  Soaspec.last_exchange = self
  @response ||= make_request
  @response.define_singleton_method(:exchange) { Soaspec.last_exchange } unless @response.respond_to?(:exchange)
  @response.extend Forwardable
  @response.delegate i[value_from_path values_from_path] => :exchange
  @response
end