knockapi 0.5.1 → 0.6.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: a134ca1b8dfef66365a05c99f1eb70146f647d1df31978da691b81b09016d37e
4
- data.tar.gz: ce602039743e58d61f5a926aec90996a95e6635343b148df247c914b33597cd4
3
+ metadata.gz: 7a526dd568aa49b46a2f2d231613f08f1050f7e3bee2a082960decd08208baf5
4
+ data.tar.gz: 6f12896b9f0f024002bc2da4bb5700985cdc47716e2d343ed33428c50b653f9e
5
5
  SHA512:
6
- metadata.gz: 78a5c9740fd5fe6328ffaa1b8582dbf93221fc2775bdfc3471935c86de5bbb2fe1b9d80f2e7280c3a8bdb6bdc99cc59180a9e46ab77b6041673aae06ab3d43d7
7
- data.tar.gz: 4dd3a4622d8d2cddd6b1b6b895740071603ffc613971e817bd58baa650602cc2c835664935d06500a768d83c00e8961b4eadbbf1e65b8cc91462b9c13d0fc7ee
6
+ metadata.gz: de4bc6ceefb3481d8f8d2e8850c31563a46c7298a18d379c8304ed77b46dddeea3792307c1e1ce23a69ff95979eb7fab1d85ac5f659541b98559966bb15e3433
7
+ data.tar.gz: f02009ea0c6f503104190e9c23469c2644602c6505c8c6ddbe395d99efd1d56324700cf9db8351cd020651e1bcc6bc7e1bc3869c5120dae9663f14a794c717c3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- knockapi (0.5.1)
4
+ knockapi (0.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 APIError.new(
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 InvalidRequestError.new(
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/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Knock
4
- VERSION = '0.5.1'
4
+ VERSION = '0.6.0'
5
5
  end
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.5.1
4
+ version: 0.6.0
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-07-29 00:00:00.000000000 Z
11
+ date: 2024-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler