Class: CircleCi::Response

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/circleci/response.rb

Overview

Response class is used to get access to raw HTTP request info

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resp) ⇒ Response

Initializing response object to be returned from API calls, used internally.



19
20
21
22
# File 'lib/circleci/response.rb', line 19

def initialize(resp)
  @resp = resp
  @body = parsed_body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



13
14
15
# File 'lib/circleci/response.rb', line 13

def body
  @body
end

Instance Method Details

#success?Boolean

Convenience method to determine if request was successfull or not

Returns:

  • (Boolean)


28
29
30
31
32
33
34
# File 'lib/circleci/response.rb', line 28

def success?
  case @resp.code.to_i
  when (200..299) then true
  else
    false
  end
end