iron_admin 0.5.0 → 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 (451) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/iron_admin_manifest.js +12 -0
  3. data/app/components/iron_admin/dashboards/metric_card_component.html.haml +8 -3
  4. data/app/components/iron_admin/dashboards/metric_card_component.rb +21 -1
  5. data/app/components/iron_admin/form/belongs_to_component.rb +60 -6
  6. data/app/components/iron_admin/form/nested_form_component.html.haml +28 -0
  7. data/app/components/iron_admin/form/nested_form_component.rb +81 -0
  8. data/app/components/iron_admin/resources/data_table_component.html.haml +1 -1
  9. data/app/components/iron_admin/resources/data_table_component.rb +6 -0
  10. data/app/components/iron_admin/resources/show_field_component.rb +2 -0
  11. data/app/controllers/iron_admin/application_controller.rb +32 -1
  12. data/app/controllers/iron_admin/concerns/action_executable.rb +44 -0
  13. data/app/controllers/iron_admin/concerns/filterable.rb +84 -0
  14. data/app/controllers/iron_admin/concerns/json_params_coercion.rb +67 -0
  15. data/app/controllers/iron_admin/concerns/nested_permittable.rb +36 -0
  16. data/app/controllers/iron_admin/concerns/scopeable.rb +84 -0
  17. data/app/controllers/iron_admin/concerns/searchable.rb +13 -16
  18. data/app/controllers/iron_admin/exports_controller.rb +15 -11
  19. data/app/controllers/iron_admin/imports_controller.rb +83 -0
  20. data/app/controllers/iron_admin/live_controller.rb +12 -0
  21. data/app/controllers/iron_admin/resources_controller.rb +118 -117
  22. data/app/controllers/iron_admin/search_controller.rb +5 -5
  23. data/app/controllers/iron_admin/tools_controller.rb +63 -4
  24. data/app/helpers/iron_admin/application_helper.rb +33 -14
  25. data/app/helpers/iron_admin/field_display_helper.rb +160 -1
  26. data/app/javascript/iron_admin/controllers/cp_nested_form_controller.js +113 -0
  27. data/app/javascript/iron_admin/controllers/filter_operator_controller.js +10 -0
  28. data/app/javascript/iron_admin/index.js +4 -0
  29. data/app/views/iron_admin/dashboard/index.html.haml +7 -2
  30. data/app/views/iron_admin/form/_nested_row.html.haml +70 -0
  31. data/app/views/iron_admin/imports/new.html.haml +27 -0
  32. data/app/views/iron_admin/imports/preview.html.haml +31 -0
  33. data/app/views/iron_admin/resources/_form.html.haml +81 -5
  34. data/app/views/iron_admin/resources/action_form.html.haml +62 -0
  35. data/app/views/iron_admin/resources/bulk_action_form.html.haml +62 -0
  36. data/app/views/iron_admin/resources/index.html.haml +60 -18
  37. data/app/views/iron_admin/tools/action_form.html.haml +57 -0
  38. data/app/views/iron_admin/tools/show.html.haml +20 -1
  39. data/config/importmap.rb +2 -0
  40. data/config/locales/en.yml +36 -0
  41. data/config/routes.rb +7 -0
  42. data/docs/components/filter-components.md +60 -0
  43. data/docs/getting-started/quick-start.md +17 -1
  44. data/docs/guides/authentication.md +7 -6
  45. data/docs/guides/custom-adapters.md +628 -0
  46. data/docs/guides/extending.md +132 -3
  47. data/docs/guides/fields.md +1 -1
  48. data/docs/guides/resources.md +78 -2
  49. data/docs/guides/troubleshooting.md +29 -0
  50. data/docs/reference/routes.md +10 -0
  51. data/lib/generators/iron_admin/install/install_generator.rb +28 -4
  52. data/lib/generators/iron_admin/install_audit/install_audit_generator.rb +26 -10
  53. data/lib/iron_admin/action_field.rb +56 -0
  54. data/lib/iron_admin/adapters/active_record.rb +237 -0
  55. data/lib/iron_admin/adapters/base.rb +340 -0
  56. data/lib/iron_admin/adapters/http/column_descriptor.rb +10 -0
  57. data/lib/iron_admin/adapters/http/configuration.rb +27 -0
  58. data/lib/iron_admin/adapters/http/connection.rb +117 -0
  59. data/lib/iron_admin/adapters/http/model_proxy.rb +75 -0
  60. data/lib/iron_admin/adapters/http/query.rb +111 -0
  61. data/lib/iron_admin/adapters/http/record.rb +83 -0
  62. data/lib/iron_admin/adapters/http/type_inferrer.rb +51 -0
  63. data/lib/iron_admin/adapters/http.rb +241 -0
  64. data/lib/iron_admin/adapters/mongoid/association_wrapper.rb +74 -0
  65. data/lib/iron_admin/adapters/mongoid/column_descriptor.rb +10 -0
  66. data/lib/iron_admin/adapters/mongoid.rb +284 -0
  67. data/lib/iron_admin/adapters/registry.rb +44 -0
  68. data/lib/iron_admin/concerns/importable.rb +81 -0
  69. data/lib/iron_admin/concerns/live_updatable.rb +38 -0
  70. data/lib/iron_admin/concerns/nestable.rb +69 -0
  71. data/lib/iron_admin/concerns/soft_deletable.rb +61 -0
  72. data/lib/iron_admin/configuration.rb +20 -0
  73. data/lib/iron_admin/dashboard.rb +15 -20
  74. data/lib/iron_admin/engine.rb +28 -1
  75. data/lib/iron_admin/errors.rb +29 -0
  76. data/lib/iron_admin/field_inferrer.rb +61 -22
  77. data/lib/iron_admin/filters/active_record_query_builder.rb +63 -0
  78. data/lib/iron_admin/filters/base_query_builder.rb +55 -0
  79. data/lib/iron_admin/filters/http_query_builder.rb +39 -0
  80. data/lib/iron_admin/filters/mongoid_query_builder.rb +58 -0
  81. data/lib/iron_admin/filters/query_builder.rb +12 -0
  82. data/lib/iron_admin/import/column_mapper.rb +42 -0
  83. data/lib/iron_admin/import/import_preview.rb +10 -0
  84. data/lib/iron_admin/import/import_result.rb +10 -0
  85. data/lib/iron_admin/import/importer.rb +231 -0
  86. data/lib/iron_admin/import/parser/csv.rb +34 -0
  87. data/lib/iron_admin/import/parser/json.rb +36 -0
  88. data/lib/iron_admin/import/type_caster.rb +47 -0
  89. data/lib/iron_admin/live/broadcaster.rb +43 -0
  90. data/lib/iron_admin/live/poll_cache.rb +28 -0
  91. data/lib/iron_admin/live.rb +29 -0
  92. data/lib/iron_admin/nested_association.rb +15 -0
  93. data/lib/iron_admin/nested_attributes_validator.rb +25 -0
  94. data/lib/iron_admin/policy.rb +72 -13
  95. data/lib/iron_admin/resource.rb +148 -90
  96. data/lib/iron_admin/resource_registry.rb +77 -4
  97. data/lib/iron_admin/tool.rb +50 -0
  98. data/lib/iron_admin/tool_action.rb +73 -0
  99. data/lib/iron_admin/tool_context.rb +49 -0
  100. data/lib/iron_admin/version.rb +1 -1
  101. data/lib/iron_admin.rb +28 -0
  102. data/vendor/bundle/ruby/3.2.0/cache/addressable-2.9.0.gem +0 -0
  103. data/vendor/bundle/ruby/3.2.0/cache/crack-1.0.1.gem +0 -0
  104. data/vendor/bundle/ruby/3.2.0/cache/faraday-2.14.1.gem +0 -0
  105. data/vendor/bundle/ruby/3.2.0/cache/faraday-net_http-3.4.2.gem +0 -0
  106. data/vendor/bundle/ruby/3.2.0/cache/hashdiff-1.2.1.gem +0 -0
  107. data/vendor/bundle/ruby/3.2.0/cache/net-http-0.9.1.gem +0 -0
  108. data/vendor/bundle/ruby/3.2.0/cache/public_suffix-7.0.5.gem +0 -0
  109. data/vendor/bundle/ruby/3.2.0/cache/rexml-3.4.4.gem +0 -0
  110. data/vendor/bundle/ruby/3.2.0/cache/webmock-3.26.2.gem +0 -0
  111. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-4.0.1/bigdecimal.so +0 -0
  112. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-4.0.1/gem_make.out +6 -6
  113. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-4.0.1/mkmf.log +25 -25
  114. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/date_core.so +0 -0
  115. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/gem_make.out +6 -6
  116. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/mkmf.log +4 -4
  117. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/erb-6.0.1/erb/escape.so +0 -0
  118. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/erb-6.0.1/gem_make.out +6 -6
  119. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/erb-6.0.1/mkmf.log +2 -2
  120. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/gem_make.out +6 -6
  121. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/io/console.so +0 -0
  122. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/mkmf.log +22 -22
  123. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/gem_make.out +6 -6
  124. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/json/ext/generator.so +0 -0
  125. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/json/ext/parser.so +0 -0
  126. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/mkmf.log +9 -9
  127. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/nio4r-2.7.5/gem_make.out +6 -6
  128. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/nio4r-2.7.5/mkmf.log +12 -12
  129. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/nio4r-2.7.5/nio4r_ext.so +0 -0
  130. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/prism-1.9.0/gem_make.out +6 -6
  131. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/prism-1.9.0/mkmf.log +6 -6
  132. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/prism-1.9.0/prism/prism.so +0 -0
  133. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.3.1/gem_make.out +6 -6
  134. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.3.1/mkmf.log +7 -7
  135. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.3.1/psych.so +0 -0
  136. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +6 -6
  137. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/racc/cparse.so +0 -0
  138. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/redcarpet-3.6.1/gem_make.out +6 -6
  139. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/redcarpet-3.6.1/redcarpet.so +0 -0
  140. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +6 -6
  141. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/mkmf.log +2 -2
  142. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/stringio.so +0 -0
  143. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/websocket-driver-0.8.0/gem_make.out +6 -6
  144. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/websocket-driver-0.8.0/websocket_mask.so +0 -0
  145. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/CHANGELOG.md +326 -0
  146. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/LICENSE.txt +202 -0
  147. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/README.md +121 -0
  148. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/idna/native.rb +66 -0
  149. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/idna/pure.rb +4710 -0
  150. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/idna.rb +26 -0
  151. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/template.rb +1040 -0
  152. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/uri.rb +2602 -0
  153. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/version.rb +31 -0
  154. data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable.rb +4 -0
  155. data/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/ext/bigdecimal/Makefile +3 -3
  156. data/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/lib/bigdecimal.so +0 -0
  157. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/History +58 -0
  158. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/LICENSE +20 -0
  159. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/README.md +43 -0
  160. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/json.rb +113 -0
  161. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/util.rb +17 -0
  162. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/version.rb +3 -0
  163. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/xml.rb +240 -0
  164. data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack.rb +8 -0
  165. data/vendor/bundle/ruby/3.2.0/gems/date-3.5.1/ext/date/Makefile +3 -3
  166. data/vendor/bundle/ruby/3.2.0/gems/date-3.5.1/lib/date_core.so +0 -0
  167. data/vendor/bundle/ruby/3.2.0/gems/erb-6.0.1/ext/erb/escape/Makefile +3 -3
  168. data/vendor/bundle/ruby/3.2.0/gems/erb-6.0.1/lib/erb/escape.so +0 -0
  169. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/CHANGELOG.md +574 -0
  170. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/LICENSE.md +20 -0
  171. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/README.md +67 -0
  172. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/Rakefile +12 -0
  173. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/examples/client_spec.rb +119 -0
  174. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/examples/client_test.rb +144 -0
  175. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/adapter/test.rb +311 -0
  176. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/adapter.rb +101 -0
  177. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/adapter_registry.rb +30 -0
  178. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/connection.rb +565 -0
  179. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/encoders/flat_params_encoder.rb +105 -0
  180. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/encoders/nested_params_encoder.rb +183 -0
  181. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/error.rb +202 -0
  182. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/logging/formatter.rb +118 -0
  183. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/methods.rb +6 -0
  184. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/middleware.rb +72 -0
  185. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/middleware_registry.rb +83 -0
  186. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/connection_options.rb +23 -0
  187. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/env.rb +204 -0
  188. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/proxy_options.rb +38 -0
  189. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/request_options.rb +23 -0
  190. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/ssl_options.rb +76 -0
  191. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options.rb +219 -0
  192. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/parameters.rb +5 -0
  193. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/rack_builder.rb +248 -0
  194. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/authorization.rb +54 -0
  195. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/instrumentation.rb +58 -0
  196. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/json.rb +70 -0
  197. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/url_encoded.rb +60 -0
  198. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request.rb +139 -0
  199. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response/json.rb +74 -0
  200. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response/logger.rb +39 -0
  201. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response/raise_error.rb +83 -0
  202. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response.rb +95 -0
  203. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/utils/headers.rb +150 -0
  204. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/utils/params_hash.rb +61 -0
  205. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/utils.rb +121 -0
  206. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/version.rb +5 -0
  207. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday.rb +158 -0
  208. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/external_adapters/faraday_specs_setup.rb +14 -0
  209. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/adapter/test_spec.rb +442 -0
  210. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/adapter_registry_spec.rb +28 -0
  211. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/adapter_spec.rb +55 -0
  212. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/connection_spec.rb +841 -0
  213. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/error_spec.rb +175 -0
  214. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/middleware_registry_spec.rb +31 -0
  215. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/middleware_spec.rb +213 -0
  216. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/env_spec.rb +76 -0
  217. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/options_spec.rb +297 -0
  218. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/proxy_options_spec.rb +79 -0
  219. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/request_options_spec.rb +19 -0
  220. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/params_encoders/flat_spec.rb +42 -0
  221. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/params_encoders/nested_spec.rb +151 -0
  222. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/rack_builder_spec.rb +317 -0
  223. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/authorization_spec.rb +118 -0
  224. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/instrumentation_spec.rb +74 -0
  225. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/json_spec.rb +199 -0
  226. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/url_encoded_spec.rb +93 -0
  227. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request_spec.rb +110 -0
  228. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response/json_spec.rb +206 -0
  229. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response/logger_spec.rb +299 -0
  230. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response/raise_error_spec.rb +286 -0
  231. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response_spec.rb +84 -0
  232. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/utils/headers_spec.rb +109 -0
  233. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/utils_spec.rb +120 -0
  234. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday_spec.rb +43 -0
  235. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/spec_helper.rb +133 -0
  236. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/disabling_stub.rb +14 -0
  237. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/fake_safe_buffer.rb +15 -0
  238. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/faraday_middleware_subclasses.rb +18 -0
  239. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/helper_methods.rb +96 -0
  240. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/shared_examples/adapter.rb +105 -0
  241. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/shared_examples/params_encoder.rb +18 -0
  242. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/shared_examples/request_method.rb +263 -0
  243. data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/streaming_response_checker.rb +35 -0
  244. data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/LICENSE.md +21 -0
  245. data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/README.md +57 -0
  246. data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/lib/faraday/adapter/net_http.rb +206 -0
  247. data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/lib/faraday/net_http/version.rb +7 -0
  248. data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/lib/faraday/net_http.rb +10 -0
  249. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/Gemfile +8 -0
  250. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/LICENSE +19 -0
  251. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/README.md +323 -0
  252. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/Rakefile +18 -0
  253. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/changelog.md +127 -0
  254. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/hashdiff.gemspec +39 -0
  255. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/compare_hashes.rb +101 -0
  256. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/diff.rb +185 -0
  257. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/lcs.rb +66 -0
  258. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/lcs_compare_arrays.rb +32 -0
  259. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/linear_compare_array.rb +159 -0
  260. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/patch.rb +88 -0
  261. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/util.rb +155 -0
  262. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/version.rb +5 -0
  263. data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff.rb +10 -0
  264. data/vendor/bundle/ruby/3.2.0/gems/io-console-0.8.2/ext/io/console/Makefile +3 -3
  265. data/vendor/bundle/ruby/3.2.0/gems/io-console-0.8.2/lib/io/console.so +0 -0
  266. data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/ext/json/ext/generator/Makefile +3 -3
  267. data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/ext/json/ext/parser/Makefile +3 -3
  268. data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/lib/json/ext/generator.so +0 -0
  269. data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/lib/json/ext/parser.so +0 -0
  270. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/BSDL +22 -0
  271. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/COPYING +56 -0
  272. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/README.md +93 -0
  273. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/doc/net-http/examples.rdoc +31 -0
  274. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/doc/net-http/included_getters.rdoc +3 -0
  275. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/exceptions.rb +35 -0
  276. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/generic_request.rb +429 -0
  277. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/header.rb +985 -0
  278. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/proxy_delta.rb +17 -0
  279. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/request.rb +88 -0
  280. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/requests.rb +444 -0
  281. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/response.rb +739 -0
  282. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/responses.rb +1242 -0
  283. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/status.rb +84 -0
  284. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http.rb +2608 -0
  285. data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/https.rb +23 -0
  286. data/vendor/bundle/ruby/3.2.0/gems/nio4r-2.7.5/ext/nio4r/Makefile +3 -3
  287. data/vendor/bundle/ruby/3.2.0/gems/nio4r-2.7.5/lib/nio4r_ext.so +0 -0
  288. data/vendor/bundle/ruby/3.2.0/gems/prism-1.9.0/ext/prism/Makefile +3 -3
  289. data/vendor/bundle/ruby/3.2.0/gems/prism-1.9.0/lib/prism/prism.so +0 -0
  290. data/vendor/bundle/ruby/3.2.0/gems/psych-5.3.1/ext/psych/Makefile +3 -3
  291. data/vendor/bundle/ruby/3.2.0/gems/psych-5.3.1/lib/psych.so +0 -0
  292. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/CHANGELOG.md +649 -0
  293. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/Gemfile +16 -0
  294. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/LICENSE.txt +22 -0
  295. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/README.md +231 -0
  296. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/SECURITY.md +24 -0
  297. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/data/list.txt +16298 -0
  298. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/domain.rb +235 -0
  299. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/errors.rb +41 -0
  300. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/list.rb +247 -0
  301. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/rule.rb +350 -0
  302. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/version.rb +14 -0
  303. data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix.rb +177 -0
  304. data/vendor/bundle/ruby/3.2.0/gems/racc-1.8.1/ext/racc/cparse/Makefile +3 -3
  305. data/vendor/bundle/ruby/3.2.0/gems/racc-1.8.1/lib/racc/cparse.so +0 -0
  306. data/vendor/bundle/ruby/3.2.0/gems/redcarpet-3.6.1/ext/redcarpet/Makefile +3 -3
  307. data/vendor/bundle/ruby/3.2.0/gems/redcarpet-3.6.1/lib/redcarpet.so +0 -0
  308. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/LICENSE.txt +22 -0
  309. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/NEWS.md +843 -0
  310. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/README.md +57 -0
  311. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/context.rdoc +143 -0
  312. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/child.rdoc +87 -0
  313. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/document.rdoc +276 -0
  314. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/element.rdoc +602 -0
  315. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/node.rdoc +97 -0
  316. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/parent.rdoc +267 -0
  317. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/child_toc.rdoc +12 -0
  318. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/document_toc.rdoc +30 -0
  319. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/element_toc.rdoc +55 -0
  320. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/master_toc.rdoc +135 -0
  321. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/node_toc.rdoc +16 -0
  322. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/parent_toc.rdoc +25 -0
  323. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tutorial.rdoc +1358 -0
  324. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/attlistdecl.rb +63 -0
  325. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/attribute.rb +210 -0
  326. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/cdata.rb +68 -0
  327. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/child.rb +96 -0
  328. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/comment.rb +80 -0
  329. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/doctype.rb +306 -0
  330. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/document.rb +471 -0
  331. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/attlistdecl.rb +11 -0
  332. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/dtd.rb +47 -0
  333. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/elementdecl.rb +18 -0
  334. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/entitydecl.rb +57 -0
  335. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/notationdecl.rb +40 -0
  336. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/element.rb +2578 -0
  337. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/encoding.rb +48 -0
  338. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/entity.rb +142 -0
  339. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/formatters/default.rb +116 -0
  340. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/formatters/pretty.rb +142 -0
  341. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/formatters/transitive.rb +58 -0
  342. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/functions.rb +446 -0
  343. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/instruction.rb +79 -0
  344. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/light/node.rb +188 -0
  345. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/namespace.rb +63 -0
  346. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/node.rb +80 -0
  347. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/output.rb +30 -0
  348. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parent.rb +166 -0
  349. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parseexception.rb +53 -0
  350. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/baseparser.rb +949 -0
  351. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/lightparser.rb +59 -0
  352. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/pullparser.rb +213 -0
  353. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/sax2parser.rb +270 -0
  354. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/streamparser.rb +67 -0
  355. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/treeparser.rb +89 -0
  356. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/ultralightparser.rb +57 -0
  357. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/xpathparser.rb +739 -0
  358. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/quickpath.rb +267 -0
  359. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/rexml.rb +39 -0
  360. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/sax2listener.rb +98 -0
  361. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/security.rb +28 -0
  362. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/source.rb +388 -0
  363. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/streamlistener.rb +93 -0
  364. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/text.rb +420 -0
  365. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/undefinednamespaceexception.rb +9 -0
  366. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/validation/relaxng.rb +540 -0
  367. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/validation/validation.rb +144 -0
  368. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/validation/validationexception.rb +10 -0
  369. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xmldecl.rb +130 -0
  370. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xmltokens.rb +85 -0
  371. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xpath.rb +70 -0
  372. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xpath_parser.rb +980 -0
  373. data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml.rb +3 -0
  374. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.2.0/ext/stringio/Makefile +3 -3
  375. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.2.0/lib/stringio.so +0 -0
  376. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/CHANGELOG.md +2148 -0
  377. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/LICENSE +20 -0
  378. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/README.md +1229 -0
  379. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/api.rb +111 -0
  380. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/assertion_failure.rb +13 -0
  381. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/callback_registry.rb +37 -0
  382. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/config.rb +20 -0
  383. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/cucumber.rb +12 -0
  384. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/deprecation.rb +11 -0
  385. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/errors.rb +19 -0
  386. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +228 -0
  387. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/curb_adapter.rb +354 -0
  388. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +239 -0
  389. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/excon_adapter.rb +167 -0
  390. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_lib_adapter.rb +9 -0
  391. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +21 -0
  392. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/client.rb +17 -0
  393. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/request.rb +28 -0
  394. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/response.rb +95 -0
  395. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/streamer.rb +44 -0
  396. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/webmock.rb +77 -0
  397. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb_adapter.rb +39 -0
  398. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/httpclient_adapter.rb +260 -0
  399. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/manticore_adapter.rb +147 -0
  400. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/net_http.rb +310 -0
  401. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/net_http_response.rb +36 -0
  402. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/patron_adapter.rb +132 -0
  403. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +190 -0
  404. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/any_arg_matcher.rb +15 -0
  405. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/hash_argument_matcher.rb +23 -0
  406. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/hash_excluding_matcher.rb +17 -0
  407. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/hash_including_matcher.rb +19 -0
  408. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/minitest.rb +43 -0
  409. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rack_response.rb +73 -0
  410. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_body_diff.rb +66 -0
  411. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_execution_verifier.rb +79 -0
  412. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_pattern.rb +428 -0
  413. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_registry.rb +37 -0
  414. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_signature.rb +56 -0
  415. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_signature_snippet.rb +63 -0
  416. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_stub.rb +134 -0
  417. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/response.rb +161 -0
  418. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/responses_sequence.rb +42 -0
  419. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec/matchers/request_pattern_matcher.rb +80 -0
  420. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec/matchers/webmock_matcher.rb +69 -0
  421. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec/matchers.rb +29 -0
  422. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec.rb +44 -0
  423. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/stub_registry.rb +84 -0
  424. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/stub_request_snippet.rb +40 -0
  425. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/test_unit.rb +22 -0
  426. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/hash_counter.rb +45 -0
  427. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/hash_keys_stringifier.rb +27 -0
  428. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/hash_validator.rb +19 -0
  429. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/headers.rb +77 -0
  430. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/parsers/json.rb +72 -0
  431. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/parsers/parse_error.rb +7 -0
  432. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/parsers/xml.rb +16 -0
  433. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/query_mapper.rb +283 -0
  434. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/uri.rb +113 -0
  435. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/values_stringifier.rb +22 -0
  436. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/version_checker.rb +113 -0
  437. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/version.rb +5 -0
  438. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/webmock.rb +175 -0
  439. data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock.rb +61 -0
  440. data/vendor/bundle/ruby/3.2.0/gems/websocket-driver-0.8.0/ext/websocket-driver/Makefile +3 -3
  441. data/vendor/bundle/ruby/3.2.0/gems/websocket-driver-0.8.0/lib/websocket_mask.so +0 -0
  442. data/vendor/bundle/ruby/3.2.0/specifications/addressable-2.9.0.gemspec +29 -0
  443. data/vendor/bundle/ruby/3.2.0/specifications/crack-1.0.1.gemspec +27 -0
  444. data/vendor/bundle/ruby/3.2.0/specifications/faraday-2.14.1.gemspec +0 -0
  445. data/vendor/bundle/ruby/3.2.0/specifications/faraday-net_http-3.4.2.gemspec +26 -0
  446. data/vendor/bundle/ruby/3.2.0/specifications/hashdiff-1.2.1.gemspec +30 -0
  447. data/vendor/bundle/ruby/3.2.0/specifications/net-http-0.9.1.gemspec +27 -0
  448. data/vendor/bundle/ruby/3.2.0/specifications/public_suffix-7.0.5.gemspec +24 -0
  449. data/vendor/bundle/ruby/3.2.0/specifications/rexml-3.4.4.gemspec +25 -0
  450. data/vendor/bundle/ruby/3.2.0/specifications/webmock-3.26.2.gemspec +44 -0
  451. metadata +377 -2
@@ -0,0 +1,263 @@
1
+ # frozen_string_literal: true
2
+
3
+ shared_examples 'proxy examples' do
4
+ it 'handles requests with proxy' do
5
+ res = conn.public_send(http_method, '/')
6
+
7
+ expect(res.status).to eq(200)
8
+ end
9
+
10
+ it 'handles proxy failures' do
11
+ request_stub.to_return(status: 407)
12
+
13
+ expect { conn.public_send(http_method, '/') }.to raise_error(Faraday::ProxyAuthError)
14
+ end
15
+ end
16
+
17
+ shared_examples 'a request method' do |http_method|
18
+ let(:query_or_body) { method_with_body?(http_method) ? :body : :query }
19
+ let(:response) { conn.public_send(http_method, '/') }
20
+
21
+ unless http_method == :head && feature?(:skip_response_body_on_head)
22
+ it 'retrieves the response body' do
23
+ res_body = 'test'
24
+ request_stub.to_return(body: res_body)
25
+ expect(conn.public_send(http_method, '/').body).to eq(res_body)
26
+ end
27
+ end
28
+
29
+ it 'handles headers with multiple values' do
30
+ request_stub.to_return(headers: { 'Set-Cookie' => 'name=value' })
31
+ expect(response.headers['set-cookie']).to eq('name=value')
32
+ end
33
+
34
+ it 'retrieves the response headers' do
35
+ request_stub.to_return(headers: { 'Content-Type' => 'text/plain' })
36
+ expect(response.headers['Content-Type']).to match(%r{text/plain})
37
+ expect(response.headers['content-type']).to match(%r{text/plain})
38
+ end
39
+
40
+ it 'sends user agent' do
41
+ request_stub.with(headers: { 'User-Agent' => 'Agent Faraday' })
42
+ conn.public_send(http_method, '/', nil, user_agent: 'Agent Faraday')
43
+ end
44
+
45
+ it 'represents empty body response as blank string' do
46
+ expect(response.body).to eq('')
47
+ end
48
+
49
+ it 'handles connection error' do
50
+ request_stub.disable
51
+ expect { conn.public_send(http_method, 'http://localhost:4') }.to raise_error(Faraday::ConnectionFailed)
52
+ end
53
+
54
+ on_feature :local_socket_binding do
55
+ it 'binds local socket' do
56
+ stub_request(http_method, 'http://example.com')
57
+
58
+ host = '1.2.3.4'
59
+ port = 1234
60
+ conn_options[:request] = { bind: { host: host, port: port } }
61
+
62
+ conn.public_send(http_method, '/')
63
+
64
+ expect(conn.options[:bind][:host]).to eq(host)
65
+ expect(conn.options[:bind][:port]).to eq(port)
66
+ end
67
+ end
68
+
69
+ # context 'when wrong ssl certificate is provided' do
70
+ # let(:ca_file_path) { 'tmp/faraday-different-ca-cert.crt' }
71
+ # before { conn_options.merge!(ssl: { ca_file: ca_file_path }) }
72
+ #
73
+ # it do
74
+ # expect { conn.public_send(http_method, '/') }.to raise_error(Faraday::SSLError) # do |ex|
75
+ # expect(ex.message).to include?('certificate')
76
+ # end
77
+ # end
78
+ # end
79
+
80
+ on_feature :request_body_on_query_methods do
81
+ it 'sends request body' do
82
+ request_stub.with({ body: 'test' })
83
+ res = if query_or_body == :body
84
+ conn.public_send(http_method, '/', 'test')
85
+ else
86
+ conn.public_send(http_method, '/') do |req|
87
+ req.body = 'test'
88
+ end
89
+ end
90
+ expect(res.env.request_body).to eq('test')
91
+ end
92
+ end
93
+
94
+ it 'sends url encoded parameters' do
95
+ payload = { name: 'zack' }
96
+ request_stub.with({ query_or_body => payload })
97
+ res = conn.public_send(http_method, '/', payload)
98
+ if query_or_body == :query
99
+ expect(res.env.request_body).to be_nil
100
+ else
101
+ expect(res.env.request_body).to eq('name=zack')
102
+ end
103
+ end
104
+
105
+ it 'sends url encoded nested parameters' do
106
+ payload = { name: { first: 'zack' } }
107
+ request_stub.with({ query_or_body => payload })
108
+ conn.public_send(http_method, '/', payload)
109
+ end
110
+
111
+ # TODO: This needs reimplementation: see https://github.com/lostisland/faraday/issues/718
112
+ # Should raise Faraday::TimeoutError
113
+ it 'supports timeout option' do
114
+ conn_options[:request] = { timeout: 1 }
115
+ request_stub.to_timeout
116
+ exc = adapter == 'NetHttp' ? Faraday::ConnectionFailed : Faraday::TimeoutError
117
+ expect { conn.public_send(http_method, '/') }.to raise_error(exc)
118
+ end
119
+
120
+ # TODO: This needs reimplementation: see https://github.com/lostisland/faraday/issues/718
121
+ # Should raise Faraday::ConnectionFailed
122
+ it 'supports open_timeout option' do
123
+ conn_options[:request] = { open_timeout: 1 }
124
+ request_stub.to_timeout
125
+ exc = adapter == 'NetHttp' ? Faraday::ConnectionFailed : Faraday::TimeoutError
126
+ expect { conn.public_send(http_method, '/') }.to raise_error(exc)
127
+ end
128
+
129
+ on_feature :reason_phrase_parse do
130
+ it 'parses the reason phrase' do
131
+ request_stub.to_return(status: [200, 'OK'])
132
+ expect(response.reason_phrase).to eq('OK')
133
+ end
134
+ end
135
+
136
+ on_feature :compression do
137
+ # Accept-Encoding header not sent for HEAD requests as body is not expected in the response.
138
+ unless http_method == :head
139
+ it 'handles gzip compression' do
140
+ request_stub.with(headers: { 'Accept-Encoding' => /\bgzip\b/ })
141
+ conn.public_send(http_method, '/')
142
+ end
143
+
144
+ it 'handles deflate compression' do
145
+ request_stub.with(headers: { 'Accept-Encoding' => /\bdeflate\b/ })
146
+ conn.public_send(http_method, '/')
147
+ end
148
+ end
149
+ end
150
+
151
+ on_feature :streaming do
152
+ describe 'streaming' do
153
+ let(:streamed) { [] }
154
+
155
+ context 'when response is empty' do
156
+ it 'handles streaming' do
157
+ env = nil
158
+ conn.public_send(http_method, '/') do |req|
159
+ req.options.on_data = proc do |chunk, size, block_env|
160
+ streamed << [chunk, size]
161
+ env ||= block_env
162
+ end
163
+ end
164
+
165
+ expect(streamed).to eq([['', 0]])
166
+ # TODO: enable this after updating all existing adapters to the new streaming API
167
+ # expect(env).to be_a(Faraday::Env)
168
+ # expect(env.status).to eq(200)
169
+ end
170
+ end
171
+
172
+ context 'when response contains big data' do
173
+ before { request_stub.to_return(body: big_string) }
174
+
175
+ it 'handles streaming' do
176
+ env = nil
177
+ response = conn.public_send(http_method, '/') do |req|
178
+ req.options.on_data = proc do |chunk, size, block_env|
179
+ streamed << [chunk, size]
180
+ env ||= block_env
181
+ end
182
+ end
183
+
184
+ expect(response.body).to eq('')
185
+ check_streaming_response(streamed, chunk_size: 16 * 1024)
186
+ # TODO: enable this after updating all existing adapters to the new streaming API
187
+ # expect(env).to be_a(Faraday::Env)
188
+ # expect(env.status).to eq(200)
189
+ end
190
+ end
191
+ end
192
+ end
193
+
194
+ on_feature :parallel do
195
+ context 'with parallel setup' do
196
+ before do
197
+ @resp1 = nil
198
+ @resp2 = nil
199
+ @payload1 = { a: '1' }
200
+ @payload2 = { b: '2' }
201
+
202
+ request_stub
203
+ .with({ query_or_body => @payload1 })
204
+ .to_return(body: @payload1.to_json)
205
+
206
+ stub_request(http_method, remote)
207
+ .with({ query_or_body => @payload2 })
208
+ .to_return(body: @payload2.to_json)
209
+
210
+ conn.in_parallel do
211
+ @resp1 = conn.public_send(http_method, '/', @payload1)
212
+ @resp2 = conn.public_send(http_method, '/', @payload2)
213
+
214
+ expect(conn.in_parallel?).to be_truthy
215
+ expect(@resp1.body).to be_nil
216
+ expect(@resp2.body).to be_nil
217
+ end
218
+
219
+ expect(conn.in_parallel?).to be_falsey
220
+ end
221
+
222
+ it 'handles parallel requests status' do
223
+ expect(@resp1&.status).to eq(200)
224
+ expect(@resp2&.status).to eq(200)
225
+ end
226
+
227
+ unless http_method == :head && feature?(:skip_response_body_on_head)
228
+ it 'handles parallel requests body' do
229
+ expect(@resp1&.body).to eq(@payload1.to_json)
230
+ expect(@resp2&.body).to eq(@payload2.to_json)
231
+ end
232
+ end
233
+ end
234
+ end
235
+
236
+ context 'when a proxy is provided as option' do
237
+ before do
238
+ conn_options[:proxy] = 'http://env-proxy.com:80'
239
+ end
240
+
241
+ include_examples 'proxy examples'
242
+ end
243
+
244
+ context 'when http_proxy env variable is set' do
245
+ let(:proxy_url) { 'http://env-proxy.com:80' }
246
+
247
+ around do |example|
248
+ with_env 'http_proxy' => proxy_url do
249
+ example.run
250
+ end
251
+ end
252
+
253
+ include_examples 'proxy examples'
254
+
255
+ context 'when the env proxy is ignored' do
256
+ around do |example|
257
+ with_env_proxy_disabled(&example)
258
+ end
259
+
260
+ include_examples 'proxy examples'
261
+ end
262
+ end
263
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faraday
4
+ module StreamingResponseChecker
5
+ def check_streaming_response(streamed, options = {})
6
+ opts = {
7
+ prefix: '',
8
+ streaming?: true
9
+ }.merge(options)
10
+
11
+ expected_response = opts[:prefix] + big_string
12
+
13
+ chunks, sizes = streamed.transpose
14
+
15
+ # Check that the total size of the chunks (via the last size returned)
16
+ # is the same size as the expected_response
17
+ expect(sizes.last).to eq(expected_response.bytesize)
18
+
19
+ start_index = 0
20
+ expected_chunks = []
21
+ chunks.each do |actual_chunk|
22
+ expected_chunk = expected_response[start_index..((start_index + actual_chunk.bytesize) - 1)]
23
+ expected_chunks << expected_chunk
24
+ start_index += expected_chunk.bytesize
25
+ end
26
+
27
+ # it's easier to read a smaller portion, so we check that first
28
+ expect(expected_chunks[0][0..255]).to eq(chunks[0][0..255])
29
+
30
+ [expected_chunks, chunks].transpose.each do |expected, actual|
31
+ expect(actual).to eq(expected)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Jan van der Pas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ # Faraday Net::HTTP adapter
2
+
3
+ This gem is a [Faraday][faraday] adapter for the [Net::HTTP][net-http] library. Faraday is an HTTP client library that provides a common interface over many adapters. Every adapter is defined into it's own gem. This gem defines the adapter for `Net::HTTP` the HTTP library that's included into the standard library of Ruby.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'faraday-net_http'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install faraday-net_http
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ conn = Faraday.new(...) do |f|
25
+ f.adapter :net_http do |http|
26
+ # yields Net::HTTP
27
+ http.verify_callback = lambda do |preverify, cert_store|
28
+ # do something here...
29
+ end
30
+ end
31
+ end
32
+ ```
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+
38
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](rubygems).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on [GitHub][repo].
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [license][license].
47
+
48
+ ## Code of Conduct
49
+
50
+ Everyone interacting in the Faraday Net::HTTP adapter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct][code-of-conduct].
51
+
52
+ [faraday]: https://github.com/lostisland/faraday
53
+ [net-http]: https://ruby-doc.org/stdlib-2.7.0/libdoc/net/http/rdoc/Net/HTTP.html
54
+ [rubygems]: https://rubygems.org
55
+ [repo]: https://github.com/lostisland/faraday-net_http
56
+ [license]: https://github.com/lostisland/faraday-net_http/blob/main/LICENSE.md
57
+ [code-of-conduct]: https://github.com/lostisland/faraday-net_http/blob/main/CODE_OF_CONDUCT.md
@@ -0,0 +1,206 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'net/https'
5
+ rescue LoadError
6
+ warn 'Warning: no such file to load -- net/https. ' \
7
+ 'Make sure openssl is installed if you want ssl support'
8
+ require 'net/http'
9
+ end
10
+ require 'zlib'
11
+
12
+ module Faraday
13
+ class Adapter
14
+ class NetHttp < Faraday::Adapter
15
+ exceptions = [
16
+ IOError,
17
+ Errno::EADDRNOTAVAIL,
18
+ Errno::EALREADY,
19
+ Errno::ECONNABORTED,
20
+ Errno::ECONNREFUSED,
21
+ Errno::ECONNRESET,
22
+ Errno::EHOSTUNREACH,
23
+ Errno::EINVAL,
24
+ Errno::ENETUNREACH,
25
+ Errno::EPIPE,
26
+ Net::HTTPBadResponse,
27
+ Net::HTTPHeaderSyntaxError,
28
+ Net::ProtocolError,
29
+ SocketError,
30
+ Zlib::GzipFile::Error
31
+ ]
32
+
33
+ exceptions << ::OpenSSL::SSL::SSLError if defined?(::OpenSSL::SSL::SSLError)
34
+ exceptions << ::Net::OpenTimeout if defined?(::Net::OpenTimeout)
35
+
36
+ NET_HTTP_EXCEPTIONS = exceptions.freeze
37
+
38
+ def initialize(app = nil, opts = {}, &block)
39
+ @ssl_cert_store = nil
40
+ super(app, opts, &block)
41
+ end
42
+
43
+ def build_connection(env)
44
+ net_http_connection(env).tap do |http|
45
+ configure_ssl(http, env[:ssl]) if env[:url].scheme == 'https' && env[:ssl]
46
+ configure_request(http, env[:request])
47
+ end
48
+ end
49
+
50
+ def net_http_connection(env)
51
+ proxy = env[:request][:proxy]
52
+ port = env[:url].port || (env[:url].scheme == 'https' ? 443 : 80)
53
+ if proxy
54
+ Net::HTTP.new(env[:url].hostname, port,
55
+ proxy[:uri].hostname, proxy[:uri].port,
56
+ proxy[:user], proxy[:password],
57
+ nil, proxy[:uri].scheme == 'https')
58
+ else
59
+ Net::HTTP.new(env[:url].hostname, port, nil)
60
+ end
61
+ end
62
+
63
+ def call(env)
64
+ super
65
+ connection(env) do |http|
66
+ perform_request(http, env)
67
+ rescue *NET_HTTP_EXCEPTIONS => e
68
+ raise Faraday::SSLError, e if defined?(OpenSSL) && e.is_a?(OpenSSL::SSL::SSLError)
69
+
70
+ raise Faraday::ConnectionFailed, e
71
+ end
72
+ @app.call env
73
+ rescue Timeout::Error, Errno::ETIMEDOUT => e
74
+ raise Faraday::TimeoutError, e
75
+ end
76
+
77
+ private
78
+
79
+ def create_request(env)
80
+ request = Net::HTTPGenericRequest.new \
81
+ env[:method].to_s.upcase, # request method
82
+ !!env[:body], # is there request body
83
+ env[:method] != :head, # is there response body
84
+ env[:url].request_uri, # request uri path
85
+ env[:request_headers] # request headers
86
+
87
+ if env[:body].respond_to?(:read)
88
+ request.body_stream = env[:body]
89
+ else
90
+ request.body = env[:body]
91
+ end
92
+ request
93
+ end
94
+
95
+ def perform_request(http, env)
96
+ if env.stream_response?
97
+ http_response = env.stream_response do |&on_data|
98
+ request_with_wrapped_block(http, env, &on_data)
99
+ end
100
+ http_response.body = nil
101
+ else
102
+ http_response = request_with_wrapped_block(http, env)
103
+ end
104
+ env.response_body = encoded_body(http_response)
105
+ env.response.finish(env)
106
+ http_response
107
+ end
108
+
109
+ def request_with_wrapped_block(http, env, &block)
110
+ # Must use Net::HTTP#start and pass it a block otherwise the server's
111
+ # TCP socket does not close correctly.
112
+ http.start do |opened_http|
113
+ opened_http.request create_request(env) do |response|
114
+ save_http_response(env, response)
115
+
116
+ response.read_body(&block) if block_given?
117
+ end
118
+ end
119
+ end
120
+
121
+ def save_http_response(env, http_response)
122
+ save_response(
123
+ env, http_response.code.to_i, nil, nil, http_response.message, finished: false
124
+ ) do |response_headers|
125
+ http_response.each_header do |key, value|
126
+ response_headers[key] = value
127
+ end
128
+ end
129
+ end
130
+
131
+ def configure_ssl(http, ssl)
132
+ http.use_ssl = true if http.respond_to?(:use_ssl=)
133
+
134
+ http.verify_mode = ssl_verify_mode(ssl)
135
+ http.cert_store = ssl_cert_store(ssl)
136
+
137
+ cert, *extra_chain_cert = ssl[:client_cert]
138
+ http.cert = cert if cert
139
+ http.extra_chain_cert = extra_chain_cert if extra_chain_cert.any?
140
+
141
+ http.key = ssl[:client_key] if ssl[:client_key]
142
+ http.ca_file = ssl[:ca_file] if ssl[:ca_file]
143
+ http.ca_path = ssl[:ca_path] if ssl[:ca_path]
144
+ http.verify_depth = ssl[:verify_depth] if ssl[:verify_depth]
145
+ http.ssl_version = ssl[:version] if ssl[:version]
146
+ http.min_version = ssl[:min_version] if ssl[:min_version]
147
+ http.max_version = ssl[:max_version] if ssl[:max_version]
148
+ http.verify_hostname = ssl[:verify_hostname] if verify_hostname_enabled?(http, ssl)
149
+ http.ciphers = ssl[:ciphers] if ssl[:ciphers]
150
+ end
151
+
152
+ def configure_request(http, req)
153
+ if (sec = request_timeout(:read, req))
154
+ http.read_timeout = sec
155
+ end
156
+
157
+ if (sec = http.respond_to?(:write_timeout=) &&
158
+ request_timeout(:write, req))
159
+ http.write_timeout = sec
160
+ end
161
+
162
+ if (sec = request_timeout(:open, req))
163
+ http.open_timeout = sec
164
+ end
165
+
166
+ # Only set if Net::Http supports it, since Ruby 2.5.
167
+ http.max_retries = 0 if http.respond_to?(:max_retries=)
168
+
169
+ @config_block&.call(http)
170
+ end
171
+
172
+ def ssl_cert_store(ssl)
173
+ return ssl[:cert_store] if ssl[:cert_store]
174
+
175
+ # Use the default cert store by default, i.e. system ca certs
176
+ @ssl_cert_store ||= OpenSSL::X509::Store.new.tap(&:set_default_paths)
177
+ end
178
+
179
+ def ssl_verify_mode(ssl)
180
+ ssl[:verify_mode] || begin
181
+ if ssl.fetch(:verify, true)
182
+ OpenSSL::SSL::VERIFY_PEER
183
+ else
184
+ OpenSSL::SSL::VERIFY_NONE
185
+ end
186
+ end
187
+ end
188
+
189
+ def encoded_body(http_response)
190
+ body = http_response.body || +''
191
+ /\bcharset=([^;]+)/.match(http_response['Content-Type']) do |match|
192
+ content_charset = ::Encoding.find(match[1].strip)
193
+ body = body.dup if body.frozen?
194
+ body.force_encoding(content_charset)
195
+ rescue ArgumentError
196
+ nil
197
+ end
198
+ body
199
+ end
200
+
201
+ def verify_hostname_enabled?(http, ssl)
202
+ http.respond_to?(:verify_hostname=) && ssl.key?(:verify_hostname)
203
+ end
204
+ end
205
+ end
206
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faraday
4
+ module NetHttp
5
+ VERSION = '3.4.2'
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday/adapter/net_http'
4
+ require 'faraday/net_http/version'
5
+
6
+ module Faraday
7
+ module NetHttp
8
+ Faraday::Adapter.register_middleware(net_http: Faraday::Adapter::NetHttp)
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'rake'
8
+ end
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2012 Liu Fengyun
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.