Module: SmoothOperator::Persistence::ClassMethods

Defined in:
lib/smooth_operator/persistence.rb

Instance Method Summary collapse

Instance Method Details

#create(attributes = nil, relative_path = nil, data = {}, options = {}) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/smooth_operator/persistence.rb', line 19

def create(attributes = nil, relative_path = nil, data = {}, options = {})
  if attributes.is_a?(Array)
    attributes.map { |array_entry| create(array_entry, relative_path, data, options) }
  else
    new(attributes).tap { |object| object.save(relative_path, data, options) }
  end
end

#methods_http_verbsObject



11
12
13
# File 'lib/smooth_operator/persistence.rb', line 11

def methods_http_verbs
  @methods_http_verbs ||= { create: :post, save: :put, destroy: :delete }
end