active_call-api 0.1.1 → 0.1.3
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 +8 -0
- data/README.md +6 -0
- data/lib/active_call/api/attributes.rb +7 -0
- data/lib/active_call/api/locale/en.yml +1 -0
- data/lib/active_call/api/version.rb +1 -1
- data/lib/active_call/api.rb +15 -0
- data/lib/active_call/error.rb +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5c3f38434e7692958582f2a3f817729b8d1d9890e6b66ea57f480d749b75d32
|
4
|
+
data.tar.gz: 2205f34f43fd3aade686c13a409d7bb3cc488e465c99da41d77f55f1954edc7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caf0cc2f7811f8ad07e36afc1348d043569ac3473bfc6faba830d61255ee3931cbddd61760bbc42a42a60ccb38790fde4abe49d3150ac078644761c3691c8b92
|
7
|
+
data.tar.gz: 2c11d2c5633b359592a8112efe2e9f97dcb1999b079b0f73ba5d30f52144af66244c817cbd14b8fa6f8f864ff05cef7ef3f9e764582f751767d6bb6950c1102f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [0.1.3] - 2025-04-02
|
2
|
+
|
3
|
+
- Added HTTP status code 410 Gone
|
4
|
+
|
5
|
+
## [0.1.2] - 2025-03-28
|
6
|
+
|
7
|
+
- Fix for when included in a Rails app when getting `<NoMethodError: undefined method 'attributes'`.
|
8
|
+
|
1
9
|
## [0.1.1] - 2025-03-27
|
2
10
|
|
3
11
|
- Remove `include ActiveModel::Validations`, it is already included with `active_call`.
|
data/README.md
CHANGED
@@ -127,6 +127,7 @@ The following exceptions will get raised when using `call!` and the request was
|
|
127
127
|
| **407** | `ActiveCall::ProxyAuthenticationRequiredError` |
|
128
128
|
| **408** | `ActiveCall::RequestTimeoutError` |
|
129
129
|
| **409** | `ActiveCall::ConflictError` |
|
130
|
+
| **410** | `ActiveCall::GoneError` |
|
130
131
|
| **422** | `ActiveCall::UnprocessableEntityError` |
|
131
132
|
| **429** | `ActiveCall::TooManyRequestsError` |
|
132
133
|
| **5xx** | `ActiveCall::ServerError` |
|
@@ -165,6 +166,7 @@ class YourGem::BaseService < ActiveCall::Base
|
|
165
166
|
proxy_authentication_required: YourGem::ProxyAuthenticationRequiredError,
|
166
167
|
request_timeout: YourGem::RequestTimeoutError,
|
167
168
|
conflict: YourGem::ConflictError,
|
169
|
+
gone: YourGem::GoneError,
|
168
170
|
unprocessable_entity: YourGem::UnprocessableEntityError,
|
169
171
|
too_many_requests: YourGem::TooManyRequestsError,
|
170
172
|
internal_server_error: YourGem::InternalServerError,
|
@@ -229,6 +231,10 @@ class YourGem::BaseService < ActiveCall::Base
|
|
229
231
|
response.status == 409
|
230
232
|
end
|
231
233
|
|
234
|
+
def gone?
|
235
|
+
response.status == 410
|
236
|
+
end
|
237
|
+
|
232
238
|
def unprocessable_entity?
|
233
239
|
response.status == 422
|
234
240
|
end
|
data/lib/active_call/api.rb
CHANGED
@@ -38,6 +38,7 @@ module ActiveCall::Api
|
|
38
38
|
errors.add(:base, :proxy_authentication_required) and throw :abort if proxy_authentication_required?
|
39
39
|
errors.add(:base, :request_timeout) and throw :abort if request_timeout?
|
40
40
|
errors.add(:base, :conflict) and throw :abort if conflict?
|
41
|
+
errors.add(:base, :gone) and throw :abort if gone?
|
41
42
|
errors.add(:base, :unprocessable_entity) and throw :abort if unprocessable_entity?
|
42
43
|
errors.add(:base, :too_many_requests) and throw :abort if too_many_requests?
|
43
44
|
|
@@ -90,6 +91,7 @@ module ActiveCall::Api
|
|
90
91
|
proxy_authentication_required: ActiveCall::ProxyAuthenticationRequiredError,
|
91
92
|
request_timeout: ActiveCall::RequestTimeoutError,
|
92
93
|
conflict: ActiveCall::ConflictError,
|
94
|
+
gone: ActiveCall::GoneError,
|
93
95
|
unprocessable_entity: ActiveCall::UnprocessableEntityError,
|
94
96
|
too_many_requests: ActiveCall::TooManyRequestsError,
|
95
97
|
internal_server_error: ActiveCall::InternalServerError,
|
@@ -270,6 +272,10 @@ module ActiveCall::Api
|
|
270
272
|
response.status == 409
|
271
273
|
end
|
272
274
|
|
275
|
+
def gone?
|
276
|
+
response.status == 410
|
277
|
+
end
|
278
|
+
|
273
279
|
def unprocessable_entity?
|
274
280
|
response.status == 422
|
275
281
|
end
|
@@ -302,3 +308,12 @@ end
|
|
302
308
|
ActiveSupport.on_load(:i18n) do
|
303
309
|
I18n.load_path << File.expand_path('api/locale/en.yml', __dir__)
|
304
310
|
end
|
311
|
+
|
312
|
+
ActiveSupport.on_load(:active_record) do
|
313
|
+
# Getting the following error when the gem is included in a Rails application with ActiveRecord.
|
314
|
+
#
|
315
|
+
# <NoMethodError: undefined method `attributes' for an instance of YourGem::SomeResource::UpdateService>
|
316
|
+
#
|
317
|
+
# Struggling to get to the root of the issue, but this seems to help ¯\(°_o)/¯
|
318
|
+
ActiveCall::Api.include(ActiveCall::Api::Attributes)
|
319
|
+
end
|
data/lib/active_call/error.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_call-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kobus Joubert
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_call
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|
83
83
|
- lib/active_call/api.rb
|
84
|
+
- lib/active_call/api/attributes.rb
|
84
85
|
- lib/active_call/api/locale/en.yml
|
85
86
|
- lib/active_call/api/version.rb
|
86
87
|
- lib/active_call/error.rb
|