Class: JsonapiCompliable::Adapters::Null
- Defined in:
- lib/jsonapi_compliable/adapters/null.rb
Overview
The Null adapter is a 'pass-through' adapter. It won't modify the scope. Useful when your customization does not support all possible configuration (e.g. the service you hit does not support sorting)
Instance Method Summary collapse
-
#associate(parent, child, association_name, association_type) ⇒ Object
Assign these two objects together.
-
#average(scope, attr) ⇒ Float
The average of the scope.
-
#count(scope, attr) ⇒ Numeric
The count of the scope.
-
#filter(scope, attribute, value) ⇒ Object
The scope.
-
#maximum(scope, attr) ⇒ Numeric
The sum of the scope.
-
#minimum(scope, attr) ⇒ Numeric
The maximum value of the scope.
-
#order(scope, attribute, direction) ⇒ Object
The scope.
-
#paginate(scope, current_page, per_page) ⇒ Object
The scope.
-
#resolve(scope) ⇒ Object
Resolve the scope.
-
#sum(scope, attr) ⇒ Numeric
The sum of the scope.
-
#transaction(model_class) ⇒ Object
Since this is a null adapter, just yield.
Methods inherited from Abstract
#create, #destroy, #disassociate, #sideloading_module, #update
Instance Method Details
#associate(parent, child, association_name, association_type) ⇒ Object
Assign these two objects together.
association_name
and association_type
come from
your sideload configuration:
allow_sideload :the_name, type: the_type do
# ... code.
end
61 62 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 61 def associate(parent, child, association_name, association_type) end |
#average(scope, attr) ⇒ Float
Returns the average of the scope
28 29 30 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 28 def average(scope, attr) scope end |
#count(scope, attr) ⇒ Numeric
Returns the count of the scope
23 24 25 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 23 def count(scope, attr) scope end |
#filter(scope, attribute, value) ⇒ Object
Returns the scope
8 9 10 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 8 def filter(scope, attribute, value) scope end |
#maximum(scope, attr) ⇒ Numeric
Returns the sum of the scope
38 39 40 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 38 def maximum(scope, attr) scope end |
#minimum(scope, attr) ⇒ Numeric
Returns the maximum value of the scope
43 44 45 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 43 def minimum(scope, attr) scope end |
#order(scope, attribute, direction) ⇒ Object
Returns the scope
13 14 15 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 13 def order(scope, attribute, direction) scope end |
#paginate(scope, current_page, per_page) ⇒ Object
Returns the scope
18 19 20 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 18 def paginate(scope, current_page, per_page) scope end |
#resolve(scope) ⇒ Object
Resolve the scope. This is where you'd actually fire SQL, actually make an HTTP call, etc.
56 57 58 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 56 def resolve(scope) scope end |
#sum(scope, attr) ⇒ Numeric
Returns the sum of the scope
33 34 35 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 33 def sum(scope, attr) scope end |
#transaction(model_class) ⇒ Object
Since this is a null adapter, just yield
51 52 53 |
# File 'lib/jsonapi_compliable/adapters/null.rb', line 51 def transaction(model_class) yield end |