Module: SmoothOperator::Persistence::ClassMethods

Defined in:
lib/smooth_operator/persistence.rb

Constant Summary collapse

METHODS_VS_HTTP_VERBS =
{ reload: :get, create: :post, update: :put, destroy: :delete }

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#destroy_keyObject



128
129
130
# File 'lib/smooth_operator/persistence.rb', line 128

def destroy_key
  Helpers.get_instance_variable(self, :destroy_key, '_destroy')
end

#primary_keyObject



122
123
124
# File 'lib/smooth_operator/persistence.rb', line 122

def primary_key
  Helpers.get_instance_variable(self, :primary_key, 'id')
end

Instance Method Details

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



138
139
140
# File 'lib/smooth_operator/persistence.rb', line 138

def create(attributes = nil, relative_path = nil, data = {}, options = {})
  new(attributes).tap { |object| object.save(relative_path, data, options) }
end

#methods_vs_http_verbsObject



118
119
120
# File 'lib/smooth_operator/persistence.rb', line 118

def methods_vs_http_verbs
  Helpers.get_instance_variable(self, :methods_vs_http_verbs, METHODS_VS_HTTP_VERBS.dup)
end