Class: WSDL::HTTPResponse

Inherits:
Data
  • Object
show all
Defined in:
lib/wsdl/http_response.rb

Overview

Represents an HTTP response returned by an HTTP adapter.

All HTTP adapter +get+ and +post+ methods must return an instance of this class (or a compatible object responding to +status+, +headers+, and +body+).

Examples:

Creating a response

WSDL::HTTPResponse.new(status: 200, headers: {}, body: '<xml/>')

From a custom adapter

class MyAdapter
  def post(url, headers, body)
    resp = Faraday.post(url, body, headers)
    WSDL::HTTPResponse.new(status: resp.status, headers: resp.headers, body: resp.body)
  end
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, headers: {}, body: '') ⇒ HTTPResponse

Creates a new HTTPResponse.



27
28
29
# File 'lib/wsdl/http_response.rb', line 27

def initialize(status:, headers: {}, body: '')
  super
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body



21
22
23
# File 'lib/wsdl/http_response.rb', line 21

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers



21
22
23
# File 'lib/wsdl/http_response.rb', line 21

def headers
  @headers
end

#statusObject (readonly)

Returns the value of attribute status



21
22
23
# File 'lib/wsdl/http_response.rb', line 21

def status
  @status
end