iron_admin 0.4.1 → 0.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.
Files changed (456) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +66 -30
  3. data/app/assets/config/iron_admin_manifest.js +12 -0
  4. data/app/components/iron_admin/dashboards/metric_card_component.html.haml +8 -3
  5. data/app/components/iron_admin/dashboards/metric_card_component.rb +21 -1
  6. data/app/components/iron_admin/form/belongs_to_component.rb +60 -6
  7. data/app/components/iron_admin/form/nested_form_component.html.haml +28 -0
  8. data/app/components/iron_admin/form/nested_form_component.rb +81 -0
  9. data/app/components/iron_admin/resources/data_table_component.html.haml +1 -1
  10. data/app/components/iron_admin/resources/data_table_component.rb +6 -0
  11. data/app/components/iron_admin/resources/show_field_component.rb +2 -0
  12. data/app/controllers/iron_admin/application_controller.rb +32 -1
  13. data/app/controllers/iron_admin/concerns/action_executable.rb +44 -0
  14. data/app/controllers/iron_admin/concerns/filterable.rb +84 -0
  15. data/app/controllers/iron_admin/concerns/json_params_coercion.rb +67 -0
  16. data/app/controllers/iron_admin/concerns/nested_permittable.rb +36 -0
  17. data/app/controllers/iron_admin/concerns/scopeable.rb +84 -0
  18. data/app/controllers/iron_admin/concerns/searchable.rb +13 -16
  19. data/app/controllers/iron_admin/exports_controller.rb +15 -11
  20. data/app/controllers/iron_admin/imports_controller.rb +83 -0
  21. data/app/controllers/iron_admin/live_controller.rb +12 -0
  22. data/app/controllers/iron_admin/resources_controller.rb +118 -117
  23. data/app/controllers/iron_admin/search_controller.rb +5 -5
  24. data/app/controllers/iron_admin/tools_controller.rb +63 -4
  25. data/app/helpers/iron_admin/application_helper.rb +33 -14
  26. data/app/helpers/iron_admin/field_display_helper.rb +160 -1
  27. data/app/javascript/iron_admin/controllers/cp_nested_form_controller.js +113 -0
  28. data/app/javascript/iron_admin/controllers/filter_operator_controller.js +10 -0
  29. data/app/javascript/iron_admin/index.js +4 -0
  30. data/app/views/iron_admin/dashboard/index.html.haml +7 -2
  31. data/app/views/iron_admin/form/_nested_row.html.haml +70 -0
  32. data/app/views/iron_admin/imports/new.html.haml +27 -0
  33. data/app/views/iron_admin/imports/preview.html.haml +31 -0
  34. data/app/views/iron_admin/resources/_form.html.haml +81 -5
  35. data/app/views/iron_admin/resources/action_form.html.haml +62 -0
  36. data/app/views/iron_admin/resources/bulk_action_form.html.haml +62 -0
  37. data/app/views/iron_admin/resources/index.html.haml +60 -18
  38. data/app/views/iron_admin/tools/action_form.html.haml +57 -0
  39. data/app/views/iron_admin/tools/show.html.haml +20 -1
  40. data/config/importmap.rb +2 -0
  41. data/config/locales/en.yml +36 -0
  42. data/config/routes.rb +7 -0
  43. data/docs/components/filter-components.md +60 -0
  44. data/docs/getting-started/installation.md +113 -27
  45. data/docs/getting-started/quick-start.md +17 -1
  46. data/docs/guides/authentication.md +7 -6
  47. data/docs/guides/custom-adapters.md +628 -0
  48. data/docs/guides/extending.md +132 -3
  49. data/docs/guides/fields.md +1 -1
  50. data/docs/guides/resources.md +78 -2
  51. data/docs/guides/troubleshooting.md +68 -10
  52. data/docs/reference/routes.md +10 -0
  53. data/lib/generators/iron_admin/install/install_generator.rb +49 -4
  54. data/lib/generators/iron_admin/install/templates/dashboard.rb.tt +5 -1
  55. data/lib/generators/iron_admin/install_audit/install_audit_generator.rb +26 -10
  56. data/lib/generators/iron_admin/resource/resource_generator.rb +1 -1
  57. data/lib/generators/iron_admin/resource/templates/resource.rb.tt +6 -2
  58. data/lib/iron_admin/action_field.rb +56 -0
  59. data/lib/iron_admin/adapters/active_record.rb +237 -0
  60. data/lib/iron_admin/adapters/base.rb +340 -0
  61. data/lib/iron_admin/adapters/http/column_descriptor.rb +10 -0
  62. data/lib/iron_admin/adapters/http/configuration.rb +27 -0
  63. data/lib/iron_admin/adapters/http/connection.rb +117 -0
  64. data/lib/iron_admin/adapters/http/model_proxy.rb +75 -0
  65. data/lib/iron_admin/adapters/http/query.rb +111 -0
  66. data/lib/iron_admin/adapters/http/record.rb +83 -0
  67. data/lib/iron_admin/adapters/http/type_inferrer.rb +51 -0
  68. data/lib/iron_admin/adapters/http.rb +241 -0
  69. data/lib/iron_admin/adapters/mongoid/association_wrapper.rb +74 -0
  70. data/lib/iron_admin/adapters/mongoid/column_descriptor.rb +10 -0
  71. data/lib/iron_admin/adapters/mongoid.rb +284 -0
  72. data/lib/iron_admin/adapters/registry.rb +44 -0
  73. data/lib/iron_admin/concerns/importable.rb +81 -0
  74. data/lib/iron_admin/concerns/live_updatable.rb +38 -0
  75. data/lib/iron_admin/concerns/nestable.rb +69 -0
  76. data/lib/iron_admin/concerns/soft_deletable.rb +61 -0
  77. data/lib/iron_admin/configuration.rb +20 -0
  78. data/lib/iron_admin/dashboard.rb +15 -20
  79. data/lib/iron_admin/engine.rb +35 -22
  80. data/lib/iron_admin/errors.rb +29 -0
  81. data/lib/iron_admin/field_inferrer.rb +61 -22
  82. data/lib/iron_admin/filters/active_record_query_builder.rb +63 -0
  83. data/lib/iron_admin/filters/base_query_builder.rb +55 -0
  84. data/lib/iron_admin/filters/http_query_builder.rb +39 -0
  85. data/lib/iron_admin/filters/mongoid_query_builder.rb +58 -0
  86. data/lib/iron_admin/filters/query_builder.rb +12 -0
  87. data/lib/iron_admin/import/column_mapper.rb +42 -0
  88. data/lib/iron_admin/import/import_preview.rb +10 -0
  89. data/lib/iron_admin/import/import_result.rb +10 -0
  90. data/lib/iron_admin/import/importer.rb +231 -0
  91. data/lib/iron_admin/import/parser/csv.rb +34 -0
  92. data/lib/iron_admin/import/parser/json.rb +36 -0
  93. data/lib/iron_admin/import/type_caster.rb +47 -0
  94. data/lib/iron_admin/live/broadcaster.rb +43 -0
  95. data/lib/iron_admin/live/poll_cache.rb +28 -0
  96. data/lib/iron_admin/live.rb +29 -0
  97. data/lib/iron_admin/nested_association.rb +15 -0
  98. data/lib/iron_admin/nested_attributes_validator.rb +25 -0
  99. data/lib/iron_admin/policy.rb +72 -13
  100. data/lib/iron_admin/resource.rb +149 -91
  101. data/lib/iron_admin/resource_registry.rb +77 -4
  102. data/lib/iron_admin/tool.rb +50 -0
  103. data/lib/iron_admin/tool_action.rb +73 -0
  104. data/lib/iron_admin/tool_context.rb +49 -0
  105. data/lib/iron_admin/version.rb +1 -1
  106. data/lib/iron_admin.rb +46 -10
  107. data/vendor/bundle/ruby/3.2.0/cache/addressable-2.9.0.gem +0 -0
  108. data/vendor/bundle/ruby/3.2.0/cache/crack-1.0.1.gem +0 -0
  109. data/vendor/bundle/ruby/3.2.0/cache/faraday-2.14.1.gem +0 -0
  110. data/vendor/bundle/ruby/3.2.0/cache/faraday-net_http-3.4.2.gem +0 -0
  111. data/vendor/bundle/ruby/3.2.0/cache/hashdiff-1.2.1.gem +0 -0
  112. data/vendor/bundle/ruby/3.2.0/cache/net-http-0.9.1.gem +0 -0
  113. data/vendor/bundle/ruby/3.2.0/cache/public_suffix-7.0.5.gem +0 -0
  114. data/vendor/bundle/ruby/3.2.0/cache/rexml-3.4.4.gem +0 -0
  115. data/vendor/bundle/ruby/3.2.0/cache/webmock-3.26.2.gem +0 -0
  116. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-4.0.1/bigdecimal.so +0 -0
  117. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-4.0.1/gem_make.out +6 -6
  118. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-4.0.1/mkmf.log +25 -25
  119. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/date_core.so +0 -0
  120. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/gem_make.out +6 -6
  121. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/mkmf.log +4 -4
  122. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/erb-6.0.1/erb/escape.so +0 -0
  123. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/erb-6.0.1/gem_make.out +6 -6
  124. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/erb-6.0.1/mkmf.log +2 -2
  125. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/gem_make.out +6 -6
  126. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/io/console.so +0 -0
  127. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/mkmf.log +22 -22
  128. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/gem_make.out +6 -6
  129. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/json/ext/generator.so +0 -0
  130. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/json/ext/parser.so +0 -0
  131. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/mkmf.log +9 -9
  132. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/nio4r-2.7.5/gem_make.out +6 -6
  133. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/nio4r-2.7.5/mkmf.log +12 -12
  134. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/nio4r-2.7.5/nio4r_ext.so +0 -0
  135. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/prism-1.9.0/gem_make.out +6 -6
  136. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/prism-1.9.0/mkmf.log +6 -6
  137. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/prism-1.9.0/prism/prism.so +0 -0
  138. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.3.1/gem_make.out +6 -6
  139. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.3.1/mkmf.log +7 -7
  140. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.3.1/psych.so +0 -0
  141. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +6 -6
  142. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/racc/cparse.so +0 -0
  143. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/redcarpet-3.6.1/gem_make.out +6 -6
  144. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/redcarpet-3.6.1/redcarpet.so +0 -0
  145. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +6 -6
  146. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/mkmf.log +2 -2
  147. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/stringio.so +0 -0
  148. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/websocket-driver-0.8.0/gem_make.out +6 -6
  149. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/websocket-driver-0.8.0/websocket_mask.so +0 -0
  150. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/CHANGELOG.md +326 -0
  151. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/LICENSE.txt +202 -0
  152. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/README.md +121 -0
  153. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/idna/native.rb +66 -0
  154. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/idna/pure.rb +4710 -0
  155. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/idna.rb +26 -0
  156. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/template.rb +1040 -0
  157. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/uri.rb +2602 -0
  158. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/version.rb +31 -0
  159. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable.rb +4 -0
  160. data/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/ext/bigdecimal/Makefile +3 -3
  161. data/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/lib/bigdecimal.so +0 -0
  162. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/History +58 -0
  163. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/LICENSE +20 -0
  164. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/README.md +43 -0
  165. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/json.rb +113 -0
  166. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/util.rb +17 -0
  167. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/version.rb +3 -0
  168. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/xml.rb +240 -0
  169. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack.rb +8 -0
  170. data/vendor/bundle/ruby/3.2.0/gems/date-3.5.1/ext/date/Makefile +3 -3
  171. data/vendor/bundle/ruby/3.2.0/gems/date-3.5.1/lib/date_core.so +0 -0
  172. data/vendor/bundle/ruby/3.2.0/gems/erb-6.0.1/ext/erb/escape/Makefile +3 -3
  173. data/vendor/bundle/ruby/3.2.0/gems/erb-6.0.1/lib/erb/escape.so +0 -0
  174. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/CHANGELOG.md +574 -0
  175. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/LICENSE.md +20 -0
  176. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/README.md +67 -0
  177. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/Rakefile +12 -0
  178. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/examples/client_spec.rb +119 -0
  179. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/examples/client_test.rb +144 -0
  180. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/adapter/test.rb +311 -0
  181. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/adapter.rb +101 -0
  182. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/adapter_registry.rb +30 -0
  183. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/connection.rb +565 -0
  184. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/encoders/flat_params_encoder.rb +105 -0
  185. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/encoders/nested_params_encoder.rb +183 -0
  186. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/error.rb +202 -0
  187. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/logging/formatter.rb +118 -0
  188. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/methods.rb +6 -0
  189. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/middleware.rb +72 -0
  190. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/middleware_registry.rb +83 -0
  191. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/connection_options.rb +23 -0
  192. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/env.rb +204 -0
  193. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/proxy_options.rb +38 -0
  194. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/request_options.rb +23 -0
  195. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/ssl_options.rb +76 -0
  196. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options.rb +219 -0
  197. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/parameters.rb +5 -0
  198. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/rack_builder.rb +248 -0
  199. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/authorization.rb +54 -0
  200. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/instrumentation.rb +58 -0
  201. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/json.rb +70 -0
  202. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/url_encoded.rb +60 -0
  203. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request.rb +139 -0
  204. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response/json.rb +74 -0
  205. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response/logger.rb +39 -0
  206. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response/raise_error.rb +83 -0
  207. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response.rb +95 -0
  208. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/utils/headers.rb +150 -0
  209. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/utils/params_hash.rb +61 -0
  210. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/utils.rb +121 -0
  211. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/version.rb +5 -0
  212. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday.rb +158 -0
  213. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/external_adapters/faraday_specs_setup.rb +14 -0
  214. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/adapter/test_spec.rb +442 -0
  215. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/adapter_registry_spec.rb +28 -0
  216. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/adapter_spec.rb +55 -0
  217. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/connection_spec.rb +841 -0
  218. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/error_spec.rb +175 -0
  219. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/middleware_registry_spec.rb +31 -0
  220. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/middleware_spec.rb +213 -0
  221. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/env_spec.rb +76 -0
  222. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/options_spec.rb +297 -0
  223. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/proxy_options_spec.rb +79 -0
  224. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/request_options_spec.rb +19 -0
  225. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/params_encoders/flat_spec.rb +42 -0
  226. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/params_encoders/nested_spec.rb +151 -0
  227. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/rack_builder_spec.rb +317 -0
  228. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/authorization_spec.rb +118 -0
  229. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/instrumentation_spec.rb +74 -0
  230. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/json_spec.rb +199 -0
  231. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/url_encoded_spec.rb +93 -0
  232. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request_spec.rb +110 -0
  233. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response/json_spec.rb +206 -0
  234. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response/logger_spec.rb +299 -0
  235. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response/raise_error_spec.rb +286 -0
  236. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response_spec.rb +84 -0
  237. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/utils/headers_spec.rb +109 -0
  238. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/utils_spec.rb +120 -0
  239. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday_spec.rb +43 -0
  240. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/spec_helper.rb +133 -0
  241. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/disabling_stub.rb +14 -0
  242. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/fake_safe_buffer.rb +15 -0
  243. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/faraday_middleware_subclasses.rb +18 -0
  244. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/helper_methods.rb +96 -0
  245. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/shared_examples/adapter.rb +105 -0
  246. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/shared_examples/params_encoder.rb +18 -0
  247. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/shared_examples/request_method.rb +263 -0
  248. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/streaming_response_checker.rb +35 -0
  249. data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/LICENSE.md +21 -0
  250. data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/README.md +57 -0
  251. data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/lib/faraday/adapter/net_http.rb +206 -0
  252. data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/lib/faraday/net_http/version.rb +7 -0
  253. data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/lib/faraday/net_http.rb +10 -0
  254. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/Gemfile +8 -0
  255. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/LICENSE +19 -0
  256. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/README.md +323 -0
  257. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/Rakefile +18 -0
  258. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/changelog.md +127 -0
  259. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/hashdiff.gemspec +39 -0
  260. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/compare_hashes.rb +101 -0
  261. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/diff.rb +185 -0
  262. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/lcs.rb +66 -0
  263. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/lcs_compare_arrays.rb +32 -0
  264. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/linear_compare_array.rb +159 -0
  265. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/patch.rb +88 -0
  266. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/util.rb +155 -0
  267. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/version.rb +5 -0
  268. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff.rb +10 -0
  269. data/vendor/bundle/ruby/3.2.0/gems/io-console-0.8.2/ext/io/console/Makefile +3 -3
  270. data/vendor/bundle/ruby/3.2.0/gems/io-console-0.8.2/lib/io/console.so +0 -0
  271. data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/ext/json/ext/generator/Makefile +3 -3
  272. data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/ext/json/ext/parser/Makefile +3 -3
  273. data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/lib/json/ext/generator.so +0 -0
  274. data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/lib/json/ext/parser.so +0 -0
  275. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/BSDL +22 -0
  276. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/COPYING +56 -0
  277. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/README.md +93 -0
  278. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/doc/net-http/examples.rdoc +31 -0
  279. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/doc/net-http/included_getters.rdoc +3 -0
  280. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/exceptions.rb +35 -0
  281. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/generic_request.rb +429 -0
  282. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/header.rb +985 -0
  283. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/proxy_delta.rb +17 -0
  284. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/request.rb +88 -0
  285. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/requests.rb +444 -0
  286. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/response.rb +739 -0
  287. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/responses.rb +1242 -0
  288. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/status.rb +84 -0
  289. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http.rb +2608 -0
  290. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/https.rb +23 -0
  291. data/vendor/bundle/ruby/3.2.0/gems/nio4r-2.7.5/ext/nio4r/Makefile +3 -3
  292. data/vendor/bundle/ruby/3.2.0/gems/nio4r-2.7.5/lib/nio4r_ext.so +0 -0
  293. data/vendor/bundle/ruby/3.2.0/gems/prism-1.9.0/ext/prism/Makefile +3 -3
  294. data/vendor/bundle/ruby/3.2.0/gems/prism-1.9.0/lib/prism/prism.so +0 -0
  295. data/vendor/bundle/ruby/3.2.0/gems/psych-5.3.1/ext/psych/Makefile +3 -3
  296. data/vendor/bundle/ruby/3.2.0/gems/psych-5.3.1/lib/psych.so +0 -0
  297. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/CHANGELOG.md +649 -0
  298. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/Gemfile +16 -0
  299. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/LICENSE.txt +22 -0
  300. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/README.md +231 -0
  301. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/SECURITY.md +24 -0
  302. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/data/list.txt +16298 -0
  303. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/domain.rb +235 -0
  304. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/errors.rb +41 -0
  305. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/list.rb +247 -0
  306. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/rule.rb +350 -0
  307. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/version.rb +14 -0
  308. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix.rb +177 -0
  309. data/vendor/bundle/ruby/3.2.0/gems/racc-1.8.1/ext/racc/cparse/Makefile +3 -3
  310. data/vendor/bundle/ruby/3.2.0/gems/racc-1.8.1/lib/racc/cparse.so +0 -0
  311. data/vendor/bundle/ruby/3.2.0/gems/redcarpet-3.6.1/ext/redcarpet/Makefile +3 -3
  312. data/vendor/bundle/ruby/3.2.0/gems/redcarpet-3.6.1/lib/redcarpet.so +0 -0
  313. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/LICENSE.txt +22 -0
  314. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/NEWS.md +843 -0
  315. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/README.md +57 -0
  316. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/context.rdoc +143 -0
  317. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/child.rdoc +87 -0
  318. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/document.rdoc +276 -0
  319. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/element.rdoc +602 -0
  320. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/node.rdoc +97 -0
  321. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/parent.rdoc +267 -0
  322. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/child_toc.rdoc +12 -0
  323. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/document_toc.rdoc +30 -0
  324. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/element_toc.rdoc +55 -0
  325. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/master_toc.rdoc +135 -0
  326. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/node_toc.rdoc +16 -0
  327. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/parent_toc.rdoc +25 -0
  328. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tutorial.rdoc +1358 -0
  329. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/attlistdecl.rb +63 -0
  330. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/attribute.rb +210 -0
  331. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/cdata.rb +68 -0
  332. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/child.rb +96 -0
  333. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/comment.rb +80 -0
  334. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/doctype.rb +306 -0
  335. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/document.rb +471 -0
  336. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/attlistdecl.rb +11 -0
  337. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/dtd.rb +47 -0
  338. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/elementdecl.rb +18 -0
  339. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/entitydecl.rb +57 -0
  340. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/notationdecl.rb +40 -0
  341. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/element.rb +2578 -0
  342. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/encoding.rb +48 -0
  343. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/entity.rb +142 -0
  344. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/formatters/default.rb +116 -0
  345. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/formatters/pretty.rb +142 -0
  346. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/formatters/transitive.rb +58 -0
  347. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/functions.rb +446 -0
  348. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/instruction.rb +79 -0
  349. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/light/node.rb +188 -0
  350. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/namespace.rb +63 -0
  351. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/node.rb +80 -0
  352. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/output.rb +30 -0
  353. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parent.rb +166 -0
  354. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parseexception.rb +53 -0
  355. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/baseparser.rb +949 -0
  356. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/lightparser.rb +59 -0
  357. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/pullparser.rb +213 -0
  358. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/sax2parser.rb +270 -0
  359. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/streamparser.rb +67 -0
  360. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/treeparser.rb +89 -0
  361. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/ultralightparser.rb +57 -0
  362. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/xpathparser.rb +739 -0
  363. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/quickpath.rb +267 -0
  364. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/rexml.rb +39 -0
  365. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/sax2listener.rb +98 -0
  366. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/security.rb +28 -0
  367. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/source.rb +388 -0
  368. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/streamlistener.rb +93 -0
  369. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/text.rb +420 -0
  370. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/undefinednamespaceexception.rb +9 -0
  371. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/validation/relaxng.rb +540 -0
  372. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/validation/validation.rb +144 -0
  373. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/validation/validationexception.rb +10 -0
  374. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xmldecl.rb +130 -0
  375. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xmltokens.rb +85 -0
  376. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xpath.rb +70 -0
  377. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xpath_parser.rb +980 -0
  378. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml.rb +3 -0
  379. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.2.0/ext/stringio/Makefile +3 -3
  380. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.2.0/lib/stringio.so +0 -0
  381. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/CHANGELOG.md +2148 -0
  382. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/LICENSE +20 -0
  383. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/README.md +1229 -0
  384. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/api.rb +111 -0
  385. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/assertion_failure.rb +13 -0
  386. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/callback_registry.rb +37 -0
  387. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/config.rb +20 -0
  388. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/cucumber.rb +12 -0
  389. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/deprecation.rb +11 -0
  390. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/errors.rb +19 -0
  391. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +228 -0
  392. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/curb_adapter.rb +354 -0
  393. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +239 -0
  394. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/excon_adapter.rb +167 -0
  395. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_lib_adapter.rb +9 -0
  396. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +21 -0
  397. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/client.rb +17 -0
  398. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/request.rb +28 -0
  399. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/response.rb +95 -0
  400. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/streamer.rb +44 -0
  401. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/webmock.rb +77 -0
  402. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb_adapter.rb +39 -0
  403. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/httpclient_adapter.rb +260 -0
  404. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/manticore_adapter.rb +147 -0
  405. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/net_http.rb +310 -0
  406. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/net_http_response.rb +36 -0
  407. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/patron_adapter.rb +132 -0
  408. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +190 -0
  409. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/any_arg_matcher.rb +15 -0
  410. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/hash_argument_matcher.rb +23 -0
  411. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/hash_excluding_matcher.rb +17 -0
  412. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/hash_including_matcher.rb +19 -0
  413. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/minitest.rb +43 -0
  414. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rack_response.rb +73 -0
  415. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_body_diff.rb +66 -0
  416. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_execution_verifier.rb +79 -0
  417. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_pattern.rb +428 -0
  418. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_registry.rb +37 -0
  419. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_signature.rb +56 -0
  420. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_signature_snippet.rb +63 -0
  421. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_stub.rb +134 -0
  422. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/response.rb +161 -0
  423. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/responses_sequence.rb +42 -0
  424. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec/matchers/request_pattern_matcher.rb +80 -0
  425. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec/matchers/webmock_matcher.rb +69 -0
  426. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec/matchers.rb +29 -0
  427. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec.rb +44 -0
  428. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/stub_registry.rb +84 -0
  429. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/stub_request_snippet.rb +40 -0
  430. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/test_unit.rb +22 -0
  431. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/hash_counter.rb +45 -0
  432. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/hash_keys_stringifier.rb +27 -0
  433. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/hash_validator.rb +19 -0
  434. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/headers.rb +77 -0
  435. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/parsers/json.rb +72 -0
  436. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/parsers/parse_error.rb +7 -0
  437. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/parsers/xml.rb +16 -0
  438. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/query_mapper.rb +283 -0
  439. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/uri.rb +113 -0
  440. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/values_stringifier.rb +22 -0
  441. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/version_checker.rb +113 -0
  442. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/version.rb +5 -0
  443. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/webmock.rb +175 -0
  444. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock.rb +61 -0
  445. data/vendor/bundle/ruby/3.2.0/gems/websocket-driver-0.8.0/ext/websocket-driver/Makefile +3 -3
  446. data/vendor/bundle/ruby/3.2.0/gems/websocket-driver-0.8.0/lib/websocket_mask.so +0 -0
  447. data/vendor/bundle/ruby/3.2.0/specifications/addressable-2.9.0.gemspec +29 -0
  448. data/vendor/bundle/ruby/3.2.0/specifications/crack-1.0.1.gemspec +27 -0
  449. data/vendor/bundle/ruby/3.2.0/specifications/faraday-2.14.1.gemspec +0 -0
  450. data/vendor/bundle/ruby/3.2.0/specifications/faraday-net_http-3.4.2.gemspec +26 -0
  451. data/vendor/bundle/ruby/3.2.0/specifications/hashdiff-1.2.1.gemspec +30 -0
  452. data/vendor/bundle/ruby/3.2.0/specifications/net-http-0.9.1.gemspec +27 -0
  453. data/vendor/bundle/ruby/3.2.0/specifications/public_suffix-7.0.5.gemspec +24 -0
  454. data/vendor/bundle/ruby/3.2.0/specifications/rexml-3.4.4.gemspec +25 -0
  455. data/vendor/bundle/ruby/3.2.0/specifications/webmock-3.26.2.gemspec +44 -0
  456. metadata +377 -2
@@ -0,0 +1,985 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # The \HTTPHeader module provides access to \HTTP headers.
4
+ #
5
+ # The module is included in:
6
+ #
7
+ # - Net::HTTPGenericRequest (and therefore Net::HTTPRequest).
8
+ # - Net::HTTPResponse.
9
+ #
10
+ # The headers are a hash-like collection of key/value pairs called _fields_.
11
+ #
12
+ # == Request and Response Fields
13
+ #
14
+ # Headers may be included in:
15
+ #
16
+ # - A Net::HTTPRequest object:
17
+ # the object's headers will be sent with the request.
18
+ # Any fields may be defined in the request;
19
+ # see {Setters}[rdoc-ref:Net::HTTPHeader@Setters].
20
+ # - A Net::HTTPResponse object:
21
+ # the objects headers are usually those returned from the host.
22
+ # Fields may be retrieved from the object;
23
+ # see {Getters}[rdoc-ref:Net::HTTPHeader@Getters]
24
+ # and {Iterators}[rdoc-ref:Net::HTTPHeader@Iterators].
25
+ #
26
+ # Exactly which fields should be sent or expected depends on the host;
27
+ # see:
28
+ #
29
+ # - {Request fields}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields].
30
+ # - {Response fields}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_fields].
31
+ #
32
+ # == About the Examples
33
+ #
34
+ # :include: doc/net-http/examples.rdoc
35
+ #
36
+ # == Fields
37
+ #
38
+ # A header field is a key/value pair.
39
+ #
40
+ # === Field Keys
41
+ #
42
+ # A field key may be:
43
+ #
44
+ # - A string: Key <tt>'Accept'</tt> is treated as if it were
45
+ # <tt>'Accept'.downcase</tt>; i.e., <tt>'accept'</tt>.
46
+ # - A symbol: Key <tt>:Accept</tt> is treated as if it were
47
+ # <tt>:Accept.to_s.downcase</tt>; i.e., <tt>'accept'</tt>.
48
+ #
49
+ # Examples:
50
+ #
51
+ # req = Net::HTTP::Get.new(uri)
52
+ # req[:accept] # => "*/*"
53
+ # req['Accept'] # => "*/*"
54
+ # req['ACCEPT'] # => "*/*"
55
+ #
56
+ # req['accept'] = 'text/html'
57
+ # req[:accept] = 'text/html'
58
+ # req['ACCEPT'] = 'text/html'
59
+ #
60
+ # === Field Values
61
+ #
62
+ # A field value may be returned as an array of strings or as a string:
63
+ #
64
+ # - These methods return field values as arrays:
65
+ #
66
+ # - #get_fields: Returns the array value for the given key,
67
+ # or +nil+ if it does not exist.
68
+ # - #to_hash: Returns a hash of all header fields:
69
+ # each key is a field name; its value is the array value for the field.
70
+ #
71
+ # - These methods return field values as string;
72
+ # the string value for a field is equivalent to
73
+ # <tt>self[key.downcase.to_s].join(', '))</tt>:
74
+ #
75
+ # - #[]: Returns the string value for the given key,
76
+ # or +nil+ if it does not exist.
77
+ # - #fetch: Like #[], but accepts a default value
78
+ # to be returned if the key does not exist.
79
+ #
80
+ # The field value may be set:
81
+ #
82
+ # - #[]=: Sets the value for the given key;
83
+ # the given value may be a string, a symbol, an array, or a hash.
84
+ # - #add_field: Adds a given value to a value for the given key
85
+ # (not overwriting the existing value).
86
+ # - #delete: Deletes the field for the given key.
87
+ #
88
+ # Example field values:
89
+ #
90
+ # - \String:
91
+ #
92
+ # req['Accept'] = 'text/html' # => "text/html"
93
+ # req['Accept'] # => "text/html"
94
+ # req.get_fields('Accept') # => ["text/html"]
95
+ #
96
+ # - \Symbol:
97
+ #
98
+ # req['Accept'] = :text # => :text
99
+ # req['Accept'] # => "text"
100
+ # req.get_fields('Accept') # => ["text"]
101
+ #
102
+ # - Simple array:
103
+ #
104
+ # req[:foo] = %w[bar baz bat]
105
+ # req[:foo] # => "bar, baz, bat"
106
+ # req.get_fields(:foo) # => ["bar", "baz", "bat"]
107
+ #
108
+ # - Simple hash:
109
+ #
110
+ # req[:foo] = {bar: 0, baz: 1, bat: 2}
111
+ # req[:foo] # => "bar, 0, baz, 1, bat, 2"
112
+ # req.get_fields(:foo) # => ["bar", "0", "baz", "1", "bat", "2"]
113
+ #
114
+ # - Nested:
115
+ #
116
+ # req[:foo] = [%w[bar baz], {bat: 0, bam: 1}]
117
+ # req[:foo] # => "bar, baz, bat, 0, bam, 1"
118
+ # req.get_fields(:foo) # => ["bar", "baz", "bat", "0", "bam", "1"]
119
+ #
120
+ # req[:foo] = {bar: %w[baz bat], bam: {bah: 0, bad: 1}}
121
+ # req[:foo] # => "bar, baz, bat, bam, bah, 0, bad, 1"
122
+ # req.get_fields(:foo) # => ["bar", "baz", "bat", "bam", "bah", "0", "bad", "1"]
123
+ #
124
+ # == Convenience Methods
125
+ #
126
+ # Various convenience methods retrieve values, set values, query values,
127
+ # set form values, or iterate over fields.
128
+ #
129
+ # === Setters
130
+ #
131
+ # \Method #[]= can set any field, but does little to validate the new value;
132
+ # some of the other setter methods provide some validation:
133
+ #
134
+ # - #[]=: Sets the string or array value for the given key.
135
+ # - #add_field: Creates or adds to the array value for the given key.
136
+ # - #basic_auth: Sets the string authorization header for <tt>'Authorization'</tt>.
137
+ # - #content_length=: Sets the integer length for field <tt>'Content-Length</tt>.
138
+ # - #content_type=: Sets the string value for field <tt>'Content-Type'</tt>.
139
+ # - #proxy_basic_auth: Sets the string authorization header for <tt>'Proxy-Authorization'</tt>.
140
+ # - #set_range: Sets the value for field <tt>'Range'</tt>.
141
+ #
142
+ # === Form Setters
143
+ #
144
+ # - #set_form: Sets an HTML form data set.
145
+ # - #set_form_data: Sets header fields and a body from HTML form data.
146
+ #
147
+ # === Getters
148
+ #
149
+ # \Method #[] can retrieve the value of any field that exists,
150
+ # but always as a string;
151
+ # some of the other getter methods return something different
152
+ # from the simple string value:
153
+ #
154
+ # - #[]: Returns the string field value for the given key.
155
+ # - #content_length: Returns the integer value of field <tt>'Content-Length'</tt>.
156
+ # - #content_range: Returns the Range value of field <tt>'Content-Range'</tt>.
157
+ # - #content_type: Returns the string value of field <tt>'Content-Type'</tt>.
158
+ # - #fetch: Returns the string field value for the given key.
159
+ # - #get_fields: Returns the array field value for the given +key+.
160
+ # - #main_type: Returns first part of the string value of field <tt>'Content-Type'</tt>.
161
+ # - #sub_type: Returns second part of the string value of field <tt>'Content-Type'</tt>.
162
+ # - #range: Returns an array of Range objects of field <tt>'Range'</tt>, or +nil+.
163
+ # - #range_length: Returns the integer length of the range given in field <tt>'Content-Range'</tt>.
164
+ # - #type_params: Returns the string parameters for <tt>'Content-Type'</tt>.
165
+ #
166
+ # === Queries
167
+ #
168
+ # - #chunked?: Returns whether field <tt>'Transfer-Encoding'</tt> is set to <tt>'chunked'</tt>.
169
+ # - #connection_close?: Returns whether field <tt>'Connection'</tt> is set to <tt>'close'</tt>.
170
+ # - #connection_keep_alive?: Returns whether field <tt>'Connection'</tt> is set to <tt>'keep-alive'</tt>.
171
+ # - #key?: Returns whether a given key exists.
172
+ #
173
+ # === Iterators
174
+ #
175
+ # - #each_capitalized: Passes each field capitalized-name/value pair to the block.
176
+ # - #each_capitalized_name: Passes each capitalized field name to the block.
177
+ # - #each_header: Passes each field name/value pair to the block.
178
+ # - #each_name: Passes each field name to the block.
179
+ # - #each_value: Passes each string field value to the block.
180
+ #
181
+ module Net::HTTPHeader
182
+ # The maximum length of HTTP header keys.
183
+ MAX_KEY_LENGTH = 1024
184
+ # The maximum length of HTTP header values.
185
+ MAX_FIELD_LENGTH = 65536
186
+
187
+ def initialize_http_header(initheader) #:nodoc:
188
+ @header = {}
189
+ return unless initheader
190
+ initheader.each do |key, value|
191
+ warn "net/http: duplicated HTTP header: #{key}", uplevel: 3 if key?(key) and $VERBOSE
192
+ if value.nil?
193
+ warn "net/http: nil HTTP header: #{key}", uplevel: 3 if $VERBOSE
194
+ else
195
+ value = value.strip # raise error for invalid byte sequences
196
+ if key.to_s.bytesize > MAX_KEY_LENGTH
197
+ raise ArgumentError, "too long (#{key.bytesize} bytes) header: #{key[0, 30].inspect}..."
198
+ end
199
+ if value.to_s.bytesize > MAX_FIELD_LENGTH
200
+ raise ArgumentError, "header #{key} has too long field value: #{value.bytesize}"
201
+ end
202
+ if value.count("\r\n") > 0
203
+ raise ArgumentError, "header #{key} has field value #{value.inspect}, this cannot include CR/LF"
204
+ end
205
+ @header[key.downcase.to_s] = [value]
206
+ end
207
+ end
208
+ end
209
+
210
+ def size #:nodoc: obsolete
211
+ @header.size
212
+ end
213
+
214
+ alias length size #:nodoc: obsolete
215
+
216
+ # Returns the string field value for the case-insensitive field +key+,
217
+ # or +nil+ if there is no such key;
218
+ # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
219
+ #
220
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
221
+ # res['Connection'] # => "keep-alive"
222
+ # res['Nosuch'] # => nil
223
+ #
224
+ # Note that some field values may be retrieved via convenience methods;
225
+ # see {Getters}[rdoc-ref:Net::HTTPHeader@Getters].
226
+ def [](key)
227
+ a = @header[key.downcase.to_s] or return nil
228
+ a.join(', ')
229
+ end
230
+
231
+ # Sets the value for the case-insensitive +key+ to +val+,
232
+ # overwriting the previous value if the field exists;
233
+ # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
234
+ #
235
+ # req = Net::HTTP::Get.new(uri)
236
+ # req['Accept'] # => "*/*"
237
+ # req['Accept'] = 'text/html'
238
+ # req['Accept'] # => "text/html"
239
+ #
240
+ # Note that some field values may be set via convenience methods;
241
+ # see {Setters}[rdoc-ref:Net::HTTPHeader@Setters].
242
+ def []=(key, val)
243
+ unless val
244
+ @header.delete key.downcase.to_s
245
+ return val
246
+ end
247
+ set_field(key, val)
248
+ end
249
+
250
+ # Adds value +val+ to the value array for field +key+ if the field exists;
251
+ # creates the field with the given +key+ and +val+ if it does not exist.
252
+ # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
253
+ #
254
+ # req = Net::HTTP::Get.new(uri)
255
+ # req.add_field('Foo', 'bar')
256
+ # req['Foo'] # => "bar"
257
+ # req.add_field('Foo', 'baz')
258
+ # req['Foo'] # => "bar, baz"
259
+ # req.add_field('Foo', %w[baz bam])
260
+ # req['Foo'] # => "bar, baz, baz, bam"
261
+ # req.get_fields('Foo') # => ["bar", "baz", "baz", "bam"]
262
+ #
263
+ def add_field(key, val)
264
+ stringified_downcased_key = key.downcase.to_s
265
+ if @header.key?(stringified_downcased_key)
266
+ append_field_value(@header[stringified_downcased_key], val)
267
+ else
268
+ set_field(key, val)
269
+ end
270
+ end
271
+
272
+ # :stopdoc:
273
+ private def set_field(key, val)
274
+ case val
275
+ when Enumerable
276
+ ary = []
277
+ append_field_value(ary, val)
278
+ @header[key.downcase.to_s] = ary
279
+ else
280
+ val = val.to_s # for compatibility use to_s instead of to_str
281
+ if val.b.count("\r\n") > 0
282
+ raise ArgumentError, 'header field value cannot include CR/LF'
283
+ end
284
+ @header[key.downcase.to_s] = [val]
285
+ end
286
+ end
287
+
288
+ private def append_field_value(ary, val)
289
+ case val
290
+ when Enumerable
291
+ val.each{|x| append_field_value(ary, x)}
292
+ else
293
+ val = val.to_s
294
+ if /[\r\n]/n.match?(val.b)
295
+ raise ArgumentError, 'header field value cannot include CR/LF'
296
+ end
297
+ ary.push val
298
+ end
299
+ end
300
+ # :startdoc:
301
+
302
+ # Returns the array field value for the given +key+,
303
+ # or +nil+ if there is no such field;
304
+ # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
305
+ #
306
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
307
+ # res.get_fields('Connection') # => ["keep-alive"]
308
+ # res.get_fields('Nosuch') # => nil
309
+ #
310
+ def get_fields(key)
311
+ stringified_downcased_key = key.downcase.to_s
312
+ return nil unless @header[stringified_downcased_key]
313
+ @header[stringified_downcased_key].dup
314
+ end
315
+
316
+ # call-seq:
317
+ # fetch(key, default_val = nil) {|key| ... } -> object
318
+ # fetch(key, default_val = nil) -> value or default_val
319
+ #
320
+ # With a block, returns the string value for +key+ if it exists;
321
+ # otherwise returns the value of the block;
322
+ # ignores the +default_val+;
323
+ # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
324
+ #
325
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
326
+ #
327
+ # # Field exists; block not called.
328
+ # res.fetch('Connection') do |value|
329
+ # fail 'Cannot happen'
330
+ # end # => "keep-alive"
331
+ #
332
+ # # Field does not exist; block called.
333
+ # res.fetch('Nosuch') do |value|
334
+ # value.downcase
335
+ # end # => "nosuch"
336
+ #
337
+ # With no block, returns the string value for +key+ if it exists;
338
+ # otherwise, returns +default_val+ if it was given;
339
+ # otherwise raises an exception:
340
+ #
341
+ # res.fetch('Connection', 'Foo') # => "keep-alive"
342
+ # res.fetch('Nosuch', 'Foo') # => "Foo"
343
+ # res.fetch('Nosuch') # Raises KeyError.
344
+ #
345
+ def fetch(key, *args, &block) #:yield: +key+
346
+ a = @header.fetch(key.downcase.to_s, *args, &block)
347
+ a.kind_of?(Array) ? a.join(', ') : a
348
+ end
349
+
350
+ # Calls the block with each key/value pair:
351
+ #
352
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
353
+ # res.each_header do |key, value|
354
+ # p [key, value] if key.start_with?('c')
355
+ # end
356
+ #
357
+ # Output:
358
+ #
359
+ # ["content-type", "application/json; charset=utf-8"]
360
+ # ["connection", "keep-alive"]
361
+ # ["cache-control", "max-age=43200"]
362
+ # ["cf-cache-status", "HIT"]
363
+ # ["cf-ray", "771d17e9bc542cf5-ORD"]
364
+ #
365
+ # Returns an enumerator if no block is given.
366
+ #
367
+ # Net::HTTPHeader#each is an alias for Net::HTTPHeader#each_header.
368
+ def each_header #:yield: +key+, +value+
369
+ block_given? or return enum_for(__method__) { @header.size }
370
+ @header.each do |k,va|
371
+ yield k, va.join(', ')
372
+ end
373
+ end
374
+
375
+ alias each each_header
376
+
377
+ # Calls the block with each field key:
378
+ #
379
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
380
+ # res.each_key do |key|
381
+ # p key if key.start_with?('c')
382
+ # end
383
+ #
384
+ # Output:
385
+ #
386
+ # "content-type"
387
+ # "connection"
388
+ # "cache-control"
389
+ # "cf-cache-status"
390
+ # "cf-ray"
391
+ #
392
+ # Returns an enumerator if no block is given.
393
+ #
394
+ # Net::HTTPHeader#each_name is an alias for Net::HTTPHeader#each_key.
395
+ def each_name(&block) #:yield: +key+
396
+ block_given? or return enum_for(__method__) { @header.size }
397
+ @header.each_key(&block)
398
+ end
399
+
400
+ alias each_key each_name
401
+
402
+ # Calls the block with each capitalized field name:
403
+ #
404
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
405
+ # res.each_capitalized_name do |key|
406
+ # p key if key.start_with?('C')
407
+ # end
408
+ #
409
+ # Output:
410
+ #
411
+ # "Content-Type"
412
+ # "Connection"
413
+ # "Cache-Control"
414
+ # "Cf-Cache-Status"
415
+ # "Cf-Ray"
416
+ #
417
+ # The capitalization is system-dependent;
418
+ # see {Case Mapping}[https://docs.ruby-lang.org/en/master/case_mapping_rdoc.html].
419
+ #
420
+ # Returns an enumerator if no block is given.
421
+ def each_capitalized_name #:yield: +key+
422
+ block_given? or return enum_for(__method__) { @header.size }
423
+ @header.each_key do |k|
424
+ yield capitalize(k)
425
+ end
426
+ end
427
+
428
+ # Calls the block with each string field value:
429
+ #
430
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
431
+ # res.each_value do |value|
432
+ # p value if value.start_with?('c')
433
+ # end
434
+ #
435
+ # Output:
436
+ #
437
+ # "chunked"
438
+ # "cf-q-config;dur=6.0000002122251e-06"
439
+ # "cloudflare"
440
+ #
441
+ # Returns an enumerator if no block is given.
442
+ def each_value #:yield: +value+
443
+ block_given? or return enum_for(__method__) { @header.size }
444
+ @header.each_value do |va|
445
+ yield va.join(', ')
446
+ end
447
+ end
448
+
449
+ # Removes the header for the given case-insensitive +key+
450
+ # (see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]);
451
+ # returns the deleted value, or +nil+ if no such field exists:
452
+ #
453
+ # req = Net::HTTP::Get.new(uri)
454
+ # req.delete('Accept') # => ["*/*"]
455
+ # req.delete('Nosuch') # => nil
456
+ #
457
+ def delete(key)
458
+ @header.delete(key.downcase.to_s)
459
+ end
460
+
461
+ # Returns +true+ if the field for the case-insensitive +key+ exists, +false+ otherwise:
462
+ #
463
+ # req = Net::HTTP::Get.new(uri)
464
+ # req.key?('Accept') # => true
465
+ # req.key?('Nosuch') # => false
466
+ #
467
+ def key?(key)
468
+ @header.key?(key.downcase.to_s)
469
+ end
470
+
471
+ # Returns a hash of the key/value pairs:
472
+ #
473
+ # req = Net::HTTP::Get.new(uri)
474
+ # req.to_hash
475
+ # # =>
476
+ # {"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],
477
+ # "accept"=>["*/*"],
478
+ # "user-agent"=>["Ruby"],
479
+ # "host"=>["jsonplaceholder.typicode.com"]}
480
+ #
481
+ def to_hash
482
+ @header.dup
483
+ end
484
+
485
+ # Like #each_header, but the keys are returned in capitalized form.
486
+ #
487
+ # Net::HTTPHeader#canonical_each is an alias for Net::HTTPHeader#each_capitalized.
488
+ def each_capitalized
489
+ block_given? or return enum_for(__method__) { @header.size }
490
+ @header.each do |k,v|
491
+ yield capitalize(k), v.join(', ')
492
+ end
493
+ end
494
+
495
+ alias canonical_each each_capitalized
496
+
497
+ def capitalize(name) # :nodoc:
498
+ name.to_s.split('-'.freeze).map {|s| s.capitalize }.join('-'.freeze)
499
+ end
500
+ private :capitalize
501
+
502
+ # Returns an array of Range objects that represent
503
+ # the value of field <tt>'Range'</tt>,
504
+ # or +nil+ if there is no such field;
505
+ # see {Range request header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#range-request-header]:
506
+ #
507
+ # req = Net::HTTP::Get.new(uri)
508
+ # req['Range'] = 'bytes=0-99,200-299,400-499'
509
+ # req.range # => [0..99, 200..299, 400..499]
510
+ # req.delete('Range')
511
+ # req.range # # => nil
512
+ #
513
+ def range
514
+ return nil unless @header['range']
515
+
516
+ value = self['Range']
517
+ # byte-range-set = *( "," OWS ) ( byte-range-spec / suffix-byte-range-spec )
518
+ # *( OWS "," [ OWS ( byte-range-spec / suffix-byte-range-spec ) ] )
519
+ # corrected collected ABNF
520
+ # http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-19#section-5.4.1
521
+ # http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-19#appendix-C
522
+ # http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-19#section-3.2.5
523
+ unless /\Abytes=((?:,[ \t]*)*(?:\d+-\d*|-\d+)(?:[ \t]*,(?:[ \t]*\d+-\d*|-\d+)?)*)\z/ =~ value
524
+ raise Net::HTTPHeaderSyntaxError, "invalid syntax for byte-ranges-specifier: '#{value}'"
525
+ end
526
+
527
+ byte_range_set = $1
528
+ result = byte_range_set.split(/,/).map {|spec|
529
+ m = /(\d+)?\s*-\s*(\d+)?/i.match(spec) or
530
+ raise Net::HTTPHeaderSyntaxError, "invalid byte-range-spec: '#{spec}'"
531
+ d1 = m[1].to_i
532
+ d2 = m[2].to_i
533
+ if m[1] and m[2]
534
+ if d1 > d2
535
+ raise Net::HTTPHeaderSyntaxError, "last-byte-pos MUST greater than or equal to first-byte-pos but '#{spec}'"
536
+ end
537
+ d1..d2
538
+ elsif m[1]
539
+ d1..-1
540
+ elsif m[2]
541
+ -d2..-1
542
+ else
543
+ raise Net::HTTPHeaderSyntaxError, 'range is not specified'
544
+ end
545
+ }
546
+ # if result.empty?
547
+ # byte-range-set must include at least one byte-range-spec or suffix-byte-range-spec
548
+ # but above regexp already denies it.
549
+ if result.size == 1 && result[0].begin == 0 && result[0].end == -1
550
+ raise Net::HTTPHeaderSyntaxError, 'only one suffix-byte-range-spec with zero suffix-length'
551
+ end
552
+ result
553
+ end
554
+
555
+ # call-seq:
556
+ # set_range(length) -> length
557
+ # set_range(offset, length) -> range
558
+ # set_range(begin..length) -> range
559
+ #
560
+ # Sets the value for field <tt>'Range'</tt>;
561
+ # see {Range request header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#range-request-header]:
562
+ #
563
+ # With argument +length+:
564
+ #
565
+ # req = Net::HTTP::Get.new(uri)
566
+ # req.set_range(100) # => 100
567
+ # req['Range'] # => "bytes=0-99"
568
+ #
569
+ # With arguments +offset+ and +length+:
570
+ #
571
+ # req.set_range(100, 100) # => 100...200
572
+ # req['Range'] # => "bytes=100-199"
573
+ #
574
+ # With argument +range+:
575
+ #
576
+ # req.set_range(100..199) # => 100..199
577
+ # req['Range'] # => "bytes=100-199"
578
+ #
579
+ # Net::HTTPHeader#range= is an alias for Net::HTTPHeader#set_range.
580
+ def set_range(r, e = nil)
581
+ unless r
582
+ @header.delete 'range'
583
+ return r
584
+ end
585
+ r = (r...r+e) if e
586
+ case r
587
+ when Numeric
588
+ n = r.to_i
589
+ rangestr = (n > 0 ? "0-#{n-1}" : "-#{-n}")
590
+ when Range
591
+ first = r.first
592
+ last = r.end
593
+ last -= 1 if r.exclude_end?
594
+ if last == -1
595
+ rangestr = (first > 0 ? "#{first}-" : "-#{-first}")
596
+ else
597
+ raise Net::HTTPHeaderSyntaxError, 'range.first is negative' if first < 0
598
+ raise Net::HTTPHeaderSyntaxError, 'range.last is negative' if last < 0
599
+ raise Net::HTTPHeaderSyntaxError, 'must be .first < .last' if first > last
600
+ rangestr = "#{first}-#{last}"
601
+ end
602
+ else
603
+ raise TypeError, 'Range/Integer is required'
604
+ end
605
+ @header['range'] = ["bytes=#{rangestr}"]
606
+ r
607
+ end
608
+
609
+ alias range= set_range
610
+
611
+ # Returns the value of field <tt>'Content-Length'</tt> as an integer,
612
+ # or +nil+ if there is no such field;
613
+ # see {Content-Length request header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-length-request-header]:
614
+ #
615
+ # res = Net::HTTP.get_response(hostname, '/nosuch/1')
616
+ # res.content_length # => 2
617
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
618
+ # res.content_length # => nil
619
+ #
620
+ def content_length
621
+ return nil unless key?('Content-Length')
622
+ len = self['Content-Length'].slice(/\d+/) or
623
+ raise Net::HTTPHeaderSyntaxError, 'wrong Content-Length format'
624
+ len.to_i
625
+ end
626
+
627
+ # Sets the value of field <tt>'Content-Length'</tt> to the given numeric;
628
+ # see {Content-Length response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-length-response-header]:
629
+ #
630
+ # _uri = uri.dup
631
+ # hostname = _uri.hostname # => "jsonplaceholder.typicode.com"
632
+ # _uri.path = '/posts' # => "/posts"
633
+ # req = Net::HTTP::Post.new(_uri) # => #<Net::HTTP::Post POST>
634
+ # req.body = '{"title": "foo","body": "bar","userId": 1}'
635
+ # req.content_length = req.body.size # => 42
636
+ # req.content_type = 'application/json'
637
+ # res = Net::HTTP.start(hostname) do |http|
638
+ # http.request(req)
639
+ # end # => #<Net::HTTPCreated 201 Created readbody=true>
640
+ #
641
+ def content_length=(len)
642
+ unless len
643
+ @header.delete 'content-length'
644
+ return nil
645
+ end
646
+ @header['content-length'] = [len.to_i.to_s]
647
+ end
648
+
649
+ # Returns +true+ if field <tt>'Transfer-Encoding'</tt>
650
+ # exists and has value <tt>'chunked'</tt>,
651
+ # +false+ otherwise;
652
+ # see {Transfer-Encoding response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#transfer-encoding-response-header]:
653
+ #
654
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
655
+ # res['Transfer-Encoding'] # => "chunked"
656
+ # res.chunked? # => true
657
+ #
658
+ def chunked?
659
+ return false unless @header['transfer-encoding']
660
+ field = self['Transfer-Encoding']
661
+ (/(?:\A|[^\-\w])chunked(?![\-\w])/i =~ field) ? true : false
662
+ end
663
+
664
+ # Returns a Range object representing the value of field
665
+ # <tt>'Content-Range'</tt>, or +nil+ if no such field exists;
666
+ # see {Content-Range response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-range-response-header]:
667
+ #
668
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
669
+ # res['Content-Range'] # => nil
670
+ # res['Content-Range'] = 'bytes 0-499/1000'
671
+ # res['Content-Range'] # => "bytes 0-499/1000"
672
+ # res.content_range # => 0..499
673
+ #
674
+ def content_range
675
+ return nil unless @header['content-range']
676
+ m = %r<\A\s*(\w+)\s+(\d+)-(\d+)/(\d+|\*)>.match(self['Content-Range']) or
677
+ raise Net::HTTPHeaderSyntaxError, 'wrong Content-Range format'
678
+ return unless m[1] == 'bytes'
679
+ m[2].to_i .. m[3].to_i
680
+ end
681
+
682
+ # Returns the integer representing length of the value of field
683
+ # <tt>'Content-Range'</tt>, or +nil+ if no such field exists;
684
+ # see {Content-Range response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-range-response-header]:
685
+ #
686
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
687
+ # res['Content-Range'] # => nil
688
+ # res['Content-Range'] = 'bytes 0-499/1000'
689
+ # res.range_length # => 500
690
+ #
691
+ def range_length
692
+ r = content_range() or return nil
693
+ r.end - r.begin + 1
694
+ end
695
+
696
+ # Returns the {media type}[https://en.wikipedia.org/wiki/Media_type]
697
+ # from the value of field <tt>'Content-Type'</tt>,
698
+ # or +nil+ if no such field exists;
699
+ # see {Content-Type response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-response-header]:
700
+ #
701
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
702
+ # res['content-type'] # => "application/json; charset=utf-8"
703
+ # res.content_type # => "application/json"
704
+ #
705
+ def content_type
706
+ main = main_type()
707
+ return nil unless main
708
+
709
+ sub = sub_type()
710
+ if sub
711
+ "#{main}/#{sub}"
712
+ else
713
+ main
714
+ end
715
+ end
716
+
717
+ # Returns the leading ('type') part of the
718
+ # {media type}[https://en.wikipedia.org/wiki/Media_type]
719
+ # from the value of field <tt>'Content-Type'</tt>,
720
+ # or +nil+ if no such field exists;
721
+ # see {Content-Type response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-response-header]:
722
+ #
723
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
724
+ # res['content-type'] # => "application/json; charset=utf-8"
725
+ # res.main_type # => "application"
726
+ #
727
+ def main_type
728
+ return nil unless @header['content-type']
729
+ self['Content-Type'].split(';').first.to_s.split('/')[0].to_s.strip
730
+ end
731
+
732
+ # Returns the trailing ('subtype') part of the
733
+ # {media type}[https://en.wikipedia.org/wiki/Media_type]
734
+ # from the value of field <tt>'Content-Type'</tt>,
735
+ # or +nil+ if no such field exists;
736
+ # see {Content-Type response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-response-header]:
737
+ #
738
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
739
+ # res['content-type'] # => "application/json; charset=utf-8"
740
+ # res.sub_type # => "json"
741
+ #
742
+ def sub_type
743
+ return nil unless @header['content-type']
744
+ _, sub = *self['Content-Type'].split(';').first.to_s.split('/')
745
+ return nil unless sub
746
+ sub.strip
747
+ end
748
+
749
+ # Returns the trailing ('parameters') part of the value of field <tt>'Content-Type'</tt>,
750
+ # or +nil+ if no such field exists;
751
+ # see {Content-Type response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-response-header]:
752
+ #
753
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
754
+ # res['content-type'] # => "application/json; charset=utf-8"
755
+ # res.type_params # => {"charset"=>"utf-8"}
756
+ #
757
+ def type_params
758
+ result = {}
759
+ list = self['Content-Type'].to_s.split(';')
760
+ list.shift
761
+ list.each do |param|
762
+ k, v = *param.split('=', 2)
763
+ result[k.strip] = v.strip
764
+ end
765
+ result
766
+ end
767
+
768
+ # Sets the value of field <tt>'Content-Type'</tt>;
769
+ # returns the new value;
770
+ # see {Content-Type request header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-request-header]:
771
+ #
772
+ # req = Net::HTTP::Get.new(uri)
773
+ # req.set_content_type('application/json') # => ["application/json"]
774
+ #
775
+ # Net::HTTPHeader#content_type= is an alias for Net::HTTPHeader#set_content_type.
776
+ def set_content_type(type, params = {})
777
+ @header['content-type'] = [type + params.map{|k,v|"; #{k}=#{v}"}.join('')]
778
+ end
779
+
780
+ alias content_type= set_content_type
781
+
782
+ # Sets the request body to a URL-encoded string derived from argument +params+,
783
+ # and sets request header field <tt>'Content-Type'</tt>
784
+ # to <tt>'application/x-www-form-urlencoded'</tt>.
785
+ #
786
+ # The resulting request is suitable for HTTP request +POST+ or +PUT+.
787
+ #
788
+ # Argument +params+ must be suitable for use as argument +enum+ to
789
+ # {URI.encode_www_form}[https://docs.ruby-lang.org/en/master/URI.html#method-c-encode_www_form].
790
+ #
791
+ # With only argument +params+ given,
792
+ # sets the body to a URL-encoded string with the default separator <tt>'&'</tt>:
793
+ #
794
+ # req = Net::HTTP::Post.new('example.com')
795
+ #
796
+ # req.set_form_data(q: 'ruby', lang: 'en')
797
+ # req.body # => "q=ruby&lang=en"
798
+ # req['Content-Type'] # => "application/x-www-form-urlencoded"
799
+ #
800
+ # req.set_form_data([['q', 'ruby'], ['lang', 'en']])
801
+ # req.body # => "q=ruby&lang=en"
802
+ #
803
+ # req.set_form_data(q: ['ruby', 'perl'], lang: 'en')
804
+ # req.body # => "q=ruby&q=perl&lang=en"
805
+ #
806
+ # req.set_form_data([['q', 'ruby'], ['q', 'perl'], ['lang', 'en']])
807
+ # req.body # => "q=ruby&q=perl&lang=en"
808
+ #
809
+ # With string argument +sep+ also given,
810
+ # uses that string as the separator:
811
+ #
812
+ # req.set_form_data({q: 'ruby', lang: 'en'}, '|')
813
+ # req.body # => "q=ruby|lang=en"
814
+ #
815
+ # Net::HTTPHeader#form_data= is an alias for Net::HTTPHeader#set_form_data.
816
+ def set_form_data(params, sep = '&')
817
+ query = URI.encode_www_form(params)
818
+ query.gsub!(/&/, sep) if sep != '&'
819
+ self.body = query
820
+ self.content_type = 'application/x-www-form-urlencoded'
821
+ end
822
+
823
+ alias form_data= set_form_data
824
+
825
+ # Stores form data to be used in a +POST+ or +PUT+ request.
826
+ #
827
+ # The form data given in +params+ consists of zero or more fields;
828
+ # each field is:
829
+ #
830
+ # - A scalar value.
831
+ # - A name/value pair.
832
+ # - An IO stream opened for reading.
833
+ #
834
+ # Argument +params+ should be an
835
+ # {Enumerable}[https://docs.ruby-lang.org/en/master/Enumerable.html#module-Enumerable-label-Enumerable+in+Ruby+Classes]
836
+ # (method <tt>params.map</tt> will be called),
837
+ # and is often an array or hash.
838
+ #
839
+ # First, we set up a request:
840
+ #
841
+ # _uri = uri.dup
842
+ # _uri.path ='/posts'
843
+ # req = Net::HTTP::Post.new(_uri)
844
+ #
845
+ # <b>Argument +params+ As an Array</b>
846
+ #
847
+ # When +params+ is an array,
848
+ # each of its elements is a subarray that defines a field;
849
+ # the subarray may contain:
850
+ #
851
+ # - One string:
852
+ #
853
+ # req.set_form([['foo'], ['bar'], ['baz']])
854
+ #
855
+ # - Two strings:
856
+ #
857
+ # req.set_form([%w[foo 0], %w[bar 1], %w[baz 2]])
858
+ #
859
+ # - When argument +enctype+ (see below) is given as
860
+ # <tt>'multipart/form-data'</tt>:
861
+ #
862
+ # - A string name and an IO stream opened for reading:
863
+ #
864
+ # require 'stringio'
865
+ # req.set_form([['file', StringIO.new('Ruby is cool.')]])
866
+ #
867
+ # - A string name, an IO stream opened for reading,
868
+ # and an options hash, which may contain these entries:
869
+ #
870
+ # - +:filename+: The name of the file to use.
871
+ # - +:content_type+: The content type of the uploaded file.
872
+ #
873
+ # Example:
874
+ #
875
+ # req.set_form([['file', file, {filename: "other-filename.foo"}]]
876
+ #
877
+ # The various forms may be mixed:
878
+ #
879
+ # req.set_form(['foo', %w[bar 1], ['file', file]])
880
+ #
881
+ # <b>Argument +params+ As a Hash</b>
882
+ #
883
+ # When +params+ is a hash,
884
+ # each of its entries is a name/value pair that defines a field:
885
+ #
886
+ # - The name is a string.
887
+ # - The value may be:
888
+ #
889
+ # - +nil+.
890
+ # - Another string.
891
+ # - An IO stream opened for reading
892
+ # (only when argument +enctype+ -- see below -- is given as
893
+ # <tt>'multipart/form-data'</tt>).
894
+ #
895
+ # Examples:
896
+ #
897
+ # # Nil-valued fields.
898
+ # req.set_form({'foo' => nil, 'bar' => nil, 'baz' => nil})
899
+ #
900
+ # # String-valued fields.
901
+ # req.set_form({'foo' => 0, 'bar' => 1, 'baz' => 2})
902
+ #
903
+ # # IO-valued field.
904
+ # require 'stringio'
905
+ # req.set_form({'file' => StringIO.new('Ruby is cool.')})
906
+ #
907
+ # # Mixture of fields.
908
+ # req.set_form({'foo' => nil, 'bar' => 1, 'file' => file})
909
+ #
910
+ # Optional argument +enctype+ specifies the value to be given
911
+ # to field <tt>'Content-Type'</tt>, and must be one of:
912
+ #
913
+ # - <tt>'application/x-www-form-urlencoded'</tt> (the default).
914
+ # - <tt>'multipart/form-data'</tt>;
915
+ # see {RFC 7578}[https://www.rfc-editor.org/rfc/rfc7578].
916
+ #
917
+ # Optional argument +formopt+ is a hash of options
918
+ # (applicable only when argument +enctype+
919
+ # is <tt>'multipart/form-data'</tt>)
920
+ # that may include the following entries:
921
+ #
922
+ # - +:boundary+: The value is the boundary string for the multipart message.
923
+ # If not given, the boundary is a random string.
924
+ # See {Boundary}[https://www.rfc-editor.org/rfc/rfc7578#section-4.1].
925
+ # - +:charset+: Value is the character set for the form submission.
926
+ # Field names and values of non-file fields should be encoded with this charset.
927
+ #
928
+ def set_form(params, enctype='application/x-www-form-urlencoded', formopt={})
929
+ @body_data = params
930
+ @body = nil
931
+ @body_stream = nil
932
+ @form_option = formopt
933
+ case enctype
934
+ when /\Aapplication\/x-www-form-urlencoded\z/i,
935
+ /\Amultipart\/form-data\z/i
936
+ self.content_type = enctype
937
+ else
938
+ raise ArgumentError, "invalid enctype: #{enctype}"
939
+ end
940
+ end
941
+
942
+ # Sets header <tt>'Authorization'</tt> using the given
943
+ # +account+ and +password+ strings:
944
+ #
945
+ # req.basic_auth('my_account', 'my_password')
946
+ # req['Authorization']
947
+ # # => "Basic bXlfYWNjb3VudDpteV9wYXNzd29yZA=="
948
+ #
949
+ def basic_auth(account, password)
950
+ @header['authorization'] = [basic_encode(account, password)]
951
+ end
952
+
953
+ # Sets header <tt>'Proxy-Authorization'</tt> using the given
954
+ # +account+ and +password+ strings:
955
+ #
956
+ # req.proxy_basic_auth('my_account', 'my_password')
957
+ # req['Proxy-Authorization']
958
+ # # => "Basic bXlfYWNjb3VudDpteV9wYXNzd29yZA=="
959
+ #
960
+ def proxy_basic_auth(account, password)
961
+ @header['proxy-authorization'] = [basic_encode(account, password)]
962
+ end
963
+
964
+ def basic_encode(account, password) # :nodoc:
965
+ 'Basic ' + ["#{account}:#{password}"].pack('m0')
966
+ end
967
+ private :basic_encode
968
+
969
+ # Returns whether the HTTP session is to be closed.
970
+ def connection_close?
971
+ token = /(?:\A|,)\s*close\s*(?:\z|,)/i
972
+ @header['connection']&.grep(token) {return true}
973
+ @header['proxy-connection']&.grep(token) {return true}
974
+ false
975
+ end
976
+
977
+ # Returns whether the HTTP session is to be kept alive.
978
+ def connection_keep_alive?
979
+ token = /(?:\A|,)\s*keep-alive\s*(?:\z|,)/i
980
+ @header['connection']&.grep(token) {return true}
981
+ @header['proxy-connection']&.grep(token) {return true}
982
+ false
983
+ end
984
+
985
+ end