Class: Rocket::Response
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Rocket::Response
- Defined in:
- lib/rocket/response.rb
Instance Method Summary collapse
- #client_error? ⇒ Boolean
-
#initialize(resp, json) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(resp, json) ⇒ Response
Returns a new instance of Response.
3 4 5 6 |
# File 'lib/rocket/response.rb', line 3 def initialize(resp, json) super(RecursiveOpenStruct.new(json, :recurse_over_arrays => true)) @resp = resp end |
Instance Method Details
#client_error? ⇒ Boolean
12 13 14 |
# File 'lib/rocket/response.rb', line 12 def client_error? (400..499).include? @resp.code.to_i end |
#success? ⇒ Boolean
8 9 10 |
# File 'lib/rocket/response.rb', line 8 def success? (200..299).include? @resp.code.to_i end |