Module: RestArea
- Defined in:
- lib/rest_area/configuration.rb,
lib/rest_area.rb,
lib/rest_area/engine.rb,
lib/rest_area/version.rb,
lib/rest_area/resource.rb,
app/helpers/rest_area/application_helper.rb,
app/controllers/rest_area/rest_controller.rb,
app/controllers/rest_area/message_controller.rb,
app/controllers/rest_area/application_controller.rb
Overview
Used for configuring rest_area
Example:
RestArea.configure do
resources :cereal, :thing do
action :index, :show, :create, :update, :delete
messages :say_hello, :say_goodbye
headers ({
'Cache-Control' => 'public, max-age=86400'
'Expires' => ->{Date.today + 1}
})
end
resource :supermarket do
read_only!
key :name
message :ring_it_up
end
end
Defined Under Namespace
Modules: ApplicationHelper Classes: ApplicationController, Configuration, Engine, MessageController, Resource, RestController
Constant Summary collapse
- VERSION =
"1.4.3"
Class Method Summary collapse
Class Method Details
.class_whitelist=(array) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rest_area.rb', line 23 def class_whitelist=(array) resources.clear array.each do |klass| self.config.resource klass.name.underscore.to_sym end end |
.config ⇒ Object
11 12 13 |
# File 'lib/rest_area.rb', line 11 def config @config ||= RestArea::Configuration.new end |
.configure(&block) ⇒ Object
15 16 17 |
# File 'lib/rest_area.rb', line 15 def configure(&block) self.config.instance_eval(&block) if block_given? end |
.resources ⇒ Object
19 20 21 |
# File 'lib/rest_area.rb', line 19 def resources self.config.resources end |