rack-linkeddata 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc9deb8760334ad2f933b56890f20a8c7cf5f179ddce2c46d0b301c10f8391e5
4
- data.tar.gz: 791f3460f9ea1ac579b120fb450c6c092b3afdfaf2f0c2b9dd9732ac9236cb00
3
+ metadata.gz: 966d05516d9e34419506a0fdaa47a04e61ba51b18630f98f2590fc7d82c1a00b
4
+ data.tar.gz: 2a616206491f89c318b16beb61a35688965958271dce37b5a0ce412a17568507
5
5
  SHA512:
6
- metadata.gz: e6f32f42b0449dc2aef3752f3ede3b1313ee08f17c122a30cab1f907b1c36bba7233a12f500320b63cce689588d6f348a3d867afc39a2d862a974701cb5806f3
7
- data.tar.gz: ea371601178e5f934cf45604e86444286954c7690bc0e665e4ab0613aaff4ceb98061f07a0890115d217754cb2c95f6ce90baf2b20484396d8589c7f73153d1d
6
+ metadata.gz: 86a3666ae1e6e3e0ef7bc0bb730883ccce7063ebe1f7053eead450ad7498dff6aecf9cd2fdadd00f3da9ab5d3acef68696899feb045e8c139c8e1342fcd5e8bc
7
+ data.tar.gz: e98c08daae3e76e3b3c7c8037b718b5be537be1e1e74578d36f2addaa99d38ec1a1aeb1dcd94eb3c566823d700d13023aad107cd28613663ed263ae8f6c55d8c
data/README.md CHANGED
@@ -99,7 +99,7 @@ for N-Triples, N-Quads, Turtle, RDF/XML, RDF/JSON, JSON-LD, RDFa, TriG and TriX.
99
99
  ## Dependencies
100
100
 
101
101
  * [Rack](http://rubygems.org/gems/rack) (~> 2.0)
102
- * [Linked Data](http://rubygems.org/gems/linkeddata) (~> 3.0)
102
+ * [Linked Data](http://rubygems.org/gems/linkeddata) (~> 3.1)
103
103
 
104
104
  ## Installation
105
105
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.0
1
+ 3.1.0
@@ -9,18 +9,18 @@ module Rack
9
9
  ##
10
10
  # Registers all known RDF formats with Rack's MIME types registry.
11
11
  #
12
+ # @param [Boolean] :overwrite (false)
12
13
  # @param [Hash{Symbol => Object}] options
13
- # @option options [Boolean] :overwrite (false)
14
14
  # @return [void]
15
- def self.register_mime_types!(options = {})
15
+ def self.register_mime_types!(overwrite: false, **options)
16
16
  if defined?(Rack::Mime::MIME_TYPES)
17
17
  RDF::Format.each do |format|
18
- if !Rack::Mime::MIME_TYPES.has_key?(file_ext = ".#{format.to_sym}") || options[:overwrite]
18
+ if !Rack::Mime::MIME_TYPES.has_key?(file_ext = ".#{format.to_sym}") || overwrite
19
19
  Rack::Mime::MIME_TYPES.merge!(file_ext => format.content_type.first)
20
20
  end
21
21
  end
22
22
  RDF::Format.file_extensions.each do |file_ext, formats|
23
- if !Rack::Mime::MIME_TYPES.has_key?(file_ext = ".#{file_ext}") || options[:overwrite]
23
+ if !Rack::Mime::MIME_TYPES.has_key?(file_ext = ".#{file_ext}") || overwrite
24
24
  Rack::Mime::MIME_TYPES.merge!(file_ext => formats.first.content_type.first)
25
25
  end
26
26
  end
@@ -32,9 +32,9 @@ module Rack; module LinkedData
32
32
  # @param [#call] app
33
33
  # @param [Hash{Symbol => Object}] options
34
34
  # Other options passed to writer.
35
- # @option options [String] :default (DEFAULT_CONTENT_TYPE) Specific content type
35
+ # @param [String] :default (DEFAULT_CONTENT_TYPE) Specific content type
36
36
  # @option options [RDF::Format, #to_sym] :format Specific RDF writer format to use
37
- def initialize(app, options = {})
37
+ def initialize(app, options)
38
38
  @app, @options = app, options
39
39
  @options[:default] = (@options[:default] || DEFAULT_CONTENT_TYPE).to_s
40
40
  end
@@ -64,6 +64,8 @@ module Rack; module LinkedData
64
64
  # Serializes an `RDF::Enumerable` response into a Rack protocol
65
65
  # response using HTTP content negotiation rules or a specified Content-Type.
66
66
  #
67
+ # Passes parameters from Accept header, and Link header to writer.
68
+ #
67
69
  # @param [Hash{String => String}] env
68
70
  # @param [Integer] status
69
71
  # @param [Hash{String => Object}] headers
@@ -74,7 +76,11 @@ module Rack; module LinkedData
74
76
  find_writer(env, headers) do |writer, ct, accept_params = {}|
75
77
  begin
76
78
  # Passes content_type as writer option to allow parameters to be extracted.
77
- result, content_type = writer.dump(body, nil, @options.merge(accept_params: accept_params)), ct.split(';').first
79
+ writer_options = @options.merge(
80
+ accept_params: accept_params,
81
+ link: env['HTTP_LINK']
82
+ )
83
+ result, content_type = writer.dump(body, nil, **writer_options), ct.split(';').first
78
84
  break
79
85
  rescue RDF::WriterError
80
86
  # Continue to next writer
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-linkeddata
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arto Bendiken
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-12-17 00:00:00.000000000 Z
12
+ date: 2019-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: linkeddata
@@ -17,34 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '3.0'
20
+ version: '3.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '3.0'
27
+ version: '3.1'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rdf
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '3.0'
35
- - - ">="
36
- - !ruby/object:Gem::Version
37
- version: 3.0.8
34
+ version: '3.1'
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
38
  requirements:
42
39
  - - "~>"
43
40
  - !ruby/object:Gem::Version
44
- version: '3.0'
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 3.0.8
41
+ version: '3.1'
48
42
  - !ruby/object:Gem::Dependency
49
43
  name: rack
50
44
  requirement: !ruby/object:Gem::Requirement
@@ -65,28 +59,28 @@ dependencies:
65
59
  requirements:
66
60
  - - "~>"
67
61
  - !ruby/object:Gem::Version
68
- version: 0.9.12
62
+ version: 0.9.20
69
63
  type: :development
70
64
  prerelease: false
71
65
  version_requirements: !ruby/object:Gem::Requirement
72
66
  requirements:
73
67
  - - "~>"
74
68
  - !ruby/object:Gem::Version
75
- version: 0.9.12
69
+ version: 0.9.20
76
70
  - !ruby/object:Gem::Dependency
77
71
  name: rspec
78
72
  requirement: !ruby/object:Gem::Requirement
79
73
  requirements:
80
74
  - - "~>"
81
75
  - !ruby/object:Gem::Version
82
- version: '3.7'
76
+ version: '3.9'
83
77
  type: :development
84
78
  prerelease: false
85
79
  version_requirements: !ruby/object:Gem::Requirement
86
80
  requirements:
87
81
  - - "~>"
88
82
  - !ruby/object:Gem::Version
89
- version: '3.7'
83
+ version: '3.9'
90
84
  - !ruby/object:Gem::Dependency
91
85
  name: rack-test
92
86
  requirement: !ruby/object:Gem::Requirement
@@ -127,14 +121,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
121
  requirements:
128
122
  - - ">="
129
123
  - !ruby/object:Gem::Version
130
- version: 2.2.2
124
+ version: '2.4'
131
125
  required_rubygems_version: !ruby/object:Gem::Requirement
132
126
  requirements:
133
127
  - - ">="
134
128
  - !ruby/object:Gem::Version
135
129
  version: '0'
136
130
  requirements: []
137
- rubygems_version: 3.0.1
131
+ rubygems_version: 3.0.6
138
132
  signing_key:
139
133
  specification_version: 4
140
134
  summary: Linked Data content negotiation for Rack applications.