linkheaders-processor 0.1.8 → 0.1.16

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: af390c80d1304df2d885e4bb19ad6be8a95e695b7b88ac2a59762e8f11d17dff
4
- data.tar.gz: f3e90daa90734be50afb722f6023ecb6594c778776c987c0a4bf9b42e4d3aeaa
3
+ metadata.gz: ef79d8492d08ea54cc8c23067d4f3c443dee0941f5d901007928d62df93d8073
4
+ data.tar.gz: ec81315a8baedf8ea2b0ffdc1c882d44647ca45b0a2a5a1f71734c47ce3d9f64
5
5
  SHA512:
6
- metadata.gz: 100903ef954dc3b40aaea1f97b285bb5dce59703a968905c9a9a7933416c1e4b847de32d0c03de5c646b3d0ae8d6d9a73ae003c315ee335aac10a956cfc38bfb
7
- data.tar.gz: 71b0b8b7ad489ee6f3db7787fa6de0da3b3bbc40c2f16c53f16586be88233f3c88693c848624bd592d1a923ea9d90e535eaf6841547cade3e96664bdde6cdba4
6
+ metadata.gz: 0b510601d2b51739b893b07c546d1ed723dd2bef296c3af59b7fdc3dbfdcfdc08f8e20741c6f2f9ca0957675c02c9ddfb6d5a21201976f256b1b2a45ee7dde2b
7
+ data.tar.gz: d20ed0c9b8b04607b104aad8ce5a07c26cc12ae16b925c9ccd3e9feca78f691592976a352ac301a907d517eb55b8972960b7cec4fc3913316c9453f1d2549098
data/Gemfile CHANGED
@@ -7,6 +7,4 @@ gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
9
9
 
10
- gem "rspec", "~> 3.0"
11
-
12
10
  gem "rubocop", "~> 1.21"
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- linkheaders-processor (0.1.8)
4
+ linkheaders-processor (0.1.16)
5
5
  json (~> 2.0)
6
6
  json-ld (~> 3.2)
7
7
  json-ld-preloaded (~> 3.2)
8
+ link_header (~> 0.0.8)
8
9
  metainspector (~> 5.11.2)
9
10
  rest-client (~> 2.1)
10
11
  securerandom (~> 0.1.0)
@@ -117,7 +118,7 @@ GEM
117
118
  diff-lcs (>= 1.2.0, < 2.0)
118
119
  rspec-support (~> 3.11.0)
119
120
  rspec-support (3.11.0)
120
- rubocop (1.32.0)
121
+ rubocop (1.33.0)
121
122
  json (~> 2.3)
122
123
  parallel (~> 1.10)
123
124
  parser (>= 3.1.0.0)
@@ -143,7 +144,7 @@ PLATFORMS
143
144
  DEPENDENCIES
144
145
  linkheaders-processor!
145
146
  rake (~> 13.0)
146
- rspec (~> 3.0)
147
+ rspec (~> 3.11)
147
148
  rubocop (~> 1.21)
148
149
 
149
150
  BUNDLED WITH
data/README.md CHANGED
@@ -2,24 +2,24 @@
2
2
 
3
3
  A gem to extract Link Headers from Web responses.
4
4
 
5
- This module handles HTTP Link Headers, HTML Link Headers, and auto-follows links to LinkSets in both JSON and Text format, and processes them also.
5
+ This module handles HTTP Link Headers, HTML Link Headers, and auto-follows links to LinkSets in both JSON and Text format, and processes them also. It also handles some unusual cases, such as having multiple relation types in a single link, or when dealing with 204 or 410 response where there is no message body.
6
6
 
7
7
  ## Installation
8
8
 
9
9
  Install the gem and add to the application's Gemfile by executing:
10
10
 
11
- $ bundle add linkheader-processor
11
+ $ bundle add linkheaders-processor
12
12
 
13
13
  If bundler is not being used to manage dependencies, install the gem by executing:
14
14
 
15
- $ gem install linkheader-processor
15
+ $ gem install linkheaders-processor
16
16
 
17
17
  ## Usage
18
18
 
19
19
 
20
20
  ```
21
21
 
22
- require 'linkheader/processor'
22
+ require 'linkheaders/processor'
23
23
  require 'rest-client'
24
24
 
25
25
  # url1 has http link headers, and a reference to a linkset in json format
@@ -28,27 +28,33 @@ If bundler is not being used to manage dependencies, install the gem by executin
28
28
  # url2 has http link headers, with a reference to a linkset in legacy text format
29
29
  url2 = "https://s11.no/2022/a2a-fair-metrics/28-http-linkset-txt-only/"
30
30
 
31
- p = LinkHeader::Parser.new(default_anchor: url1)
31
+ p = LinkHeaders::Processor.new(default_anchor: url1)
32
32
  r = RestClient.get(url1)
33
33
 
34
34
  p.extract_and_parse(response: r)
35
- factory = p.factory # LinkHeader::LinkFactory
35
+ factory = p.factory # LinkHeaders::LinkFactory
36
36
 
37
37
  factory.all_links.each do |l|
38
38
  puts l.href
39
39
  puts l.relation
40
40
  puts l.responsepart
41
41
 
42
+ # Additional properties are added as other instance methods
43
+ # you can access them as follows:
44
+
42
45
  puts l.linkmethods # returns list of instance methods beyond href and relation, that are attributes of the link
43
46
  l.linkmethods.each do |method|
44
47
  puts "#{method}=" + l.send(method)
45
48
  end
49
+ # or
50
+ puts l.type if l.respond_to? 'type'
46
51
  puts
52
+
47
53
  end
48
54
 
49
55
 
50
56
 
51
- p = LinkHeader::Parser.new(default_anchor: url2)
57
+ p = LinkHeaders::Processor.new(default_anchor: url2)
52
58
  r = RestClient.get(url2)
53
59
 
54
60
  p.extract_and_parse(response: r)
@@ -1,3 +1,4 @@
1
+
1
2
  module LinkHeaders
2
3
  class LinkFactory
3
4
 
@@ -5,7 +6,7 @@ module LinkHeaders
5
6
  attr_accessor :default_anchor
6
7
  # @return [Array] An array of strings containing any warnings that were encountered when creating the link (e.g. duplicate cite-as but non-identical URLs)
7
8
  attr_accessor :warnings
8
- @@all_links = Array.new
9
+ attr_accessor :all_links
9
10
 
10
11
  #
11
12
  # Create the LinkFacgtory Object
@@ -15,8 +16,10 @@ module LinkHeaders
15
16
  def initialize(default_anchor: 'https://example.org/')
16
17
  @default_anchor = default_anchor
17
18
  @warnings = Array.new
19
+ @all_links = Array.new
18
20
  end
19
21
 
22
+
20
23
  #
21
24
  # Create a new LinkHeader::Link object
22
25
  #
@@ -30,9 +33,13 @@ module LinkHeaders
30
33
  #
31
34
  def new_link(responsepart:, href:, relation:, anchor: @default_anchor, **kwargs)
32
35
  # warn "creating new link with kw #{kwargs}"
33
- link = LinkHeader::Link.new(responsepart: responsepart, factory: self, href: href, anchor: anchor, relation: relation, **kwargs)
36
+ if relation.split(/\s/).length > 1
37
+ @warnings |= ['WARN: the link relation contains spaces. This is allowed by the standard to indicate multiple relations for the same link, but this MUST be processed before creating a LinkHeaders::Link object!']
38
+ end
39
+
40
+ link = LinkHeaders::Link.new(responsepart: responsepart, factory: self, href: href, anchor: anchor, relation: relation, **kwargs)
34
41
  link = sanitycheck(link) # this will add warnings if the link already exists and has a conflict. returns the original of a duplicate
35
- @@all_links |= [link]
42
+ self.all_links |= [link]
36
43
  return link
37
44
  end
38
45
 
@@ -42,7 +49,7 @@ module LinkHeaders
42
49
  # @return [Array] Array of all LinkHeader::Link objects created by the factory so far
43
50
  #
44
51
  def all_links
45
- @@all_links
52
+ @all_links
46
53
  end
47
54
 
48
55
  #
@@ -106,19 +113,21 @@ module LinkHeaders
106
113
  end
107
114
 
108
115
  def sanitycheck(link)
109
- flag = true
116
+ if link.relation == "describedby" and !(link.respond_to? 'type')
117
+ @warnings |= ['WARN: A describedby link should include a "type" attribute, to know the MIME type of the addressed description']
118
+ end
119
+
110
120
  self.all_links.each do |l|
111
121
  if l.relation == "cite-as" and link.relation == "cite-as"
112
122
  if l.href != link.href
113
- @warnings << 'WARN: Found conflicting cite-as relations. This should never happen'
123
+ @warnings |= ['WARN: Found conflicting cite-as relations. This should never happen']
114
124
  end
115
125
  end
116
126
  if l.href == link.href
117
127
  if l.relation != link.relation
118
- @warnings << 'WARN: Found identical hrefs with different relation types. This may be suspicious. Both have been retained'
119
- end
120
- if l.relation = link.relation
121
- @warnings << 'WARN: found apparent duplicate. Ignoring and returning known link'
128
+ @warnings |= ['WARN: Found identical hrefs with different relation types. This may be suspicious. Both have been retained']
129
+ else
130
+ @warnings |= ['WARN: found apparent duplicate. Ignoring and returning known link']
122
131
  link = l
123
132
  end
124
133
  end
@@ -183,5 +192,24 @@ module LinkHeaders
183
192
  self.send("#{k}=", v)
184
193
  end
185
194
  end
195
+
196
+ #
197
+ # Create an HTML version of the link
198
+ # @return [String] HTML version of the Link object
199
+ #
200
+ def to_html
201
+ methods = self.linkmethods
202
+ href = self.href
203
+ rel = self.relation
204
+ anchor = self.anchor
205
+ properties = []
206
+ methods.each do |method|
207
+ value = self.send(method)
208
+ properties << [method, value]
209
+ end
210
+ properties << ["rel", rel]
211
+ properties << ["anchor", anchor]
212
+ LinkHeader::Link.new(href, properties).to_html
213
+ end
186
214
  end
187
215
  end
@@ -3,6 +3,6 @@
3
3
 
4
4
  module LinkHeaders
5
5
  class Processor
6
- VERSION = "0.1.8"
6
+ VERSION = "0.1.16"
7
7
  end
8
8
  end
@@ -1,10 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'processor/version'
4
- require_relative 'constants'
5
4
  require_relative 'link'
6
5
  require_relative 'web_utils'
7
-
6
+ require 'link_header'
8
7
  require 'json'
9
8
  require 'rest-client'
10
9
  require 'securerandom'
@@ -17,7 +16,7 @@ module LinkHeaders
17
16
  #
18
17
  # Works for both HTML and HTTP links, and handles references to Linksets of either JSON or Text types
19
18
  #
20
- class Parser
19
+ class Processor
21
20
  # @return [<Type>] <description>
22
21
  attr_accessor :default_anchor, :factory
23
22
 
@@ -28,7 +27,7 @@ module LinkHeaders
28
27
  #
29
28
  def initialize(default_anchor: 'https://default.anchor.org/')
30
29
  @default_anchor = default_anchor
31
- @factory = LinkHeader::LinkFactory.new(default_anchor: @default_anchor)
30
+ @factory = LinkHeaders::LinkFactory.new(default_anchor: @default_anchor)
32
31
  end
33
32
 
34
33
  #
@@ -60,10 +59,14 @@ module LinkHeaders
60
59
  return [[], []]
61
60
  end
62
61
 
63
- parse_http_link_headers(head) # pass guid to check against anchors in linksets
64
- HTML_FORMATS['html'].each do |format|
62
+ newlinks = parse_http_link_headers(head) # pass guid to check against anchors in linksets
63
+ warn "HTTPlinks #{newlinks.inspect}"
64
+
65
+ ['text/html','text/xhtml+xml', 'application/xhtml+xml'].each do |format|
65
66
  if head[:content_type] and head[:content_type].match(format)
67
+ warn "found #{format} content - parsing"
66
68
  htmllinks = parse_html_link_headers(body) # pass html body to find HTML link headers
69
+ warn "htmllinks #{htmllinks.inspect}"
67
70
  end
68
71
  end
69
72
  end
@@ -75,7 +78,7 @@ module LinkHeaders
75
78
  #
76
79
  #
77
80
  def parse_http_link_headers(headers)
78
-
81
+ newlinks = Array.new
79
82
  # Link: <https://example.one.com>; rel="preconnect", <https://example.two.com>; rel="preconnect", <https://example.three.com>; rel="preconnect"
80
83
  links = headers[:link]
81
84
  return [] unless links
@@ -85,11 +88,13 @@ module LinkHeaders
85
88
  # warn parts
86
89
 
87
90
  # Parse each part into a named link
88
- split_http_link_headers(parts) # creates links from the split headers and adds to factory.all_links
89
- check_for_linkset(responsepart: :header) # all links are held in the Linkset::LinkFactory object (factory variable here). This scans the links for a linkset link to follow
91
+ newlinks << split_http_link_headers_and_process(parts) # creates links from the split headers and adds to factory.all_links
92
+ newlinks << check_for_linkset(responsepart: :header) # all links are held in the Linkset::LinkFactory object (factory variable here). This scans the links for a linkset link to follow
93
+ newlinks
90
94
  end
91
95
 
92
- def split_http_link_headers(parts)
96
+ def split_http_link_headers_and_process(parts)
97
+ newlinks = Array.new
93
98
  parts.each do |part, _index|
94
99
  # warn "link is: #{part}"
95
100
 
@@ -117,9 +122,15 @@ module LinkHeaders
117
122
  sections.delete('anchor')
118
123
  relation = sections['rel']
119
124
  sections.delete('rel')
125
+ relations = relation.split(/\s+/) # handle the multiple relation case
126
+ $stderr.puts "RELATIONS #{relations}"
120
127
 
121
- factory.new_link(responsepart: :header, anchor: anchor, href: href, relation: relation, **sections) # parsed['https://example.one.com'][:rel] = "preconnect"
128
+ relations.each do |rel|
129
+ next unless rel.match?(/\w/)
130
+ newlinks << factory.new_link(responsepart: :header, anchor: anchor, href: href, relation: rel, **sections) # parsed['https://example.one.com'][:rel] = "preconnect"
131
+ end
122
132
  end
133
+ newlinks
123
134
  end
124
135
 
125
136
  #
@@ -130,9 +141,9 @@ module LinkHeaders
130
141
  def parse_html_link_headers(body)
131
142
  m = MetaInspector.new('http://example.org', document: body)
132
143
  # an array of elements that look like this: [{:rel=>"alternate", :type=>"application/ld+json", :href=>"http://scidata.vitk.lv/dataset/303.jsonld"}]
133
-
144
+ newlinks = Array.new
134
145
  m.head_links.each do |l|
135
- # warn "link is: #{l}"
146
+ warn "HTML head link is: #{l.inspect}"
136
147
  next unless l[:href] and l[:rel] # required
137
148
 
138
149
  anchor = l[:anchor] || default_anchor
@@ -140,14 +151,23 @@ module LinkHeaders
140
151
  relation = l[:rel]
141
152
  l.delete(:rel)
142
153
  href = l[:href]
143
- l.delete(:href)
144
- factory.new_link(responsepart: :body, anchor: anchor, href: href, relation: relation, **l)
154
+ l.delete(:href)
155
+
156
+ relations = relation.split(/\s+/) # handle the multiple relation case
157
+ $stderr.puts "RELATIONS #{relations}"
158
+
159
+ relations.each do |rel|
160
+ next unless rel.match?(/\w/)
161
+ newlinks << factory.new_link(responsepart: :header, anchor: anchor, href: href, relation: rel, **l) # parsed['https://example.one.com'][:rel] = "preconnect"
162
+ end
145
163
  end
146
- check_for_linkset(responsepart: :body)
164
+ newlinks << check_for_linkset(responsepart: :body)
165
+ newlinks
147
166
  end
148
167
 
149
168
  def check_for_linkset(responsepart:)
150
- # warn "looking for a linkset"
169
+ warn "looking for a linkset"
170
+ newlinks = Array.new
151
171
  factory.linksets.each do |linkset|
152
172
  # warn "found #{linkset.methods- Object.new.methods}"
153
173
  # warn "inspect #{linkset.inspect}"
@@ -156,20 +176,21 @@ module LinkHeaders
156
176
  case linkset.type
157
177
  when 'application/linkset+json'
158
178
  # warn "found a json linkset"
159
- processJSONLinkset(href: linkset.href)
179
+ newlinks << processJSONLinkset(href: linkset.href)
160
180
  when 'application/linkset'
161
181
  # warn "found a text linkset"
162
- processTextLinkset(href:linkset.href)
182
+ newlinks << processTextLinkset(href:linkset.href)
163
183
  else
164
184
  warn "the linkset #{linkset} was not typed as 'application/linkset+json' or 'application/linkset', and it should be! (found #{linkset.type}) Ignoring..."
165
185
  end
166
186
  end
187
+ newlinks
167
188
  end
168
189
 
169
190
  def processJSONLinkset(href:)
170
- _headers, linkset = fetch(href, { 'Accept' => 'application/linkset+json' })
191
+ _headers, linkset = lhfetch(href, { 'Accept' => 'application/linkset+json' })
171
192
  # warn "Linkset body #{linkset.inspect}"
172
-
193
+ newlinks = Array.new
173
194
  return nil unless linkset
174
195
 
175
196
  # linkset = '{ "linkset":
@@ -194,10 +215,10 @@ module LinkHeaders
194
215
  attrhash = {}
195
216
  # warn ls.keys, "\n"
196
217
 
197
- ls.each_key do |reltype| # key = e.g. "item", "described-by". "cite"
218
+ ls.each_key do |relation| # key = e.g. "item", "described-by". "cite"
198
219
  # warn reltype, "\n"
199
220
  # warn ls[reltype], "\n"
200
- ls[reltype].each do |attrs| # attr = e.g. {"href": "http://example.com/foo1", "type": "text/html"}
221
+ ls[relation].each do |attrs| # attr = e.g. {"href": "http://example.com/foo1", "type": "text/html"}
201
222
  next unless attrs['href'] # this is a required attribute of a linkset relation
202
223
 
203
224
  href = attrs['href']
@@ -206,13 +227,21 @@ module LinkHeaders
206
227
  attrhash[attr.to_sym] = val
207
228
  end
208
229
  end
209
- factory.new_link(responsepart: :linkset, href: href, relation: reltype, anchor: anchor, **attrhash)
230
+
231
+ relations = relation.split(/\s+/) # handle the multiple relation case
232
+
233
+ relations.each do |rel|
234
+ next unless rel.match?(/\w/)
235
+ newlinks << factory.new_link(responsepart: :header, anchor: anchor, href: href, relation: rel, **attrhash) # parsed['https://example.one.com'][:rel] = "preconnect"
236
+ end
210
237
  end
211
238
  end
239
+ newlinks
212
240
  end
213
241
 
214
242
  def processTextLinkset(href:)
215
- headers, linkset = fetch(href, { 'Accept' => 'application/linkset' })
243
+ newlinks = Array.new
244
+ headers, linkset = lhfetch(href, { 'Accept' => 'application/linkset' })
216
245
  # warn "linkset body #{linkset.inspect}"
217
246
  return {} unless linkset
218
247
 
@@ -237,14 +266,19 @@ module LinkHeaders
237
266
  end
238
267
  warn "No link relation type... this is bad! Skipping" unless attrhash[:rel]
239
268
  next unless attrhash[:rel]
240
- reltype = attrhash[:rel]
269
+ relation = attrhash[:rel]
241
270
  attrhash.delete(:rel)
242
271
  anchor = attrhash[:anchor] || @default_anchor
243
272
  attrhash.delete(:anchor)
244
273
 
245
- factory.new_link(responsepart: :linkset, href: href, relation: reltype, anchor: anchor, **attrhash)
246
- # warn "created #{[href, reltype, anchor, **attrhash]}"
274
+ relations = relation.split(/\s+/) # handle the multiple relation case
275
+ #$stderr.puts "RELATIONS #{relations}"
276
+ relations.each do |rel|
277
+ next unless rel.match?(/\w/)
278
+ newlinks << factory.new_link(responsepart: :header, anchor: anchor, href: href, relation: rel, **attrhash) # parsed['https://example.one.com'][:rel] = "preconnect"
279
+ end
247
280
  end
281
+ newlinks
248
282
  end
249
283
  end
250
284
  end
@@ -1,4 +1,4 @@
1
- def fetch(url, headers = ACCEPT_ALL_HEADER) # we will try to retrieve turtle whenever possible
1
+ def lhfetch(url, headers = {accept: "*/*"})
2
2
  # warn "In fetch routine now. "
3
3
 
4
4
  # warn "executing call over the Web to #{url.to_s}"
@@ -1,7 +1,37 @@
1
1
  # frozen_string_literal: true
2
+ require_relative '../../lib/linkheaders/processor'
3
+ require 'rest-client'
4
+
5
+
6
+ url1 = "https://w3id.org/a2a-fair-metrics/22-http-html-citeas-describedby-mixed/"
7
+ p = LinkHeaders::Processor.new(default_anchor: url1)
8
+ r = RestClient.get(url1)
9
+ p.extract_and_parse(response: r)
10
+ factory = p.factory # LinkHeaders::LinkFactory
11
+
12
+
13
+ RSpec.describe LinkHeaders::Processor do
2
14
 
3
- RSpec.describe LinkHeader::Parser do
4
15
  it 'has a version number' do
5
- expect(LinkHeader::Parser::VERSION).not_to be nil
16
+ expect(LinkHeaders::Processor::VERSION).not_to be nil
17
+ end
18
+
19
+ it "should find PURL citeas which has described-by and cite-as in mixed HTTP and HTML headers" do
20
+ expect(factory.all_links.length).to eq 5
21
+ end
22
+ it "should find find href on all links" do
23
+ expect(factory.all_links.select{|l| l.href}.length).to eq 5
24
+ end
25
+ it "should find find href on all links" do
26
+ expect(factory.all_links.select{|l| l.anchor}.length).to eq 5
27
+ end
28
+ it "should find 5 links in mixed HTTP and HTML headers" do
29
+ expect(factory.all_links.select{|l| l.relation}.length).to eq 5
30
+ end
31
+ it "should find one citeas in mixed HTTP and HTML headers" do
32
+ expect(factory.all_links.select{|l| l.relation == 'cite-as'}.length).to eq 1
33
+ end
34
+ it "should find described-by in mixed HTTP and HTML headers" do
35
+ expect(factory.all_links.select{|l| l.relation == 'describedby'}.length).to eq 1
6
36
  end
7
37
  end
data/spec/spec_helper.rb CHANGED
@@ -7,7 +7,7 @@ RSpec.configure do |config|
7
7
  config.example_status_persistence_file_path = ".rspec_status"
8
8
 
9
9
  # Disable RSpec exposing methods globally on `Module` and `main`
10
- config.disable_monkey_patching!
10
+ # config.disable_monkey_patching!
11
11
 
12
12
  config.expect_with :rspec do |c|
13
13
  c.syntax = :expect
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linkheaders-processor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Wilkinson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-27 00:00:00.000000000 Z
11
+ date: 2022-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '3.11'
20
20
  type: :development
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: '0'
26
+ version: '3.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 5.11.2
111
+ - !ruby/object:Gem::Dependency
112
+ name: link_header
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.0.8
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.0.8
111
125
  description: A parser/processor for Link Headers and Linksets in both JSON and Text
112
126
  formats.
113
127
  email:
@@ -123,7 +137,6 @@ files:
123
137
  - README.md
124
138
  - Rakefile
125
139
  - launch.json
126
- - lib/linkheaders/constants.rb
127
140
  - lib/linkheaders/link.rb
128
141
  - lib/linkheaders/processor.rb
129
142
  - lib/linkheaders/processor/version.rb
@@ -1,28 +0,0 @@
1
- ACCEPT_ALL_HEADER = {'Accept' => 'text/turtle, application/ld+json, application/rdf+xml, text/xhtml+xml, application/n3, application/rdf+n3, application/turtle, application/x-turtle, text/n3, text/turtle, text/rdf+n3, text/rdf+turtle, application/n-triples' }
2
-
3
- TEXT_FORMATS = {
4
- 'text' => ['text/plain',],
5
- }
6
-
7
- RDF_FORMATS = {
8
- 'jsonld' => ['application/ld+json', 'application/vnd.schemaorg.ld+json'], # NEW FOR DATACITE
9
- 'turtle' => ['text/turtle','application/n3','application/rdf+n3',
10
- 'application/turtle', 'application/x-turtle','text/n3','text/turtle',
11
- 'text/rdf+n3', 'text/rdf+turtle'],
12
- #'rdfa' => ['text/xhtml+xml', 'application/xhtml+xml'],
13
- 'rdfxml' => ['application/rdf+xml'],
14
- 'triples' => ['application/n-triples','application/n-quads', 'application/trig']
15
- }
16
-
17
- XML_FORMATS = {
18
- 'xml' => ['text/xhtml','text/xml',]
19
- }
20
-
21
- HTML_FORMATS = {
22
- 'html' => ['text/html','text/xhtml+xml', 'application/xhtml+xml']
23
- }
24
-
25
- JSON_FORMATS = {
26
- 'json' => ['application/json',]
27
- }
28
-