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



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

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

#primary_keyObject



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

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

Instance Method Details

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



135
136
137
138
139
# File 'lib/smooth_operator/persistence.rb', line 135

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

#methods_vs_http_verbsObject



113
114
115
# File 'lib/smooth_operator/persistence.rb', line 113

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