lib/rom/http/relation.rb in rom-http-0.4.0 vs lib/rom/http/relation.rb in rom-http-0.5.0
- old
+ new
@@ -1,33 +1,44 @@
-require 'rom/plugins/relation/schema'
+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 :schema
+ 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
- dataset.response_transformer(
- Dataset::ResponseTransformers::Schemad.new(self.class.schema)
- ) if self.class.schema
+ 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