easypost 6.2.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +6 -6
- data/CHANGELOG.md +10 -0
- data/Makefile +6 -1
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/easypost/client.rb +2 -0
- data/lib/easypost/models/claim.rb +5 -0
- data/lib/easypost/models.rb +1 -0
- data/lib/easypost/services/carrier_account.rb +26 -5
- data/lib/easypost/services/claim.rb +43 -0
- 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 +2 -0
- data/lib/easypost/utilities/static_mapper.rb +2 -0
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 643a95f0b48e9abedc30e67d868ec3538d8d896b9c385734966805c83e72bd90
|
|
4
|
+
data.tar.gz: a532de25388ea110f152e77205bea2104228e83e7279dc66d0b500238d5b8416
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 94b9cf67261d5c9bba01183812bef018d0b4918cc5f3593befdff2884095816299585bf33d86ee0de14015814c53ddd2911b9de85692c9c73421e1133cd57605
|
|
7
|
+
data.tar.gz: ba8c81ed037de3ccad7441eba06111eefb7430e69ac36169dd3409efa7965a092b18bc114d3767610dcb15453a6bfeed584073f35a986214b96f5eab4c6e2dcb
|
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,15 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v6.4.0 (2024-07-24)
|
|
4
|
+
|
|
5
|
+
- Adds new `Claim` service for filing claims on EasyPost shipments and insurances
|
|
6
|
+
|
|
7
|
+
## v6.3.0 (2024-07-12)
|
|
8
|
+
|
|
9
|
+
- Adds new `shipment.recommend_ship_date`, `smartrate.recommend_ship_date`, and `smartrate.estimate_delivery_date` functions
|
|
10
|
+
- Routes `UpsAccount`, `UpsMailInnovationsAccount`, and `UpsSurepostAccount` create/update requests to the new `/ups_oauth_registrations` endpoint
|
|
11
|
+
- 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
|
|
12
|
+
|
|
3
13
|
## v6.2.0 (2024-04-10)
|
|
4
14
|
|
|
5
15
|
- 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.4.0
|
data/lib/easypost/client.rb
CHANGED
|
@@ -42,6 +42,7 @@ class EasyPost::Client
|
|
|
42
42
|
EasyPost::Services::CarrierAccount,
|
|
43
43
|
EasyPost::Services::CarrierMetadata,
|
|
44
44
|
EasyPost::Services::CarrierType,
|
|
45
|
+
EasyPost::Services::Claim,
|
|
45
46
|
EasyPost::Services::CustomsInfo,
|
|
46
47
|
EasyPost::Services::CustomsItem,
|
|
47
48
|
EasyPost::Services::EndShipper,
|
|
@@ -56,6 +57,7 @@ class EasyPost::Client
|
|
|
56
57
|
EasyPost::Services::Report,
|
|
57
58
|
EasyPost::Services::ScanForm,
|
|
58
59
|
EasyPost::Services::Shipment,
|
|
60
|
+
EasyPost::Services::SmartRate,
|
|
59
61
|
EasyPost::Services::Tracker,
|
|
60
62
|
EasyPost::Services::User,
|
|
61
63
|
EasyPost::Services::Webhook,
|
data/lib/easypost/models.rb
CHANGED
|
@@ -10,6 +10,7 @@ require_relative 'models/batch'
|
|
|
10
10
|
require_relative 'models/brand'
|
|
11
11
|
require_relative 'models/carrier_account'
|
|
12
12
|
require_relative 'models/carrier_type'
|
|
13
|
+
require_relative 'models/claim'
|
|
13
14
|
require_relative 'models/customs_info'
|
|
14
15
|
require_relative 'models/customs_item'
|
|
15
16
|
require_relative 'models/end_shipper'
|
|
@@ -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
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class EasyPost::Services::Claim < EasyPost::Services::Service
|
|
4
|
+
MODEL_CLASS = EasyPost::Models::Claim
|
|
5
|
+
|
|
6
|
+
# Create an Claim object
|
|
7
|
+
def create(params = {})
|
|
8
|
+
response = @client.make_request(:post, 'claims', params)
|
|
9
|
+
|
|
10
|
+
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Retrieve an Claim object
|
|
14
|
+
def retrieve(id)
|
|
15
|
+
response = @client.make_request(:get, "claims/#{id}", nil)
|
|
16
|
+
|
|
17
|
+
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Retrieve all Claim objects
|
|
21
|
+
def all(params = {})
|
|
22
|
+
filters = { key: 'claims' }
|
|
23
|
+
|
|
24
|
+
get_all_helper('claims', MODEL_CLASS, params, filters)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Get the next page of claims.
|
|
28
|
+
def get_next_page(collection, page_size = nil)
|
|
29
|
+
raise EasyPost::Errors::EndOfPaginationError.new unless more_pages?(collection)
|
|
30
|
+
|
|
31
|
+
params = { before_id: collection.claims.last.id }
|
|
32
|
+
params[:page_size] = page_size unless page_size.nil?
|
|
33
|
+
|
|
34
|
+
all(params)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Cancel a filed claim
|
|
38
|
+
def cancel(id)
|
|
39
|
+
response = @client.make_request(:post, "claims/#{id}/cancel", nil)
|
|
40
|
+
|
|
41
|
+
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
|
|
42
|
+
end
|
|
43
|
+
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
|
@@ -14,6 +14,7 @@ require_relative 'services/billing'
|
|
|
14
14
|
require_relative 'services/carrier_account'
|
|
15
15
|
require_relative 'services/carrier_metadata'
|
|
16
16
|
require_relative 'services/carrier_type'
|
|
17
|
+
require_relative 'services/claim'
|
|
17
18
|
require_relative 'services/customs_info'
|
|
18
19
|
require_relative 'services/customs_item'
|
|
19
20
|
require_relative 'services/end_shipper'
|
|
@@ -28,6 +29,7 @@ require_relative 'services/refund'
|
|
|
28
29
|
require_relative 'services/report'
|
|
29
30
|
require_relative 'services/scan_form'
|
|
30
31
|
require_relative 'services/shipment'
|
|
32
|
+
require_relative 'services/smart_rate'
|
|
31
33
|
require_relative 'services/tracker'
|
|
32
34
|
require_relative 'services/user'
|
|
33
35
|
require_relative 'services/webhook'
|
|
@@ -11,6 +11,7 @@ module EasyPost::InternalUtilities::StaticMapper
|
|
|
11
11
|
'brd' => EasyPost::Models::Brand,
|
|
12
12
|
'ca' => EasyPost::Models::CarrierAccount,
|
|
13
13
|
'card' => EasyPost::Models::PaymentMethod,
|
|
14
|
+
'clm' => EasyPost::Models::Claim,
|
|
14
15
|
'cstinfo' => EasyPost::Models::CustomsInfo,
|
|
15
16
|
'cstitem' => EasyPost::Models::CustomsItem,
|
|
16
17
|
'es' => EasyPost::Models::EndShipper,
|
|
@@ -43,6 +44,7 @@ module EasyPost::InternalUtilities::StaticMapper
|
|
|
43
44
|
'Batch' => EasyPost::Models::Batch,
|
|
44
45
|
'Brand' => EasyPost::Models::Brand,
|
|
45
46
|
'CarrierAccount' => EasyPost::Models::CarrierAccount,
|
|
47
|
+
'Claim' => EasyPost::Models::Claim,
|
|
46
48
|
'CreditCard' => EasyPost::Models::PaymentMethod,
|
|
47
49
|
'CustomsInfo' => EasyPost::Models::CustomsInfo,
|
|
48
50
|
'CustomsItem' => EasyPost::Models::CustomsItem,
|
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.4.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-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: brakeman
|
|
@@ -262,6 +262,7 @@ files:
|
|
|
262
262
|
- lib/easypost/models/brand.rb
|
|
263
263
|
- lib/easypost/models/carrier_account.rb
|
|
264
264
|
- lib/easypost/models/carrier_type.rb
|
|
265
|
+
- lib/easypost/models/claim.rb
|
|
265
266
|
- lib/easypost/models/customs_info.rb
|
|
266
267
|
- lib/easypost/models/customs_item.rb
|
|
267
268
|
- lib/easypost/models/end_shipper.rb
|
|
@@ -296,6 +297,7 @@ files:
|
|
|
296
297
|
- lib/easypost/services/carrier_account.rb
|
|
297
298
|
- lib/easypost/services/carrier_metadata.rb
|
|
298
299
|
- lib/easypost/services/carrier_type.rb
|
|
300
|
+
- lib/easypost/services/claim.rb
|
|
299
301
|
- lib/easypost/services/customs_info.rb
|
|
300
302
|
- lib/easypost/services/customs_item.rb
|
|
301
303
|
- lib/easypost/services/end_shipper.rb
|
|
@@ -310,6 +312,7 @@ files:
|
|
|
310
312
|
- lib/easypost/services/report.rb
|
|
311
313
|
- lib/easypost/services/scan_form.rb
|
|
312
314
|
- lib/easypost/services/shipment.rb
|
|
315
|
+
- lib/easypost/services/smart_rate.rb
|
|
313
316
|
- lib/easypost/services/tracker.rb
|
|
314
317
|
- lib/easypost/services/user.rb
|
|
315
318
|
- lib/easypost/services/webhook.rb
|
|
@@ -338,7 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
338
341
|
- !ruby/object:Gem::Version
|
|
339
342
|
version: '0'
|
|
340
343
|
requirements: []
|
|
341
|
-
rubygems_version: 3.
|
|
344
|
+
rubygems_version: 3.3.3
|
|
342
345
|
signing_key:
|
|
343
346
|
specification_version: 4
|
|
344
347
|
summary: EasyPost Ruby Client Library
|