Module: Apicasso
- Defined in:
- lib/apicasso.rb,
lib/apicasso/engine.rb,
lib/apicasso/version.rb,
app/models/apicasso/key.rb,
lib/apicasso/configuration.rb,
app/models/apicasso/ability.rb,
app/models/apicasso/request.rb,
lib/apicasso/active_record_extension.rb,
app/models/apicasso/application_record.rb,
app/controllers/apicasso/crud_controller.rb,
app/controllers/apicasso/batch_controller.rb,
app/controllers/apicasso/apidocs_controller.rb,
app/controllers/apicasso/application_controller.rb,
lib/generators/apicasso/install/install_generator.rb
Overview
A Module to rule them all…
Defined Under Namespace
Modules: ActiveRecordExtension, Generators Classes: Ability, ApidocsController, ApplicationController, ApplicationRecord, BatchController, Configuration, CrudController, Engine, Key, Request
Constant Summary collapse
- VERSION =
Current gem version
'0.7.2'.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#clear_for(permission, klass, clearance) ⇒ Object
Given a permission, a class and a hash of clearance conditions builds permissions for the current ability.
Class Method Details
.configuration ⇒ Object
17 18 19 |
# File 'lib/apicasso.rb', line 17 def self.configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
25 26 27 |
# File 'lib/apicasso.rb', line 25 def self.configure yield(configuration) end |
.reset ⇒ Object
21 22 23 |
# File 'lib/apicasso.rb', line 21 def self.reset @configuration = Configuration.new end |
Instance Method Details
#clear_for(permission, klass, clearance) ⇒ Object
Given a permission, a class and a hash of clearance conditions builds permissions for the current ability. Usage: To have a key reading all banners from a channel with id 999 you would have a scope:
> ‘{banner: {owner_id: [999]}}`
55 56 57 58 59 |
# File 'app/models/apicasso/ability.rb', line 55 def clear_for(, klass, clearance) clearance.to_h.each do |by_field, values| can , klass, by_field.to_sym => values end end |