Sha256: e03e48d738e33690bd574991a06ec44fd6bbe82a2451a3300d1eb5230693a19d

Contents?: true

Size: 942 Bytes

Versions: 1

Compression:

Stored size: 942 Bytes

Contents

require 'rom/plugins/relation/view'
require 'rom/plugins/relation/key_inference'

module ROM
  module HTTP
    # HTTP-specific relation extensions
    #
    class Relation < ROM::Relation
      include Enumerable

      adapter :http

      use :view
      use :key_inference

      forward :with_request_method, :with_path, :append_path, :with_options,
              :with_params, :clear_params, :project

      # @api private
      def initialize(*)
        super
        if schema?
          dataset.response_transformer(
            Dataset::ResponseTransformers::Schemad.new(schema.to_h)
          )
        end
      end

      # @see Dataset#insert
      def insert(*args)
        dataset.insert(*args)
      end
      alias_method :<<, :insert

      # @see Dataset#update
      def update(*args)
        dataset.update(*args)
      end

      # @see Dataset#delete
      def delete
        dataset.delete
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-http-0.5.0 lib/rom/http/relation.rb