module Roda::Endpoints::Repository

Generic HTTP endpoint abstraction.

Public Instance Methods

find(id) click to toggle source

@param [Integer] id @return [ROM::Struct]

# File lib/roda/endpoints/repository.rb, line 21
def find(id)
  if id.to_i < 1
    raise ArgumentError,
          "#{self.class}#fetch: invalid id provided: #{id.inspect}"
  end
  root.fetch(id.to_i)
end
last_modified() click to toggle source

@return [Time]

# File lib/roda/endpoints/repository.rb, line 15
def last_modified
  root.order(Sequel.desc(:updated_at)).first&.updated_at
end
list(**_kwargs) click to toggle source

@param [<ROM::Struct>] _kwargs

# File lib/roda/endpoints/repository.rb, line 10
def list(**_kwargs)
  root.to_a
end