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.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/restify/adapter/base.rb +1 -1
  5. data/lib/restify/cache.rb +1 -1
  6. data/lib/restify/relation.rb +7 -11
  7. data/lib/restify/response.rb +2 -2
  8. data/lib/restify/version.rb +2 -2
  9. data/spec/restify/adapter/base_spec.rb +33 -0
  10. data/spec/restify/context_spec.rb +2 -2
  11. data/spec/restify/features/opentelemetry_spec.rb +1 -1
  12. data/spec/restify/global_spec.rb +50 -1
  13. data/spec/restify/link_spec.rb +13 -3
  14. data/spec/restify/relation_spec.rb +79 -7
  15. data/spec/restify/resource_spec.rb +6 -0
  16. data/spec/restify_spec.rb +1 -1
  17. data/spec/spec_helper.rb +0 -1
  18. data/vendor/bundle/ruby/4.0.0/bundler/gems/my-rubocop-2b861962124a/LICENSE +21 -0
  19. data/vendor/bundle/ruby/4.0.0/bundler/gems/my-rubocop-2b861962124a/README.md +23 -0
  20. data/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.3/CHANGELOG.md +561 -0
  21. data/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.3/MIT-LICENSE +20 -0
  22. data/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.3/README.rdoc +40 -0
  23. data/vendor/bundle/ruby/4.0.0/gems/addressable-2.9.0/CHANGELOG.md +326 -0
  24. data/vendor/bundle/ruby/4.0.0/gems/addressable-2.9.0/LICENSE.txt +202 -0
  25. data/vendor/bundle/ruby/4.0.0/gems/addressable-2.9.0/README.md +121 -0
  26. data/vendor/bundle/ruby/4.0.0/gems/ast-2.4.3/LICENSE.MIT +20 -0
  27. data/vendor/bundle/ruby/4.0.0/gems/ast-2.4.3/README.YARD.md +12 -0
  28. data/vendor/bundle/ruby/4.0.0/gems/base64-0.3.0/README.md +48 -0
  29. data/vendor/bundle/ruby/4.0.0/gems/bigdecimal-4.1.2/LICENSE +56 -0
  30. data/vendor/bundle/ruby/4.0.0/gems/concurrent-ruby-1.3.7/CHANGELOG.md +615 -0
  31. data/vendor/bundle/ruby/4.0.0/gems/concurrent-ruby-1.3.7/LICENSE.txt +21 -0
  32. data/vendor/bundle/ruby/4.0.0/gems/concurrent-ruby-1.3.7/README.md +409 -0
  33. data/vendor/bundle/ruby/4.0.0/gems/connection_pool-3.0.2/LICENSE +20 -0
  34. data/vendor/bundle/ruby/4.0.0/gems/connection_pool-3.0.2/README.md +182 -0
  35. data/vendor/bundle/ruby/4.0.0/gems/crack-1.0.1/LICENSE +20 -0
  36. data/vendor/bundle/ruby/4.0.0/gems/crack-1.0.1/README.md +43 -0
  37. data/vendor/bundle/ruby/4.0.0/gems/diff-lcs-1.6.2/CHANGELOG.md +518 -0
  38. data/vendor/bundle/ruby/4.0.0/gems/diff-lcs-1.6.2/README.md +92 -0
  39. data/vendor/bundle/ruby/4.0.0/gems/docile-1.4.1/LICENSE +21 -0
  40. data/vendor/bundle/ruby/4.0.0/gems/docile-1.4.1/README.md +409 -0
  41. data/vendor/bundle/ruby/4.0.0/gems/drb-2.2.3/LICENSE.txt +22 -0
  42. data/vendor/bundle/ruby/4.0.0/gems/ethon-0.18.0/CHANGELOG.md +417 -0
  43. data/vendor/bundle/ruby/4.0.0/gems/ethon-0.18.0/LICENSE +20 -0
  44. data/vendor/bundle/ruby/4.0.0/gems/ethon-0.18.0/README.md +118 -0
  45. data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/CHANGELOG.md +507 -0
  46. data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/LICENSE +24 -0
  47. data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/LICENSE.SPECS +22 -0
  48. data/vendor/bundle/ruby/4.0.0/gems/ffi-1.17.4-x86_64-linux-gnu/README.md +138 -0
  49. data/vendor/bundle/ruby/4.0.0/gems/hashdiff-1.2.1/LICENSE +19 -0
  50. data/vendor/bundle/ruby/4.0.0/gems/hashdiff-1.2.1/README.md +323 -0
  51. data/vendor/bundle/ruby/4.0.0/gems/hashdiff-1.2.1/changelog.md +127 -0
  52. data/vendor/bundle/ruby/4.0.0/gems/hitimes-3.2.0/LICENSE.txt +16 -0
  53. data/vendor/bundle/ruby/4.0.0/gems/hitimes-3.2.0/README.md +187 -0
  54. data/vendor/bundle/ruby/4.0.0/gems/i18n-1.15.2/MIT-LICENSE +20 -0
  55. data/vendor/bundle/ruby/4.0.0/gems/i18n-1.15.2/README.md +139 -0
  56. data/vendor/bundle/ruby/4.0.0/gems/json-2.19.9/README.md +310 -0
  57. data/vendor/bundle/ruby/4.0.0/gems/language_server-protocol-3.17.0.5/LICENSE.txt +21 -0
  58. data/vendor/bundle/ruby/4.0.0/gems/language_server-protocol-3.17.0.5/README.md +88 -0
  59. data/vendor/bundle/ruby/4.0.0/gems/lint_roller-1.1.0/CHANGELOG.md +15 -0
  60. data/vendor/bundle/ruby/4.0.0/gems/lint_roller-1.1.0/LICENSE.txt +21 -0
  61. data/vendor/bundle/ruby/4.0.0/gems/lint_roller-1.1.0/README.md +173 -0
  62. data/vendor/bundle/ruby/4.0.0/gems/little-plugger-1.1.4/README.rdoc +53 -0
  63. data/vendor/bundle/ruby/4.0.0/gems/logger-1.7.0/README.md +104 -0
  64. data/vendor/bundle/ruby/4.0.0/gems/logging-2.4.0/LICENSE +22 -0
  65. data/vendor/bundle/ruby/4.0.0/gems/logging-2.4.0/README.md +140 -0
  66. data/vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/README.rdoc +763 -0
  67. data/vendor/bundle/ruby/4.0.0/gems/msgpack-1.8.3/ChangeLog +383 -0
  68. data/vendor/bundle/ruby/4.0.0/gems/msgpack-1.8.3/LICENSE +177 -0
  69. data/vendor/bundle/ruby/4.0.0/gems/msgpack-1.8.3/README.md +302 -0
  70. data/vendor/bundle/ruby/4.0.0/gems/multi_json-1.21.1/LICENSE.md +20 -0
  71. data/vendor/bundle/ruby/4.0.0/gems/multi_json-1.21.1/README.md +281 -0
  72. data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/ext/libev/LICENSE +37 -0
  73. data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/ext/libev/README +59 -0
  74. data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/license.md +80 -0
  75. data/vendor/bundle/ruby/4.0.0/gems/nio4r-2.7.5/readme.md +91 -0
  76. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-api-1.10.0/CHANGELOG.md +219 -0
  77. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-api-1.10.0/LICENSE +201 -0
  78. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-api-1.10.0/README.md +68 -0
  79. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-common-0.25.0/CHANGELOG.md +110 -0
  80. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-common-0.25.0/LICENSE +201 -0
  81. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-common-0.25.0/README.md +62 -0
  82. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-base-0.26.1/CHANGELOG.md +97 -0
  83. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-base-0.26.1/LICENSE +201 -0
  84. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-base-0.26.1/README.md +155 -0
  85. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-ethon-0.29.0/CHANGELOG.md +192 -0
  86. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-ethon-0.29.0/LICENSE +201 -0
  87. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-instrumentation-ethon-0.29.0/README.md +66 -0
  88. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-registry-0.6.0/CHANGELOG.md +31 -0
  89. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-registry-0.6.0/LICENSE +201 -0
  90. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-registry-0.6.0/README.md +40 -0
  91. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-sdk-1.12.0/CHANGELOG.md +302 -0
  92. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-sdk-1.12.0/LICENSE +201 -0
  93. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-sdk-1.12.0/README.md +101 -0
  94. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-semantic_conventions-1.41.0/CHANGELOG.md +65 -0
  95. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-semantic_conventions-1.41.0/LICENSE +201 -0
  96. data/vendor/bundle/ruby/4.0.0/gems/opentelemetry-semantic_conventions-1.41.0/README.md +115 -0
  97. data/vendor/bundle/ruby/4.0.0/gems/parallel-2.1.0/MIT-LICENSE.txt +20 -0
  98. data/vendor/bundle/ruby/4.0.0/gems/parser-3.3.11.1/LICENSE.txt +26 -0
  99. data/vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/CHANGELOG.md +786 -0
  100. data/vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/LICENSE.md +7 -0
  101. data/vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/README.md +143 -0
  102. data/vendor/bundle/ruby/4.0.0/gems/public_suffix-7.0.5/CHANGELOG.md +649 -0
  103. data/vendor/bundle/ruby/4.0.0/gems/public_suffix-7.0.5/LICENSE.txt +22 -0
  104. data/vendor/bundle/ruby/4.0.0/gems/public_suffix-7.0.5/README.md +231 -0
  105. data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/LICENSE +29 -0
  106. data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/README.md +484 -0
  107. data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/docs/jungle/README.md +9 -0
  108. data/vendor/bundle/ruby/4.0.0/gems/puma-8.0.2/docs/jungle/rc.d/README.md +74 -0
  109. data/vendor/bundle/ruby/4.0.0/gems/racc-1.8.1/ChangeLog +846 -0
  110. data/vendor/bundle/ruby/4.0.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
  111. data/vendor/bundle/ruby/4.0.0/gems/racc-1.8.1/README.rdoc +60 -0
  112. data/vendor/bundle/ruby/4.0.0/gems/rack-3.2.6/CHANGELOG.md +1346 -0
  113. data/vendor/bundle/ruby/4.0.0/gems/rack-3.2.6/MIT-LICENSE +20 -0
  114. data/vendor/bundle/ruby/4.0.0/gems/rack-3.2.6/README.md +384 -0
  115. data/vendor/bundle/ruby/4.0.0/gems/rainbow-3.1.1/Changelog.md +101 -0
  116. data/vendor/bundle/ruby/4.0.0/gems/rainbow-3.1.1/LICENSE +20 -0
  117. data/vendor/bundle/ruby/4.0.0/gems/rainbow-3.1.1/README.markdown +227 -0
  118. data/vendor/bundle/ruby/4.0.0/gems/rake-13.4.2/MIT-LICENSE +21 -0
  119. data/vendor/bundle/ruby/4.0.0/gems/rake-13.4.2/README.rdoc +155 -0
  120. data/vendor/bundle/ruby/4.0.0/gems/rake-release-1.4.0/LICENSE +21 -0
  121. data/vendor/bundle/ruby/4.0.0/gems/rake-release-1.4.0/README.md +107 -0
  122. data/vendor/bundle/ruby/4.0.0/gems/regexp_parser-2.12.0/LICENSE +22 -0
  123. data/vendor/bundle/ruby/4.0.0/gems/rexml-3.4.4/LICENSE.txt +22 -0
  124. data/vendor/bundle/ruby/4.0.0/gems/rexml-3.4.4/README.md +57 -0
  125. data/vendor/bundle/ruby/4.0.0/gems/rspec-3.13.2/LICENSE.md +27 -0
  126. data/vendor/bundle/ruby/4.0.0/gems/rspec-3.13.2/README.md +47 -0
  127. data/vendor/bundle/ruby/4.0.0/gems/rspec-core-3.13.6/Changelog.md +2447 -0
  128. data/vendor/bundle/ruby/4.0.0/gems/rspec-core-3.13.6/LICENSE.md +26 -0
  129. data/vendor/bundle/ruby/4.0.0/gems/rspec-core-3.13.6/README.md +389 -0
  130. data/vendor/bundle/ruby/4.0.0/gems/rspec-expectations-3.13.5/Changelog.md +1366 -0
  131. data/vendor/bundle/ruby/4.0.0/gems/rspec-expectations-3.13.5/LICENSE.md +25 -0
  132. data/vendor/bundle/ruby/4.0.0/gems/rspec-expectations-3.13.5/README.md +326 -0
  133. data/vendor/bundle/ruby/4.0.0/gems/rspec-mocks-3.13.8/Changelog.md +1351 -0
  134. data/vendor/bundle/ruby/4.0.0/gems/rspec-mocks-3.13.8/LICENSE.md +25 -0
  135. data/vendor/bundle/ruby/4.0.0/gems/rspec-mocks-3.13.8/README.md +465 -0
  136. data/vendor/bundle/ruby/4.0.0/gems/rspec-support-3.13.7/Changelog.md +444 -0
  137. data/vendor/bundle/ruby/4.0.0/gems/rspec-support-3.13.7/LICENSE.md +23 -0
  138. data/vendor/bundle/ruby/4.0.0/gems/rspec-support-3.13.7/README.md +40 -0
  139. data/vendor/bundle/ruby/4.0.0/gems/rubocop-1.88.0/LICENSE.txt +20 -0
  140. data/vendor/bundle/ruby/4.0.0/gems/rubocop-1.88.0/README.md +255 -0
  141. data/vendor/bundle/ruby/4.0.0/gems/rubocop-ast-1.49.1/LICENSE.txt +20 -0
  142. data/vendor/bundle/ruby/4.0.0/gems/rubocop-ast-1.49.1/README.md +54 -0
  143. data/vendor/bundle/ruby/4.0.0/gems/rubocop-capybara-2.23.0/CHANGELOG.md +116 -0
  144. data/vendor/bundle/ruby/4.0.0/gems/rubocop-capybara-2.23.0/MIT-LICENSE.md +21 -0
  145. data/vendor/bundle/ruby/4.0.0/gems/rubocop-capybara-2.23.0/README.md +91 -0
  146. data/vendor/bundle/ruby/4.0.0/gems/rubocop-factory_bot-2.28.0/CHANGELOG.md +135 -0
  147. data/vendor/bundle/ruby/4.0.0/gems/rubocop-factory_bot-2.28.0/MIT-LICENSE.md +21 -0
  148. data/vendor/bundle/ruby/4.0.0/gems/rubocop-factory_bot-2.28.0/README.md +91 -0
  149. data/vendor/bundle/ruby/4.0.0/gems/rubocop-performance-1.26.1/LICENSE.txt +20 -0
  150. data/vendor/bundle/ruby/4.0.0/gems/rubocop-performance-1.26.1/README.md +100 -0
  151. data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec-3.10.2/CHANGELOG.md +1136 -0
  152. data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec-3.10.2/MIT-LICENSE.md +21 -0
  153. data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec-3.10.2/README.md +112 -0
  154. data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec_rails-2.32.0/CHANGELOG.md +98 -0
  155. data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec_rails-2.32.0/MIT-LICENSE.md +21 -0
  156. data/vendor/bundle/ruby/4.0.0/gems/rubocop-rspec_rails-2.32.0/README.md +93 -0
  157. data/vendor/bundle/ruby/4.0.0/gems/ruby-progressbar-1.13.0/LICENSE.txt +19 -0
  158. data/vendor/bundle/ruby/4.0.0/gems/ruby-progressbar-1.13.0/README.md +131 -0
  159. data/vendor/bundle/ruby/4.0.0/gems/securerandom-0.4.1/README.md +72 -0
  160. data/vendor/bundle/ruby/4.0.0/gems/simplecov-0.22.0/CHANGELOG.md +191 -0
  161. data/vendor/bundle/ruby/4.0.0/gems/simplecov-0.22.0/LICENSE +20 -0
  162. data/vendor/bundle/ruby/4.0.0/gems/simplecov-0.22.0/README.md +974 -0
  163. data/vendor/bundle/ruby/4.0.0/gems/simplecov-cobertura-3.2.0/LICENSE +202 -0
  164. data/vendor/bundle/ruby/4.0.0/gems/simplecov-cobertura-3.2.0/README.md +65 -0
  165. data/vendor/bundle/ruby/4.0.0/gems/simplecov-html-0.13.2/CHANGELOG.md +114 -0
  166. data/vendor/bundle/ruby/4.0.0/gems/simplecov-html-0.13.2/LICENSE +20 -0
  167. data/vendor/bundle/ruby/4.0.0/gems/simplecov-html-0.13.2/README.md +30 -0
  168. data/vendor/bundle/ruby/4.0.0/gems/simplecov_json_formatter-0.1.4/CHANGELOG.md +13 -0
  169. data/vendor/bundle/ruby/4.0.0/gems/simplecov_json_formatter-0.1.4/README.md +29 -0
  170. data/vendor/bundle/ruby/4.0.0/gems/typhoeus-1.6.0/CHANGELOG.md +465 -0
  171. data/vendor/bundle/ruby/4.0.0/gems/typhoeus-1.6.0/LICENSE +22 -0
  172. data/vendor/bundle/ruby/4.0.0/gems/typhoeus-1.6.0/README.md +588 -0
  173. data/vendor/bundle/ruby/4.0.0/gems/tzinfo-2.0.6/LICENSE +19 -0
  174. data/vendor/bundle/ruby/4.0.0/gems/tzinfo-2.0.6/README.md +406 -0
  175. data/vendor/bundle/ruby/4.0.0/gems/unicode-display_width-3.2.0/CHANGELOG.md +299 -0
  176. data/vendor/bundle/ruby/4.0.0/gems/unicode-display_width-3.2.0/MIT-LICENSE.txt +22 -0
  177. data/vendor/bundle/ruby/4.0.0/gems/unicode-display_width-3.2.0/README.md +194 -0
  178. data/vendor/bundle/ruby/4.0.0/gems/unicode-emoji-4.2.0/CHANGELOG.md +202 -0
  179. data/vendor/bundle/ruby/4.0.0/gems/unicode-emoji-4.2.0/MIT-LICENSE.txt +20 -0
  180. data/vendor/bundle/ruby/4.0.0/gems/unicode-emoji-4.2.0/README.md +205 -0
  181. data/vendor/bundle/ruby/4.0.0/gems/uri-1.1.1/README.md +55 -0
  182. data/vendor/bundle/ruby/4.0.0/gems/webmock-3.26.2/CHANGELOG.md +2148 -0
  183. data/vendor/bundle/ruby/4.0.0/gems/webmock-3.26.2/LICENSE +20 -0
  184. data/vendor/bundle/ruby/4.0.0/gems/webmock-3.26.2/README.md +1229 -0
  185. metadata +171 -4
  186. data/doc/file.README.html +0 -192
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b3748ffce3669fb7d0cf84c08ef2cb5732e18edd0a2c7f49c611c00a7d09058
4
- data.tar.gz: 86918b318d74c3c1fa5ed03e68bd4fcc877a0697b37a324407508a1d2cb78477
3
+ metadata.gz: 6db18b2b418bd450289f6e0c64f429e0c3f3066e6a45c082af2f34fa87b3219f
4
+ data.tar.gz: ca2c0abe620c7a679e0c0ec0b12e57448ea7d709b5e0ee18d523183e97085715
5
5
  SHA512:
6
- metadata.gz: 8fca1f764083979b98c66a55c2a3d49e3ad4c77bff142f2e5af8d40c4003fd2151bb8bce4076cb66b856b91054fba4cb814bb0635d2b3be3cf9d7e6b301f79f2
7
- data.tar.gz: bdb52897e18ae8ba441128f9147a383ddde7e777f92ab59cce5353ac8e8feda23c9af072f9aaf2b4cb252085840bb7ef70927b289a42b66e6209a650d3d5a4c5
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
@@ -33,7 +33,7 @@ Links are extracted from
33
33
  Add it to your Gemfile:
34
34
 
35
35
  ```ruby
36
- gem 'restify', '~> 2.0'
36
+ gem 'restify', '~> 2.1'
37
37
  ```
38
38
 
39
39
  Or install it manually:
@@ -14,7 +14,7 @@ module Restify
14
14
  end
15
15
 
16
16
  def call_native(_request, _writer)
17
- throw NotImplementedError.new 'Subclass responsibility'
17
+ raise NotImplementedError.new 'Subclass responsibility'
18
18
  end
19
19
  end
20
20
  end
data/lib/restify/cache.rb CHANGED
@@ -19,7 +19,7 @@ module Restify
19
19
 
20
20
  private
21
21
 
22
- def match(_request)
22
+ def match(_request) # rubocop:disable Naming/PredicateMethod
23
23
  false
24
24
  end
25
25
 
@@ -16,7 +16,7 @@ module Restify
16
16
 
17
17
  def initialize(context, template)
18
18
  @context = context
19
- @template = Addressable::Template.new template
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
- if (value = params.delete(var) { params.delete(var.to_sym) { nil } })
117
- hash[var] = value
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
@@ -148,8 +148,8 @@ module Restify
148
148
  private
149
149
 
150
150
  def convert_headers(headers)
151
- headers.each_with_object({}) do |pair, hash|
152
- hash[pair[0].upcase] = pair[1]
151
+ headers.each.to_h do |pair|
152
+ [pair[0].upcase, pair[1]]
153
153
  end
154
154
  end
155
155
  end
@@ -3,8 +3,8 @@
3
3
  module Restify
4
4
  module VERSION
5
5
  MAJOR = 2
6
- MINOR = 0
7
- PATCH = 1
6
+ MINOR = 1
7
+ PATCH = 0
8
8
  STAGE = nil
9
9
  STRING = [MAJOR, MINOR, PATCH, STAGE].compact.join('.').freeze
10
10
 
@@ -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
- include_examples 'serialization'
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
- include_examples 'serialization'
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 match(/Ethon/)
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
@@ -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(uri, **options) }
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
@@ -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 have(1).item
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 have(1).item
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 have(2).item
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
- include_examples 'non-data-request', :get
229
+ it_behaves_like 'non-data-request', :get
164
230
  end
165
231
 
166
232
  describe '#head' do
167
- include_examples 'non-data-request', :head
233
+ it_behaves_like 'non-data-request', :head
168
234
  end
169
235
 
170
236
  describe '#delete' do
171
- include_examples 'non-data-request', :delete
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
- include_examples 'data-request', :post
290
+ it_behaves_like 'data-request', :post
225
291
  end
226
292
 
227
293
  describe '#put' do
228
- include_examples 'data-request', :put
294
+ it_behaves_like 'data-request', :put
229
295
  end
230
296
 
231
297
  describe '#patch' do
232
- include_examples 'data-request', :patch
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
@@ -118,4 +118,10 @@ describe Restify::Resource do
118
118
  end
119
119
  end
120
120
  end
121
+
122
+ describe '#inspect' do
123
+ subject(:inspect) { resource.inspect }
124
+
125
+ it { is_expected.to eq '#<Restify::Resource @data={} @relations={}>' }
126
+ end
121
127
  end
data/spec/restify_spec.rb CHANGED
@@ -161,7 +161,7 @@ describe Restify do
161
161
  users = users_relation.get.value!
162
162
 
163
163
  # We get a collection back (Restify::Collection).
164
- expect(users).to have(2).items
164
+ expect(users.size).to eq(2)
165
165
 
166
166
  # Let's get the first one.
167
167
  user = users.first
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rspec'
4
- require 'rspec/collection_matchers'
5
4
 
6
5
  require 'simplecov'
7
6
  require 'simplecov-cobertura'
@@ -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
+ ```