problem_details 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/README.md +4 -6
- data/VERSION +1 -1
- data/lib/problem_details/document.rb +1 -1
- data/lib/problem_details/version.rb +1 -1
- data/problem_details.gemspec +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fd24fabc07eeb260be9ba8ffcdedd2c26d6a6dab7cb5ad352afb6496c31ecde5
|
4
|
+
data.tar.gz: 4e60cd1565a490714a107de8a32bc96acd09f6471ebf7ea13b87962bd26ac818
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e43be8595c80c1a077b739745b05fa87930dfc5a05bea2ebd9a4dd373622936f9139d9e3321a3df6fd53c3fcfdae90df67de27db7b0e68367af23a6386ef1c46
|
7
|
+
data.tar.gz: 6886cef6f8cd9010dfc8befa0b4e068eb4d8c88e2bb2b495c913abade10fd92df808ac6af368469ae3202ad37254afc4292f1b62f6535a4bf22b0293bfb3e1d5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -16,7 +16,7 @@ Currently only JSON serialization is supported.
|
|
16
16
|
|
17
17
|
## Supported Versions
|
18
18
|
|
19
|
-
* Ruby 2.
|
19
|
+
* Ruby 2.4.x, 2.5.x, 2.6.x
|
20
20
|
* Rails 4.x, 5.x
|
21
21
|
* Sinatra >= 1.4
|
22
22
|
|
@@ -61,18 +61,19 @@ will produce:
|
|
61
61
|
|
62
62
|
```json
|
63
63
|
{
|
64
|
-
"type": "about:blank",
|
65
64
|
"title": "Not Found",
|
66
65
|
"status": 404
|
67
66
|
}
|
68
67
|
```
|
69
68
|
|
70
|
-
As above, the value of `type`
|
69
|
+
As above, the value of `type` is implied to be `about:blank` by default if the value is ommited, also the value of `title` is filled automatically from the status code. These are described in [Predefined Problem Types](https://tools.ietf.org/html/rfc7807#section-4.2):
|
71
70
|
|
72
71
|
> The "about:blank" URI, when used as a problem type, indicates that the problem has no additional semantics beyond that of the HTTP status code.
|
73
72
|
|
74
73
|
> When "about:blank" is used, the title SHOULD be the same as the recommended HTTP status phrase for that code (e.g., "Not Found" for 404, and so on)
|
75
74
|
|
75
|
+
> ..."about:blank" URI is the default value for that ["type"] member. Consequently, any problem details object not carrying an explicit "type" member implicitly uses this URI.
|
76
|
+
|
76
77
|
But you may also have the need to add some little hint, e.g. as a custom detail of the problem:
|
77
78
|
|
78
79
|
```ruby
|
@@ -83,7 +84,6 @@ will produce:
|
|
83
84
|
|
84
85
|
```json
|
85
86
|
{
|
86
|
-
"type": "about:blank",
|
87
87
|
"title": "Service Unavailable",
|
88
88
|
"status": 503,
|
89
89
|
"detail": "Database not reachable"
|
@@ -143,7 +143,6 @@ HTTP/1.1 422 Unprocessable Entity
|
|
143
143
|
Content-Type: application/problem+json; charset=utf-8
|
144
144
|
|
145
145
|
{
|
146
|
-
"type": "about:blank",
|
147
146
|
"title": "Unprocessable Entity",
|
148
147
|
"status": 422,
|
149
148
|
"errors": {
|
@@ -195,7 +194,6 @@ HTTP/1.1 400 Bad Request
|
|
195
194
|
Content-Type: application/problem+json
|
196
195
|
|
197
196
|
{
|
198
|
-
"type": "about:blank",
|
199
197
|
"title": "Bad Request",
|
200
198
|
"status": 400,
|
201
199
|
"foo": "bar"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -11,7 +11,7 @@ module ProblemDetails
|
|
11
11
|
|
12
12
|
def initialize(params = {})
|
13
13
|
params = params.dup
|
14
|
-
@type = params.delete(:type)
|
14
|
+
@type = params.delete(:type)
|
15
15
|
@status = Rack::Utils.status_code(params.delete(:status)) if params.key?(:status)
|
16
16
|
@title = params.delete(:title) || (@status ? ::Rack::Utils::HTTP_STATUS_CODES[@status] : nil)
|
17
17
|
@detail = params.delete(:detail)
|
data/problem_details.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.required_ruby_version = '>= 2.0.0'
|
26
26
|
|
27
27
|
spec.add_runtime_dependency 'rack', '>= 1.1.0'
|
28
|
-
spec.add_development_dependency 'bundler', '
|
28
|
+
spec.add_development_dependency 'bundler', '>= 1.16'
|
29
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: problem_details
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nobuhiro Nikushi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.16'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.16'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -101,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
|
-
|
105
|
-
rubygems_version: 2.5.1
|
104
|
+
rubygems_version: 3.0.3
|
106
105
|
signing_key:
|
107
106
|
specification_version: 4
|
108
107
|
summary: An implementation of RFC 7807 Problem Details for HTTP APIs
|