Module: Chef::DSL::RestResource
- Defined in:
- lib/chef/dsl/rest_resource.rb
Instance Method Summary collapse
-
#rest_api_collection(rest_api_collection = NOT_PASSED) ⇒ Object
URL to collection.
-
#rest_api_document(rest_api_document = NOT_PASSED, first_element_only: false) ⇒ Object
RFC6570-Templated URL to document.
- #rest_api_document_first_element_only(rest_api_document_first_element_only = NOT_PASSED) ⇒ Object
-
#rest_identity_map(rest_identity_map = NOT_PASSED) ⇒ Object
Explicit REST document identity mapping.
-
#rest_post_only_properties(rest_post_only_properties = NOT_PASSED) ⇒ Object
Mark up properties for POST only, not PATCH/PUT.
- #rest_property_map(rest_property_map = NOT_PASSED) ⇒ Object
Instance Method Details
#rest_api_collection(rest_api_collection = NOT_PASSED) ⇒ Object
URL to collection
33 34 35 36 37 38 39 40 41 |
# File 'lib/chef/dsl/rest_resource.rb', line 33 def rest_api_collection(rest_api_collection = NOT_PASSED) if rest_api_collection != NOT_PASSED raise ArgumentError, "You must pass an absolute path to rest_api_collection" unless rest_api_collection.start_with? "/" @rest_api_collection = rest_api_collection end @rest_api_collection end |
#rest_api_document(rest_api_document = NOT_PASSED, first_element_only: false) ⇒ Object
RFC6570-Templated URL to document
44 45 46 47 48 49 50 51 52 |
# File 'lib/chef/dsl/rest_resource.rb', line 44 def rest_api_document(rest_api_document = NOT_PASSED, first_element_only: false) if rest_api_document != NOT_PASSED raise ArgumentError, "You must pass an absolute path to rest_api_document" unless rest_api_document.start_with? "/" @rest_api_document = rest_api_document @rest_api_document_first_element_only = first_element_only end @rest_api_document end |
#rest_api_document_first_element_only(rest_api_document_first_element_only = NOT_PASSED) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/chef/dsl/rest_resource.rb', line 68 def rest_api_document_first_element_only(rest_api_document_first_element_only = NOT_PASSED) if rest_api_document_first_element_only != NOT_PASSED @rest_api_document_first_element_only = rest_api_document_first_element_only end @rest_api_document_first_element_only end |
#rest_identity_map(rest_identity_map = NOT_PASSED) ⇒ Object
Explicit REST document identity mapping
55 56 57 58 |
# File 'lib/chef/dsl/rest_resource.rb', line 55 def rest_identity_map(rest_identity_map = NOT_PASSED) @rest_identity_map = rest_identity_map if rest_identity_map != NOT_PASSED @rest_identity_map end |
#rest_post_only_properties(rest_post_only_properties = NOT_PASSED) ⇒ Object
Mark up properties for POST only, not PATCH/PUT
61 62 63 64 65 66 |
# File 'lib/chef/dsl/rest_resource.rb', line 61 def rest_post_only_properties(rest_post_only_properties = NOT_PASSED) if rest_post_only_properties != NOT_PASSED @rest_post_only_properties = Array(rest_post_only_properties).map(&:to_sym) end @rest_post_only_properties || [] end |
#rest_property_map(rest_property_map = NOT_PASSED) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/chef/dsl/rest_resource.rb', line 23 def rest_property_map(rest_property_map = NOT_PASSED) if rest_property_map != NOT_PASSED rest_property_map = rest_property_map.to_h { |k| [k.to_sym, k] } if rest_property_map.is_a? Array @rest_property_map = rest_property_map end @rest_property_map end |