Class: Rocket::Response

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/rocket/response.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


12
13
14
# File 'lib/rocket/response.rb', line 12

def client_error?
  (400..499).include? @resp.code.to_i
end

#success?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/rocket/response.rb', line 8

def success?
  (200..299).include? @resp.code.to_i
end