Class: Wallaby::ModelOperator

Inherits:
Object
  • Object
show all
Defined in:
lib/interfaces/wallaby/model_operator.rb

Direct Known Subclasses

ActiveRecord::ModelOperator

Instance Method Summary collapse

Constructor Details

#initialize(model_class, model_decorator = nil) ⇒ ModelOperator

Returns a new instance of ModelOperator.



2
3
4
5
6
# File 'lib/interfaces/wallaby/model_operator.rb', line 2

def initialize(model_class, model_decorator = nil)
  fail ArgumentError, 'model class required' unless model_class
  @model_class      = model_class
  @model_decorator  = model_decorator || Wallaby::DecoratorFinder.find_model(@model_class)
end

Instance Method Details

#collection(params, ability) ⇒ Object



8
9
10
# File 'lib/interfaces/wallaby/model_operator.rb', line 8

def collection(params, ability)
  fail Wallaby::NotImplemented
end

#create(params, ability) ⇒ Object



20
21
22
# File 'lib/interfaces/wallaby/model_operator.rb', line 20

def create(params, ability)
  fail Wallaby::NotImplemented
end

#destroy(resource, params) ⇒ Object



28
29
30
# File 'lib/interfaces/wallaby/model_operator.rb', line 28

def destroy(resource, params)
  fail Wallaby::NotImplemented
end

#find(id, params) ⇒ Object



16
17
18
# File 'lib/interfaces/wallaby/model_operator.rb', line 16

def find(id, params)
  fail Wallaby::NotImplemented
end

#new(params) ⇒ Object



12
13
14
# File 'lib/interfaces/wallaby/model_operator.rb', line 12

def new(params)
  fail Wallaby::NotImplemented
end

#update(resource, params, ability) ⇒ Object



24
25
26
# File 'lib/interfaces/wallaby/model_operator.rb', line 24

def update(resource, params, ability)
  fail Wallaby::NotImplemented
end