knockapi 0.5.1 → 0.6.1
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/Gemfile.lock +1 -1
- data/lib/knock/client.rb +8 -2
- data/lib/knock/errors.rb +9 -0
- data/lib/knock/users.rb +2 -2
- data/lib/knock/version.rb +1 -1
- data/lib/knock.rb +3 -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: 02b5965b9c39219da8275caf8ea54d22451c919330a110155657f1dbc5fa480c
|
4
|
+
data.tar.gz: b43840005837b8649093bbb354b82f5401afcfcb260adb93c175a3837206f7dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ffbb9e5354ab085a0e1551d689847d3f6cb5ee9ad3ec0c765cbf54943cac5c3e1b663848a2c21395e8d83dd32838e0c2b0f9a1c88ad1bd38b7f37f6a149ce60
|
7
|
+
data.tar.gz: a904c79300bdd5f979520191dc2d10321814ba231243a74f2c8a1a093df9f21952bda7c4833a0d91fae529320f825bc09858aa5a97a60f6c4de58349de797ea9
|
data/Gemfile.lock
CHANGED
data/lib/knock/client.rb
CHANGED
@@ -103,7 +103,7 @@ module Knock
|
|
103
103
|
request_id: response['x-request-id']
|
104
104
|
)
|
105
105
|
when 404
|
106
|
-
raise
|
106
|
+
raise NotFoundError.new(
|
107
107
|
message: json['message'],
|
108
108
|
http_status: http_status,
|
109
109
|
request_id: response['x-request-id']
|
@@ -113,12 +113,18 @@ module Knock
|
|
113
113
|
errors = extract_error(json['errors']) if json['errors']
|
114
114
|
message += " (#{errors})" if errors
|
115
115
|
|
116
|
-
raise
|
116
|
+
raise UnprocessableEntityError.new(
|
117
117
|
message: message,
|
118
118
|
http_status: http_status,
|
119
119
|
request_id: response['x-request-id']
|
120
120
|
)
|
121
121
|
when 429
|
122
|
+
raise RateLimitExceededError.new(
|
123
|
+
message: json['message'],
|
124
|
+
http_status: http_status,
|
125
|
+
request_id: response['x-request-id']
|
126
|
+
)
|
127
|
+
else
|
122
128
|
raise APIError.new(
|
123
129
|
message: json['message'],
|
124
130
|
http_status: http_status,
|
data/lib/knock/errors.rb
CHANGED
@@ -43,6 +43,15 @@ module Knock
|
|
43
43
|
# parameters.
|
44
44
|
class InvalidRequestError < KnockError; end
|
45
45
|
|
46
|
+
# RateLimitExceededError is raised when the rate limit for the API has been hit
|
47
|
+
class RateLimitExceededError < KnockError; end
|
48
|
+
|
49
|
+
# NotFoundError is raised when a resource is not found
|
50
|
+
class NotFoundError < KnockError; end
|
51
|
+
|
46
52
|
# TimeoutError is raised when the HTTP request to the API times out
|
47
53
|
class TimeoutError < KnockError; end
|
54
|
+
|
55
|
+
# UnprocessableEntityError is raised when a request is made that cannot be processed
|
56
|
+
class UnprocessableEntityError < KnockError; end
|
48
57
|
end
|
data/lib/knock/users.rb
CHANGED
@@ -223,9 +223,9 @@ module Knock
|
|
223
223
|
endpoint = '/v1/users/bulk/preferences'
|
224
224
|
|
225
225
|
# Put the preference set id if it doesn't already exist
|
226
|
-
preferences['id'] = preference_set unless preferences.has_key('id')
|
226
|
+
preferences['id'] = preference_set unless preferences.has_key?('id')
|
227
227
|
|
228
|
-
request =
|
228
|
+
request = post_request(
|
229
229
|
auth: true,
|
230
230
|
path: endpoint,
|
231
231
|
body: {
|
data/lib/knock/version.rb
CHANGED
data/lib/knock.rb
CHANGED
@@ -49,7 +49,10 @@ module Knock
|
|
49
49
|
autoload :APIError, 'knock/errors'
|
50
50
|
autoload :AuthenticationError, 'knock/errors'
|
51
51
|
autoload :InvalidRequestError, 'knock/errors'
|
52
|
+
autoload :NotFoundError, 'knock/errors'
|
53
|
+
autoload :RateLimitExceededError, 'knock/errors'
|
52
54
|
autoload :TimeoutError, 'knock/errors'
|
55
|
+
autoload :UnprocessableEntityError, 'knock/errors'
|
53
56
|
|
54
57
|
# Triggers the workflow with the given key
|
55
58
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knockapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Knock Labs, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|