rack-linkeddata 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rack/linkeddata/conneg.rb +29 -9
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1c9a0ddbc3a23ee37f6aefc9ba4adde4671181e
|
4
|
+
data.tar.gz: 14c2fbc74dfc76f243292eb7763b30ec4e3b23cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6270b177a3a3c72b8a28208c23ee207cd350da68cdff0ba3e5a0824df80bfcd0ed549a271ef4a845522f964396c136e4e2584dc5f3ab62253105557135ecec1e
|
7
|
+
data.tar.gz: 699e48429e41637e23cdea4d532ba6b8cb933755c80550465bbb69de5a276e2884e984dc67385c004d8e8123b55a5d02976565e8eea2b039b4d79ad3ca61fc3f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.2
|
@@ -119,14 +119,7 @@ module Rack; module LinkedData
|
|
119
119
|
# @param [String, #to_s] content_type
|
120
120
|
# @return [Array(Class, String)]
|
121
121
|
def find_writer_for_content_type(content_type)
|
122
|
-
writer =
|
123
|
-
when '*/*'
|
124
|
-
RDF::Writer.for(:content_type => (content_type = options[:default]))
|
125
|
-
when /^([^\/]+)\/\*$/
|
126
|
-
nil # TODO: match subtype wildcards
|
127
|
-
else
|
128
|
-
RDF::Writer.for(:content_type => content_type)
|
129
|
-
end
|
122
|
+
writer = RDF::Writer.for(content_type: content_type) if content_type
|
130
123
|
writer ? [writer, content_type] : nil
|
131
124
|
end
|
132
125
|
|
@@ -141,7 +134,8 @@ module Rack; module LinkedData
|
|
141
134
|
# @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
|
142
135
|
def parse_accept_header(header)
|
143
136
|
entries = header.to_s.split(',')
|
144
|
-
entries.map { |e| accept_entry(e) }.sort_by(&:last).map(&:first)
|
137
|
+
entries = entries.map { |e| accept_entry(e) }.sort_by(&:last).map(&:first)
|
138
|
+
entries.map { |e| find_content_type_for_media_range(e) }
|
145
139
|
end
|
146
140
|
|
147
141
|
def accept_entry(entry)
|
@@ -151,6 +145,32 @@ module Rack; module LinkedData
|
|
151
145
|
[type, [quality, type.count('*'), 1 - options.size]]
|
152
146
|
end
|
153
147
|
|
148
|
+
##
|
149
|
+
# Returns a content type appropriate for the given `media_range`,
|
150
|
+
# returns `nil` if `media_range` contains a wildcard subtype
|
151
|
+
# that is not mapped.
|
152
|
+
#
|
153
|
+
# @param [String, #to_s] media_range
|
154
|
+
# @return [String, nil]
|
155
|
+
def find_content_type_for_media_range(media_range)
|
156
|
+
case media_range.to_s
|
157
|
+
when '*/*'
|
158
|
+
options[:default]
|
159
|
+
when 'text/*'
|
160
|
+
'text/turtle'
|
161
|
+
when 'application/*'
|
162
|
+
'application/ld+json'
|
163
|
+
when 'application/json'
|
164
|
+
'application/ld+json'
|
165
|
+
when 'application/xml'
|
166
|
+
'application/rdf+xml'
|
167
|
+
when /^([^\/]+)\/\*$/
|
168
|
+
nil
|
169
|
+
else
|
170
|
+
media_range.to_s
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
154
174
|
##
|
155
175
|
# Outputs an HTTP `406 Not Acceptable` response.
|
156
176
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-linkeddata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arto Bendiken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: linkeddata
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|