easypost 5.2.0 → 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 +4 -4
- data/CHANGELOG.md +4 -0
- data/VERSION +1 -1
- data/lib/easypost/constants.rb +1 -0
- data/lib/easypost/services/api_key.rb +20 -1
- data/lib/easypost/services/user.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 759f5d1f9b9695bab8f8b3f251891bcbd47c80c788c02bbd6931a7394ced4e28
|
4
|
+
data.tar.gz: d53c1a16d32deb694dc155079020aa49c0b1be479d16f13635684e2a881308ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 332993e711d82b3c8b3f68363df38a56f94e5dfcb7abd43c6c53eb86171a3c518ca07ecf93a679b0c8db6fb72cf869012b81c293ee953220bf6cb258d3670940
|
7
|
+
data.tar.gz: 49323ec48974fe364913cf7f9201231b843a242d15206a98b5e8f34440c7cd6a640bd7a2972ca18292fb7c6af4e2b090a4dcc7f6b402752d3472ececf0084750
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.3.0
|
data/lib/easypost/constants.rb
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2023-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brakeman
|