Class: Railsdav::Renderer
- Inherits:
-
Object
- Object
- Railsdav::Renderer
- Defined in:
- lib/railsdav/renderer.rb,
lib/railsdav/renderer/response_collector.rb,
lib/railsdav/renderer/resource_descriptor.rb,
lib/railsdav/renderer/response_type_selector.rb
Defined Under Namespace
Classes: ResourceDescriptor, ResponseCollector, ResponseTypeSelector
Instance Attribute Summary collapse
-
#depth ⇒ Object
Returns the value of attribute depth.
Class Method Summary collapse
-
.webdav_metadata_for_url(routing_data) ⇒ Object
Return the webdav metadata for a given URL/path.
Instance Method Summary collapse
-
#initialize(controller) ⇒ Renderer
constructor
Create a new Renderer instance that will render an XML multistatus response.
-
#respond_with(response_type, options = {}) ⇒ Object
Render the requested response_type.
Constructor Details
#initialize(controller) ⇒ Renderer
Create a new Renderer instance that will render an XML multistatus response.
Arguments:
controller: the current controller instance
35 36 37 38 39 40 41 |
# File 'lib/railsdav/renderer.rb', line 35 def initialize(controller) @controller = controller @request = controller.request # @depth = (@request.headers['Depth'].to_i > 0) ? 1 : 0 # depth "infinite" is not yet supported @depth = (@request.headers['Depth'].to_i) Rails.logger.debug "Depth:#{@request.headers['Depth']}" end |
Instance Attribute Details
#depth ⇒ Object
Returns the value of attribute depth.
28 29 30 |
# File 'lib/railsdav/renderer.rb', line 28 def depth @depth end |
Class Method Details
.webdav_metadata_for_url(routing_data) ⇒ Object
Return the webdav metadata for a given URL/path
If the given route is recognized, a controller and action can be identified. To get the properties for that URI, we lookup the metadata specified in the target controller (see #enable_webdav_for)
23 24 25 26 |
# File 'lib/railsdav/renderer.rb', line 23 def self.(routing_data) controller = "#{routing_data[:controller]}_controller".camelize.constantize controller ? controller.(routing_data[:action]) : nil end |
Instance Method Details
#respond_with(response_type, options = {}) ⇒ Object
Render the requested response_type.
Arguments:
response_type: currently either :propstat or :response.
options:
- for response: :href, :status, :error (see #response)
- for propstat: :size, :format, :created_at, :updated_at, :resource_layout, ... (see #propstat)
50 51 52 |
# File 'lib/railsdav/renderer.rb', line 50 def respond_with(response_type, = {}) self.send response_type, end |