class TheCaptain::Response::CaptainVessel

Attributes

data[R]
raw_response[R]
status[R]

Public Class Methods

new(captain_response) click to toggle source
# File lib/the_captain/response/captain_vessel.rb, line 11
def initialize(captain_response)
  raise Error::ClientInvalidResourceError unless captain_response.is_a?(HTTP::Response)
  @raw_response = captain_response
  @status       = @raw_response.status
  @data         = Oj.sc_parse(CaptainObjectParser.new, @raw_response.to_s).freeze
  freeze
end

Public Instance Methods

inspect() click to toggle source
# File lib/the_captain/response/captain_vessel.rb, line 27
def inspect
  "#<#{self.class}:0x#{object_id.to_s(16)}> @status=#{@status.inspect} @data=#{@data.inspect}"
end
Also aliased as: to_s
invalid?() click to toggle source
# File lib/the_captain/response/captain_vessel.rb, line 23
def invalid?
  !valid?
end
to_s()
Alias for: inspect
valid?() click to toggle source
# File lib/the_captain/response/captain_vessel.rb, line 19
def valid?
  @status.success?
end