Sha256: aa7217772dc79df432de6cf1d2eb18aeee05f9a5db171956f8e098005f6173d3

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 Bytes

Contents

# frozen_string_literal: true

require 'roda/endpoints'

class Roda
  module Endpoints
    # Generic HTTP endpoint abstraction.
    module Repository
      # @param [<ROM::Struct>] _kwargs
      def list(**_kwargs)
        root.to_a
      end

      # @return [Time]
      def last_modified
        root.order(Sequel.desc(:updated_at)).first.updated_at
      end

      # @param [Integer] id
      # @return [ROM::Struct]
      def fetch(id)
        root.fetch(id.to_i)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roda-endpoints-0.3.1 lib/roda/endpoints/repository.rb