Class: Karaden::Net::Response

Inherits:
ResponseInterface show all
Defined in:
lib/karaden/net/response.rb

Constant Summary collapse

ERRORS =
{
  Karaden::Exception::BadRequestException::STATUS_CODE => Karaden::Exception::BadRequestException,
  Karaden::Exception::UnauthorizedException::STATUS_CODE => Karaden::Exception::UnauthorizedException,
  Karaden::Exception::NotFoundException::STATUS_CODE => Karaden::Exception::NotFoundException,
  Karaden::Exception::ForbiddenException::STATUS_CODE => Karaden::Exception::ForbiddenException,
  Karaden::Exception::UnprocessableEntityException::STATUS_CODE => Karaden::Exception::UnprocessableEntityException,
  Karaden::Exception::TooManyRequestsException::STATUS_CODE => Karaden::Exception::TooManyRequestsException
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(response, request_options) ⇒ Response

Returns a new instance of Response.



13
14
15
16
17
18
# File 'lib/karaden/net/response.rb', line 13

def initialize(response, request_options)
  @error = nil
  @object = nil
  super()
  interpret(response, request_options)
end

Instance Method Details

#errorObject



20
21
22
# File 'lib/karaden/net/response.rb', line 20

def error()
  @error
end

#error?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/karaden/net/response.rb', line 36

def error?()
  !@error.nil?
end

#headersObject

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/karaden/net/response.rb', line 32

def headers()
  raise NotImplementedError
end

#objectObject



24
25
26
# File 'lib/karaden/net/response.rb', line 24

def object()
  @object
end

#status_codeObject

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/karaden/net/response.rb', line 28

def status_code()
  raise NotImplementedError
end