Skip to content

Commit 356686a

Browse files
committed
fix: webhook update params
1 parent 1dd7074 commit 356686a

11 files changed

+90
-74
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
## Next Release
44

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

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

easypost.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
lib = File.expand_path('lib', __dir__)
44
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
55
require 'easypost/version'
6+
require 'bigdecimal'
67

78
Gem::Specification.new do |spec|
89
spec.name = 'easypost'

lib/easypost/services/user.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def api_keys(id)
7474
# Update the Brand of a User.
7575
def update_brand(id, params = {})
7676
wrapped_params = { brand: params }
77-
response = @client.make_request(:get, "users/#{id}/brand", wrapped_params)
77+
response = @client.make_request(:patch, "users/#{id}/brand", wrapped_params)
7878

7979
EasyPost::InternalUtilities::Json.convert_json_to_object(response, EasyPost::Models::Brand)
8080
end

lib/easypost/services/webhook.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def all(params = {})
2727

2828
# Update a Webhook.
2929
def update(id, params = {})
30-
response = @client.make_request(:patch, "webhooks/#{id}", params)
30+
wrapped_params = { webhook: params }
31+
response = @client.make_request(:patch, "webhooks/#{id}", wrapped_params)
3132

3233
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
3334
end

spec/cassettes/user/EasyPost_Services_User_update_brand_updates_the_authenticated_user_s_brand.yml

Lines changed: 26 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/cassettes/webhook/EasyPost_Services_Webhook_create_creates_a_webhook.yml

Lines changed: 20 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/cassettes/webhook/EasyPost_Services_Webhook_update_updates_a_webhook.yml

Lines changed: 29 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def create_and_insure_shipment(client, amount)
6161
def check_expired_cassette(cassette_path)
6262
full_cassette_path = "#{"spec/cassettes/#{cassette_path}".gsub('::', '_').gsub(' ', '_').gsub('.', '_')}.yml"
6363
seconds_in_day = 86_400
64-
expiration_days = 180
64+
expiration_days = 365
6565
expiration_seconds = seconds_in_day * expiration_days
6666

6767
return unless File.exist?(full_cassette_path)

spec/support/vcr.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
require 'vcr'
44
require 'json'
55

6-
REPLACEMENT_STRING = '<REDACTED>'
7-
REPLACEMENT_ARRAY = [].freeze
8-
REPLACEMENT_HASH = {}.freeze
6+
REPLACEMENT_STRING ||= '<REDACTED>'.freeze
7+
REPLACEMENT_ARRAY ||= [].freeze
8+
REPLACEMENT_HASH ||= {}.freeze
99

10-
SCRUBBERS = [
10+
SCRUBBERS ||= [
1111
['client_ip', REPLACEMENT_STRING],
1212
['credentials', REPLACEMENT_HASH],
1313
['email', REPLACEMENT_STRING],

0 commit comments

Comments
 (0)