Class: Mizuno::ClientResponse
- Inherits:
-
Object
- Object
- Mizuno::ClientResponse
- Includes:
- Rack::Response::Helpers
- Defined in:
- lib/mizuno/client_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
-
#status ⇒ Object
Returns the value of attribute status.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(url) ⇒ ClientResponse
constructor
A new instance of ClientResponse.
- #ssl? ⇒ Boolean
- #success? ⇒ Boolean
- #timeout? ⇒ Boolean
Constructor Details
#initialize(url) ⇒ ClientResponse
Returns a new instance of ClientResponse.
9 10 11 12 |
# File 'lib/mizuno/client_response.rb', line 9 def initialize(url) @url = url @headers = Rack::Utils::HeaderHash.new end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/mizuno/client_response.rb', line 7 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
7 8 9 |
# File 'lib/mizuno/client_response.rb', line 7 def headers @headers end |
#ssl ⇒ Object
Returns the value of attribute ssl.
7 8 9 |
# File 'lib/mizuno/client_response.rb', line 7 def ssl @ssl end |
#status ⇒ Object
Returns the value of attribute status.
7 8 9 |
# File 'lib/mizuno/client_response.rb', line 7 def status @status end |
#timeout ⇒ Object
Returns the value of attribute timeout.
7 8 9 |
# File 'lib/mizuno/client_response.rb', line 7 def timeout @timeout end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/mizuno/client_response.rb', line 7 def url @url end |
Instance Method Details
#[](key) ⇒ Object
14 15 16 |
# File 'lib/mizuno/client_response.rb', line 14 def [](key) @headers[key] end |
#[]=(key, value) ⇒ Object
18 19 20 |
# File 'lib/mizuno/client_response.rb', line 18 def []=(key, value) @headers[key] = value end |
#ssl? ⇒ Boolean
22 23 24 |
# File 'lib/mizuno/client_response.rb', line 22 def ssl? @ssl == true end |
#success? ⇒ Boolean
30 31 32 |
# File 'lib/mizuno/client_response.rb', line 30 def success? successful? or redirect? end |
#timeout? ⇒ Boolean
26 27 28 |
# File 'lib/mizuno/client_response.rb', line 26 def timeout? (@timeout == true) or (@status == 408) end |