shaf 3.0.0 → 3.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa31b5bc9a9cc80cc5b34c5a3f6101eb17ebf8166bd1a6ae46f0008709c3fa0f
4
- data.tar.gz: d4fc21aa271c30bb3e52bbc65571917beb0b16029e7ee764fc8705a5d4197ca8
3
+ metadata.gz: c508aa7154d738ed2009c18256326f590917af8c24d60bfacfd5bb91613c4270
4
+ data.tar.gz: 49e9fec1c522764bb1a722623cfb49cf8de3d6d7e026355a09310a6099828711
5
5
  SHA512:
6
- metadata.gz: 6820ebc741c7392a44a767d1be674394fb307c3e937997c0428dea3663fd57faa3ab9ff6700dedda76e522650373997413b4a5b256198d9646c4741a91ae33d7
7
- data.tar.gz: 9315cdd74263a2ae7b39f8a5960267aff7b61c498e0d95ca00559f61a3756f53f84f62b946bb24d8d818d901133cc537ef4402a0b3e201ae34f52b201015f72c
6
+ metadata.gz: d1d2ddda76cb3e76470f4cbc0297e72ef3c3b9c6119a12d101d999a50bc0aab37a442067ddd0cb4fdd3e698d0446982e65d199e633e46d875175e087f3bc9a61
7
+ data.tar.gz: 3d2c97ed1362ac58addf9c282e37d8754adad5a994c421d72779e4576dd91c8cbd1bbfc67689d20bf51bc20410270f61752383d36b11eb9dcbe28883c6552440
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'tempfile'
5
+ require 'uri'
6
+ require 'csv'
7
+
8
+ module Shaf
9
+ class LinkRelations
10
+ class LinkRelation
11
+ attr_reader :name, :description, :reference, :notes
12
+
13
+ def initialize(name, description, reference, notes)
14
+ @name = name.to_sym
15
+ @description = description.freeze
16
+ @reference = reference.freeze
17
+ @notes = notes.freeze
18
+ end
19
+ end
20
+
21
+ class << self
22
+ IANA_URL = URI('https://www.iana.org/assignments/link-relations/link-relations-1.csv')
23
+
24
+ def all
25
+ relations.values
26
+ end
27
+
28
+ def get(key)
29
+ load_iana
30
+ relations[key.to_sym]
31
+ end
32
+
33
+ def add(link_relation)
34
+ relations[link_relation.name.to_sym] = link_relation
35
+ end
36
+
37
+ private
38
+
39
+ def load_iana
40
+ return if @loaded
41
+
42
+ iana_csv.each do |name, desc, ref, notes|
43
+ next if name == 'Relation Name'
44
+ add LinkRelation.new(name, desc, ref, notes)
45
+ end
46
+
47
+ @loaded = true
48
+ end
49
+
50
+ def relations
51
+ @relations ||= {}
52
+ end
53
+
54
+ def tmp_file_name
55
+ File.join(Dir.tmpdir, 'shaf_iana_link_relations')
56
+ end
57
+
58
+ def iana_csv
59
+ CSV.new(iana_links)
60
+ end
61
+
62
+ def iana_links
63
+ return File.read(tmp_file_name) if File.readable? tmp_file_name
64
+
65
+ response = Net::HTTP.get_response(IANA_URL)
66
+
67
+ if response.code.to_i == 200
68
+ response.body.tap do |content|
69
+ File.open(tmp_file_name, 'w') { |file| file.write(content) }
70
+ end
71
+ else
72
+ Utils.iana_link_relations
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
data/lib/shaf/utils.rb CHANGED
@@ -107,9 +107,9 @@ module Shaf
107
107
  end
108
108
  end
109
109
 
110
- def iana_link_relations_csv
110
+ def iana_link_relations
111
111
  zip_file = File.join(gem_root, 'iana_link_relations.csv.gz')
112
- Zlib::GzipReader.open(zip_file) { |content| CSV.new(content.read) }
112
+ Zlib::GzipReader.open(zip_file) { |content| content.read }
113
113
  end
114
114
 
115
115
  private
data/lib/shaf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shaf
4
- VERSION = '3.0.0'
4
+ VERSION = '3.0.1'
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'shaf/api_doc/link_relations'
3
+ require 'shaf/link_relations'
4
4
 
5
5
  module Shaf
6
6
  module Yard
@@ -52,8 +52,7 @@ module Shaf
52
52
  end
53
53
 
54
54
  def iana_doc
55
- ApiDoc::LinkRelations.load_iana
56
- ApiDoc::LinkRelations[name.to_sym]&.description
55
+ LinkRelations.get(name)&.description
57
56
  end
58
57
  end
59
58
  end
@@ -1,6 +1,7 @@
1
1
  <h4 class=description-list>
2
2
  <strong> <%= object.name %></strong>
3
- <% value_types.each do |type:, class_name:| %>
3
+ <% value_types.each do |value_type| %>
4
+ <% type, class_name = value_type.values_at(:type, :class_name) %>
4
5
  <span class="property-source <%= class_name %>"><%= type %></span>
5
6
  <% end %>
6
7
  </h4>
@@ -1,6 +1,7 @@
1
1
  <h4 class=description-list>
2
2
  <strong> <%= object.name %></strong>
3
- <% value_types.each do |type:, class_name:| %>
3
+ <% value_types.each do |value_type| %>
4
+ <% type, class_name = value_type.values_at(:type, :class_name) %>
4
5
  <span class="property-source <%= class_name %>"><%= type %></span>
5
6
  <% end %>
6
7
  </h4>
@@ -1,6 +1,7 @@
1
1
  <div id="profile-list" class="list sidebar-content <%= 'active' if profile? %>">
2
2
  <ul>
3
- <% @profiles.each do |name:, path:| %>
3
+ <% @profiles.each do |profile| %>
4
+ <% name, path = profile.values_at(:name, :path) %>
4
5
  <li class="sidebar-link <%= 'active' if profile_active?(name) %>">
5
6
  <a href=<%= path %> class="<%= 'active' if profile_active?(name) %>"><%= name%></a>
6
7
  </li>
@@ -1,6 +1,7 @@
1
1
  <div id="serializer-list" class="list sidebar-content <%= 'active' if resource? || index? %>">
2
2
  <ul>
3
- <% @resources.each do |name:, path:| %>
3
+ <% @resources.each do |resource| %>
4
+ <% name, path = resource.values_at(:name, :path) %>
4
5
  <li class="sidebar-link <%= 'active' if resource_active?(name) %>">
5
6
  <a href=<%= path %> class="<%= 'active' if resource_active?(name) %>"><%= name%></a>
6
7
  </li>
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sammy Henningsson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDVjCCAj6gAwIBAgIBATANBgkqhkiG9w0BAQsFADAqMSgwJgYDVQQDDB9zYW1t
14
- eS5oZW5uaW5nc3Nvbi9EQz1oZXkvREM9Y29tMB4XDTIxMDIwMjEzNTY1OFoXDTIy
15
- MDIwMjEzNTY1OFowKjEoMCYGA1UEAwwfc2FtbXkuaGVubmluZ3Nzb24vREM9aGV5
14
+ eS5oZW5uaW5nc3Nvbi9EQz1oZXkvREM9Y29tMB4XDTIzMDkwMjIxMDQ1MVoXDTI1
15
+ MDkwMTIxMDQ1MVowKjEoMCYGA1UEAwwfc2FtbXkuaGVubmluZ3Nzb24vREM9aGV5
16
16
  L0RDPWNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK+SDC1mfyhu
17
17
  cJ6Va21rIHUGscEtQrdvyBqxFG1s2TgPMAv4RbqwdJVPa7kjtbCzslADlUE1oru2
18
18
  C+rcJsMtVGX02ukMIPHT1OjTyy0/EMqLqSy3WeRI8APyDSxCVbe+h5BMf3zZnYfd
@@ -22,14 +22,14 @@ cert_chain:
22
22
  nIxTSJpPr2cCAwEAAaOBhjCBgzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
23
23
  HQ4EFgQUukjj1Cd2ea6IOHDLZe0ymzs2jWkwJAYDVR0RBB0wG4EZc2FtbXkuaGVu
24
24
  bmluZ3Nzb25AaGV5LmNvbTAkBgNVHRIEHTAbgRlzYW1teS5oZW5uaW5nc3NvbkBo
25
- ZXkuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQBt310FZ56E/fp/y5Wym1xb4C0owfnI
26
- LzUqOjXWZTO7RezlBJV/qIwqt6bEjYDQR56zULJFSp4YdoDsratmQ+/kwtbHF7xf
27
- WYkSE36mhLP2ggQFH9fXtX6XdyIlwFqwEfNW73ZrkBXGjMxLVKIS9uHdN7PoNhbS
28
- 0YjOZZD/rq1Jf+klwl/G7bBDPjn58DWlUmwzoj49goGS/UBG37RssQxRwPelKHZh
29
- 5ZlcHq9h5CxVt380OKaU6wMg95RJBd/kUJqmPxxlxMH8QDQinTwZmmFA9wW7PJdy
30
- wAx8px9LkSjTs0GVLH7VtVRWAELllsswCJktz63Adelx9fmIMgrTYgZM
25
+ ZXkuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQAsxqfXdj/fWsDuJmENnfpYLkPJ96MS
26
+ 8GcxCGRaq2k5nZlGU38tPzTm9HdOjCOouO4PthohqNQ9X7jOkSbKA/zrGGTHyao9
27
+ 0URFQQ/ln3liGyjD4FsXSVZVBqbw9U0AGXh9MwatyWBj9Q679SttxCIGYJtNwtVo
28
+ jCXrgrCX+Slrrlfi7ve5Dz/V9bhl2jZrv4d2rIuMBJCHPr8sa/nobyskfYgs0v2D
29
+ Dw5VdKSj3KIY2gdwi1boraHAMinBgq6VXJczYUhdWtQln+0GFS1XHf1dBlCSZCTN
30
+ trIX62sesXxQtqAqHQHNIbWC2vP1K04nAzyw4ohA0yTAo/Hscqusp+If
31
31
  -----END CERTIFICATE-----
32
- date: 2021-10-03 00:00:00.000000000 Z
32
+ date: 2023-09-02 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: file_transactions
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '5'
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: '5.14'
57
+ version: '5.19'
58
58
  type: :development
59
59
  prerelease: false
60
60
  version_requirements: !ruby/object:Gem::Requirement
@@ -64,7 +64,7 @@ dependencies:
64
64
  version: '5'
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '5.14'
67
+ version: '5.19'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: rack-test
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -304,6 +304,7 @@ files:
304
304
  - lib/shaf/helpers/payload.rb
305
305
  - lib/shaf/helpers/vary.rb
306
306
  - lib/shaf/immutable_attr.rb
307
+ - lib/shaf/link_relations.rb
307
308
  - lib/shaf/logger.rb
308
309
  - lib/shaf/middleware/request_id.rb
309
310
  - lib/shaf/parser.rb
@@ -452,13 +453,13 @@ files:
452
453
  - yard_templates/api_doc/sidebar/html/serializer_list.erb
453
454
  - yard_templates/api_doc/sidebar/html/sidebar.erb
454
455
  - yard_templates/api_doc/sidebar/setup.rb
455
- homepage:
456
+ homepage:
456
457
  licenses:
457
458
  - MIT
458
459
  metadata:
459
460
  changelog_uri: https://github.com/sammyhenningsson/shaf/blob/master/CHANGELOG.md
460
461
  homepage_uri: https://github.com/sammyhenningsson/shaf
461
- post_install_message:
462
+ post_install_message:
462
463
  rdoc_options: []
463
464
  require_paths:
464
465
  - lib
@@ -473,8 +474,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
473
474
  - !ruby/object:Gem::Version
474
475
  version: '0'
475
476
  requirements: []
476
- rubygems_version: 3.1.4
477
- signing_key:
477
+ rubygems_version: 3.4.18
478
+ signing_key:
478
479
  specification_version: 4
479
480
  summary: Sinatra Hypermedia Api Framework
480
481
  test_files: []
metadata.gz.sig CHANGED
Binary file