diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index 1d092bb..3f18aba 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -19,15 +19,6 @@ def put(path, body = {}, params = {}) end end - def patch(path, body = {}, params = {}) - handle_request do - agent.patch(path) do |request| - request.params = parse_request(params) - request.body = parse_request(body) - end - end - end - def post(path, body = {}, params = {}) handle_request do agent.post(path) do |request| diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index d5736b6..93d5c6d 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -374,18 +374,19 @@ def remove_tags_from_products(ids, tags) # @see https://developer.epages.com/beyond-docs/#update_variation_properties # # @param id [String] the product UUID - # @param body [Hash] the request body containing variation properties + # @param body [Array] the request body containing variation properties # # @return [Hash] # # @example - # variation_properties = [ + # body = [ # { property: 'salesPrice', enabled: true }, # { property: 'listPrice', enabled: true }, # { property: 'manufacturerPrice', enabled: true }, # { property: 'productIdentifiers', enabled: true }, # { property: 'defaultImage', enabled: true }, # ] + # @client.update_variation_properties('a32ef424-ecc4-4bfc-815b-4f15bb3cffa1', body) def update_variation_properties(id, body) patch("products/#{id}/variation-properties", body) end diff --git a/lib/beyond_api/utils.rb b/lib/beyond_api/utils.rb index 3bdf6a1..0c58093 100644 --- a/lib/beyond_api/utils.rb +++ b/lib/beyond_api/utils.rb @@ -15,8 +15,15 @@ def self.file_content_type(file_path) end end - def self.camelize_keys(hash) - hash.deep_transform_keys { |key| key.to_s.camelize(:lower) } + def self.camelize_keys(input) + case input + when Array + input.map(&method(:camelize_keys)) + when Hash + input.deep_transform_keys { |key| key.to_s.camelize(:lower) } + else + input + end end def self.faraday_file_parts(file_paths)