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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a490b659ed5817624823ce658ac7557662d362a79d3fdcd299fda513e4d70a6d
4
- data.tar.gz: bd49a9afc7da9416fcbe7f3bc6d6088a83863256a32457fb2fa0701721adca3e
3
+ metadata.gz: f953ec3c340b1b0db32a879914a9f9b6df21e5725def849674660a137cda3901
4
+ data.tar.gz: 22a71045b9b4fad02225c816661e71d40cb77a26fa0987d8e31e2b43072d6fea
5
5
  SHA512:
6
- metadata.gz: baaaeaed6a61e88644c96a7cf4f25627cd4eb5be33f77717814836afaefd3e56915dec5adae1033772ac2fd388dc9ba84a3c27e8392a75942d9c63a3c9ff3573
7
- data.tar.gz: 8ae9c41a8b377ea0de2ad14272e54247437a6c8716baba87709be6b87ebfe1fabd5729666549f1ddd1968a86ee3ad5521c8b2a9c9f8dd2cf54ecbff4d85dc06f
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.0.0
1
+ 7.1.0
@@ -48,6 +48,7 @@ class EasyPost::Client
48
48
  EasyPost::Services::EndShipper,
49
49
  EasyPost::Services::Event,
50
50
  EasyPost::Services::Insurance,
51
+ EasyPost::Services::Luma,
51
52
  EasyPost::Services::Order,
52
53
  EasyPost::Services::Parcel,
53
54
  EasyPost::Services::Pickup,
@@ -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
- UPS_OAUTH_CARRIER_ACCOUNT_TYPES = %w[UpsAccount UpsMailInnovationsAccount UpsSurepostAccount].freeze
6
- CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH = %w[AmazonShippingAccount].freeze
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
- update_url = if UPS_OAUTH_CARRIER_ACCOUNT_TYPES.include?(params[:type])
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 UPS_OAUTH_CARRIER_ACCOUNT_TYPES.include?(carrier_account_type)
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
- params = { planned_ship_date: planned_ship_date }
117
- response = @client.make_request(:get, url, params)
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
- params = { desired_delivery_date: desired_delivery_date }
126
- response = @client.make_request(:get, url, params)
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
@@ -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.0.0
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