Class: Spec::Client::Http::Response
- Inherits:
-
Object
- Object
- Spec::Client::Http::Response
- Defined in:
- lib/spec/client/http/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#code ⇒ Object
Returns the value of attribute code.
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
- #cookies ⇒ Object
-
#initialize(url) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(url) ⇒ Response
Returns a new instance of Response.
11 12 13 14 15 16 |
# File 'lib/spec/client/http/response.rb', line 11 def initialize(url) @code = 0 @headers = {} @body = "" @url = url end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
9 10 11 |
# File 'lib/spec/client/http/response.rb', line 9 def body @body end |
#code ⇒ Object
Returns the value of attribute code.
9 10 11 |
# File 'lib/spec/client/http/response.rb', line 9 def code @code end |
#headers ⇒ Object
Returns the value of attribute headers.
9 10 11 |
# File 'lib/spec/client/http/response.rb', line 9 def headers @headers end |
Instance Method Details
#cookies ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/spec/client/http/response.rb', line 18 def # TODO: can probably use ruby tricks to bind these together rather than using a temporary array... = [] (headers["Set-Cookie"]||[]).map do || uri = URI::parse(@url) Mechanize::Cookie::parse(uri,) do |c| .push(c) end end end |