class Trav3::Response

The results from queries return either `Success` or `RequestError` which both repsond with Hash like query methods for the JSON data or the Net::HTTP resonse object methods.

The `Response` classes `Success` and `RequestError` forward method calls for all of the instance methods of a `ResponseCollection` to the collection. And many of the methods calls for the Net::HTTP response are also available on this class and those method calls are forwarded to the response.

Attributes

travis[R]

Public Class Methods

new(travis, response) click to toggle source
# File lib/trav3/response/response.rb, line 115
def initialize(travis, response)
  @travis = travis
  @response = response
  @collection = begin
                  result = JSON.parse(response&.body || '{}')
                  ResponseCollection.new(travis, result)
                rescue JSON::ParserError
                  response.error!
                end
end

Public Instance Methods

failure?() click to toggle source

@abstract

# File lib/trav3/response/response.rb, line 137
def failure?
  raise Unimplemented
end
inspect() click to toggle source

Class name and keys of response

# File lib/trav3/response/response.rb, line 127
def inspect
  "<#{self.class} Response: keys = #{keys}>"
end
success?() click to toggle source

@abstract

# File lib/trav3/response/response.rb, line 132
def success?
  raise Unimplemented
end