rails-rfc6570 2.5.0 → 2.6.0

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: 8526615ae06cd6c8ca8cde71ea61249827646e1fabf6b655c05706062be3e4d2
4
- data.tar.gz: 37cfb563a826b507523997b6aadd02580a844e573211bfc7f80b3caa42d90c66
3
+ metadata.gz: 6de8ecfb67ddb06053d95a06b1415e5151908f1b8fce02e8f31f3c07a51053d9
4
+ data.tar.gz: 87a11cdedd112d71fcf17516a4bf06d6b2f9861200faddcfa34772cdca233240
5
5
  SHA512:
6
- metadata.gz: 74bf6d20d7e6aa3f8cf1b366a70b1397d1e42cdf28fc4e12b0f33fbb37078818b6a4dc7f36a581c5dab45f43242345d541d62611aba2190d942b1233d2f62730
7
- data.tar.gz: 4f4a6eeb5297a1771c865e070fd3c7728fa6b41ac44251ed2d8e002985e60aee4734c49f4f32a6b93c43b5bc239a5dd3e09d30f36adcf74e160730ffe0add461
6
+ metadata.gz: 92ee5cb14342e8fcd7e89340818243ff8077f41e33a401cedaa2ca4acb70d3ec5dbbaf637029b008f50fb1c3d7153debcc27fee35e6a8792920aea86c2b8f33d
7
+ data.tar.gz: 403acc801cf66f3cfd26dd4c731224bd7b41cdc829d630d71d922a40bb87432fc0015bf8c4f4b9367f8cad728edc1c8d9b96ab488acd64a632e49b583c9b6641
data/CHANGELOG.md CHANGED
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Changelog](http://keepachangelog.com/).
5
5
 
6
6
 
7
+
7
8
  ## Unreleased
8
9
  ---
9
10
 
@@ -16,6 +17,13 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Ch
16
17
  ### Breaks
17
18
 
18
19
 
20
+ ## 2.6.0 - (2021-12-16)
21
+ ---
22
+
23
+ ### New
24
+ * Support for Rails 7
25
+
26
+
19
27
  ## 2.5.0 - (2020-12-13)
20
28
  ---
21
29
 
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Rails::RFC6570
2
2
 
3
- [![Build Status](https://github.com/jgraichen/rails-rfc6570/workflows/Build/badge.svg?event=push)](https://github.com/jgraichen/rails-rfc6570/actions?query=workflow%3ABuild)
3
+ [![Build Status](https://github.com/jgraichen/rails-rfc6570/workflows/test/badge.svg?event=push)](https://github.com/jgraichen/rails-rfc6570/actions?query=workflow%3Atest)
4
4
 
5
- Pragmatic access to your Rails routes as RFC6570 URI templates. Tested with Rails 5.0, 5.1, 5.2, 6.0 and Ruby 2.5, 2.6, 2.7.
5
+ Pragmatic access to your Rails routes as RFC6570 URI templates. Tested with Rails 5.0, 5.1, 5.2, 6.0, 6.1 and Ruby 2.5, 2.6, 2.7.
6
6
 
7
7
  ## Installation
8
8
 
@@ -22,7 +22,7 @@ Or install it yourself as:
22
22
 
23
23
  **Rails::RFC6570** gives you direct access to your Rails routes as RFC6570 URI templates using the [addressable](https://github.com/sporkmonger/addressable) gem. It further patches `Addressable::Template` with a `#as_json` and `#to_s` so that you can simply pass the template objects or even partial expanded templates to your render call, decorator or serializer.
24
24
 
25
- This examples print a JSON index resource just like https://api.github.com:
25
+ The following examples print a JSON index resource just like https://api.github.com:
26
26
 
27
27
  ```ruby
28
28
  class ApplicationController < ActionController::API
@@ -34,9 +34,9 @@ end
34
34
 
35
35
  **Pro Tip**: Append `_url` to the route names: `rfc6570_routes.transform_keys {|k| "#{k}_url" }`.
36
36
 
37
- By default the `format` placeholder is ignored and the HTTP host will be included in the URI template.
37
+ By default, the `format` placeholder is ignored and the HTTP host will be included in the URI template.
38
38
 
39
- Additionally you can specify a list of query parameters in your controllers:
39
+ Additionally, you can specify a list of query parameters in your controllers:
40
40
 
41
41
  ```ruby
42
42
  class UserController < ApplicationController
@@ -10,7 +10,7 @@ module Rails
10
10
  @parts = Visitor.new(factory: method(:symbol)).accept(route.path.spec)
11
11
  end
12
12
 
13
- def evaluate(ignore: %w[format], ctx:, **kwargs)
13
+ def evaluate(ctx:, ignore: %w[format], **kwargs)
14
14
  parts = @parts.reject do |part|
15
15
  part.is_a?(Subst) && ignore.include?(part.name)
16
16
  end
@@ -21,7 +21,7 @@ module Rails
21
21
 
22
22
  if controller.present? && action.present?
23
23
  params = ::Rails::RFC6570.params_for(controller, action)
24
- parts << '{?' + params.join(',') + '}' if params&.any?
24
+ parts << ("{?#{params.join(',')}}") if params&.any?
25
25
  end
26
26
  end
27
27
 
@@ -4,7 +4,7 @@ module Rails
4
4
  module RFC6570
5
5
  module VERSION
6
6
  MAJOR = 2
7
- MINOR = 5
7
+ MINOR = 6
8
8
  PATCH = 0
9
9
  STAGE = nil
10
10
 
data/lib/rails/rfc6570.rb CHANGED
@@ -13,9 +13,6 @@ module Rails
13
13
  initializer 'rails-rfc6570', group: :all do |_app|
14
14
  require 'rails/rfc6570/patches'
15
15
 
16
- MAJOR = Rails::VERSION::MAJOR
17
- MINOR = Rails::VERSION::MINOR
18
-
19
16
  ::ActionDispatch::Routing::RouteSet.include \
20
17
  Rails::RFC6570::Extensions::RouteSet
21
18
 
@@ -42,7 +39,7 @@ module Rails
42
39
 
43
40
  module NamedRouteCollection
44
41
  def to_rfc6570(opts = {})
45
- Hash[routes.map {|n, r| [n, r.to_rfc6570(opts)] }]
42
+ routes.map {|n, r| [n, r.to_rfc6570(opts)] }.to_h
46
43
  end
47
44
 
48
45
  def define_rfc6570_helpers(name, route, mod, set)
@@ -64,7 +61,7 @@ module Rails
64
61
  self,
65
62
  route,
66
63
  **opts,
67
- path_only: false
64
+ path_only: false,
68
65
  )
69
66
  end
70
67
 
@@ -73,7 +70,7 @@ module Rails
73
70
  self,
74
71
  route,
75
72
  **opts,
76
- path_only: true
73
+ path_only: true,
77
74
  )
78
75
  end
79
76
  end
@@ -14,6 +14,10 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = 'https://github.com/jgraichen/rails-rfc6570'
15
15
  spec.license = 'MIT'
16
16
 
17
+ spec.metadata = {
18
+ 'rubygems_mfa_required' => 'true',
19
+ }
20
+
17
21
  spec.files = Dir['**/*'].grep(%r{^(
18
22
  (bin|lib|test|spec|features)/|
19
23
  (.*\.gemspec|.*LICENSE.*|.*README.*|.*CHANGELOG.*)
@@ -22,7 +26,9 @@ Gem::Specification.new do |spec|
22
26
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
27
  spec.require_paths = ['lib']
24
28
 
25
- spec.add_runtime_dependency 'actionpack', '>= 4.2', '< 6.2'
29
+ spec.required_ruby_version = '>= 2.5'
30
+
31
+ spec.add_runtime_dependency 'actionpack', '>= 4.2', '< 7.1'
26
32
  spec.add_runtime_dependency 'addressable', '~> 2.3'
27
33
 
28
34
  spec.add_development_dependency 'bundler'
@@ -3010,3 +3010,147 @@ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 411)
3010
3010
  Started GET "/" for 127.0.0.1 at 2020-12-13 13:45:28 +0100
3011
3011
  Processing by APIController#index as HTML
3012
3012
  Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 411)
3013
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3014
+ Processing by APIController#index as HTML
3015
+ Completed 200 OK in 1ms (Views: 0.2ms | Allocations: 1019)
3016
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3017
+ Processing by APIController#index as HTML
3018
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 455)
3019
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3020
+ Processing by APIController#index as HTML
3021
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 455)
3022
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3023
+ Processing by APIController#index as HTML
3024
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 455)
3025
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3026
+ Processing by APIController#index as HTML
3027
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 455)
3028
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3029
+ Processing by APIController#index as HTML
3030
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 455)
3031
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3032
+ Processing by APIController#index as HTML
3033
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 455)
3034
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3035
+ Processing by APIController#index as HTML
3036
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 455)
3037
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3038
+ Processing by APIController#action as HTML
3039
+ Completed 200 OK in 1ms (Views: 0.2ms | Allocations: 828)
3040
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3041
+ Processing by APIController#action as HTML
3042
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 738)
3043
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3044
+ Processing by APIController#action as HTML
3045
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 738)
3046
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3047
+ Processing by APIController#action as HTML
3048
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 738)
3049
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3050
+ Processing by APIController#action as HTML
3051
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 738)
3052
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3053
+ Processing by APIController#action as HTML
3054
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 738)
3055
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3056
+ Processing by APIController#action as HTML
3057
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 738)
3058
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:22:59 +0100
3059
+ Processing by APIController#action as HTML
3060
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 815)
3061
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3062
+ Processing by APIController#action as HTML
3063
+ Completed 200 OK in 1ms (Views: 0.2ms | Allocations: 1157)
3064
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3065
+ Processing by APIController#action as HTML
3066
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 735)
3067
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3068
+ Processing by APIController#action as HTML
3069
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 735)
3070
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3071
+ Processing by APIController#action as HTML
3072
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 735)
3073
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3074
+ Processing by APIController#action as HTML
3075
+ Completed 200 OK in 1ms (Views: 0.2ms | Allocations: 735)
3076
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3077
+ Processing by APIController#action as HTML
3078
+ Completed 200 OK in 1ms (Views: 0.2ms | Allocations: 735)
3079
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3080
+ Processing by APIController#action as HTML
3081
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 735)
3082
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3083
+ Processing by APIController#action as HTML
3084
+ Completed 200 OK in 1ms (Views: 0.2ms | Allocations: 812)
3085
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3086
+ Processing by APIController#index as HTML
3087
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 692)
3088
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3089
+ Processing by APIController#index as HTML
3090
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3091
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3092
+ Processing by APIController#index as HTML
3093
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3094
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3095
+ Processing by APIController#index as HTML
3096
+ Completed 200 OK in 1ms (Views: 0.3ms | Allocations: 454)
3097
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3098
+ Processing by APIController#index as HTML
3099
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3100
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3101
+ Processing by APIController#index as HTML
3102
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3103
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3104
+ Processing by APIController#index as HTML
3105
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3106
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:25:10 +0100
3107
+ Processing by APIController#index as HTML
3108
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3109
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3110
+ Processing by APIController#action as HTML
3111
+ Completed 200 OK in 8ms (Views: 0.3ms | Allocations: 1173)
3112
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3113
+ Processing by APIController#action as HTML
3114
+ Completed 200 OK in 1ms (Views: 0.2ms | Allocations: 735)
3115
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3116
+ Processing by APIController#action as HTML
3117
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 735)
3118
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3119
+ Processing by APIController#action as HTML
3120
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 735)
3121
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3122
+ Processing by APIController#action as HTML
3123
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 735)
3124
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3125
+ Processing by APIController#action as HTML
3126
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 735)
3127
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3128
+ Processing by APIController#action as HTML
3129
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 735)
3130
+ Started GET "/action" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3131
+ Processing by APIController#action as HTML
3132
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 812)
3133
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3134
+ Processing by APIController#index as HTML
3135
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 695)
3136
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3137
+ Processing by APIController#index as HTML
3138
+ Completed 200 OK in 1ms (Views: 0.1ms | Allocations: 454)
3139
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3140
+ Processing by APIController#index as HTML
3141
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3142
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3143
+ Processing by APIController#index as HTML
3144
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3145
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3146
+ Processing by APIController#index as HTML
3147
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3148
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3149
+ Processing by APIController#index as HTML
3150
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3151
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3152
+ Processing by APIController#index as HTML
3153
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
3154
+ Started GET "/" for 127.0.0.1 at 2021-12-16 11:28:54 +0100
3155
+ Processing by APIController#index as HTML
3156
+ Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 454)
@@ -36,7 +36,7 @@ class APIController < ApplicationController
36
36
  template_path: action_path_rfc6570,
37
37
  partial: test6_rfc6570.partial_expand(title: 'TITLE'),
38
38
  ignore: test6_rfc6570(ignore: %w[title]),
39
- expand: test6_rfc6570.expand(capture: %w[a b], title: 'TITLE')
39
+ expand: test6_rfc6570.expand(capture: %w[a b], title: 'TITLE'),
40
40
  }
41
41
  end
42
42
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-rfc6570
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-13 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.2'
22
+ version: '7.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.2'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: addressable
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,8 @@ files:
109
109
  homepage: https://github.com/jgraichen/rails-rfc6570
110
110
  licenses:
111
111
  - MIT
112
- metadata: {}
112
+ metadata:
113
+ rubygems_mfa_required: 'true'
113
114
  post_install_message:
114
115
  rdoc_options: []
115
116
  require_paths:
@@ -118,14 +119,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
119
  requirements:
119
120
  - - ">="
120
121
  - !ruby/object:Gem::Version
121
- version: '0'
122
+ version: '2.5'
122
123
  required_rubygems_version: !ruby/object:Gem::Requirement
123
124
  requirements:
124
125
  - - ">="
125
126
  - !ruby/object:Gem::Version
126
127
  version: '0'
127
128
  requirements: []
128
- rubygems_version: 3.1.2
129
+ rubygems_version: 3.2.22
129
130
  signing_key:
130
131
  specification_version: 4
131
132
  summary: Pragmatical access to your Rails routes as RFC6570 URI templates.