Class: Spec::Performance::Client::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/spec/performance/client/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Response

Returns a new instance of Response.



9
10
11
12
# File 'lib/spec/performance/client/response.rb', line 9

def initialize(attributes = {})
  @code = attributes[:code].to_i
  @body = attributes[:body]
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



7
8
9
# File 'lib/spec/performance/client/response.rb', line 7

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



7
8
9
# File 'lib/spec/performance/client/response.rb', line 7

def code
  @code
end

#cookiesObject (readonly)

Returns the value of attribute cookies.



7
8
9
# File 'lib/spec/performance/client/response.rb', line 7

def cookies
  @cookies
end

Instance Method Details

#redirect?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/spec/performance/client/response.rb', line 18

def redirect?
  @code == 301 || @code == 302
end

#success?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/spec/performance/client/response.rb', line 14

def success?
  @code == 200
end