class Gpdb::REST::Response

Attributes

_response[RW]
body[RW]
errors[RW]
status[RW]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Gpdb::Model::new
# File lib/gpdb/rest/response.rb, line 10
def initialize(*args)
  if args[0].is_a?(Hash)
    super
  elsif args[0].is_a?(::Gpdb::REST::Response)
    super(
      body:      args[0].body,
      status:    args[0].status,
      _response: args[0]._response
    )
  end

  self.errors = body[:errors] if body.is_a?(Hash)
end

Public Instance Methods

inspect() click to toggle source
# File lib/gpdb/rest/response.rb, line 28
def inspect
  to_s
end
to_s() click to toggle source
# File lib/gpdb/rest/response.rb, line 24
def to_s
  "<#{self.class} #{status} #{_response.reason_phrase} #{_response.headers['x-runtime']}s #{body.present? ? 'with body' : nil}>"
end