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,739 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This class is the base class for \Net::HTTP response classes.
4
+ #
5
+ # == About the Examples
6
+ #
7
+ # :include: doc/net-http/examples.rdoc
8
+ #
9
+ # == Returned Responses
10
+ #
11
+ # \Method Net::HTTP.get_response returns
12
+ # an instance of one of the subclasses of \Net::HTTPResponse:
13
+ #
14
+ # Net::HTTP.get_response(uri)
15
+ # # => #<Net::HTTPOK 200 OK readbody=true>
16
+ # Net::HTTP.get_response(hostname, '/nosuch')
17
+ # # => #<Net::HTTPNotFound 404 Not Found readbody=true>
18
+ #
19
+ # As does method Net::HTTP#request:
20
+ #
21
+ # req = Net::HTTP::Get.new(uri)
22
+ # Net::HTTP.start(hostname) do |http|
23
+ # http.request(req)
24
+ # end # => #<Net::HTTPOK 200 OK readbody=true>
25
+ #
26
+ # \Class \Net::HTTPResponse includes module Net::HTTPHeader,
27
+ # which provides access to response header values via (among others):
28
+ #
29
+ # - \Hash-like method <tt>[]</tt>.
30
+ # - Specific reader methods, such as +content_type+.
31
+ #
32
+ # Examples:
33
+ #
34
+ # res = Net::HTTP.get_response(uri) # => #<Net::HTTPOK 200 OK readbody=true>
35
+ # res['Content-Type'] # => "text/html; charset=UTF-8"
36
+ # res.content_type # => "text/html"
37
+ #
38
+ # == Response Subclasses
39
+ #
40
+ # \Class \Net::HTTPResponse has a subclass for each
41
+ # {HTTP status code}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes].
42
+ # You can look up the response class for a given code:
43
+ #
44
+ # Net::HTTPResponse::CODE_TO_OBJ['200'] # => Net::HTTPOK
45
+ # Net::HTTPResponse::CODE_TO_OBJ['400'] # => Net::HTTPBadRequest
46
+ # Net::HTTPResponse::CODE_TO_OBJ['404'] # => Net::HTTPNotFound
47
+ #
48
+ # And you can retrieve the status code for a response object:
49
+ #
50
+ # Net::HTTP.get_response(uri).code # => "200"
51
+ # Net::HTTP.get_response(hostname, '/nosuch').code # => "404"
52
+ #
53
+ # The response subclasses (indentation shows class hierarchy):
54
+ #
55
+ # - Net::HTTPUnknownResponse (for unhandled \HTTP extensions).
56
+ #
57
+ # - Net::HTTPInformation:
58
+ #
59
+ # - Net::HTTPContinue (100)
60
+ # - Net::HTTPSwitchProtocol (101)
61
+ # - Net::HTTPProcessing (102)
62
+ # - Net::HTTPEarlyHints (103)
63
+ #
64
+ # - Net::HTTPSuccess:
65
+ #
66
+ # - Net::HTTPOK (200)
67
+ # - Net::HTTPCreated (201)
68
+ # - Net::HTTPAccepted (202)
69
+ # - Net::HTTPNonAuthoritativeInformation (203)
70
+ # - Net::HTTPNoContent (204)
71
+ # - Net::HTTPResetContent (205)
72
+ # - Net::HTTPPartialContent (206)
73
+ # - Net::HTTPMultiStatus (207)
74
+ # - Net::HTTPAlreadyReported (208)
75
+ # - Net::HTTPIMUsed (226)
76
+ #
77
+ # - Net::HTTPRedirection:
78
+ #
79
+ # - Net::HTTPMultipleChoices (300)
80
+ # - Net::HTTPMovedPermanently (301)
81
+ # - Net::HTTPFound (302)
82
+ # - Net::HTTPSeeOther (303)
83
+ # - Net::HTTPNotModified (304)
84
+ # - Net::HTTPUseProxy (305)
85
+ # - Net::HTTPTemporaryRedirect (307)
86
+ # - Net::HTTPPermanentRedirect (308)
87
+ #
88
+ # - Net::HTTPClientError:
89
+ #
90
+ # - Net::HTTPBadRequest (400)
91
+ # - Net::HTTPUnauthorized (401)
92
+ # - Net::HTTPPaymentRequired (402)
93
+ # - Net::HTTPForbidden (403)
94
+ # - Net::HTTPNotFound (404)
95
+ # - Net::HTTPMethodNotAllowed (405)
96
+ # - Net::HTTPNotAcceptable (406)
97
+ # - Net::HTTPProxyAuthenticationRequired (407)
98
+ # - Net::HTTPRequestTimeOut (408)
99
+ # - Net::HTTPConflict (409)
100
+ # - Net::HTTPGone (410)
101
+ # - Net::HTTPLengthRequired (411)
102
+ # - Net::HTTPPreconditionFailed (412)
103
+ # - Net::HTTPRequestEntityTooLarge (413)
104
+ # - Net::HTTPRequestURITooLong (414)
105
+ # - Net::HTTPUnsupportedMediaType (415)
106
+ # - Net::HTTPRequestedRangeNotSatisfiable (416)
107
+ # - Net::HTTPExpectationFailed (417)
108
+ # - Net::HTTPMisdirectedRequest (421)
109
+ # - Net::HTTPUnprocessableEntity (422)
110
+ # - Net::HTTPLocked (423)
111
+ # - Net::HTTPFailedDependency (424)
112
+ # - Net::HTTPUpgradeRequired (426)
113
+ # - Net::HTTPPreconditionRequired (428)
114
+ # - Net::HTTPTooManyRequests (429)
115
+ # - Net::HTTPRequestHeaderFieldsTooLarge (431)
116
+ # - Net::HTTPUnavailableForLegalReasons (451)
117
+ #
118
+ # - Net::HTTPServerError:
119
+ #
120
+ # - Net::HTTPInternalServerError (500)
121
+ # - Net::HTTPNotImplemented (501)
122
+ # - Net::HTTPBadGateway (502)
123
+ # - Net::HTTPServiceUnavailable (503)
124
+ # - Net::HTTPGatewayTimeOut (504)
125
+ # - Net::HTTPVersionNotSupported (505)
126
+ # - Net::HTTPVariantAlsoNegotiates (506)
127
+ # - Net::HTTPInsufficientStorage (507)
128
+ # - Net::HTTPLoopDetected (508)
129
+ # - Net::HTTPNotExtended (510)
130
+ # - Net::HTTPNetworkAuthenticationRequired (511)
131
+ #
132
+ # There is also the Net::HTTPBadResponse exception which is raised when
133
+ # there is a protocol error.
134
+ #
135
+ class Net::HTTPResponse
136
+ class << self
137
+ # true if the response has a body.
138
+ def body_permitted?
139
+ self::HAS_BODY
140
+ end
141
+
142
+ def exception_type # :nodoc: internal use only
143
+ self::EXCEPTION_TYPE
144
+ end
145
+
146
+ def read_new(sock) #:nodoc: internal use only
147
+ httpv, code, msg = read_status_line(sock)
148
+ res = response_class(code).new(httpv, code, msg)
149
+ each_response_header(sock) do |k,v|
150
+ res.add_field k, v
151
+ end
152
+ res
153
+ end
154
+
155
+ private
156
+ # :stopdoc:
157
+
158
+ def read_status_line(sock)
159
+ str = sock.readline
160
+ m = /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)(?:\s+(.*))?\z/in.match(str) or
161
+ raise Net::HTTPBadResponse, "wrong status line: #{str.dump}"
162
+ m.captures
163
+ end
164
+
165
+ def response_class(code)
166
+ CODE_TO_OBJ[code] or
167
+ CODE_CLASS_TO_OBJ[code[0,1]] or
168
+ Net::HTTPUnknownResponse
169
+ end
170
+
171
+ def each_response_header(sock)
172
+ key = value = nil
173
+ while true
174
+ line = sock.readuntil("\n", true).sub(/\s+\z/, '')
175
+ break if line.empty?
176
+ if line[0] == ?\s or line[0] == ?\t and value
177
+ value << ' ' unless value.empty?
178
+ value << line.strip
179
+ else
180
+ yield key, value if key
181
+ key, value = line.strip.split(/\s*:\s*/, 2)
182
+ raise Net::HTTPBadResponse, 'wrong header line format' if value.nil?
183
+ end
184
+ end
185
+ yield key, value if key
186
+ end
187
+ end
188
+
189
+ # next is to fix bug in RDoc, where the private inside class << self
190
+ # spills out.
191
+ public
192
+
193
+ include Net::HTTPHeader
194
+
195
+ def initialize(httpv, code, msg) #:nodoc: internal use only
196
+ @http_version = httpv
197
+ @code = code
198
+ @message = msg
199
+ initialize_http_header nil
200
+ @body = nil
201
+ @read = false
202
+ @uri = nil
203
+ @decode_content = false
204
+ @body_encoding = false
205
+ @ignore_eof = true
206
+ end
207
+
208
+ # The HTTP version supported by the server.
209
+ attr_reader :http_version
210
+
211
+ # The HTTP result code string. For example, '302'. You can also
212
+ # determine the response type by examining which response subclass
213
+ # the response object is an instance of.
214
+ attr_reader :code
215
+
216
+ # The HTTP result message sent by the server. For example, 'Not Found'.
217
+ attr_reader :message
218
+ alias msg message # :nodoc: obsolete
219
+
220
+ # The URI used to fetch this response. The response URI is only available
221
+ # if a URI was used to create the request.
222
+ attr_reader :uri
223
+
224
+ # Set to true automatically when the request did not contain an
225
+ # Accept-Encoding header from the user.
226
+ attr_accessor :decode_content
227
+
228
+ # Returns the value set by body_encoding=, or +false+ if none;
229
+ # see #body_encoding=.
230
+ attr_reader :body_encoding
231
+
232
+ # Sets the encoding that should be used when reading the body:
233
+ #
234
+ # - If the given value is an Encoding object, that encoding will be used.
235
+ # - Otherwise if the value is a string, the value of
236
+ # {Encoding#find(value)}[https://docs.ruby-lang.org/en/master/Encoding.html#method-c-find]
237
+ # will be used.
238
+ # - Otherwise an encoding will be deduced from the body itself.
239
+ #
240
+ # Examples:
241
+ #
242
+ # http = Net::HTTP.new(hostname)
243
+ # req = Net::HTTP::Get.new('/')
244
+ #
245
+ # http.request(req) do |res|
246
+ # p res.body.encoding # => #<Encoding:ASCII-8BIT>
247
+ # end
248
+ #
249
+ # http.request(req) do |res|
250
+ # res.body_encoding = "UTF-8"
251
+ # p res.body.encoding # => #<Encoding:UTF-8>
252
+ # end
253
+ #
254
+ def body_encoding=(value)
255
+ value = Encoding.find(value) if value.is_a?(String)
256
+ @body_encoding = value
257
+ end
258
+
259
+ # Whether to ignore EOF when reading bodies with a specified Content-Length
260
+ # header.
261
+ attr_accessor :ignore_eof
262
+
263
+ def inspect # :nodoc:
264
+ "#<#{self.class} #{@code} #{@message} readbody=#{@read}>"
265
+ end
266
+
267
+ #
268
+ # response <-> exception relationship
269
+ #
270
+
271
+ def code_type #:nodoc:
272
+ self.class
273
+ end
274
+
275
+ def error! #:nodoc:
276
+ message = @code
277
+ message = "#{message} #{@message.dump}" if @message
278
+ raise error_type().new(message, self)
279
+ end
280
+
281
+ def error_type #:nodoc:
282
+ self.class::EXCEPTION_TYPE
283
+ end
284
+
285
+ # Raises an HTTP error if the response is not 2xx (success).
286
+ def value
287
+ error! unless self.kind_of?(Net::HTTPSuccess)
288
+ end
289
+
290
+ def uri= uri # :nodoc:
291
+ @uri = uri.dup if uri
292
+ end
293
+
294
+ #
295
+ # header (for backward compatibility only; DO NOT USE)
296
+ #
297
+
298
+ def response #:nodoc:
299
+ warn "Net::HTTPResponse#response is obsolete", uplevel: 1 if $VERBOSE
300
+ self
301
+ end
302
+
303
+ def header #:nodoc:
304
+ warn "Net::HTTPResponse#header is obsolete", uplevel: 1 if $VERBOSE
305
+ self
306
+ end
307
+
308
+ def read_header #:nodoc:
309
+ warn "Net::HTTPResponse#read_header is obsolete", uplevel: 1 if $VERBOSE
310
+ self
311
+ end
312
+
313
+ #
314
+ # body
315
+ #
316
+
317
+ def reading_body(sock, reqmethodallowbody) #:nodoc: internal use only
318
+ @socket = sock
319
+ @body_exist = reqmethodallowbody && self.class.body_permitted?
320
+ begin
321
+ yield
322
+ self.body # ensure to read body
323
+ ensure
324
+ @socket = nil
325
+ end
326
+ end
327
+
328
+ # Gets the entity body returned by the remote HTTP server.
329
+ #
330
+ # If a block is given, the body is passed to the block, and
331
+ # the body is provided in fragments, as it is read in from the socket.
332
+ #
333
+ # If +dest+ argument is given, response is read into that variable,
334
+ # with <code>dest#<<</code> method (it could be String or IO, or any
335
+ # other object responding to <code><<</code>).
336
+ #
337
+ # Calling this method a second or subsequent time for the same
338
+ # HTTPResponse object will return the value already read.
339
+ #
340
+ # http.request_get('/index.html') {|res|
341
+ # puts res.read_body
342
+ # }
343
+ #
344
+ # http.request_get('/index.html') {|res|
345
+ # p res.read_body.object_id # 538149362
346
+ # p res.read_body.object_id # 538149362
347
+ # }
348
+ #
349
+ # # using iterator
350
+ # http.request_get('/index.html') {|res|
351
+ # res.read_body do |segment|
352
+ # print segment
353
+ # end
354
+ # }
355
+ #
356
+ def read_body(dest = nil, &block)
357
+ if @read
358
+ raise IOError, "#{self.class}\#read_body called twice" if dest or block
359
+ return @body
360
+ end
361
+ to = procdest(dest, block)
362
+ stream_check
363
+ if @body_exist
364
+ read_body_0 to
365
+ @body = to
366
+ else
367
+ @body = nil
368
+ end
369
+ @read = true
370
+ return if @body.nil?
371
+
372
+ case enc = @body_encoding
373
+ when Encoding, false, nil
374
+ # Encoding: force given encoding
375
+ # false/nil: do not force encoding
376
+ else
377
+ # other value: detect encoding from body
378
+ enc = detect_encoding(@body)
379
+ end
380
+
381
+ @body.force_encoding(enc) if enc
382
+
383
+ @body
384
+ end
385
+
386
+ # Returns the string response body;
387
+ # note that repeated calls for the unmodified body return a cached string:
388
+ #
389
+ # path = '/todos/1'
390
+ # Net::HTTP.start(hostname) do |http|
391
+ # res = http.get(path)
392
+ # p res.body
393
+ # p http.head(path).body # No body.
394
+ # end
395
+ #
396
+ # Output:
397
+ #
398
+ # "{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false\n}"
399
+ # nil
400
+ #
401
+ def body
402
+ read_body()
403
+ end
404
+
405
+ # Sets the body of the response to the given value.
406
+ def body=(value)
407
+ @body = value
408
+ end
409
+
410
+ alias entity body #:nodoc: obsolete
411
+
412
+ private
413
+
414
+ # :nodoc:
415
+ def detect_encoding(str, encoding=nil)
416
+ if encoding
417
+ elsif encoding = type_params['charset']
418
+ elsif encoding = check_bom(str)
419
+ else
420
+ encoding = case content_type&.downcase
421
+ when %r{text/x(?:ht)?ml|application/(?:[^+]+\+)?xml}
422
+ /\A<xml[ \t\r\n]+
423
+ version[ \t\r\n]*=[ \t\r\n]*(?:"[0-9.]+"|'[0-9.]*')[ \t\r\n]+
424
+ encoding[ \t\r\n]*=[ \t\r\n]*
425
+ (?:"([A-Za-z][\-A-Za-z0-9._]*)"|'([A-Za-z][\-A-Za-z0-9._]*)')/x =~ str
426
+ encoding = $1 || $2 || Encoding::UTF_8
427
+ when %r{text/html.*}
428
+ sniff_encoding(str)
429
+ end
430
+ end
431
+ return encoding
432
+ end
433
+
434
+ # :nodoc:
435
+ def sniff_encoding(str, encoding=nil)
436
+ # the encoding sniffing algorithm
437
+ # http://www.w3.org/TR/html5/parsing.html#determining-the-character-encoding
438
+ if enc = scanning_meta(str)
439
+ enc
440
+ # 6. last visited page or something
441
+ # 7. frequency
442
+ elsif str.ascii_only?
443
+ Encoding::US_ASCII
444
+ elsif str.dup.force_encoding(Encoding::UTF_8).valid_encoding?
445
+ Encoding::UTF_8
446
+ end
447
+ # 8. implementation-defined or user-specified
448
+ end
449
+
450
+ # :nodoc:
451
+ def check_bom(str)
452
+ case str.byteslice(0, 2)
453
+ when "\xFE\xFF"
454
+ return Encoding::UTF_16BE
455
+ when "\xFF\xFE"
456
+ return Encoding::UTF_16LE
457
+ end
458
+ if "\xEF\xBB\xBF" == str.byteslice(0, 3)
459
+ return Encoding::UTF_8
460
+ end
461
+ nil
462
+ end
463
+
464
+ # :nodoc:
465
+ def scanning_meta(str)
466
+ require 'strscan'
467
+ ss = StringScanner.new(str)
468
+ if ss.scan_until(/<meta[\t\n\f\r ]*/)
469
+ attrs = {} # attribute_list
470
+ got_pragma = false
471
+ need_pragma = nil
472
+ charset = nil
473
+
474
+ # step: Attributes
475
+ while attr = get_attribute(ss)
476
+ name, value = *attr
477
+ next if attrs[name]
478
+ attrs[name] = true
479
+ case name
480
+ when 'http-equiv'
481
+ got_pragma = true if value == 'content-type'
482
+ when 'content'
483
+ encoding = extracting_encodings_from_meta_elements(value)
484
+ unless charset
485
+ charset = encoding
486
+ end
487
+ need_pragma = true
488
+ when 'charset'
489
+ need_pragma = false
490
+ charset = value
491
+ end
492
+ end
493
+
494
+ # step: Processing
495
+ return if need_pragma.nil?
496
+ return if need_pragma && !got_pragma
497
+
498
+ charset = Encoding.find(charset) rescue nil
499
+ return unless charset
500
+ charset = Encoding::UTF_8 if charset == Encoding::UTF_16
501
+ return charset # tentative
502
+ end
503
+ nil
504
+ end
505
+
506
+ def get_attribute(ss)
507
+ ss.scan(/[\t\n\f\r \/]*/)
508
+ if ss.peek(1) == '>'
509
+ ss.getch
510
+ return nil
511
+ end
512
+ name = ss.scan(/[^=\t\n\f\r \/>]*/)
513
+ name.downcase!
514
+ raise if name.empty?
515
+ ss.skip(/[\t\n\f\r ]*/)
516
+ if ss.getch != '='
517
+ value = ''
518
+ return [name, value]
519
+ end
520
+ ss.skip(/[\t\n\f\r ]*/)
521
+ case ss.peek(1)
522
+ when '"'
523
+ ss.getch
524
+ value = ss.scan(/[^"]+/)
525
+ value.downcase!
526
+ ss.getch
527
+ when "'"
528
+ ss.getch
529
+ value = ss.scan(/[^']+/)
530
+ value.downcase!
531
+ ss.getch
532
+ when '>'
533
+ value = ''
534
+ else
535
+ value = ss.scan(/[^\t\n\f\r >]+/)
536
+ value.downcase!
537
+ end
538
+ [name, value]
539
+ end
540
+
541
+ def extracting_encodings_from_meta_elements(value)
542
+ # http://dev.w3.org/html5/spec/fetching-resources.html#algorithm-for-extracting-an-encoding-from-a-meta-element
543
+ if /charset[\t\n\f\r ]*=(?:"([^"]*)"|'([^']*)'|["']|\z|([^\t\n\f\r ;]+))/i =~ value
544
+ return $1 || $2 || $3
545
+ end
546
+ return nil
547
+ end
548
+
549
+ ##
550
+ # Checks for a supported Content-Encoding header and yields an Inflate
551
+ # wrapper for this response's socket when zlib is present. If the
552
+ # Content-Encoding is not supported or zlib is missing, the plain socket is
553
+ # yielded.
554
+ #
555
+ # If a Content-Range header is present, a plain socket is yielded as the
556
+ # bytes in the range may not be a complete deflate block.
557
+
558
+ def inflater # :nodoc:
559
+ return yield @socket unless Net::HTTP::HAVE_ZLIB
560
+ return yield @socket unless @decode_content
561
+ return yield @socket if self['content-range']
562
+
563
+ v = self['content-encoding']
564
+ case v&.downcase
565
+ when 'deflate', 'gzip', 'x-gzip' then
566
+ self.delete 'content-encoding'
567
+
568
+ inflate_body_io = Inflater.new(@socket)
569
+
570
+ begin
571
+ yield inflate_body_io
572
+ success = true
573
+ ensure
574
+ begin
575
+ inflate_body_io.finish
576
+ if self['content-length']
577
+ self['content-length'] = inflate_body_io.bytes_inflated.to_s
578
+ end
579
+ rescue => err
580
+ # Ignore #finish's error if there is an exception from yield
581
+ raise err if success
582
+ end
583
+ end
584
+ when 'none', 'identity' then
585
+ self.delete 'content-encoding'
586
+
587
+ yield @socket
588
+ else
589
+ yield @socket
590
+ end
591
+ end
592
+
593
+ def read_body_0(dest)
594
+ inflater do |inflate_body_io|
595
+ if chunked?
596
+ read_chunked dest, inflate_body_io
597
+ return
598
+ end
599
+
600
+ @socket = inflate_body_io
601
+
602
+ clen = content_length()
603
+ if clen
604
+ @socket.read clen, dest, @ignore_eof
605
+ return
606
+ end
607
+ clen = range_length()
608
+ if clen
609
+ @socket.read clen, dest
610
+ return
611
+ end
612
+ @socket.read_all dest
613
+ end
614
+ end
615
+
616
+ ##
617
+ # read_chunked reads from +@socket+ for chunk-size, chunk-extension, CRLF,
618
+ # etc. and +chunk_data_io+ for chunk-data which may be deflate or gzip
619
+ # encoded.
620
+ #
621
+ # See RFC 2616 section 3.6.1 for definitions
622
+
623
+ def read_chunked(dest, chunk_data_io) # :nodoc:
624
+ total = 0
625
+ while true
626
+ line = @socket.readline
627
+ hexlen = line.slice(/[0-9a-fA-F]+/) or
628
+ raise Net::HTTPBadResponse, "wrong chunk size line: #{line}"
629
+ len = hexlen.hex
630
+ break if len == 0
631
+ begin
632
+ chunk_data_io.read len, dest
633
+ ensure
634
+ total += len
635
+ @socket.read 2 # \r\n
636
+ end
637
+ end
638
+ until @socket.readline.empty?
639
+ # none
640
+ end
641
+ end
642
+
643
+ def stream_check
644
+ raise IOError, 'attempt to read body out of block' if @socket.nil? || @socket.closed?
645
+ end
646
+
647
+ def procdest(dest, block)
648
+ raise ArgumentError, 'both arg and block given for HTTP method' if
649
+ dest and block
650
+ if block
651
+ Net::ReadAdapter.new(block)
652
+ else
653
+ dest || +''
654
+ end
655
+ end
656
+
657
+ ##
658
+ # Inflater is a wrapper around Net::BufferedIO that transparently inflates
659
+ # zlib and gzip streams.
660
+
661
+ class Inflater # :nodoc:
662
+
663
+ ##
664
+ # Creates a new Inflater wrapping +socket+
665
+
666
+ def initialize socket
667
+ @socket = socket
668
+ # zlib with automatic gzip detection
669
+ @inflate = Zlib::Inflate.new(32 + Zlib::MAX_WBITS)
670
+ end
671
+
672
+ ##
673
+ # Finishes the inflate stream.
674
+
675
+ def finish
676
+ return if @inflate.total_in == 0
677
+ @inflate.finish
678
+ end
679
+
680
+ ##
681
+ # The number of bytes inflated, used to update the Content-Length of
682
+ # the response.
683
+
684
+ def bytes_inflated
685
+ @inflate.total_out
686
+ end
687
+
688
+ ##
689
+ # Returns a Net::ReadAdapter that inflates each read chunk into +dest+.
690
+ #
691
+ # This allows a large response body to be inflated without storing the
692
+ # entire body in memory.
693
+
694
+ def inflate_adapter(dest)
695
+ if dest.respond_to?(:set_encoding)
696
+ dest.set_encoding(Encoding::ASCII_8BIT)
697
+ elsif dest.respond_to?(:force_encoding)
698
+ dest.force_encoding(Encoding::ASCII_8BIT)
699
+ end
700
+ block = proc do |compressed_chunk|
701
+ @inflate.inflate(compressed_chunk) do |chunk|
702
+ compressed_chunk.clear
703
+ dest << chunk
704
+ end
705
+ end
706
+
707
+ Net::ReadAdapter.new(block)
708
+ end
709
+
710
+ ##
711
+ # Reads +clen+ bytes from the socket, inflates them, then writes them to
712
+ # +dest+. +ignore_eof+ is passed down to Net::BufferedIO#read
713
+ #
714
+ # Unlike Net::BufferedIO#read, this method returns more than +clen+ bytes.
715
+ # At this time there is no way for a user of Net::HTTPResponse to read a
716
+ # specific number of bytes from the HTTP response body, so this internal
717
+ # API does not return the same number of bytes as were requested.
718
+ #
719
+ # See https://bugs.ruby-lang.org/issues/6492 for further discussion.
720
+
721
+ def read clen, dest, ignore_eof = false
722
+ temp_dest = inflate_adapter(dest)
723
+
724
+ @socket.read clen, temp_dest, ignore_eof
725
+ end
726
+
727
+ ##
728
+ # Reads the rest of the socket, inflates it, then writes it to +dest+.
729
+
730
+ def read_all dest
731
+ temp_dest = inflate_adapter(dest)
732
+
733
+ @socket.read_all temp_dest
734
+ end
735
+
736
+ end
737
+
738
+ end
739
+