Skip to content

Commit

Permalink
Merge pull request #272 from EasyPost/fix_custom_info_create_custom_i…
Browse files Browse the repository at this point in the history
…tems

fix: customs_info wrapping for customs_items
  • Loading branch information
Justintime50 authored Jun 20, 2023
2 parents 723fb5f + 1bd1c7a commit 682d065
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 41 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v5.0.1 (2023-06-20)

- 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`

## v5.0.0 (2023-06-06)

See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-4x-to-50) for more details.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0
5.0.1
5 changes: 4 additions & 1 deletion lib/easypost/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def default_request_execute(method, uri, headers, open_timeout, read_timeout, bo
# Attempt to make the request and return the response.
Net::HTTP.start(
uri.host,
uri.port, use_ssl: true, read_timeout: read_timeout, open_timeout: open_timeout,
uri.port,
use_ssl: true,
read_timeout: read_timeout,
open_timeout: open_timeout,
) do |http|
http.request(request)
end
Expand Down
4 changes: 3 additions & 1 deletion lib/easypost/services/customs_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ class EasyPost::Services::CustomsInfo < EasyPost::Services::Service

# Create a CustomsInfo object
def create(params)
@client.make_request(:post, 'customs_infos', MODEL_CLASS, params)
wrapped_params = { customs_info: params }

@client.make_request(:post, 'customs_infos', MODEL_CLASS, wrapped_params)
end

# Retrieve a CustomsInfo object
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.

1 change: 1 addition & 0 deletions spec/customs_info_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
customs_info = client.customs_info.create(Fixture.basic_customs_info)

expect(customs_info).to be_an_instance_of(EasyPost::Models::CustomsInfo)
expect(customs_info.customs_items).to all(be_an_instance_of(EasyPost::Models::CustomsItem))
expect(customs_info.id).to match('cstinfo_')
expect(customs_info.eel_pfc).to eq('NOEEI 30.37(a)')
end
Expand Down

0 comments on commit 682d065

Please sign in to comment.