Class: Handsoap::Http::Response

Inherits:
Part
  • Object
show all
Defined in:
lib/handsoap/http/response.rb

Overview

Represents a HTTP Response.

Instance Attribute Summary collapse

Attributes inherited from Part

#body, #headers, #parts

Instance Method Summary collapse

Methods inherited from Part

#[], #charset, #inspect, #mime_type, #multipart?

Constructor Details

#initialize(status, headers, body, parts = nil) ⇒ Response

Returns a new instance of Response.



10
11
12
13
# File 'lib/handsoap/http/response.rb', line 10

def initialize(status, headers, body, parts = nil)
  @status = status.to_i
  super(headers, body, parts)
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



9
10
11
# File 'lib/handsoap/http/response.rb', line 9

def status
  @status
end

Instance Method Details

#primary_partObject



14
15
16
17
18
19
20
21
# File 'lib/handsoap/http/response.rb', line 14

def primary_part
  # Strictly speaking, the main part doesn't need to be first, but until proven otherwise, we'll just assume that.
  if multipart?
    parts.first
  else
    self
  end
end