Class: Hatetepe::Response
Instance Attribute Summary collapse
-
#request ⇒ Object
Returns the value of attribute request.
-
#status ⇒ Object
Returns the value of attribute status.
Attributes inherited from Message
#body, #connection, #headers, #http_version
Instance Method Summary collapse
- #[](idx) ⇒ Object
- #failure? ⇒ Boolean
-
#initialize(status, headers = {}, body = nil, http_version = "1.1") ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
- #to_a ⇒ Object
Constructor Details
#initialize(status, headers = {}, body = nil, http_version = "1.1") ⇒ Response
Returns a new instance of Response.
7 8 9 10 |
# File 'lib/hatetepe/response.rb', line 7 def initialize(status, headers = {}, body = nil, http_version = "1.1") @status = status super headers, body, http_version end |
Instance Attribute Details
#request ⇒ Object
Returns the value of attribute request.
5 6 7 |
# File 'lib/hatetepe/response.rb', line 5 def request @request end |
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'lib/hatetepe/response.rb', line 5 def status @status end |
Instance Method Details
#[](idx) ⇒ Object
24 25 26 |
# File 'lib/hatetepe/response.rb', line 24 def [](idx) to_a[idx] end |
#failure? ⇒ Boolean
16 17 18 |
# File 'lib/hatetepe/response.rb', line 16 def failure? status.between? 400, 599 end |
#success? ⇒ Boolean
12 13 14 |
# File 'lib/hatetepe/response.rb', line 12 def success? status.between? 100, 399 end |
#to_a ⇒ Object
20 21 22 |
# File 'lib/hatetepe/response.rb', line 20 def to_a [status, headers, body] end |