Module: RoadForest::Resource::Role::Writable
- Defined in:
- lib/roadforest/resource/role/writable.rb
Defined Under Namespace
Classes: IncludeOrder
Class Method Summary collapse
Instance Method Summary collapse
- #content_types_accepted ⇒ Object
- #delete_resource ⇒ Object
- #known_content_type(content_type) ⇒ Object
- #post_is_create ⇒ Object
- #request_body ⇒ Object
Class Method Details
.allowed_methods ⇒ Object
9 10 11 |
# File 'lib/roadforest/resource/role/writable.rb', line 9 def self.allowed_methods %w[POST PUT DELETE] end |
.included(mod) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/roadforest/resource/role/writable.rb', line 13 def self.included(mod) if mod.ancestors.include?(HasChildren) #Might regret this later - some kind of "I promise to fix it?" raise IncludeOrder, "Writable has to be included before HasChildren" end end |
Instance Method Details
#content_types_accepted ⇒ Object
24 25 26 |
# File 'lib/roadforest/resource/role/writable.rb', line 24 def content_types_accepted content_engine.parsers.type_map end |
#delete_resource ⇒ Object
37 38 39 |
# File 'lib/roadforest/resource/role/writable.rb', line 37 def delete_resource @interface.delete(params) end |
#known_content_type(content_type) ⇒ Object
32 33 34 35 |
# File 'lib/roadforest/resource/role/writable.rb', line 32 def known_content_type(content_type) content_type = Webmachine::MediaType.parse(content_type) content_types_accepted.any?{|ct, _| content_type.match?(ct)} end |
#post_is_create ⇒ Object
20 21 22 |
# File 'lib/roadforest/resource/role/writable.rb', line 20 def post_is_create true end |
#request_body ⇒ Object
28 29 30 |
# File 'lib/roadforest/resource/role/writable.rb', line 28 def request_body @request.body end |