Skip to content

Commit 682d065

Browse files
authored
Merge pull request #272 from EasyPost/fix_custom_info_create_custom_items
fix: customs_info wrapping for customs_items
2 parents 723fb5f + 1bd1c7a commit 682d065

File tree

7 files changed

+53
-41
lines changed

7 files changed

+53
-41
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## v5.0.1 (2023-06-20)
4+
5+
- Fixes a bug where the params of a `customs_info` on create weren't wrapped properly which led to an empty set of `customs_items`
6+
37
## v5.0.0 (2023-06-06)
48

59
See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-4x-to-50) for more details.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.0
1+
5.0.1

lib/easypost/http_client.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ def default_request_execute(method, uri, headers, open_timeout, read_timeout, bo
4343
# Attempt to make the request and return the response.
4444
Net::HTTP.start(
4545
uri.host,
46-
uri.port, use_ssl: true, read_timeout: read_timeout, open_timeout: open_timeout,
46+
uri.port,
47+
use_ssl: true,
48+
read_timeout: read_timeout,
49+
open_timeout: open_timeout,
4750
) do |http|
4851
http.request(request)
4952
end

lib/easypost/services/customs_info.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ class EasyPost::Services::CustomsInfo < EasyPost::Services::Service
55

66
# Create a CustomsInfo object
77
def create(params)
8-
@client.make_request(:post, 'customs_infos', MODEL_CLASS, params)
8+
wrapped_params = { customs_info: params }
9+
10+
@client.make_request(:post, 'customs_infos', MODEL_CLASS, wrapped_params)
911
end
1012

1113
# Retrieve a CustomsInfo object

spec/cassettes/customs_info/EasyPost_Services_CustomsInfo_create_creates_a_customs_info.yml

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

spec/cassettes/customs_info/EasyPost_Services_CustomsInfo_retrieve_retrieves_a_customs_info.yml

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

spec/customs_info_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
customs_info = client.customs_info.create(Fixture.basic_customs_info)
1111

1212
expect(customs_info).to be_an_instance_of(EasyPost::Models::CustomsInfo)
13+
expect(customs_info.customs_items).to all(be_an_instance_of(EasyPost::Models::CustomsItem))
1314
expect(customs_info.id).to match('cstinfo_')
1415
expect(customs_info.eel_pfc).to eq('NOEEI 30.37(a)')
1516
end

0 commit comments

Comments
 (0)