Class: ROM::HTTP::Relation

Inherits:
Relation
  • Object
show all
Extended by:
Dry::Core::Cache, Initializer
Includes:
Enumerable
Defined in:
lib/rom/http/relation.rb

Overview

HTTP-specific relation extensions

Instance Method Summary collapse

Instance Method Details

#deleteObject

See Also:



68
69
70
# File 'lib/rom/http/relation.rb', line 68

def delete
  dataset.delete
end

#exclude(*names) ⇒ Object



36
37
38
# File 'lib/rom/http/relation.rb', line 36

def exclude(*names)
  with(schema: schema.exclude(*names.flatten))
end

#insert(*args) ⇒ Object Also known as: <<

See Also:



57
58
59
# File 'lib/rom/http/relation.rb', line 57

def insert(*args)
  with_transformation { dataset.insert(*args) }
end

#prefix(prefix) ⇒ Object



44
45
46
# File 'lib/rom/http/relation.rb', line 44

def prefix(prefix)
  with(schema: schema.prefix(prefix))
end

#primary_keyObject



22
23
24
25
26
27
28
29
30
# File 'lib/rom/http/relation.rb', line 22

def primary_key
  attribute = schema.find(&:primary_key?)

  if attribute
    attribute.alias || attribute.name
  else
    :id
  end
end

#project(*names) ⇒ Object



32
33
34
# File 'lib/rom/http/relation.rb', line 32

def project(*names)
  with(schema: schema.project(*names.flatten))
end

#rename(mapping) ⇒ Object



40
41
42
# File 'lib/rom/http/relation.rb', line 40

def rename(mapping)
  with(schema: schema.rename(mapping))
end

#to_aObject



52
53
54
# File 'lib/rom/http/relation.rb', line 52

def to_a
  with_transformation { super }
end

#update(*args) ⇒ Object

See Also:



63
64
65
# File 'lib/rom/http/relation.rb', line 63

def update(*args)
  with_transformation { dataset.update(*args) }
end

#wrap(prefix = dataset.name) ⇒ Object



48
49
50
# File 'lib/rom/http/relation.rb', line 48

def wrap(prefix = dataset.name)
  with(schema: schema.wrap(prefix))
end