class BooticClient::ResponseHandlers::Set

Public Class Methods

new(handlers = []) click to toggle source
# File lib/bootic_client/response_handlers.rb, line 8
def initialize(handlers = [])
  @handlers = handlers
end

Public Instance Methods

append(handler) click to toggle source
# File lib/bootic_client/response_handlers.rb, line 23
def append(handler)
  @handlers << handler
end
prepend(handler) click to toggle source
# File lib/bootic_client/response_handlers.rb, line 27
def prepend(handler)
  @handlers.unshift handler
end
resolve(response, client) click to toggle source
# File lib/bootic_client/response_handlers.rb, line 12
def resolve(response, client)
  custom = @handlers.find do |handler|
    obj = handler.call(response, client)
    break obj if obj
    nil
  end
  # if no handler found,
  # return raw Faraday response
  custom || response
end
to_a() click to toggle source
# File lib/bootic_client/response_handlers.rb, line 31
def to_a
  @handlers
end