easypost 7.0.0 → 7.1.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/CHANGELOG.md +11 -0
- data/VERSION +1 -1
- data/lib/easypost/client.rb +1 -0
- data/lib/easypost/services/carrier_account.rb +6 -13
- data/lib/easypost/services/luma.rb +12 -0
- data/lib/easypost/services/shipment.rb +21 -4
- data/lib/easypost/services.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f953ec3c340b1b0db32a879914a9f9b6df21e5725def849674660a137cda3901
|
4
|
+
data.tar.gz: 22a71045b9b4fad02225c816661e71d40cb77a26fa0987d8e31e2b43072d6fea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c63d058c576a6548837a665d211c22be93502eec9c1780251d17d6f50162380e08e6cb6e28c3148397465975f43e2efa8960573dc11694f9fc682dc95bc629a
|
7
|
+
data.tar.gz: f621157312c8613ca0f11d59964ae4d97ee2c43467403c1b9130b3e4740dafe5566156210808e388bb2937773de8b313382e61ed7e675692233861661b1033bf
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v7.1.0 (2025-06-18)
|
4
|
+
|
5
|
+
- Adds the following functions
|
6
|
+
- `shipment.create_and_buy_luma`
|
7
|
+
- `shipment.buy_luma`
|
8
|
+
- `luma.get_promise`
|
9
|
+
|
10
|
+
## v7.0.1 (2025-05-27)
|
11
|
+
|
12
|
+
- Corrects the endpoint used for creating/updating UPS accounts
|
13
|
+
|
3
14
|
## v7.0.0 (2025-04-28)
|
4
15
|
|
5
16
|
See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-6x-to-70) for more details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.1.0
|
data/lib/easypost/client.rb
CHANGED
@@ -2,8 +2,10 @@
|
|
2
2
|
|
3
3
|
class EasyPost::Services::CarrierAccount < EasyPost::Services::Service
|
4
4
|
CUSTOM_WORKFLOW_CARRIER_TYPES = %w[FedexAccount FedexSmartpostAccount].freeze
|
5
|
-
|
6
|
-
|
5
|
+
CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH = %w[
|
6
|
+
AmazonShippingAccount UpsAccount UpsMailInnovationsAccount
|
7
|
+
UpsSurepostAccount
|
8
|
+
].freeze
|
7
9
|
MODEL_CLASS = EasyPost::Models::CarrierAccount # :nodoc:
|
8
10
|
|
9
11
|
# Create a carrier account
|
@@ -14,8 +16,6 @@ class EasyPost::Services::CarrierAccount < EasyPost::Services::Service
|
|
14
16
|
# For UPS and FedEx the endpoint is different
|
15
17
|
create_url = if CUSTOM_WORKFLOW_CARRIER_TYPES.include?(carrier_account_type)
|
16
18
|
'carrier_accounts/register'
|
17
|
-
elsif UPS_OAUTH_CARRIER_ACCOUNT_TYPES.include?(carrier_account_type)
|
18
|
-
'ups_oauth_registrations'
|
19
19
|
elsif CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH.include?(carrier_account_type)
|
20
20
|
'carrier_accounts/register_oauth'
|
21
21
|
else
|
@@ -42,12 +42,7 @@ class EasyPost::Services::CarrierAccount < EasyPost::Services::Service
|
|
42
42
|
def update(id, params = {})
|
43
43
|
carrier_account = retrieve(id)
|
44
44
|
wrapped_params = { select_top_layer_key(carrier_account[:type]).to_sym => params }
|
45
|
-
|
46
|
-
'ups_oauth_registrations/'
|
47
|
-
else
|
48
|
-
'carrier_accounts/'
|
49
|
-
end
|
50
|
-
response = @client.make_request(:put, "#{update_url}#{id}", wrapped_params)
|
45
|
+
response = @client.make_request(:put, "carrier_accounts/#{id}", wrapped_params)
|
51
46
|
|
52
47
|
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
|
53
48
|
end
|
@@ -64,9 +59,7 @@ class EasyPost::Services::CarrierAccount < EasyPost::Services::Service
|
|
64
59
|
|
65
60
|
# Select the top-layer key for the carrier account creation/update request based on the carrier type.
|
66
61
|
def select_top_layer_key(carrier_account_type)
|
67
|
-
if
|
68
|
-
'ups_oauth_registrations'
|
69
|
-
elsif CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH.include?(carrier_account_type)
|
62
|
+
if CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH.include?(carrier_account_type)
|
70
63
|
'carrier_account_oauth_registrations'
|
71
64
|
else
|
72
65
|
'carrier_account'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class EasyPost::Services::Luma < EasyPost::Services::Service
|
4
|
+
# Get service recommendations from Luma that meet the criteria of your ruleset.
|
5
|
+
def get_promise(params = {})
|
6
|
+
url = 'luma/promise'
|
7
|
+
wrapped_params = { shipment: params }
|
8
|
+
response = @client.make_request(:post, url, wrapped_params)
|
9
|
+
|
10
|
+
EasyPost::InternalUtilities::Json.convert_json_to_object(response).luma_info
|
11
|
+
end
|
12
|
+
end
|
@@ -113,8 +113,8 @@ class EasyPost::Services::Shipment < EasyPost::Services::Service
|
|
113
113
|
# Retrieves the estimated delivery date of each Rate via SmartRate.
|
114
114
|
def retrieve_estimated_delivery_date(id, planned_ship_date)
|
115
115
|
url = "shipments/#{id}/smartrate/delivery_date"
|
116
|
-
|
117
|
-
response = @client.make_request(:get, url,
|
116
|
+
wrapped_params = { planned_ship_date: planned_ship_date }
|
117
|
+
response = @client.make_request(:get, url, wrapped_params)
|
118
118
|
|
119
119
|
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS).rates
|
120
120
|
end
|
@@ -122,9 +122,26 @@ class EasyPost::Services::Shipment < EasyPost::Services::Service
|
|
122
122
|
# Retrieve a recommended ship date for an existing Shipment via the Precision Shipping API, based on a specific desired delivery date.
|
123
123
|
def recommend_ship_date(id, desired_delivery_date)
|
124
124
|
url = "shipments/#{id}/smartrate/precision_shipping"
|
125
|
-
|
126
|
-
response = @client.make_request(:get, url,
|
125
|
+
wrapped_params = { desired_delivery_date: desired_delivery_date }
|
126
|
+
response = @client.make_request(:get, url, wrapped_params)
|
127
127
|
|
128
128
|
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS).rates
|
129
129
|
end
|
130
|
+
|
131
|
+
# Create and buy a Luma Shipment in one call.
|
132
|
+
def create_and_buy_luma(params = {})
|
133
|
+
url = 'shipments/luma'
|
134
|
+
wrapped_params = { shipment: params }
|
135
|
+
response = @client.make_request(:post, url, wrapped_params)
|
136
|
+
|
137
|
+
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Buy a Shipment with Luma.
|
141
|
+
def buy_luma(id, params = {})
|
142
|
+
url = "shipments/#{id}/luma"
|
143
|
+
response = @client.make_request(:post, url, params)
|
144
|
+
|
145
|
+
EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
|
146
|
+
end
|
130
147
|
end
|
data/lib/easypost/services.rb
CHANGED
@@ -20,6 +20,7 @@ require_relative 'services/customs_item'
|
|
20
20
|
require_relative 'services/end_shipper'
|
21
21
|
require_relative 'services/event'
|
22
22
|
require_relative 'services/insurance'
|
23
|
+
require_relative 'services/luma'
|
23
24
|
require_relative 'services/order'
|
24
25
|
require_relative 'services/parcel'
|
25
26
|
require_relative 'services/pickup'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easypost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- EasyPost Developers
|
@@ -341,6 +341,7 @@ files:
|
|
341
341
|
- lib/easypost/services/end_shipper.rb
|
342
342
|
- lib/easypost/services/event.rb
|
343
343
|
- lib/easypost/services/insurance.rb
|
344
|
+
- lib/easypost/services/luma.rb
|
344
345
|
- lib/easypost/services/order.rb
|
345
346
|
- lib/easypost/services/parcel.rb
|
346
347
|
- lib/easypost/services/pickup.rb
|