diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2022-03-31 21:39:22 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2022-03-31 21:39:22 -0700 |
commit | 4df3e3960920d2eb4e03fa23b6405d7d6945e26b (patch) | |
tree | 2e8c03071841a8eec995cfd95da7b1eb1d6ea1f9 | |
parent | ae4777206577025e13116f2e94b273833cb5dfed (diff) | |
download | chef-4df3e3960920d2eb4e03fa23b6405d7d6945e26b.tar.gz |
use chef/constants
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/dsl/rest_resource.rb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/chef/dsl/rest_resource.rb b/lib/chef/dsl/rest_resource.rb index 055904e1c2..593311361d 100644 --- a/lib/chef/dsl/rest_resource.rb +++ b/lib/chef/dsl/rest_resource.rb @@ -1,8 +1,10 @@ +require "chef/constants" unless defined?(NOT_PASSED) + class Chef module DSL module RestResource - def rest_property_map(rest_property_map = "NOT_PASSED") - if rest_property_map != "NOT_PASSED" + 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 @@ -11,14 +13,14 @@ class Chef end # URL to collection - def rest_api_collection(rest_api_collection = "NOT_PASSED") - @rest_api_collection = rest_api_collection if rest_api_collection != "NOT_PASSED" + def rest_api_collection(rest_api_collection = NOT_PASSED) + @rest_api_collection = rest_api_collection if rest_api_collection != NOT_PASSED @rest_api_collection end # RFC6570-Templated URL to document - def rest_api_document(rest_api_document = "NOT_PASSED", first_element_only: false) - if rest_api_document != "NOT_PASSED" + def rest_api_document(rest_api_document = NOT_PASSED, first_element_only: false) + if rest_api_document != NOT_PASSED @rest_api_document = rest_api_document @rest_api_document_first_element_only = first_element_only end @@ -26,21 +28,21 @@ class Chef end # Explicit REST document identity mapping - def rest_identity_map(rest_identity_map = "NOT_PASSED") - @rest_identity_map = rest_identity_map if rest_identity_map != "NOT_PASSED" + 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 # Mark up properties for POST only, not PATCH/PUT - def rest_post_only_properties(rest_post_only_properties = "NOT_PASSED") - if rest_post_only_properties != "NOT_PASSED" + 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 - def rest_api_document_first_element_only(rest_api_document_first_element_only = "NOT_PASSED") - if rest_api_document_first_element_only != "NOT_PASSED" + 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 |