Skip to content

Commit

Permalink
fix: webhook update params
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Feb 14, 2025
1 parent 1dd7074 commit 356686a
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 74 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

## Next Release

- Fixes the update webhook function to wrap parameters in the request correctly
- Corrects the HTTP verb for updating a brand from `GET` to `PATCH`
- Removes the deprecated `create_list` tracker endpoint function as it is no longer available via API
- Explicitly requires `bigdecimal` instead of implicitly assuming it will be included

## v6.4.1 (2024-08-09)

Expand Down
1 change: 1 addition & 0 deletions easypost.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'easypost/version'
require 'bigdecimal'

Gem::Specification.new do |spec|
spec.name = 'easypost'
Expand Down
2 changes: 1 addition & 1 deletion lib/easypost/services/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def api_keys(id)
# Update the Brand of a User.
def update_brand(id, params = {})
wrapped_params = { brand: params }
response = @client.make_request(:get, "users/#{id}/brand", wrapped_params)
response = @client.make_request(:patch, "users/#{id}/brand", wrapped_params)

EasyPost::InternalUtilities::Json.convert_json_to_object(response, EasyPost::Models::Brand)
end
Expand Down
3 changes: 2 additions & 1 deletion lib/easypost/services/webhook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def all(params = {})

# Update a Webhook.
def update(id, params = {})
response = @client.make_request(:patch, "webhooks/#{id}", params)
wrapped_params = { webhook: params }
response = @client.make_request(:patch, "webhooks/#{id}", wrapped_params)

EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
end
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def create_and_insure_shipment(client, amount)
def check_expired_cassette(cassette_path)
full_cassette_path = "#{"spec/cassettes/#{cassette_path}".gsub('::', '_').gsub(' ', '_').gsub('.', '_')}.yml"
seconds_in_day = 86_400
expiration_days = 180
expiration_days = 365
expiration_seconds = seconds_in_day * expiration_days

return unless File.exist?(full_cassette_path)
Expand Down
8 changes: 4 additions & 4 deletions spec/support/vcr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
require 'vcr'
require 'json'

REPLACEMENT_STRING = '<REDACTED>'
REPLACEMENT_ARRAY = [].freeze
REPLACEMENT_HASH = {}.freeze
REPLACEMENT_STRING ||= '<REDACTED>'.freeze
REPLACEMENT_ARRAY ||= [].freeze
REPLACEMENT_HASH ||= {}.freeze

SCRUBBERS = [
SCRUBBERS ||= [
['client_ip', REPLACEMENT_STRING],
['credentials', REPLACEMENT_HASH],
['email', REPLACEMENT_STRING],
Expand Down
Loading

0 comments on commit 356686a

Please sign in to comment.