easypost 5.2.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 043543a947c3d50354a25d984eded8e68e37d9af9d7e2c6158176201426cafa1
4
- data.tar.gz: 15ebc3486ec63ac23b0dfa6de82001537a72697863e1587fd9a1d909cde33a9a
3
+ metadata.gz: 759f5d1f9b9695bab8f8b3f251891bcbd47c80c788c02bbd6931a7394ced4e28
4
+ data.tar.gz: d53c1a16d32deb694dc155079020aa49c0b1be479d16f13635684e2a881308ae
5
5
  SHA512:
6
- metadata.gz: 8a004acaa7797b54fd7226e4321a47e9aaa11aa055ee39dd886456d547f3e9ec847046c77f2f548a3f510c9d992842c4896fcb5beb6ee060280098e87ee2ae40
7
- data.tar.gz: 7b4f5377749b4d65278f744befef446cfcfe7372f171e64a6b42996b9c0c988b0a6370f949d2986698fc5484f66d4bc3cb879b0f714b04a25e9216c196d960ee
6
+ metadata.gz: 332993e711d82b3c8b3f68363df38a56f94e5dfcb7abd43c6c53eb86171a3c518ca07ecf93a679b0c8db6fb72cf869012b81c293ee953220bf6cb258d3670940
7
+ data.tar.gz: 49323ec48974fe364913cf7f9201231b843a242d15206a98b5e8f34440c7cd6a640bd7a2972ca18292fb7c6af4e2b090a4dcc7f6b402752d3472ececf0084750
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
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
+
3
7
  ## v5.2.0 (2023-09-14)
4
8
 
5
9
  - Add `carrier_type` service + `carrier_type.all` method
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.2.0
1
+ 5.3.0
@@ -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.'
@@ -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
@@ -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
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.2.0
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-14 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