easypost 6.2.0 → 6.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +6 -6
- data/CHANGELOG.md +6 -0
- data/Makefile +6 -1
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/easypost/client.rb +1 -0
- data/lib/easypost/services/carrier_account.rb +26 -5
- data/lib/easypost/services/shipment.rb +9 -0
- data/lib/easypost/services/smart_rate.rb +19 -0
- data/lib/easypost/services/tracker.rb +1 -0
- data/lib/easypost/services.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5c061be62ecbd985d48cc8d63c9ee9818cdb4f8da07140f308551f9f2404d8b
|
4
|
+
data.tar.gz: 77edf8e77aadc515bb909267f2fbeb780eef7eaf677d4dd862f917a114af39b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6367c6955313221a4e063dfb477153f7c906b8db94fb398608b4c017eed750db036f96300bd8f1f2c804b33660803d2f02fd3ba07ce08647d6b0d3255f8ef12f
|
7
|
+
data.tar.gz: 31f99fd5e0a377c5e56c155e6ab262c80d42db6d9850daeadaca96c54b561ded5a7d63c47404701a62f564b62e03aaa6c21125b7b895f0673567a77d020c76db
|
data/.github/workflows/ci.yml
CHANGED
@@ -11,7 +11,7 @@ jobs:
|
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
rubyversion: ['2.6', '2.7', '3.0', '3.1', '3.2']
|
14
|
+
rubyversion: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3']
|
15
15
|
steps:
|
16
16
|
- name: Checkout Repository
|
17
17
|
uses: actions/checkout@v3
|
@@ -19,7 +19,7 @@ jobs:
|
|
19
19
|
uses: ruby/setup-ruby@v1
|
20
20
|
with:
|
21
21
|
ruby-version: ${{ matrix.rubyversion }}
|
22
|
-
rubygems: '3.
|
22
|
+
rubygems: '3.3.0'
|
23
23
|
bundler-cache: true
|
24
24
|
- name: Install Dependencies
|
25
25
|
run: make install
|
@@ -39,8 +39,8 @@ jobs:
|
|
39
39
|
- name: Set up Ruby
|
40
40
|
uses: ruby/setup-ruby@v1
|
41
41
|
with:
|
42
|
-
ruby-version: '3.
|
43
|
-
rubygems: '3.
|
42
|
+
ruby-version: '3.3'
|
43
|
+
rubygems: '3.3.0'
|
44
44
|
bundler-cache: true
|
45
45
|
- name: Install Dependencies
|
46
46
|
run: make install
|
@@ -57,8 +57,8 @@ jobs:
|
|
57
57
|
- name: Set up Ruby
|
58
58
|
uses: ruby/setup-ruby@v1
|
59
59
|
with:
|
60
|
-
ruby-version: '3.
|
61
|
-
rubygems: '3.
|
60
|
+
ruby-version: '3.3'
|
61
|
+
rubygems: '3.3.0'
|
62
62
|
bundler-cache: true
|
63
63
|
- name: Install Dependencies
|
64
64
|
run: make install
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v6.3.0 (2024-07-12)
|
4
|
+
|
5
|
+
- Adds new `shipment.recommend_ship_date`, `smartrate.recommend_ship_date`, and `smartrate.estimate_delivery_date` functions
|
6
|
+
- Routes `UpsAccount`, `UpsMailInnovationsAccount`, and `UpsSurepostAccount` create/update requests to the new `/ups_oauth_registrations` endpoint
|
7
|
+
- Starting `2024-08-05`, UPS accounts will require a new payload to register or update. See [UPS OAuth 2.0 Update](https://support.easypost.com/hc/en-us/articles/26635027512717-UPS-OAuth-2-0-Update?utm_medium=email&_hsenc=p2ANqtz-96MmFtWICOzy9sKRbbcZSiMovZSrY3MSX1_bgY9N3f9yLVfWQdLhjAGq-SmNcOnDIS6GYhZ0OApjDBrGkKyLLMx1z6_TFOVp6-wllhEFQINrkuRuc&_hsmi=313130292&utm_content=313130292&utm_source=hs_email) for more details
|
8
|
+
|
3
9
|
## v6.2.0 (2024-04-10)
|
4
10
|
|
5
11
|
- Fix payment method funding and deletion failures due to undetermined payment method type
|
data/Makefile
CHANGED
@@ -24,8 +24,13 @@ docs:
|
|
24
24
|
install-styleguide: | update-examples-submodule
|
25
25
|
sh examples/symlink_directory_files.sh examples/style_guides/ruby .
|
26
26
|
|
27
|
+
## init-examples-submodule - Initialize the examples submodule
|
28
|
+
init-examples-submodule:
|
29
|
+
git submodule init
|
30
|
+
git submodule update
|
31
|
+
|
27
32
|
## install - Install globally from source
|
28
|
-
install: |
|
33
|
+
install: | init-examples-submodule
|
29
34
|
bundle install
|
30
35
|
|
31
36
|
## lint - Lint the project
|
data/README.md
CHANGED
@@ -163,7 +163,7 @@ If you're using a custom HTTP connection, keep in mind that the `response_data`
|
|
163
163
|
|
164
164
|
## Documentation
|
165
165
|
|
166
|
-
API documentation can be found at: <https://easypost.com
|
166
|
+
API documentation can be found at: <https://docs.easypost.com>.
|
167
167
|
|
168
168
|
Library documentation can be found on the web at: <https://easypost.github.io/easypost-ruby/> or by building them locally via the `make docs` command.
|
169
169
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
6.
|
1
|
+
6.3.0
|
data/lib/easypost/client.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class EasyPost::Services::CarrierAccount < EasyPost::Services::Service
|
4
|
-
CUSTOM_WORKFLOW_CARRIER_TYPES = %w[
|
4
|
+
CUSTOM_WORKFLOW_CARRIER_TYPES = %w[FedexAccount FedexSmartpostAccount].freeze
|
5
|
+
UPS_OAUTH_CARRIER_ACCOUNT_TYPES = %w[UpsAccount UpsMailInnovationsAccount UpsSurepostAccount].freeze
|
5
6
|
MODEL_CLASS = EasyPost::Models::CarrierAccount
|
6
7
|
|
7
8
|
# Create a carrier account
|
8
9
|
def create(params = {})
|
9
|
-
|
10
|
+
carrier_account_type = params[:type]
|
11
|
+
wrapped_params = { select_top_layer_key(carrier_account_type).to_sym => params }
|
10
12
|
|
11
13
|
# For UPS and FedEx the endpoint is different
|
12
|
-
create_url = if CUSTOM_WORKFLOW_CARRIER_TYPES.include?(
|
14
|
+
create_url = if CUSTOM_WORKFLOW_CARRIER_TYPES.include?(carrier_account_type)
|
13
15
|
'carrier_accounts/register'
|
16
|
+
elsif UPS_OAUTH_CARRIER_ACCOUNT_TYPES.include?(carrier_account_type)
|
17
|
+
'ups_oauth_registrations'
|
14
18
|
else
|
15
19
|
'carrier_accounts'
|
16
20
|
end
|
@@ -33,8 +37,14 @@ class EasyPost::Services::CarrierAccount < EasyPost::Services::Service
|
|
33
37
|
|
34
38
|
# Update a carrier account
|
35
39
|
def update(id, params = {})
|
36
|
-
|
37
|
-
|
40
|
+
carrier_account = retrieve(id)
|
41
|
+
wrapped_params = { select_top_layer_key(carrier_account[:type]).to_sym => params }
|
42
|
+
update_url = if UPS_OAUTH_CARRIER_ACCOUNT_TYPES.include?(params[:type])
|
43
|
+
'ups_oauth_registrations/'
|
44
|
+
else
|
45
|
+
'carrier_accounts/'
|
46
|
+
end
|
47
|
+
response = @client.make_request(:put, "#{update_url}#{id}", wrapped_params)
|
38
48
|
|
39
49
|
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
|
40
50
|
end
|
@@ -46,4 +56,15 @@ class EasyPost::Services::CarrierAccount < EasyPost::Services::Service
|
|
46
56
|
# Return true if succeeds, an error will be thrown if it fails
|
47
57
|
true
|
48
58
|
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
# Select the top-layer key for the carrier account creation/update request based on the carrier type.
|
63
|
+
def select_top_layer_key(carrier_account_type)
|
64
|
+
if UPS_OAUTH_CARRIER_ACCOUNT_TYPES.include?(carrier_account_type)
|
65
|
+
'ups_oauth_registrations'
|
66
|
+
else
|
67
|
+
'carrier_account'
|
68
|
+
end
|
69
|
+
end
|
49
70
|
end
|
@@ -118,4 +118,13 @@ class EasyPost::Services::Shipment < EasyPost::Services::Service
|
|
118
118
|
|
119
119
|
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS).rates
|
120
120
|
end
|
121
|
+
|
122
|
+
# Retrieve a recommended ship date for an existing Shipment via the Precision Shipping API, based on a specific desired delivery date.
|
123
|
+
def recommend_ship_date(id, desired_delivery_date)
|
124
|
+
url = "shipments/#{id}/smartrate/precision_shipping"
|
125
|
+
params = { desired_delivery_date: desired_delivery_date }
|
126
|
+
response = @client.make_request(:get, url, params)
|
127
|
+
|
128
|
+
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS).rates
|
129
|
+
end
|
121
130
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class EasyPost::Services::SmartRate < EasyPost::Services::Service
|
2
|
+
# Retrieve the estimated delivery date of each carrier-service level combination via the
|
3
|
+
# Smart Deliver By API, based on a specific ship date and origin-destination postal code pair.
|
4
|
+
def estimate_delivery_date(params = {})
|
5
|
+
url = 'smartrate/deliver_by'
|
6
|
+
|
7
|
+
response = @client.make_request(:post, url, params)
|
8
|
+
EasyPost::InternalUtilities::Json.convert_json_to_object(response, EasyPost::Models::EasyPostObject)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Retrieve a recommended ship date for each carrier-service level combination via the
|
12
|
+
# Smart Deliver On API, based on a specific delivery date and origin-destination postal code pair.
|
13
|
+
def recommend_ship_date(params = {})
|
14
|
+
url = 'smartrate/deliver_on'
|
15
|
+
|
16
|
+
response = @client.make_request(:post, url, params)
|
17
|
+
EasyPost::InternalUtilities::Json.convert_json_to_object(response, EasyPost::Models::EasyPostObject)
|
18
|
+
end
|
19
|
+
end
|
@@ -30,6 +30,7 @@ class EasyPost::Services::Tracker < EasyPost::Services::Service
|
|
30
30
|
end
|
31
31
|
|
32
32
|
# Create multiple Tracker objects in bulk.
|
33
|
+
# <b>DEPRECATED:</b> Please use <tt>create</tt> instead. This function will be removed in a future release.
|
33
34
|
def create_list(params = {})
|
34
35
|
wrapped_params = { 'trackers' => params }
|
35
36
|
|
data/lib/easypost/services.rb
CHANGED
@@ -28,6 +28,7 @@ require_relative 'services/refund'
|
|
28
28
|
require_relative 'services/report'
|
29
29
|
require_relative 'services/scan_form'
|
30
30
|
require_relative 'services/shipment'
|
31
|
+
require_relative 'services/smart_rate'
|
31
32
|
require_relative 'services/tracker'
|
32
33
|
require_relative 'services/user'
|
33
34
|
require_relative 'services/webhook'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easypost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- EasyPost Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brakeman
|
@@ -310,6 +310,7 @@ files:
|
|
310
310
|
- lib/easypost/services/report.rb
|
311
311
|
- lib/easypost/services/scan_form.rb
|
312
312
|
- lib/easypost/services/shipment.rb
|
313
|
+
- lib/easypost/services/smart_rate.rb
|
313
314
|
- lib/easypost/services/tracker.rb
|
314
315
|
- lib/easypost/services/user.rb
|
315
316
|
- lib/easypost/services/webhook.rb
|
@@ -338,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
338
339
|
- !ruby/object:Gem::Version
|
339
340
|
version: '0'
|
340
341
|
requirements: []
|
341
|
-
rubygems_version: 3.5.
|
342
|
+
rubygems_version: 3.5.14
|
342
343
|
signing_key:
|
343
344
|
specification_version: 4
|
344
345
|
summary: EasyPost Ruby Client Library
|