easypost 5.1.1 → 5.3.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: 05dcc6dfaedaea7f8e6bbe28ab7bf510db31211cf664fcef76b42736929eeda6
4
- data.tar.gz: 4c70e841f3fc6c6542928cfed6bbb848f53200e80a77157cabcfd42438a72d3c
3
+ metadata.gz: 759f5d1f9b9695bab8f8b3f251891bcbd47c80c788c02bbd6931a7394ced4e28
4
+ data.tar.gz: d53c1a16d32deb694dc155079020aa49c0b1be479d16f13635684e2a881308ae
5
5
  SHA512:
6
- metadata.gz: 85306184880d3bd91c1232c7e5a360f21755de6889f075aa0155b91b1a8601abda4951ff4f9ac4f879a7159da805b40093e1f2625274606773b4feb868ec2f0b
7
- data.tar.gz: 88d77f2ec9743baaecdeba5556ff95161aa1817384043132bfb8a1334bb03adab3699f4375d37d75625a86bb41161e082c3dc0d8d40459c32a040cf138021510
6
+ metadata.gz: 332993e711d82b3c8b3f68363df38a56f94e5dfcb7abd43c6c53eb86171a3c518ca07ecf93a679b0c8db6fb72cf869012b81c293ee953220bf6cb258d3670940
7
+ data.tar.gz: 49323ec48974fe364913cf7f9201231b843a242d15206a98b5e8f34440c7cd6a640bd7a2972ca18292fb7c6af4e2b090a4dcc7f6b402752d3472ececf0084750
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v5.3.0 (2023-10-11)
4
+
5
+ - Migrate API Key-related functions out of `user` service into `api_key` service, deprecating the old and introducing the new
6
+
7
+ ## v5.2.0 (2023-09-14)
8
+
9
+ - Add `carrier_type` service + `carrier_type.all` method
10
+
3
11
  ## v5.1.1 (2023-09-05)
4
12
 
5
13
  - Fix endpoint for creating a FedEx Smartpost carrier account
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.1.1
1
+ 5.3.0
@@ -41,6 +41,7 @@ class EasyPost::Client
41
41
  EasyPost::Services::Billing,
42
42
  EasyPost::Services::CarrierAccount,
43
43
  EasyPost::Services::CarrierMetadata,
44
+ EasyPost::Services::CarrierType,
44
45
  EasyPost::Services::CustomsInfo,
45
46
  EasyPost::Services::CustomsItem,
46
47
  EasyPost::Services::EndShipper,
@@ -6,6 +6,7 @@ class EasyPost::Constants
6
6
  INVALID_PAYMENT_METHOD = 'The chosen payment method is not valid. Please try again.'
7
7
  MISSING_REQUIRED_PARAMETER = 'Required parameter %s is missing.'
8
8
  NO_MATCHING_RATES = 'No matching rates found.'
9
+ NO_USER_FOUND = 'No user found with the given id.'
9
10
  NO_MORE_PAGES = 'There are no more pages to retrieve.'
10
11
  NO_PAYMENT_METHODS = 'Billing has not been setup for this user. Please add a payment method.'
11
12
  STRIPE_CARD_CREATE_FAILED = 'Could not send card details to Stripe, please try again later.'
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A CarrierType details the valid fields for a CarrierAccount.
4
+ class EasyPost::Models::CarrierType < EasyPost::Models::EasyPostObject
5
+ end
@@ -10,6 +10,7 @@ require_relative 'models/batch'
10
10
  require_relative 'models/brand'
11
11
  require_relative 'models/carbon_offset'
12
12
  require_relative 'models/carrier_account'
13
+ require_relative 'models/carrier_type'
13
14
  require_relative 'models/customs_info'
14
15
  require_relative 'models/customs_item'
15
16
  require_relative 'models/end_shipper'
@@ -1,8 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class EasyPost::Services::ApiKey < EasyPost::Services::Service
4
- # Retrieve all api keys.
4
+ # Retrieve a list of all ApiKey objects.
5
5
  def all
6
6
  @client.make_request(:get, 'api_keys', EasyPost::Models::ApiKey)
7
7
  end
8
+
9
+ # Retrieve a list of ApiKey objects (works for the authenticated user or a child user).
10
+ def retrieve_api_keys_for_user(id)
11
+ api_keys = all
12
+
13
+ if api_keys.id == id
14
+ # This function was called on the authenticated user
15
+ return api_keys.keys
16
+ end
17
+
18
+ # This function was called on a child user (authenticated as parent, only return this child user's details).
19
+ api_keys.children.each do |child|
20
+ if child.id == id
21
+ return child.keys
22
+ end
23
+ end
24
+
25
+ raise EasyPost::Errors::FilteringError.new(EasyPost::Constants::NO_USER_FOUND)
26
+ end
8
27
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EasyPost::Services::CarrierType < EasyPost::Services::Service
4
+ MODEL_CLASS = EasyPost::Models::CarrierType
5
+
6
+ # Retrieve all carrier types
7
+ def all
8
+ @client.make_request(:get, 'carrier_types', MODEL_CLASS)
9
+ end
10
+ end
@@ -33,11 +33,15 @@ class EasyPost::Services::User < EasyPost::Services::Service
33
33
 
34
34
  # Retrieve a list of all ApiKey objects.
35
35
  def all_api_keys
36
+ warn '[DEPRECATION] `all_api_keys` is deprecated. Please use `all` in the `api_key` service instead.'
36
37
  @client.make_request(:get, 'api_keys', EasyPost::Models::ApiKey)
37
38
  end
38
39
 
39
40
  # Retrieve a list of ApiKey objects (works for the authenticated user or a child user).
40
41
  def api_keys(id)
42
+ warn '[DEPRECATION] `api_keys` is deprecated.
43
+ Please use `retrieve_api_keys_for_user` in the `api_key` service instead.'
44
+
41
45
  api_keys = all_api_keys
42
46
 
43
47
  if api_keys.id == id
@@ -13,6 +13,7 @@ require_relative 'services/beta_referral_customer'
13
13
  require_relative 'services/billing'
14
14
  require_relative 'services/carrier_account'
15
15
  require_relative 'services/carrier_metadata'
16
+ require_relative 'services/carrier_type'
16
17
  require_relative 'services/customs_info'
17
18
  require_relative 'services/customs_item'
18
19
  require_relative 'services/end_shipper'
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: 5.1.1
4
+ version: 5.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: 2023-09-05 00:00:00.000000000 Z
11
+ date: 2023-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brakeman
@@ -276,6 +276,7 @@ files:
276
276
  - lib/easypost/models/brand.rb
277
277
  - lib/easypost/models/carbon_offset.rb
278
278
  - lib/easypost/models/carrier_account.rb
279
+ - lib/easypost/models/carrier_type.rb
279
280
  - lib/easypost/models/customs_info.rb
280
281
  - lib/easypost/models/customs_item.rb
281
282
  - lib/easypost/models/end_shipper.rb
@@ -309,6 +310,7 @@ files:
309
310
  - lib/easypost/services/billing.rb
310
311
  - lib/easypost/services/carrier_account.rb
311
312
  - lib/easypost/services/carrier_metadata.rb
313
+ - lib/easypost/services/carrier_type.rb
312
314
  - lib/easypost/services/customs_info.rb
313
315
  - lib/easypost/services/customs_item.rb
314
316
  - lib/easypost/services/end_shipper.rb