Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions lib/beyond_api/concerns/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
5 changes: 3 additions & 2 deletions lib/beyond_api/services/product_management/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions lib/beyond_api/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down