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,299 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'stringio'
4
+ require 'logger'
5
+
6
+ RSpec.describe Faraday::Response::Logger do
7
+ let(:string_io) { StringIO.new }
8
+ let(:logger) { Logger.new(string_io) }
9
+ let(:logger_options) { {} }
10
+ let(:conn) do
11
+ rubbles = ['Barney', 'Betty', 'Bam Bam']
12
+
13
+ Faraday.new do |b|
14
+ b.response :logger, logger, logger_options do |logger|
15
+ logger.filter(/(soylent green is) (.+)/, '\1 tasty')
16
+ logger.filter(/(api_key:).*"(.+)."/, '\1[API_KEY]')
17
+ logger.filter(/(password)=(.+)/, '\1=[HIDDEN]')
18
+ end
19
+ b.adapter :test do |stubs|
20
+ stubs.get('/hello') { [200, { 'Content-Type' => 'text/html' }, 'hello'] }
21
+ stubs.post('/ohai') { [200, { 'Content-Type' => 'text/html' }, 'fred'] }
22
+ stubs.post('/ohyes') { [200, { 'Content-Type' => 'text/html' }, 'pebbles'] }
23
+ stubs.get('/rubbles') { [200, { 'Content-Type' => 'application/json' }, rubbles] }
24
+ stubs.get('/8bit') { [200, { 'Content-Type' => 'text/html' }, (+'café!').force_encoding(Encoding::ASCII_8BIT)] }
25
+ stubs.get('/filtered_body') { [200, { 'Content-Type' => 'text/html' }, 'soylent green is people'] }
26
+ stubs.get('/filtered_headers') { [200, { 'Content-Type' => 'text/html' }, 'headers response'] }
27
+ stubs.get('/filtered_params') { [200, { 'Content-Type' => 'text/html' }, 'params response'] }
28
+ stubs.get('/filtered_url') { [200, { 'Content-Type' => 'text/html' }, 'url response'] }
29
+ stubs.get('/connection_failed') { raise Faraday::ConnectionFailed, 'Failed to open TCP connection' }
30
+ end
31
+ end
32
+ end
33
+
34
+ before do
35
+ logger.level = Logger::DEBUG
36
+ end
37
+
38
+ it 'still returns output' do
39
+ resp = conn.get '/hello', nil, accept: 'text/html'
40
+ expect(resp.body).to eq('hello')
41
+ end
42
+
43
+ context 'without configuration' do
44
+ let(:conn) do
45
+ Faraday.new do |b|
46
+ b.response :logger
47
+ b.adapter :test do |stubs|
48
+ stubs.get('/hello') { [200, { 'Content-Type' => 'text/html' }, 'hello'] }
49
+ end
50
+ end
51
+ end
52
+
53
+ it 'defaults to stdout' do
54
+ expect(Logger).to receive(:new).with($stdout).and_return(Logger.new(nil))
55
+ conn.get('/hello')
56
+ end
57
+ end
58
+
59
+ context 'when logger with program name' do
60
+ let(:logger) { Logger.new(string_io, progname: 'my_best_program') }
61
+
62
+ it 'logs with program name' do
63
+ conn.get '/hello'
64
+
65
+ expect(string_io.string).to match('-- my_best_program: request:')
66
+ expect(string_io.string).to match('-- my_best_program: response:')
67
+ end
68
+ end
69
+
70
+ context 'when logger without program name' do
71
+ it 'logs without program name' do
72
+ conn.get '/hello'
73
+
74
+ expect(string_io.string).to match('-- : request:')
75
+ expect(string_io.string).to match('-- : response:')
76
+ end
77
+ end
78
+
79
+ context 'with default formatter' do
80
+ let(:formatter) { instance_double(Faraday::Logging::Formatter, request: true, response: true, filter: []) }
81
+
82
+ before { allow(Faraday::Logging::Formatter).to receive(:new).and_return(formatter) }
83
+
84
+ it 'delegates logging to the formatter' do
85
+ expect(formatter).to receive(:request).with(an_instance_of(Faraday::Env))
86
+ expect(formatter).to receive(:response).with(an_instance_of(Faraday::Env))
87
+ conn.get '/hello'
88
+ end
89
+
90
+ context 'when no route' do
91
+ it 'delegates logging to the formatter' do
92
+ expect(formatter).to receive(:request).with(an_instance_of(Faraday::Env))
93
+ expect(formatter).to receive(:exception).with(an_instance_of(Faraday::Adapter::Test::Stubs::NotFound))
94
+
95
+ expect { conn.get '/noroute' }.to raise_error(Faraday::Adapter::Test::Stubs::NotFound)
96
+ end
97
+ end
98
+ end
99
+
100
+ context 'with custom formatter' do
101
+ let(:formatter_class) do
102
+ Class.new(Faraday::Logging::Formatter) do
103
+ def request(_env)
104
+ info 'Custom log formatter request'
105
+ end
106
+
107
+ def response(_env)
108
+ info 'Custom log formatter response'
109
+ end
110
+ end
111
+ end
112
+
113
+ let(:logger_options) { { formatter: formatter_class } }
114
+
115
+ it 'logs with custom formatter' do
116
+ conn.get '/hello'
117
+
118
+ expect(string_io.string).to match('Custom log formatter request')
119
+ expect(string_io.string).to match('Custom log formatter response')
120
+ end
121
+ end
122
+
123
+ it 'logs method and url' do
124
+ conn.get '/hello', nil, accept: 'text/html'
125
+ expect(string_io.string).to match('GET http:/hello')
126
+ end
127
+
128
+ it 'logs status' do
129
+ conn.get '/hello', nil, accept: 'text/html'
130
+ expect(string_io.string).to match('Status 200')
131
+ end
132
+
133
+ it 'does not log error message by default' do
134
+ expect { conn.get '/noroute' }.to raise_error(Faraday::Adapter::Test::Stubs::NotFound)
135
+ expect(string_io.string).not_to match(%(no stubbed request for get http:/noroute))
136
+ end
137
+
138
+ it 'logs request headers by default' do
139
+ conn.get '/hello', nil, accept: 'text/html'
140
+ expect(string_io.string).to match(%(Accept: "text/html))
141
+ end
142
+
143
+ it 'logs response headers by default' do
144
+ conn.get '/hello', nil, accept: 'text/html'
145
+ expect(string_io.string).to match(%(Content-Type: "text/html))
146
+ end
147
+
148
+ it 'does not log request body by default' do
149
+ conn.post '/ohai', 'name=Unagi', accept: 'text/html'
150
+ expect(string_io.string).not_to match(%(name=Unagi))
151
+ end
152
+
153
+ it 'does not log response body by default' do
154
+ conn.post '/ohai', 'name=Toro', accept: 'text/html'
155
+ expect(string_io.string).not_to match(%(fred))
156
+ end
157
+
158
+ it 'logs filter headers' do
159
+ conn.headers = { 'api_key' => 'ABC123' }
160
+ conn.get '/filtered_headers', nil, accept: 'text/html'
161
+ expect(string_io.string).to match(%(api_key:))
162
+ expect(string_io.string).to match(%([API_KEY]))
163
+ expect(string_io.string).not_to match(%(ABC123))
164
+ end
165
+
166
+ it 'logs filter url' do
167
+ conn.get '/filtered_url?password=hunter2', nil, accept: 'text/html'
168
+ expect(string_io.string).to match(%([HIDDEN]))
169
+ expect(string_io.string).not_to match(%(hunter2))
170
+ end
171
+
172
+ context 'when not logging request headers' do
173
+ let(:logger_options) { { headers: { request: false } } }
174
+
175
+ it 'does not log request headers if option is false' do
176
+ conn.get '/hello', nil, accept: 'text/html'
177
+ expect(string_io.string).not_to match(%(Accept: "text/html))
178
+ end
179
+ end
180
+
181
+ context 'when not logging response headers' do
182
+ let(:logger_options) { { headers: { response: false } } }
183
+
184
+ it 'does not log response headers if option is false' do
185
+ conn.get '/hello', nil, accept: 'text/html'
186
+ expect(string_io.string).not_to match(%(Content-Type: "text/html))
187
+ end
188
+ end
189
+
190
+ context 'when logging request body' do
191
+ let(:logger_options) { { bodies: { request: true } } }
192
+
193
+ it 'logs only request body' do
194
+ conn.post '/ohyes', 'name=Tamago', accept: 'text/html'
195
+ expect(string_io.string).to match(%(name=Tamago))
196
+ expect(string_io.string).not_to match(%(pebbles))
197
+ end
198
+ end
199
+
200
+ context 'when logging response body' do
201
+ let(:logger_options) { { bodies: { response: true } } }
202
+
203
+ it 'logs only response body' do
204
+ conn.post '/ohyes', 'name=Hamachi', accept: 'text/html'
205
+ expect(string_io.string).to match(%(pebbles))
206
+ expect(string_io.string).not_to match(%(name=Hamachi))
207
+ end
208
+ end
209
+
210
+ context 'when logging request and response bodies' do
211
+ let(:logger_options) { { bodies: true } }
212
+
213
+ it 'logs request and response body' do
214
+ conn.post '/ohyes', 'name=Ebi', accept: 'text/html'
215
+ expect(string_io.string).to match(%(name=Ebi))
216
+ expect(string_io.string).to match(%(pebbles))
217
+ end
218
+
219
+ it 'logs response body object' do
220
+ conn.get '/rubbles', nil, accept: 'text/html'
221
+ expect(string_io.string).to match(%([\"Barney\", \"Betty\", \"Bam Bam\"]\n))
222
+ end
223
+
224
+ it 'logs filter body' do
225
+ conn.get '/filtered_body', nil, accept: 'text/html'
226
+ expect(string_io.string).to match(%(soylent green is))
227
+ expect(string_io.string).to match(%(tasty))
228
+ expect(string_io.string).not_to match(%(people))
229
+ end
230
+ end
231
+
232
+ context 'when bodies are logged by default' do
233
+ before do
234
+ described_class.default_options = { bodies: true }
235
+ end
236
+
237
+ it 'logs response body' do
238
+ conn.post '/ohai'
239
+ expect(string_io.string).to match(%(fred))
240
+ end
241
+
242
+ it 'converts to UTF-8' do
243
+ conn.get '/8bit'
244
+ expect(string_io.string).to match(%(caf��!))
245
+ end
246
+
247
+ after do
248
+ described_class.default_options = { bodies: false }
249
+ end
250
+ end
251
+
252
+ context 'when logging errors' do
253
+ let(:logger_options) { { errors: true } }
254
+
255
+ it 'logs error message' do
256
+ expect { conn.get '/noroute' }.to raise_error(Faraday::Adapter::Test::Stubs::NotFound)
257
+ expect(string_io.string).to match(%(no stubbed request for get http:/noroute))
258
+ end
259
+ end
260
+
261
+ context 'when logging headers and errors' do
262
+ let(:logger_options) { { headers: true, errors: true } }
263
+
264
+ it 'logs error message' do
265
+ expect { conn.get '/connection_failed' }.to raise_error(Faraday::ConnectionFailed)
266
+ expect(string_io.string).to match(%(Failed to open TCP connection))
267
+ end
268
+ end
269
+
270
+ context 'when using log_level' do
271
+ let(:logger_options) { { bodies: true, log_level: :debug } }
272
+
273
+ it 'logs request/request body on the specified level (debug)' do
274
+ logger.level = Logger::DEBUG
275
+ conn.post '/ohyes', 'name=Ebi', accept: 'text/html'
276
+ expect(string_io.string).to match(%(name=Ebi))
277
+ expect(string_io.string).to match(%(pebbles))
278
+ end
279
+
280
+ it 'logs headers on the debug level' do
281
+ logger.level = Logger::DEBUG
282
+ conn.get '/hello', nil, accept: 'text/html'
283
+ expect(string_io.string).to match(%(Content-Type: "text/html))
284
+ end
285
+
286
+ it 'does not log request/response body on the info level' do
287
+ logger.level = Logger::INFO
288
+ conn.post '/ohyes', 'name=Ebi', accept: 'text/html'
289
+ expect(string_io.string).not_to match(%(name=Ebi))
290
+ expect(string_io.string).not_to match(%(pebbles))
291
+ end
292
+
293
+ it 'does not log headers on the info level' do
294
+ logger.level = Logger::INFO
295
+ conn.get '/hello', nil, accept: 'text/html'
296
+ expect(string_io.string).not_to match(%(Content-Type: "text/html))
297
+ end
298
+ end
299
+ end
@@ -0,0 +1,286 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Faraday::Response::RaiseError do
4
+ let(:conn) do
5
+ Faraday.new do |b|
6
+ b.response :raise_error
7
+ b.adapter :test do |stub|
8
+ stub.get('ok') { [200, { 'Content-Type' => 'text/html' }, '<body></body>'] }
9
+ stub.get('bad-request') { [400, { 'X-Reason' => 'because' }, 'keep looking'] }
10
+ stub.get('unauthorized') { [401, { 'X-Reason' => 'because' }, 'keep looking'] }
11
+ stub.get('forbidden') { [403, { 'X-Reason' => 'because' }, 'keep looking'] }
12
+ stub.get('not-found') { [404, { 'X-Reason' => 'because' }, 'keep looking'] }
13
+ stub.get('proxy-error') { [407, { 'X-Reason' => 'because' }, 'keep looking'] }
14
+ stub.get('request-timeout') { [408, { 'X-Reason' => 'because' }, 'keep looking'] }
15
+ stub.get('conflict') { [409, { 'X-Reason' => 'because' }, 'keep looking'] }
16
+ stub.get('unprocessable-content') { [422, { 'X-Reason' => 'because' }, 'keep looking'] }
17
+ stub.get('too-many-requests') { [429, { 'X-Reason' => 'because' }, 'keep looking'] }
18
+ stub.get('4xx') { [499, { 'X-Reason' => 'because' }, 'keep looking'] }
19
+ stub.get('nil-status') { [nil, { 'X-Reason' => 'nil' }, 'fail'] }
20
+ stub.get('server-error') { [500, { 'X-Error' => 'bailout' }, 'fail'] }
21
+ end
22
+ end
23
+ end
24
+
25
+ it 'raises no exception for 200 responses' do
26
+ expect { conn.get('ok') }.not_to raise_error
27
+ end
28
+
29
+ it 'raises Faraday::BadRequestError for 400 responses' do
30
+ expect { conn.get('bad-request') }.to raise_error(Faraday::BadRequestError) do |ex|
31
+ expect(ex.message).to eq('the server responded with status 400 for GET http:/bad-request')
32
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
33
+ expect(ex.response[:status]).to eq(400)
34
+ expect(ex.response_status).to eq(400)
35
+ expect(ex.response_body).to eq('keep looking')
36
+ expect(ex.response_headers['X-Reason']).to eq('because')
37
+ end
38
+ end
39
+
40
+ it 'raises Faraday::UnauthorizedError for 401 responses' do
41
+ expect { conn.get('unauthorized') }.to raise_error(Faraday::UnauthorizedError) do |ex|
42
+ expect(ex.message).to eq('the server responded with status 401 for GET http:/unauthorized')
43
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
44
+ expect(ex.response[:status]).to eq(401)
45
+ expect(ex.response_status).to eq(401)
46
+ expect(ex.response_body).to eq('keep looking')
47
+ expect(ex.response_headers['X-Reason']).to eq('because')
48
+ end
49
+ end
50
+
51
+ it 'raises Faraday::ForbiddenError for 403 responses' do
52
+ expect { conn.get('forbidden') }.to raise_error(Faraday::ForbiddenError) do |ex|
53
+ expect(ex.message).to eq('the server responded with status 403 for GET http:/forbidden')
54
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
55
+ expect(ex.response[:status]).to eq(403)
56
+ expect(ex.response_status).to eq(403)
57
+ expect(ex.response_body).to eq('keep looking')
58
+ expect(ex.response_headers['X-Reason']).to eq('because')
59
+ end
60
+ end
61
+
62
+ it 'raises Faraday::ResourceNotFound for 404 responses' do
63
+ expect { conn.get('not-found') }.to raise_error(Faraday::ResourceNotFound) do |ex|
64
+ expect(ex.message).to eq('the server responded with status 404 for GET http:/not-found')
65
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
66
+ expect(ex.response[:status]).to eq(404)
67
+ expect(ex.response_status).to eq(404)
68
+ expect(ex.response_body).to eq('keep looking')
69
+ expect(ex.response_headers['X-Reason']).to eq('because')
70
+ end
71
+ end
72
+
73
+ it 'raises Faraday::ProxyAuthError for 407 responses' do
74
+ expect { conn.get('proxy-error') }.to raise_error(Faraday::ProxyAuthError) do |ex|
75
+ expect(ex.message).to eq('407 "Proxy Authentication Required"')
76
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
77
+ expect(ex.response[:status]).to eq(407)
78
+ expect(ex.response_status).to eq(407)
79
+ expect(ex.response_body).to eq('keep looking')
80
+ expect(ex.response_headers['X-Reason']).to eq('because')
81
+ end
82
+ end
83
+
84
+ it 'raises Faraday::RequestTimeoutError for 408 responses' do
85
+ expect { conn.get('request-timeout') }.to raise_error(Faraday::RequestTimeoutError) do |ex|
86
+ expect(ex.message).to eq('the server responded with status 408 for GET http:/request-timeout')
87
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
88
+ expect(ex.response[:status]).to eq(408)
89
+ expect(ex.response_status).to eq(408)
90
+ expect(ex.response_body).to eq('keep looking')
91
+ expect(ex.response_headers['X-Reason']).to eq('because')
92
+ end
93
+ end
94
+
95
+ it 'raises Faraday::ConflictError for 409 responses' do
96
+ expect { conn.get('conflict') }.to raise_error(Faraday::ConflictError) do |ex|
97
+ expect(ex.message).to eq('the server responded with status 409 for GET http:/conflict')
98
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
99
+ expect(ex.response[:status]).to eq(409)
100
+ expect(ex.response_status).to eq(409)
101
+ expect(ex.response_body).to eq('keep looking')
102
+ expect(ex.response_headers['X-Reason']).to eq('because')
103
+ end
104
+ end
105
+
106
+ it 'raises legacy Faraday::UnprocessableEntityError for 422 responses' do
107
+ expect { conn.get('unprocessable-content') }.to raise_error(Faraday::UnprocessableEntityError) do |ex|
108
+ expect(ex.message).to eq('the server responded with status 422 for GET http:/unprocessable-content')
109
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
110
+ expect(ex.response[:status]).to eq(422)
111
+ expect(ex.response_status).to eq(422)
112
+ expect(ex.response_body).to eq('keep looking')
113
+ expect(ex.response_headers['X-Reason']).to eq('because')
114
+ end
115
+ end
116
+
117
+ it 'raises Faraday::UnprocessableContentError for 422 responses' do
118
+ expect { conn.get('unprocessable-content') }.to raise_error(Faraday::UnprocessableContentError) do |ex|
119
+ expect(ex.message).to eq('the server responded with status 422 for GET http:/unprocessable-content')
120
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
121
+ expect(ex.response[:status]).to eq(422)
122
+ expect(ex.response_status).to eq(422)
123
+ expect(ex.response_body).to eq('keep looking')
124
+ expect(ex.response_headers['X-Reason']).to eq('because')
125
+ end
126
+ end
127
+
128
+ it 'raises Faraday::TooManyRequestsError for 429 responses' do
129
+ expect { conn.get('too-many-requests') }.to raise_error(Faraday::TooManyRequestsError) do |ex|
130
+ expect(ex.message).to eq('the server responded with status 429 for GET http:/too-many-requests')
131
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
132
+ expect(ex.response[:status]).to eq(429)
133
+ expect(ex.response_status).to eq(429)
134
+ expect(ex.response_body).to eq('keep looking')
135
+ expect(ex.response_headers['X-Reason']).to eq('because')
136
+ end
137
+ end
138
+
139
+ it 'raises Faraday::NilStatusError for nil status in response' do
140
+ expect { conn.get('nil-status') }.to raise_error(Faraday::NilStatusError) do |ex|
141
+ expect(ex.message).to eq('http status could not be derived from the server response')
142
+ expect(ex.response[:headers]['X-Reason']).to eq('nil')
143
+ expect(ex.response[:status]).to be_nil
144
+ expect(ex.response_status).to be_nil
145
+ expect(ex.response_body).to eq('fail')
146
+ expect(ex.response_headers['X-Reason']).to eq('nil')
147
+ end
148
+ end
149
+
150
+ it 'raises Faraday::ClientError for other 4xx responses' do
151
+ expect { conn.get('4xx') }.to raise_error(Faraday::ClientError) do |ex|
152
+ expect(ex.message).to eq('the server responded with status 499 for GET http:/4xx')
153
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
154
+ expect(ex.response[:status]).to eq(499)
155
+ expect(ex.response_status).to eq(499)
156
+ expect(ex.response_body).to eq('keep looking')
157
+ expect(ex.response_headers['X-Reason']).to eq('because')
158
+ end
159
+ end
160
+
161
+ it 'raises Faraday::ServerError for 500 responses' do
162
+ expect { conn.get('server-error') }.to raise_error(Faraday::ServerError) do |ex|
163
+ expect(ex.message).to eq('the server responded with status 500 for GET http:/server-error')
164
+ expect(ex.response[:headers]['X-Error']).to eq('bailout')
165
+ expect(ex.response[:status]).to eq(500)
166
+ expect(ex.response_status).to eq(500)
167
+ expect(ex.response_body).to eq('fail')
168
+ expect(ex.response_headers['X-Error']).to eq('bailout')
169
+ end
170
+ end
171
+
172
+ describe 'request info' do
173
+ let(:conn) do
174
+ Faraday.new do |b|
175
+ b.response :raise_error, **middleware_options
176
+ b.adapter :test do |stub|
177
+ stub.post(url, request_body, request_headers) do
178
+ [400, { 'X-Reason' => 'because' }, 'keep looking']
179
+ end
180
+ end
181
+ end
182
+ end
183
+ let(:middleware_options) { {} }
184
+ let(:request_body) { JSON.generate({ 'item' => 'sth' }) }
185
+ let(:request_headers) { { 'Authorization' => 'Basic 123' } }
186
+ let(:url_path) { 'request' }
187
+ let(:query_params) { 'full=true' }
188
+ let(:url) { "#{url_path}?#{query_params}" }
189
+
190
+ subject(:perform_request) do
191
+ conn.post url do |req|
192
+ req.headers['Authorization'] = 'Basic 123'
193
+ req.body = request_body
194
+ end
195
+ end
196
+
197
+ it 'returns the request info in the exception' do
198
+ expect { perform_request }.to raise_error(Faraday::BadRequestError) do |ex|
199
+ expect(ex.response[:request][:method]).to eq(:post)
200
+ expect(ex.response[:request][:url]).to eq(URI("http:/#{url}"))
201
+ expect(ex.response[:request][:url_path]).to eq("/#{url_path}")
202
+ expect(ex.response[:request][:params]).to eq({ 'full' => 'true' })
203
+ expect(ex.response[:request][:headers]).to match(a_hash_including(request_headers))
204
+ expect(ex.response[:request][:body]).to eq(request_body)
205
+ end
206
+ end
207
+
208
+ describe 'DEFAULT_OPTION: include_request' do
209
+ before(:each) do
210
+ Faraday::Response::RaiseError.instance_variable_set(:@default_options, nil)
211
+ Faraday::Middleware.instance_variable_set(:@default_options, nil)
212
+ end
213
+
214
+ after(:all) do
215
+ Faraday::Response::RaiseError.instance_variable_set(:@default_options, nil)
216
+ Faraday::Middleware.instance_variable_set(:@default_options, nil)
217
+ end
218
+
219
+ context 'when RaiseError DEFAULT_OPTION (include_request: true) is used' do
220
+ it 'includes request info in the exception' do
221
+ expect { perform_request }.to raise_error(Faraday::BadRequestError) do |ex|
222
+ expect(ex.response.keys).to contain_exactly(
223
+ :status,
224
+ :headers,
225
+ :body,
226
+ :request
227
+ )
228
+ end
229
+ end
230
+ end
231
+
232
+ context 'when application sets default_options `include_request: false`' do
233
+ before(:each) do
234
+ Faraday::Response::RaiseError.default_options = { include_request: false }
235
+ end
236
+
237
+ context 'and when include_request option is omitted' do
238
+ it 'does not include request info in the exception' do
239
+ expect { perform_request }.to raise_error(Faraday::BadRequestError) do |ex|
240
+ expect(ex.response.keys).to contain_exactly(
241
+ :status,
242
+ :headers,
243
+ :body
244
+ )
245
+ end
246
+ end
247
+ end
248
+
249
+ context 'and when include_request option is explicitly set for instance' do
250
+ let(:middleware_options) { { include_request: true } }
251
+
252
+ it 'includes request info in the exception' do
253
+ expect { perform_request }.to raise_error(Faraday::BadRequestError) do |ex|
254
+ expect(ex.response.keys).to contain_exactly(
255
+ :status,
256
+ :headers,
257
+ :body,
258
+ :request
259
+ )
260
+ end
261
+ end
262
+ end
263
+ end
264
+ end
265
+ end
266
+
267
+ describe 'allowing certain status codes' do
268
+ let(:conn) do
269
+ Faraday.new do |b|
270
+ b.response :raise_error, allowed_statuses: [404]
271
+ b.adapter :test do |stub|
272
+ stub.get('bad-request') { [400, { 'X-Reason' => 'because' }, 'keep looking'] }
273
+ stub.get('not-found') { [404, { 'X-Reason' => 'because' }, 'keep looking'] }
274
+ end
275
+ end
276
+ end
277
+
278
+ it 'raises an error for status codes that are not explicitly allowed' do
279
+ expect { conn.get('bad-request') }.to raise_error(Faraday::BadRequestError)
280
+ end
281
+
282
+ it 'does not raise an error for allowed status codes' do
283
+ expect { conn.get('not-found') }.not_to raise_error
284
+ end
285
+ end
286
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Faraday::Response do
4
+ subject { Faraday::Response.new(env) }
5
+
6
+ let(:env) do
7
+ Faraday::Env.from(status: 404, body: 'yikes', url: Faraday::Utils.URI('https://lostisland.github.io/faraday'),
8
+ response_headers: { 'Content-Type' => 'text/plain' })
9
+ end
10
+
11
+ it { expect(subject.finished?).to be_truthy }
12
+ it { expect { subject.finish({}) }.to raise_error(RuntimeError) }
13
+ it { expect(subject.success?).to be_falsey }
14
+ it { expect(subject.status).to eq(404) }
15
+ it { expect(subject.body).to eq('yikes') }
16
+ it { expect(subject.url).to eq(URI('https://lostisland.github.io/faraday')) }
17
+ it { expect(subject.headers['Content-Type']).to eq('text/plain') }
18
+ it { expect(subject['content-type']).to eq('text/plain') }
19
+
20
+ describe '#apply_request' do
21
+ before { subject.apply_request(body: 'a=b', method: :post) }
22
+
23
+ it { expect(subject.body).to eq('yikes') }
24
+ it { expect(subject.env[:method]).to eq(:post) }
25
+ end
26
+
27
+ describe '#to_hash' do
28
+ let(:hash) { subject.to_hash }
29
+
30
+ it { expect(hash).to be_a(Hash) }
31
+ it { expect(hash[:status]).to eq(subject.status) }
32
+ it { expect(hash[:response_headers]).to eq(subject.headers) }
33
+ it { expect(hash[:body]).to eq(subject.body) }
34
+ it { expect(hash[:url]).to eq(subject.env.url) }
35
+
36
+ context 'when response is not finished' do
37
+ subject { Faraday::Response.new.to_hash }
38
+
39
+ it { is_expected.to eq({ status: nil, body: nil, response_headers: {}, url: nil }) }
40
+ end
41
+ end
42
+
43
+ describe 'marshal serialization support' do
44
+ subject { Faraday::Response.new }
45
+ let(:loaded) { Marshal.load(Marshal.dump(subject)) }
46
+
47
+ before do
48
+ subject.on_complete {}
49
+ subject.finish(env.merge(params: 'moo'))
50
+ end
51
+
52
+ it { expect(loaded.env[:params]).to be_nil }
53
+ it { expect(loaded.env[:body]).to eq(env[:body]) }
54
+ it { expect(loaded.env[:response_headers]).to eq(env[:response_headers]) }
55
+ it { expect(loaded.env[:status]).to eq(env[:status]) }
56
+ it { expect(loaded.env[:url]).to eq(env[:url]) }
57
+ end
58
+
59
+ describe '#on_complete' do
60
+ subject { Faraday::Response.new }
61
+
62
+ it 'parse body on finish' do
63
+ subject.on_complete { |env| env[:body] = env[:body].upcase }
64
+ subject.finish(env)
65
+
66
+ expect(subject.body).to eq('YIKES')
67
+ end
68
+
69
+ it 'can access response body in on_complete callback' do
70
+ subject.on_complete { |env| env[:body] = subject.body.upcase }
71
+ subject.finish(env)
72
+
73
+ expect(subject.body).to eq('YIKES')
74
+ end
75
+
76
+ it 'can access response body in on_complete callback' do
77
+ callback_env = nil
78
+ subject.on_complete { |env| callback_env = env }
79
+ subject.finish({})
80
+
81
+ expect(subject.env).to eq(callback_env)
82
+ end
83
+ end
84
+ end