Class: CircleCi::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http, _code, _path) ⇒ Response

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



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

def initialize(http, _code, _path) # @private
  @success, @body, @errors = http.success, http.response, http.errors
  @code, @path, @params    = _code, _path
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



5
6
7
# File 'lib/circleci/response.rb', line 5

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/circleci/response.rb', line 5

def code
  @code
end

#errorsObject (readonly)

Returns the value of attribute errors.



5
6
7
# File 'lib/circleci/response.rb', line 5

def errors
  @errors
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/circleci/response.rb', line 5

def path
  @path
end

#successObject (readonly)

Returns the value of attribute success.



5
6
7
# File 'lib/circleci/response.rb', line 5

def success
  @success
end

Instance Method Details

#parsed_body@body

Deprecated - To remove hashie dependency Parses JSON body of request

Returns:



31
32
33
# File 'lib/circleci/response.rb', line 31

def parsed_body
  @body
end

#success?Boolean

Convenience method to determine if request was successfull or not

Returns:

  • (Boolean)


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

def success?
  !!@success
end