restify 2.0.1 → 2.1.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 +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/restify/adapter/base.rb +1 -1
- data/lib/restify/cache.rb +1 -1
- data/lib/restify/relation.rb +7 -11
- data/lib/restify/response.rb +2 -2
- data/lib/restify/version.rb +2 -2
- data/spec/restify/adapter/base_spec.rb +33 -0
- data/spec/restify/context_spec.rb +2 -2
- data/spec/restify/features/opentelemetry_spec.rb +1 -1
- data/spec/restify/global_spec.rb +50 -1
- data/spec/restify/link_spec.rb +13 -3
- data/spec/restify/relation_spec.rb +79 -7
- data/spec/restify/resource_spec.rb +6 -0
- data/spec/restify_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/vendor/bundle/ruby/4.0.0/bundler/gems/my-rubocop-2b861962124a/LICENSE +21 -0
- data/vendor/bundle/ruby/4.0.0/bundler/gems/my-rubocop-2b861962124a/README.md +23 -0
- data/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.3/CHANGELOG.md +561 -0
- data/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.3/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.3/README.rdoc +40 -0
- data/vendor/bundle/ruby/4.0.0/gems/addressable-2.9.0/CHANGELOG.md +326 -0
- data/vendor/bundle/ruby/4.0.0/gems/addressable-2.9.0/LICENSE.txt +202 -0
- data/vendor/bundle/ruby/4.0.0/gems/addressable-2.9.0/README.md +121 -0
- data/vendor/bundle/ruby/4.0.0/gems/ast-2.4.3/LICENSE.MIT +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/ast-2.4.3/README.YARD.md +12 -0
- data/vendor/bundle/ruby/4.0.0/gems/base64-0.3.0/README.md +48 -0
- data/vendor/bundle/ruby/4.0.0/gems/bigdecimal-4.1.2/LICENSE +56 -0
- data/vendor/bundle/ruby/4.0.0/gems/concurrent-ruby-1.3.7/CHANGELOG.md +615 -0
- data/vendor/bundle/ruby/4.0.0/gems/concurrent-ruby-1.3.7/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/concurrent-ruby-1.3.7/README.md +409 -0
- data/vendor/bundle/ruby/4.0.0/gems/connection_pool-3.0.2/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/connection_pool-3.0.2/README.md +182 -0
- data/vendor/bundle/ruby/4.0.0/gems/crack-1.0.1/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/crack-1.0.1/README.md +43 -0
- data/vendor/bundle/ruby/4.0.0/gems/diff-lcs-1.6.2/CHANGELOG.md +518 -0
- data/vendor/bundle/ruby/4.0.0/gems/diff-lcs-1.6.2/README.md +92 -0
- data/vendor/bundle/ruby/4.0.0/gems/docile-1.4.1/LICENSE +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/docile-1.4.1/README.md +409 -0
- data/vendor/bundle/ruby/4.0.0/gems/drb-2.2.3/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/ethon-0.18.0/CHANGELOG.md +417 -0
- data/vendor/bundle/ruby/4.0.0/gems/ethon-0.18.0/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/ethon-0.18.0/README.md +118 -0
- data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/CHANGELOG.md +507 -0
- data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/LICENSE +24 -0
- data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/LICENSE.SPECS +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/README.md +138 -0
- data/vendor/bundle/ruby/4.0.0/gems/hashdiff-1.2.1/LICENSE +19 -0
- data/vendor/bundle/ruby/4.0.0/gems/hashdiff-1.2.1/README.md +323 -0
- data/vendor/bundle/ruby/4.0.0/gems/hashdiff-1.2.1/changelog.md +127 -0
- data/vendor/bundle/ruby/4.0.0/gems/hitimes-3.2.0/LICENSE.txt +16 -0
- data/vendor/bundle/ruby/4.0.0/gems/hitimes-3.2.0/README.md +187 -0
- data/vendor/bundle/ruby/4.0.0/gems/i18n-1.15.2/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/i18n-1.15.2/README.md +139 -0
- data/vendor/bundle/ruby/4.0.0/gems/json-2.19.9/README.md +310 -0
- data/vendor/bundle/ruby/4.0.0/gems/language_server-protocol-3.17.0.5/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/language_server-protocol-3.17.0.5/README.md +88 -0
- data/vendor/bundle/ruby/4.0.0/gems/lint_roller-1.1.0/CHANGELOG.md +15 -0
- data/vendor/bundle/ruby/4.0.0/gems/lint_roller-1.1.0/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/lint_roller-1.1.0/README.md +173 -0
- data/vendor/bundle/ruby/4.0.0/gems/little-plugger-1.1.4/README.rdoc +53 -0
- data/vendor/bundle/ruby/4.0.0/gems/logger-1.7.0/README.md +104 -0
- data/vendor/bundle/ruby/4.0.0/gems/logging-2.4.0/LICENSE +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/logging-2.4.0/README.md +140 -0
- data/vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/README.rdoc +763 -0
- data/vendor/bundle/ruby/4.0.0/gems/msgpack-1.8.3/ChangeLog +383 -0
- data/vendor/bundle/ruby/4.0.0/gems/msgpack-1.8.3/LICENSE +177 -0
- data/vendor/bundle/ruby/4.0.0/gems/msgpack-1.8.3/README.md +302 -0
- data/vendor/bundle/ruby/4.0.0/gems/multi_json-1.21.1/LICENSE.md +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/multi_json-1.21.1/README.md +281 -0
- data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/ext/libev/LICENSE +37 -0
- data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/ext/libev/README +59 -0
- data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/license.md +80 -0
- data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/readme.md +91 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-api-1.10.0/CHANGELOG.md +219 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-api-1.10.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-api-1.10.0/README.md +68 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-common-0.25.0/CHANGELOG.md +110 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-common-0.25.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-common-0.25.0/README.md +62 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-base-0.26.1/CHANGELOG.md +97 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-base-0.26.1/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-base-0.26.1/README.md +155 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-ethon-0.29.0/CHANGELOG.md +192 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-ethon-0.29.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-ethon-0.29.0/README.md +66 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-registry-0.6.0/CHANGELOG.md +31 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-registry-0.6.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-registry-0.6.0/README.md +40 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-sdk-1.12.0/CHANGELOG.md +302 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-sdk-1.12.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-sdk-1.12.0/README.md +101 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-semantic_conventions-1.41.0/CHANGELOG.md +65 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-semantic_conventions-1.41.0/LICENSE +201 -0
- data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-semantic_conventions-1.41.0/README.md +115 -0
- data/vendor/bundle/ruby/4.0.0/gems/parallel-2.1.0/MIT-LICENSE.txt +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/parser-3.3.11.1/LICENSE.txt +26 -0
- data/vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/CHANGELOG.md +786 -0
- data/vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/LICENSE.md +7 -0
- data/vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/README.md +143 -0
- data/vendor/bundle/ruby/4.0.0/gems/public_suffix-7.0.5/CHANGELOG.md +649 -0
- data/vendor/bundle/ruby/4.0.0/gems/public_suffix-7.0.5/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/public_suffix-7.0.5/README.md +231 -0
- data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/LICENSE +29 -0
- data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/README.md +484 -0
- data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/docs/jungle/README.md +9 -0
- data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/docs/jungle/rc.d/README.md +74 -0
- data/vendor/bundle/ruby/4.0.0/gems/racc-1.8.1/ChangeLog +846 -0
- data/vendor/bundle/ruby/4.0.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
- data/vendor/bundle/ruby/4.0.0/gems/racc-1.8.1/README.rdoc +60 -0
- data/vendor/bundle/ruby/4.0.0/gems/rack-3.2.6/CHANGELOG.md +1346 -0
- data/vendor/bundle/ruby/4.0.0/gems/rack-3.2.6/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/rack-3.2.6/README.md +384 -0
- data/vendor/bundle/ruby/4.0.0/gems/rainbow-3.1.1/Changelog.md +101 -0
- data/vendor/bundle/ruby/4.0.0/gems/rainbow-3.1.1/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/rainbow-3.1.1/README.markdown +227 -0
- data/vendor/bundle/ruby/4.0.0/gems/rake-13.4.2/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rake-13.4.2/README.rdoc +155 -0
- data/vendor/bundle/ruby/4.0.0/gems/rake-release-1.4.0/LICENSE +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rake-release-1.4.0/README.md +107 -0
- data/vendor/bundle/ruby/4.0.0/gems/regexp_parser-2.12.0/LICENSE +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/rexml-3.4.4/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/rexml-3.4.4/README.md +57 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-3.13.2/LICENSE.md +27 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-3.13.2/README.md +47 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-core-3.13.6/Changelog.md +2447 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-core-3.13.6/LICENSE.md +26 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-core-3.13.6/README.md +389 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-expectations-3.13.5/Changelog.md +1366 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-expectations-3.13.5/LICENSE.md +25 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-expectations-3.13.5/README.md +326 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-mocks-3.13.8/Changelog.md +1351 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-mocks-3.13.8/LICENSE.md +25 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-mocks-3.13.8/README.md +465 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-support-3.13.7/Changelog.md +444 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-support-3.13.7/LICENSE.md +23 -0
- data/vendor/bundle/ruby/4.0.0/gems/rspec-support-3.13.7/README.md +40 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-1.88.0/LICENSE.txt +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-1.88.0/README.md +255 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-ast-1.49.1/LICENSE.txt +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-ast-1.49.1/README.md +54 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-capybara-2.23.0/CHANGELOG.md +116 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-capybara-2.23.0/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-capybara-2.23.0/README.md +91 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-factory_bot-2.28.0/CHANGELOG.md +135 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-factory_bot-2.28.0/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-factory_bot-2.28.0/README.md +91 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-performance-1.26.1/LICENSE.txt +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-performance-1.26.1/README.md +100 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec-3.10.2/CHANGELOG.md +1136 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec-3.10.2/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec-3.10.2/README.md +112 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec_rails-2.32.0/CHANGELOG.md +98 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec_rails-2.32.0/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec_rails-2.32.0/README.md +93 -0
- data/vendor/bundle/ruby/4.0.0/gems/ruby-progressbar-1.13.0/LICENSE.txt +19 -0
- data/vendor/bundle/ruby/4.0.0/gems/ruby-progressbar-1.13.0/README.md +131 -0
- data/vendor/bundle/ruby/4.0.0/gems/securerandom-0.4.1/README.md +72 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-0.22.0/CHANGELOG.md +191 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-0.22.0/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-0.22.0/README.md +974 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-cobertura-3.2.0/LICENSE +202 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-cobertura-3.2.0/README.md +65 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-html-0.13.2/CHANGELOG.md +114 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-html-0.13.2/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov-html-0.13.2/README.md +30 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov_json_formatter-0.1.4/CHANGELOG.md +13 -0
- data/vendor/bundle/ruby/4.0.0/gems/simplecov_json_formatter-0.1.4/README.md +29 -0
- data/vendor/bundle/ruby/4.0.0/gems/typhoeus-1.6.0/CHANGELOG.md +465 -0
- data/vendor/bundle/ruby/4.0.0/gems/typhoeus-1.6.0/LICENSE +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/typhoeus-1.6.0/README.md +588 -0
- data/vendor/bundle/ruby/4.0.0/gems/tzinfo-2.0.6/LICENSE +19 -0
- data/vendor/bundle/ruby/4.0.0/gems/tzinfo-2.0.6/README.md +406 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-display_width-3.2.0/CHANGELOG.md +299 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-display_width-3.2.0/MIT-LICENSE.txt +22 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-display_width-3.2.0/README.md +194 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-emoji-4.2.0/CHANGELOG.md +202 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-emoji-4.2.0/MIT-LICENSE.txt +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/unicode-emoji-4.2.0/README.md +205 -0
- data/vendor/bundle/ruby/4.0.0/gems/uri-1.1.1/README.md +55 -0
- data/vendor/bundle/ruby/4.0.0/gems/webmock-3.26.2/CHANGELOG.md +2148 -0
- data/vendor/bundle/ruby/4.0.0/gems/webmock-3.26.2/LICENSE +20 -0
- data/vendor/bundle/ruby/4.0.0/gems/webmock-3.26.2/README.md +1229 -0
- metadata +171 -4
- data/doc/file.README.html +0 -192
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6db18b2b418bd450289f6e0c64f429e0c3f3066e6a45c082af2f34fa87b3219f
|
|
4
|
+
data.tar.gz: ca2c0abe620c7a679e0c0ec0b12e57448ea7d709b5e0ee18d523183e97085715
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 85f715444240b80d9a269662779b69791a9240b6d37d69586948aaed3c138c8b8bc11d78e0eadd42d7da600f65e628b589053f33991b66a0a9b2c923248b4999
|
|
7
|
+
data.tar.gz: 9a1509904bcc695749e2cfb2b95976a38a94013db01aabb7374c270de7af788ac1f8e633a846aafe56e14b3cbb244d3952a99c769d845ea3c68c57f8d4f66c8e
|
data/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
17
17
|
|
|
18
18
|
### Breaks
|
|
19
19
|
|
|
20
|
+
## 2.1.0 - (2026-06-20)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
### New
|
|
25
|
+
|
|
26
|
+
- Maintenance release
|
|
27
|
+
|
|
28
|
+
## 2.0.2 - (2025-05-19)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### Fixes
|
|
33
|
+
|
|
34
|
+
- Restore literal false in parameter expansion (#68)
|
|
35
|
+
|
|
20
36
|
## 2.0.1 - (2025-02-16)
|
|
21
37
|
|
|
22
38
|
---
|
data/README.md
CHANGED
data/lib/restify/adapter/base.rb
CHANGED
data/lib/restify/cache.rb
CHANGED
data/lib/restify/relation.rb
CHANGED
|
@@ -16,7 +16,7 @@ module Restify
|
|
|
16
16
|
|
|
17
17
|
def initialize(context, template)
|
|
18
18
|
@context = context
|
|
19
|
-
@template = Addressable::Template.new
|
|
19
|
+
@template = Addressable::Template.new(template)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def request(method:, params: {}, **opts)
|
|
@@ -113,17 +113,13 @@ module Restify
|
|
|
113
113
|
|
|
114
114
|
def extract!(params)
|
|
115
115
|
@template.variables.each_with_object({}) do |var, hash|
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
sym = var.to_sym
|
|
117
|
+
if params.key?(var)
|
|
118
|
+
hash[var] = params.delete(var)
|
|
119
|
+
end
|
|
120
|
+
if params.key?(sym)
|
|
121
|
+
hash[sym] = params.delete(sym)
|
|
118
122
|
end
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def to_template(pattern)
|
|
123
|
-
if pattern.is_a?(Addressable::Template)
|
|
124
|
-
pattern
|
|
125
|
-
else
|
|
126
|
-
Addressable::Template.new pattern
|
|
127
123
|
end
|
|
128
124
|
end
|
|
129
125
|
end
|
data/lib/restify/response.rb
CHANGED
data/lib/restify/version.rb
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe Restify::Adapter::Base do
|
|
6
|
+
subject(:adapter) { described_class.new }
|
|
7
|
+
|
|
8
|
+
let(:request) { Restify::Request.new(uri: 'https://example.org') }
|
|
9
|
+
|
|
10
|
+
describe '#call' do
|
|
11
|
+
subject(:call) { adapter.call(request) }
|
|
12
|
+
|
|
13
|
+
it 'delegates to call_native with a promise' do
|
|
14
|
+
expect(adapter).to receive(:call_native) do |req, writer| # rubocop:disable RSpec/SubjectStub
|
|
15
|
+
expect(req).to be request
|
|
16
|
+
expect(writer).to be_a Restify::Promise::Writer
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
call.tap do |promise|
|
|
20
|
+
expect(promise).to be_a Restify::Promise
|
|
21
|
+
expect(promise).to be_pending
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe '#call_native' do
|
|
27
|
+
subject(:call_native) { adapter.call_native(nil, nil) }
|
|
28
|
+
|
|
29
|
+
it 'must be implemented in a subclass' do
|
|
30
|
+
expect { call_native }.to raise_error(NotImplementedError)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -59,7 +59,7 @@ describe Restify::Context do
|
|
|
59
59
|
let(:load) { YAML.load(dump) }
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
it_behaves_like 'serialization'
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
context 'Marshall' do
|
|
@@ -68,7 +68,7 @@ describe Restify::Context do
|
|
|
68
68
|
let(:dump) { Marshal.dump(context) }
|
|
69
69
|
let(:load) { Marshal.load(dump) } # rubocop:disable Security/MarshalLoad
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
it_behaves_like 'serialization'
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
end
|
|
@@ -38,7 +38,7 @@ describe Restify do
|
|
|
38
38
|
# Latest span has to be from the Ethon instrumentation and must
|
|
39
39
|
# have the Restify span as a parent.
|
|
40
40
|
spans[0].tap do |span|
|
|
41
|
-
expect(span.instrumentation_scope.name).to
|
|
41
|
+
expect(span.instrumentation_scope.name).to include('Ethon')
|
|
42
42
|
expect(span.parent_span_id).to eq spans[1].span_id
|
|
43
43
|
end
|
|
44
44
|
end
|
data/spec/restify/global_spec.rb
CHANGED
|
@@ -21,7 +21,7 @@ describe Restify::Global do
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
context 'with registry symbol' do
|
|
24
|
-
subject(:restify) { global.new(
|
|
24
|
+
subject(:restify) { global.new(name, **options) }
|
|
25
25
|
|
|
26
26
|
let(:name) { :registry_item_name }
|
|
27
27
|
let(:uri) { 'http://api.github.com/' }
|
|
@@ -38,4 +38,53 @@ describe Restify::Global do
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
|
+
|
|
42
|
+
describe '#adapter' do
|
|
43
|
+
subject(:adapter) { global.adapter }
|
|
44
|
+
|
|
45
|
+
it 'defaults to Typhoeus adapter' do
|
|
46
|
+
expect(adapter).to be_a Restify::Adapter::Typhoeus
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe '#adapter=' do
|
|
51
|
+
let(:stub) { Object.new }
|
|
52
|
+
|
|
53
|
+
# Ensure to reset adapter after these specs!
|
|
54
|
+
after { Restify.adapter = nil }
|
|
55
|
+
|
|
56
|
+
it 'sets a new adapter' do
|
|
57
|
+
global.adapter = stub
|
|
58
|
+
expect(global.adapter).to be stub
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
describe '#cache' do
|
|
63
|
+
subject(:cache) { global.cache }
|
|
64
|
+
|
|
65
|
+
it 'defaults to Typhoeus adapter' do
|
|
66
|
+
expect(cache).to be_a Restify::Cache
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
describe '#cache=' do
|
|
71
|
+
let(:stub) { Object.new }
|
|
72
|
+
|
|
73
|
+
# Ensure to reset cache after these specs!
|
|
74
|
+
after { Restify.cache = nil }
|
|
75
|
+
|
|
76
|
+
it 'sets a new adapter' do
|
|
77
|
+
global.cache = stub
|
|
78
|
+
expect(global.cache).to be stub
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
describe '#logger' do
|
|
83
|
+
subject(:logger) { global.logger }
|
|
84
|
+
|
|
85
|
+
it 'returns Restify root logger' do
|
|
86
|
+
expect(logger).to be_a Logging::Logger
|
|
87
|
+
expect(logger).to eq Logging.logger[Restify]
|
|
88
|
+
end
|
|
89
|
+
end
|
|
41
90
|
end
|
data/spec/restify/link_spec.rb
CHANGED
|
@@ -9,7 +9,7 @@ describe Restify::Link do
|
|
|
9
9
|
links = described_class
|
|
10
10
|
.parse('<http://example.org/search{?query}>; rel="search"')
|
|
11
11
|
|
|
12
|
-
expect(links).to
|
|
12
|
+
expect(links.size).to eq(1)
|
|
13
13
|
expect(links[0].uri).to eq 'http://example.org/search{?query}'
|
|
14
14
|
expect(links[0].metadata).to eq 'rel' => 'search'
|
|
15
15
|
end
|
|
@@ -18,7 +18,7 @@ describe Restify::Link do
|
|
|
18
18
|
links = described_class
|
|
19
19
|
.parse('<http://example.org/search{?query}>; rel=search')
|
|
20
20
|
|
|
21
|
-
expect(links).to
|
|
21
|
+
expect(links.size).to eq(1)
|
|
22
22
|
expect(links[0].uri).to eq 'http://example.org/search{?query}'
|
|
23
23
|
expect(links[0].metadata).to eq 'rel' => 'search'
|
|
24
24
|
end
|
|
@@ -27,7 +27,7 @@ describe Restify::Link do
|
|
|
27
27
|
links = described_class
|
|
28
28
|
.parse('<p://h.tld/p>; rel=abc, <p://h.tld/b>; a=b; c="d"')
|
|
29
29
|
|
|
30
|
-
expect(links).to
|
|
30
|
+
expect(links.size).to eq(2)
|
|
31
31
|
expect(links[0].uri).to eq 'p://h.tld/p'
|
|
32
32
|
expect(links[0].metadata).to eq 'rel' => 'abc'
|
|
33
33
|
expect(links[1].uri).to eq 'p://h.tld/b'
|
|
@@ -50,6 +50,16 @@ describe Restify::Link do
|
|
|
50
50
|
expect { described_class.parse('</>; rel="s", abc-invalid') }
|
|
51
51
|
.to raise_error ArgumentError, /Invalid token at \d+:/i
|
|
52
52
|
end
|
|
53
|
+
|
|
54
|
+
it 'errors on invalid param' do
|
|
55
|
+
expect { described_class.parse('<https://example.org>; rel') }
|
|
56
|
+
.to raise_error ArgumentError, /Invalid token at \d+:/i
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'errors on invalid param value' do
|
|
60
|
+
expect { described_class.parse('<https://example.org>; rel=') }
|
|
61
|
+
.to raise_error ArgumentError, /Invalid token at \d+:/i
|
|
62
|
+
end
|
|
53
63
|
end
|
|
54
64
|
end
|
|
55
65
|
end
|
|
@@ -38,7 +38,7 @@ describe Restify::Relation do
|
|
|
38
38
|
context 'with false' do
|
|
39
39
|
let(:params) { {id: false} }
|
|
40
40
|
|
|
41
|
-
it { expect(expanded.to_s).to eq 'http://test.host/resource/' }
|
|
41
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource/false' }
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
context 'with true' do
|
|
@@ -47,6 +47,19 @@ describe Restify::Relation do
|
|
|
47
47
|
it { expect(expanded.to_s).to eq 'http://test.host/resource/true' }
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
context 'with Object' do
|
|
51
|
+
let(:object) do
|
|
52
|
+
Class.new do
|
|
53
|
+
undef to_param
|
|
54
|
+
end.new
|
|
55
|
+
end
|
|
56
|
+
let(:params) { {id: object} }
|
|
57
|
+
|
|
58
|
+
it 'raise a TypeError from adressable' do
|
|
59
|
+
expect { expanded }.to raise_error(TypeError, /Can't convert #<Class:0x.*> into String or Array/)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
50
63
|
context 'with #to_param object' do
|
|
51
64
|
let(:params) { {id: cls_to_param.new} }
|
|
52
65
|
|
|
@@ -59,6 +72,27 @@ describe Restify::Relation do
|
|
|
59
72
|
it { expect(expanded.to_s).to eq 'http://test.host/resource/1,2' }
|
|
60
73
|
end
|
|
61
74
|
|
|
75
|
+
context 'with nil query parameter' do
|
|
76
|
+
let(:pattern) { '/resource{?abc}' }
|
|
77
|
+
let(:params) { {abc: nil} }
|
|
78
|
+
|
|
79
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource' }
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
context 'with false query parameter' do
|
|
83
|
+
let(:pattern) { '/resource{?abc}' }
|
|
84
|
+
let(:params) { {abc: false} }
|
|
85
|
+
|
|
86
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource?abc=false' }
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
context 'with true query parameter' do
|
|
90
|
+
let(:pattern) { '/resource{?abc}' }
|
|
91
|
+
let(:params) { {abc: true} }
|
|
92
|
+
|
|
93
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource?abc=true' }
|
|
94
|
+
end
|
|
95
|
+
|
|
62
96
|
context 'with unknown additional query parameter' do
|
|
63
97
|
let(:pattern) { '/resource{?a,b}' }
|
|
64
98
|
let(:params) { {a: 1, b: 2, c: 3} }
|
|
@@ -119,6 +153,38 @@ describe Restify::Relation do
|
|
|
119
153
|
|
|
120
154
|
it { expect { expanded }.to raise_exception TypeError, /Can't convert Hash into String./ }
|
|
121
155
|
end
|
|
156
|
+
|
|
157
|
+
context 'with string-keyed params' do
|
|
158
|
+
context 'with value' do
|
|
159
|
+
let(:params) { {'id' => 1} }
|
|
160
|
+
|
|
161
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource/1' }
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
context 'with mixed-keyed params' do
|
|
166
|
+
context 'non-overlapping' do
|
|
167
|
+
let(:params) { {'id' => 1, q: 2} }
|
|
168
|
+
|
|
169
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource/1?q=2' }
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
context 'overlapping (1)' do
|
|
173
|
+
let(:params) { {'id' => 1, id: 2} }
|
|
174
|
+
|
|
175
|
+
it 'prefers symbol value' do
|
|
176
|
+
expect(expanded.to_s).to eq 'http://test.host/resource/2'
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
context 'overlapping (2)' do
|
|
181
|
+
let(:params) { {id: 2, 'id' => 1} }
|
|
182
|
+
|
|
183
|
+
it 'prefers symbol value' do
|
|
184
|
+
expect(expanded.to_s).to eq 'http://test.host/resource/2'
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|
|
122
188
|
end
|
|
123
189
|
|
|
124
190
|
shared_examples 'non-data-request' do |method|
|
|
@@ -160,15 +226,15 @@ describe Restify::Relation do
|
|
|
160
226
|
end
|
|
161
227
|
|
|
162
228
|
describe '#get' do
|
|
163
|
-
|
|
229
|
+
it_behaves_like 'non-data-request', :get
|
|
164
230
|
end
|
|
165
231
|
|
|
166
232
|
describe '#head' do
|
|
167
|
-
|
|
233
|
+
it_behaves_like 'non-data-request', :head
|
|
168
234
|
end
|
|
169
235
|
|
|
170
236
|
describe '#delete' do
|
|
171
|
-
|
|
237
|
+
it_behaves_like 'non-data-request', :delete
|
|
172
238
|
end
|
|
173
239
|
|
|
174
240
|
shared_examples 'data-request' do |method|
|
|
@@ -221,14 +287,20 @@ describe Restify::Relation do
|
|
|
221
287
|
end
|
|
222
288
|
|
|
223
289
|
describe '#post' do
|
|
224
|
-
|
|
290
|
+
it_behaves_like 'data-request', :post
|
|
225
291
|
end
|
|
226
292
|
|
|
227
293
|
describe '#put' do
|
|
228
|
-
|
|
294
|
+
it_behaves_like 'data-request', :put
|
|
229
295
|
end
|
|
230
296
|
|
|
231
297
|
describe '#patch' do
|
|
232
|
-
|
|
298
|
+
it_behaves_like 'data-request', :patch
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
describe '#to_s' do
|
|
302
|
+
subject(:string) { relation.to_s }
|
|
303
|
+
|
|
304
|
+
it { is_expected.to eq '/resource/{id}{?q*}' }
|
|
233
305
|
end
|
|
234
306
|
end
|
data/spec/restify_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Jan Graichen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Shared RuboCop Configuration
|
|
2
|
+
|
|
3
|
+
Shared RuboCop configuration and defaults for my libraries and projects.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
# Gemfile
|
|
9
|
+
|
|
10
|
+
gem 'rubocop-config', github: 'jgraichen/rubocop-config', tag: 'v13', require: false
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
# .rubocop.yml
|
|
15
|
+
|
|
16
|
+
inherit_gem:
|
|
17
|
+
rubocop-config: default.yml
|
|
18
|
+
|
|
19
|
+
AllCops:
|
|
20
|
+
TargetRubyVersion: 3.1
|
|
21
|
+
SuggestExtensions: False
|
|
22
|
+
NewCops: enable
|
|
23
|
+
```
|