iron_admin 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +66 -30
- data/app/assets/config/iron_admin_manifest.js +12 -0
- data/app/components/iron_admin/dashboards/metric_card_component.html.haml +8 -3
- data/app/components/iron_admin/dashboards/metric_card_component.rb +21 -1
- data/app/components/iron_admin/form/belongs_to_component.rb +60 -6
- data/app/components/iron_admin/form/nested_form_component.html.haml +28 -0
- data/app/components/iron_admin/form/nested_form_component.rb +81 -0
- data/app/components/iron_admin/resources/data_table_component.html.haml +1 -1
- data/app/components/iron_admin/resources/data_table_component.rb +6 -0
- data/app/components/iron_admin/resources/show_field_component.rb +2 -0
- data/app/controllers/iron_admin/application_controller.rb +32 -1
- data/app/controllers/iron_admin/concerns/action_executable.rb +44 -0
- data/app/controllers/iron_admin/concerns/filterable.rb +84 -0
- data/app/controllers/iron_admin/concerns/json_params_coercion.rb +67 -0
- data/app/controllers/iron_admin/concerns/nested_permittable.rb +36 -0
- data/app/controllers/iron_admin/concerns/scopeable.rb +84 -0
- data/app/controllers/iron_admin/concerns/searchable.rb +13 -16
- data/app/controllers/iron_admin/exports_controller.rb +15 -11
- data/app/controllers/iron_admin/imports_controller.rb +83 -0
- data/app/controllers/iron_admin/live_controller.rb +12 -0
- data/app/controllers/iron_admin/resources_controller.rb +118 -117
- data/app/controllers/iron_admin/search_controller.rb +5 -5
- data/app/controllers/iron_admin/tools_controller.rb +63 -4
- data/app/helpers/iron_admin/application_helper.rb +33 -14
- data/app/helpers/iron_admin/field_display_helper.rb +160 -1
- data/app/javascript/iron_admin/controllers/cp_nested_form_controller.js +113 -0
- data/app/javascript/iron_admin/controllers/filter_operator_controller.js +10 -0
- data/app/javascript/iron_admin/index.js +4 -0
- data/app/views/iron_admin/dashboard/index.html.haml +7 -2
- data/app/views/iron_admin/form/_nested_row.html.haml +70 -0
- data/app/views/iron_admin/imports/new.html.haml +27 -0
- data/app/views/iron_admin/imports/preview.html.haml +31 -0
- data/app/views/iron_admin/resources/_form.html.haml +81 -5
- data/app/views/iron_admin/resources/action_form.html.haml +62 -0
- data/app/views/iron_admin/resources/bulk_action_form.html.haml +62 -0
- data/app/views/iron_admin/resources/index.html.haml +60 -18
- data/app/views/iron_admin/tools/action_form.html.haml +57 -0
- data/app/views/iron_admin/tools/show.html.haml +20 -1
- data/config/importmap.rb +2 -0
- data/config/locales/en.yml +36 -0
- data/config/routes.rb +7 -0
- data/docs/components/filter-components.md +60 -0
- data/docs/getting-started/installation.md +113 -27
- data/docs/getting-started/quick-start.md +17 -1
- data/docs/guides/authentication.md +7 -6
- data/docs/guides/custom-adapters.md +628 -0
- data/docs/guides/extending.md +132 -3
- data/docs/guides/fields.md +1 -1
- data/docs/guides/resources.md +78 -2
- data/docs/guides/troubleshooting.md +68 -10
- data/docs/reference/routes.md +10 -0
- data/lib/generators/iron_admin/install/install_generator.rb +49 -4
- data/lib/generators/iron_admin/install/templates/dashboard.rb.tt +5 -1
- data/lib/generators/iron_admin/install_audit/install_audit_generator.rb +26 -10
- data/lib/generators/iron_admin/resource/resource_generator.rb +1 -1
- data/lib/generators/iron_admin/resource/templates/resource.rb.tt +6 -2
- data/lib/iron_admin/action_field.rb +56 -0
- data/lib/iron_admin/adapters/active_record.rb +237 -0
- data/lib/iron_admin/adapters/base.rb +340 -0
- data/lib/iron_admin/adapters/http/column_descriptor.rb +10 -0
- data/lib/iron_admin/adapters/http/configuration.rb +27 -0
- data/lib/iron_admin/adapters/http/connection.rb +117 -0
- data/lib/iron_admin/adapters/http/model_proxy.rb +75 -0
- data/lib/iron_admin/adapters/http/query.rb +111 -0
- data/lib/iron_admin/adapters/http/record.rb +83 -0
- data/lib/iron_admin/adapters/http/type_inferrer.rb +51 -0
- data/lib/iron_admin/adapters/http.rb +241 -0
- data/lib/iron_admin/adapters/mongoid/association_wrapper.rb +74 -0
- data/lib/iron_admin/adapters/mongoid/column_descriptor.rb +10 -0
- data/lib/iron_admin/adapters/mongoid.rb +284 -0
- data/lib/iron_admin/adapters/registry.rb +44 -0
- data/lib/iron_admin/concerns/importable.rb +81 -0
- data/lib/iron_admin/concerns/live_updatable.rb +38 -0
- data/lib/iron_admin/concerns/nestable.rb +69 -0
- data/lib/iron_admin/concerns/soft_deletable.rb +61 -0
- data/lib/iron_admin/configuration.rb +20 -0
- data/lib/iron_admin/dashboard.rb +15 -20
- data/lib/iron_admin/engine.rb +35 -22
- data/lib/iron_admin/errors.rb +29 -0
- data/lib/iron_admin/field_inferrer.rb +61 -22
- data/lib/iron_admin/filters/active_record_query_builder.rb +63 -0
- data/lib/iron_admin/filters/base_query_builder.rb +55 -0
- data/lib/iron_admin/filters/http_query_builder.rb +39 -0
- data/lib/iron_admin/filters/mongoid_query_builder.rb +58 -0
- data/lib/iron_admin/filters/query_builder.rb +12 -0
- data/lib/iron_admin/import/column_mapper.rb +42 -0
- data/lib/iron_admin/import/import_preview.rb +10 -0
- data/lib/iron_admin/import/import_result.rb +10 -0
- data/lib/iron_admin/import/importer.rb +231 -0
- data/lib/iron_admin/import/parser/csv.rb +34 -0
- data/lib/iron_admin/import/parser/json.rb +36 -0
- data/lib/iron_admin/import/type_caster.rb +47 -0
- data/lib/iron_admin/live/broadcaster.rb +43 -0
- data/lib/iron_admin/live/poll_cache.rb +28 -0
- data/lib/iron_admin/live.rb +29 -0
- data/lib/iron_admin/nested_association.rb +15 -0
- data/lib/iron_admin/nested_attributes_validator.rb +25 -0
- data/lib/iron_admin/policy.rb +72 -13
- data/lib/iron_admin/resource.rb +149 -91
- data/lib/iron_admin/resource_registry.rb +77 -4
- data/lib/iron_admin/tool.rb +50 -0
- data/lib/iron_admin/tool_action.rb +73 -0
- data/lib/iron_admin/tool_context.rb +49 -0
- data/lib/iron_admin/version.rb +1 -1
- data/lib/iron_admin.rb +46 -10
- data/vendor/bundle/ruby/3.2.0/cache/addressable-2.9.0.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/crack-1.0.1.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/faraday-2.14.1.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/faraday-net_http-3.4.2.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/hashdiff-1.2.1.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/net-http-0.9.1.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/public_suffix-7.0.5.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/rexml-3.4.4.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/webmock-3.26.2.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-4.0.1/bigdecimal.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-4.0.1/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/bigdecimal-4.0.1/mkmf.log +25 -25
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/date_core.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/mkmf.log +4 -4
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/erb-6.0.1/erb/escape.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/erb-6.0.1/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/erb-6.0.1/mkmf.log +2 -2
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/io/console.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/mkmf.log +22 -22
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/json/ext/generator.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/json/ext/parser.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/json-2.18.1/mkmf.log +9 -9
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/nio4r-2.7.5/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/nio4r-2.7.5/mkmf.log +12 -12
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/nio4r-2.7.5/nio4r_ext.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/prism-1.9.0/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/prism-1.9.0/mkmf.log +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/prism-1.9.0/prism/prism.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.3.1/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.3.1/mkmf.log +7 -7
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.3.1/psych.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/racc/cparse.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/redcarpet-3.6.1/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/redcarpet-3.6.1/redcarpet.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/mkmf.log +2 -2
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/stringio.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/websocket-driver-0.8.0/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/websocket-driver-0.8.0/websocket_mask.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/CHANGELOG.md +326 -0
- data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/LICENSE.txt +202 -0
- data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/README.md +121 -0
- data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/idna/native.rb +66 -0
- data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/idna/pure.rb +4710 -0
- data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/idna.rb +26 -0
- data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/template.rb +1040 -0
- data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/uri.rb +2602 -0
- data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable/version.rb +31 -0
- data/vendor/bundle/ruby/3.2.0/gems/addressable-2.9.0/lib/addressable.rb +4 -0
- data/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/ext/bigdecimal/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/bigdecimal-4.0.1/lib/bigdecimal.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/History +58 -0
- data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/LICENSE +20 -0
- data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/README.md +43 -0
- data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/json.rb +113 -0
- data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/util.rb +17 -0
- data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/version.rb +3 -0
- data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack/xml.rb +240 -0
- data/vendor/bundle/ruby/3.2.0/gems/crack-1.0.1/lib/crack.rb +8 -0
- data/vendor/bundle/ruby/3.2.0/gems/date-3.5.1/ext/date/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/date-3.5.1/lib/date_core.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/erb-6.0.1/ext/erb/escape/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/erb-6.0.1/lib/erb/escape.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/CHANGELOG.md +574 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/LICENSE.md +20 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/README.md +67 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/Rakefile +12 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/examples/client_spec.rb +119 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/examples/client_test.rb +144 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/adapter/test.rb +311 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/adapter.rb +101 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/adapter_registry.rb +30 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/connection.rb +565 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/encoders/flat_params_encoder.rb +105 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/encoders/nested_params_encoder.rb +183 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/error.rb +202 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/logging/formatter.rb +118 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/methods.rb +6 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/middleware.rb +72 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/middleware_registry.rb +83 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/connection_options.rb +23 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/env.rb +204 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/proxy_options.rb +38 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/request_options.rb +23 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options/ssl_options.rb +76 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/options.rb +219 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/parameters.rb +5 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/rack_builder.rb +248 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/authorization.rb +54 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/instrumentation.rb +58 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/json.rb +70 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request/url_encoded.rb +60 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/request.rb +139 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response/json.rb +74 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response/logger.rb +39 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response/raise_error.rb +83 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/response.rb +95 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/utils/headers.rb +150 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/utils/params_hash.rb +61 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/utils.rb +121 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday/version.rb +5 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/lib/faraday.rb +158 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/external_adapters/faraday_specs_setup.rb +14 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/adapter/test_spec.rb +442 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/adapter_registry_spec.rb +28 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/adapter_spec.rb +55 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/connection_spec.rb +841 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/error_spec.rb +175 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/middleware_registry_spec.rb +31 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/middleware_spec.rb +213 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/env_spec.rb +76 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/options_spec.rb +297 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/proxy_options_spec.rb +79 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/options/request_options_spec.rb +19 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/params_encoders/flat_spec.rb +42 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/params_encoders/nested_spec.rb +151 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/rack_builder_spec.rb +317 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/authorization_spec.rb +118 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/instrumentation_spec.rb +74 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/json_spec.rb +199 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request/url_encoded_spec.rb +93 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/request_spec.rb +110 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response/json_spec.rb +206 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response/logger_spec.rb +299 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response/raise_error_spec.rb +286 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/response_spec.rb +84 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/utils/headers_spec.rb +109 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday/utils_spec.rb +120 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/faraday_spec.rb +43 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/spec_helper.rb +133 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/disabling_stub.rb +14 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/fake_safe_buffer.rb +15 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/faraday_middleware_subclasses.rb +18 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/helper_methods.rb +96 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/shared_examples/adapter.rb +105 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/shared_examples/params_encoder.rb +18 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/shared_examples/request_method.rb +263 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-2.14.1/spec/support/streaming_response_checker.rb +35 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/LICENSE.md +21 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/README.md +57 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/lib/faraday/adapter/net_http.rb +206 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/lib/faraday/net_http/version.rb +7 -0
- data/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.4.2/lib/faraday/net_http.rb +10 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/Gemfile +8 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/LICENSE +19 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/README.md +323 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/Rakefile +18 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/changelog.md +127 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/hashdiff.gemspec +39 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/compare_hashes.rb +101 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/diff.rb +185 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/lcs.rb +66 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/lcs_compare_arrays.rb +32 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/linear_compare_array.rb +159 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/patch.rb +88 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/util.rb +155 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff/version.rb +5 -0
- data/vendor/bundle/ruby/3.2.0/gems/hashdiff-1.2.1/lib/hashdiff.rb +10 -0
- data/vendor/bundle/ruby/3.2.0/gems/io-console-0.8.2/ext/io/console/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/io-console-0.8.2/lib/io/console.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/ext/json/ext/generator/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/ext/json/ext/parser/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/lib/json/ext/generator.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/json-2.18.1/lib/json/ext/parser.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/BSDL +22 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/COPYING +56 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/README.md +93 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/doc/net-http/examples.rdoc +31 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/doc/net-http/included_getters.rdoc +3 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/exceptions.rb +35 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/generic_request.rb +429 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/header.rb +985 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/proxy_delta.rb +17 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/request.rb +88 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/requests.rb +444 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/response.rb +739 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/responses.rb +1242 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http/status.rb +84 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/http.rb +2608 -0
- data/vendor/bundle/ruby/3.2.0/gems/net-http-0.9.1/lib/net/https.rb +23 -0
- data/vendor/bundle/ruby/3.2.0/gems/nio4r-2.7.5/ext/nio4r/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/nio4r-2.7.5/lib/nio4r_ext.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/prism-1.9.0/ext/prism/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/prism-1.9.0/lib/prism/prism.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/psych-5.3.1/ext/psych/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/psych-5.3.1/lib/psych.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/CHANGELOG.md +649 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/Gemfile +16 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/README.md +231 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/SECURITY.md +24 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/data/list.txt +16298 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/domain.rb +235 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/errors.rb +41 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/list.rb +247 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/rule.rb +350 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix/version.rb +14 -0
- data/vendor/bundle/ruby/3.2.0/gems/public_suffix-7.0.5/lib/public_suffix.rb +177 -0
- data/vendor/bundle/ruby/3.2.0/gems/racc-1.8.1/ext/racc/cparse/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/racc-1.8.1/lib/racc/cparse.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/redcarpet-3.6.1/ext/redcarpet/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/redcarpet-3.6.1/lib/redcarpet.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/NEWS.md +843 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/README.md +57 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/context.rdoc +143 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/child.rdoc +87 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/document.rdoc +276 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/element.rdoc +602 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/node.rdoc +97 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/rdoc/parent.rdoc +267 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/child_toc.rdoc +12 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/document_toc.rdoc +30 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/element_toc.rdoc +55 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/master_toc.rdoc +135 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/node_toc.rdoc +16 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tasks/tocs/parent_toc.rdoc +25 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/doc/rexml/tutorial.rdoc +1358 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/attlistdecl.rb +63 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/attribute.rb +210 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/cdata.rb +68 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/child.rb +96 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/comment.rb +80 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/doctype.rb +306 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/document.rb +471 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/attlistdecl.rb +11 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/dtd.rb +47 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/elementdecl.rb +18 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/entitydecl.rb +57 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/dtd/notationdecl.rb +40 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/element.rb +2578 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/encoding.rb +48 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/entity.rb +142 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/formatters/default.rb +116 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/formatters/pretty.rb +142 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/formatters/transitive.rb +58 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/functions.rb +446 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/instruction.rb +79 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/light/node.rb +188 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/namespace.rb +63 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/node.rb +80 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/output.rb +30 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parent.rb +166 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parseexception.rb +53 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/baseparser.rb +949 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/lightparser.rb +59 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/pullparser.rb +213 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/sax2parser.rb +270 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/streamparser.rb +67 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/treeparser.rb +89 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/ultralightparser.rb +57 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/parsers/xpathparser.rb +739 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/quickpath.rb +267 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/rexml.rb +39 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/sax2listener.rb +98 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/security.rb +28 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/source.rb +388 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/streamlistener.rb +93 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/text.rb +420 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/undefinednamespaceexception.rb +9 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/validation/relaxng.rb +540 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/validation/validation.rb +144 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/validation/validationexception.rb +10 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xmldecl.rb +130 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xmltokens.rb +85 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xpath.rb +70 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml/xpath_parser.rb +980 -0
- data/vendor/bundle/ruby/3.2.0/gems/rexml-3.4.4/lib/rexml.rb +3 -0
- data/vendor/bundle/ruby/3.2.0/gems/stringio-3.2.0/ext/stringio/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/stringio-3.2.0/lib/stringio.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/CHANGELOG.md +2148 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/LICENSE +20 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/README.md +1229 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/api.rb +111 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/assertion_failure.rb +13 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/callback_registry.rb +37 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/config.rb +20 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/cucumber.rb +12 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/deprecation.rb +11 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/errors.rb +19 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +228 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/curb_adapter.rb +354 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +239 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/excon_adapter.rb +167 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_lib_adapter.rb +9 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +21 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/client.rb +17 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/request.rb +28 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/response.rb +95 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/streamer.rb +44 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb/webmock.rb +77 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/http_rb_adapter.rb +39 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/httpclient_adapter.rb +260 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/manticore_adapter.rb +147 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/net_http.rb +310 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/net_http_response.rb +36 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/patron_adapter.rb +132 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +190 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/any_arg_matcher.rb +15 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/hash_argument_matcher.rb +23 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/hash_excluding_matcher.rb +17 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/matchers/hash_including_matcher.rb +19 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/minitest.rb +43 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rack_response.rb +73 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_body_diff.rb +66 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_execution_verifier.rb +79 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_pattern.rb +428 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_registry.rb +37 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_signature.rb +56 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_signature_snippet.rb +63 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/request_stub.rb +134 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/response.rb +161 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/responses_sequence.rb +42 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec/matchers/request_pattern_matcher.rb +80 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec/matchers/webmock_matcher.rb +69 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec/matchers.rb +29 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/rspec.rb +44 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/stub_registry.rb +84 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/stub_request_snippet.rb +40 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/test_unit.rb +22 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/hash_counter.rb +45 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/hash_keys_stringifier.rb +27 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/hash_validator.rb +19 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/headers.rb +77 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/parsers/json.rb +72 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/parsers/parse_error.rb +7 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/parsers/xml.rb +16 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/query_mapper.rb +283 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/uri.rb +113 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/values_stringifier.rb +22 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/util/version_checker.rb +113 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/version.rb +5 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock/webmock.rb +175 -0
- data/vendor/bundle/ruby/3.2.0/gems/webmock-3.26.2/lib/webmock.rb +61 -0
- data/vendor/bundle/ruby/3.2.0/gems/websocket-driver-0.8.0/ext/websocket-driver/Makefile +3 -3
- data/vendor/bundle/ruby/3.2.0/gems/websocket-driver-0.8.0/lib/websocket_mask.so +0 -0
- data/vendor/bundle/ruby/3.2.0/specifications/addressable-2.9.0.gemspec +29 -0
- data/vendor/bundle/ruby/3.2.0/specifications/crack-1.0.1.gemspec +27 -0
- data/vendor/bundle/ruby/3.2.0/specifications/faraday-2.14.1.gemspec +0 -0
- data/vendor/bundle/ruby/3.2.0/specifications/faraday-net_http-3.4.2.gemspec +26 -0
- data/vendor/bundle/ruby/3.2.0/specifications/hashdiff-1.2.1.gemspec +30 -0
- data/vendor/bundle/ruby/3.2.0/specifications/net-http-0.9.1.gemspec +27 -0
- data/vendor/bundle/ruby/3.2.0/specifications/public_suffix-7.0.5.gemspec +24 -0
- data/vendor/bundle/ruby/3.2.0/specifications/rexml-3.4.4.gemspec +25 -0
- data/vendor/bundle/ruby/3.2.0/specifications/webmock-3.26.2.gemspec +44 -0
- metadata +377 -2
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'faraday/adapter_registry'
|
|
4
|
+
|
|
5
|
+
module Faraday
|
|
6
|
+
# A Builder that processes requests into responses by passing through an inner
|
|
7
|
+
# middleware stack (heavily inspired by Rack).
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# Faraday::Connection.new(url: 'http://httpbingo.org') do |builder|
|
|
11
|
+
# builder.request :url_encoded # Faraday::Request::UrlEncoded
|
|
12
|
+
# builder.adapter :net_http # Faraday::Adapter::NetHttp
|
|
13
|
+
# end
|
|
14
|
+
class RackBuilder
|
|
15
|
+
# Used to detect missing arguments
|
|
16
|
+
NO_ARGUMENT = Object.new
|
|
17
|
+
|
|
18
|
+
attr_accessor :handlers
|
|
19
|
+
|
|
20
|
+
# Error raised when trying to modify the stack after calling `lock!`
|
|
21
|
+
class StackLocked < RuntimeError; end
|
|
22
|
+
|
|
23
|
+
# borrowed from ActiveSupport::Dependencies::Reference &
|
|
24
|
+
# ActionDispatch::MiddlewareStack::Middleware
|
|
25
|
+
class Handler
|
|
26
|
+
REGISTRY = Faraday::AdapterRegistry.new
|
|
27
|
+
|
|
28
|
+
attr_reader :name
|
|
29
|
+
|
|
30
|
+
def initialize(klass, *args, **kwargs, &block)
|
|
31
|
+
@name = klass.to_s
|
|
32
|
+
REGISTRY.set(klass) if klass.respond_to?(:name)
|
|
33
|
+
@args = args
|
|
34
|
+
@kwargs = kwargs
|
|
35
|
+
@block = block
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def klass
|
|
39
|
+
REGISTRY.get(@name)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def inspect
|
|
43
|
+
@name
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def ==(other)
|
|
47
|
+
if other.is_a? Handler
|
|
48
|
+
name == other.name
|
|
49
|
+
elsif other.respond_to? :name
|
|
50
|
+
klass == other
|
|
51
|
+
else
|
|
52
|
+
@name == other.to_s
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def build(app = nil)
|
|
57
|
+
klass.new(app, *@args, **@kwargs, &@block)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def initialize(&block)
|
|
62
|
+
@adapter = nil
|
|
63
|
+
@handlers = []
|
|
64
|
+
build(&block)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def initialize_dup(original)
|
|
68
|
+
super
|
|
69
|
+
@adapter = original.adapter
|
|
70
|
+
@handlers = original.handlers.dup
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def build
|
|
74
|
+
raise_if_locked
|
|
75
|
+
block_given? ? yield(self) : request(:url_encoded)
|
|
76
|
+
adapter(Faraday.default_adapter, **Faraday.default_adapter_options) unless @adapter
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def [](idx)
|
|
80
|
+
@handlers[idx]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Locks the middleware stack to ensure no further modifications are made.
|
|
84
|
+
def lock!
|
|
85
|
+
@handlers.freeze
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def locked?
|
|
89
|
+
@handlers.frozen?
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def use(klass, ...)
|
|
93
|
+
if klass.is_a? Symbol
|
|
94
|
+
use_symbol(Faraday::Middleware, klass, ...)
|
|
95
|
+
else
|
|
96
|
+
raise_if_locked
|
|
97
|
+
raise_if_adapter(klass)
|
|
98
|
+
@handlers << self.class::Handler.new(klass, ...)
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def request(key, ...)
|
|
103
|
+
use_symbol(Faraday::Request, key, ...)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def response(...)
|
|
107
|
+
use_symbol(Faraday::Response, ...)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def adapter(klass = NO_ARGUMENT, *args, **kwargs, &block)
|
|
111
|
+
return @adapter if klass == NO_ARGUMENT || klass.nil?
|
|
112
|
+
|
|
113
|
+
klass = Faraday::Adapter.lookup_middleware(klass) if klass.is_a?(Symbol)
|
|
114
|
+
@adapter = self.class::Handler.new(klass, *args, **kwargs, &block)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
## methods to push onto the various positions in the stack:
|
|
118
|
+
|
|
119
|
+
def insert(index, ...)
|
|
120
|
+
raise_if_locked
|
|
121
|
+
index = assert_index(index)
|
|
122
|
+
handler = self.class::Handler.new(...)
|
|
123
|
+
@handlers.insert(index, handler)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
alias insert_before insert
|
|
127
|
+
|
|
128
|
+
def insert_after(index, ...)
|
|
129
|
+
index = assert_index(index)
|
|
130
|
+
insert(index + 1, ...)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def swap(index, ...)
|
|
134
|
+
raise_if_locked
|
|
135
|
+
index = assert_index(index)
|
|
136
|
+
@handlers.delete_at(index)
|
|
137
|
+
insert(index, ...)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def delete(handler)
|
|
141
|
+
raise_if_locked
|
|
142
|
+
@handlers.delete(handler)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Processes a Request into a Response by passing it through this Builder's
|
|
146
|
+
# middleware stack.
|
|
147
|
+
#
|
|
148
|
+
# @param connection [Faraday::Connection]
|
|
149
|
+
# @param request [Faraday::Request]
|
|
150
|
+
#
|
|
151
|
+
# @return [Faraday::Response]
|
|
152
|
+
def build_response(connection, request)
|
|
153
|
+
app.call(build_env(connection, request))
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# The "rack app" wrapped in middleware. All requests are sent here.
|
|
157
|
+
#
|
|
158
|
+
# The builder is responsible for creating the app object. After this,
|
|
159
|
+
# the builder gets locked to ensure no further modifications are made
|
|
160
|
+
# to the middleware stack.
|
|
161
|
+
#
|
|
162
|
+
# Returns an object that responds to `call` and returns a Response.
|
|
163
|
+
def app
|
|
164
|
+
@app ||= begin
|
|
165
|
+
lock!
|
|
166
|
+
ensure_adapter!
|
|
167
|
+
to_app
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def to_app
|
|
172
|
+
# last added handler is the deepest and thus closest to the inner app
|
|
173
|
+
# adapter is always the last one
|
|
174
|
+
@handlers.reverse.inject(@adapter.build) do |app, handler|
|
|
175
|
+
handler.build(app)
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def ==(other)
|
|
180
|
+
other.is_a?(self.class) &&
|
|
181
|
+
@handlers == other.handlers &&
|
|
182
|
+
@adapter == other.adapter
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# ENV Keys
|
|
186
|
+
# :http_method - a symbolized request HTTP method (:get, :post)
|
|
187
|
+
# :body - the request body that will eventually be converted to a string.
|
|
188
|
+
# :url - URI instance for the current request.
|
|
189
|
+
# :status - HTTP response status code
|
|
190
|
+
# :request_headers - hash of HTTP Headers to be sent to the server
|
|
191
|
+
# :response_headers - Hash of HTTP headers from the server
|
|
192
|
+
# :parallel_manager - sent if the connection is in parallel mode
|
|
193
|
+
# :request - Hash of options for configuring the request.
|
|
194
|
+
# :timeout - open/read timeout Integer in seconds
|
|
195
|
+
# :open_timeout - read timeout Integer in seconds
|
|
196
|
+
# :proxy - Hash of proxy options
|
|
197
|
+
# :uri - Proxy Server URI
|
|
198
|
+
# :user - Proxy server username
|
|
199
|
+
# :password - Proxy server password
|
|
200
|
+
# :ssl - Hash of options for configuring SSL requests.
|
|
201
|
+
def build_env(connection, request)
|
|
202
|
+
exclusive_url = connection.build_exclusive_url(
|
|
203
|
+
request.path, request.params,
|
|
204
|
+
request.options.params_encoder
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
Env.new(request.http_method, request.body, exclusive_url,
|
|
208
|
+
request.options, request.headers, connection.ssl,
|
|
209
|
+
connection.parallel_manager)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
private
|
|
213
|
+
|
|
214
|
+
LOCK_ERR = "can't modify middleware stack after making a request"
|
|
215
|
+
MISSING_ADAPTER_ERROR = "An attempt to run a request with a Faraday::Connection without adapter has been made.\n" \
|
|
216
|
+
"Please set Faraday.default_adapter or provide one when initializing the connection.\n" \
|
|
217
|
+
'For more info, check https://lostisland.github.io/faraday/usage/.'
|
|
218
|
+
|
|
219
|
+
def raise_if_locked
|
|
220
|
+
raise StackLocked, LOCK_ERR if locked?
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def raise_if_adapter(klass)
|
|
224
|
+
return unless klass <= Faraday::Adapter
|
|
225
|
+
|
|
226
|
+
raise 'Adapter should be set using the `adapter` method, not `use`'
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
def ensure_adapter!
|
|
230
|
+
raise MISSING_ADAPTER_ERROR unless @adapter
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def adapter_set?
|
|
234
|
+
!@adapter.nil?
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
def use_symbol(mod, key, ...)
|
|
238
|
+
use(mod.lookup_middleware(key), ...)
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
def assert_index(index)
|
|
242
|
+
idx = index.is_a?(Integer) ? index : @handlers.index(index)
|
|
243
|
+
raise "No such handler: #{index.inspect}" unless idx
|
|
244
|
+
|
|
245
|
+
idx
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faraday
|
|
4
|
+
class Request
|
|
5
|
+
# Request middleware for the Authorization HTTP header
|
|
6
|
+
class Authorization < Faraday::Middleware
|
|
7
|
+
KEY = 'Authorization'
|
|
8
|
+
|
|
9
|
+
# @param app [#call]
|
|
10
|
+
# @param type [String, Symbol] Type of Authorization
|
|
11
|
+
# @param params [Array<String, Proc, #call>] parameters to build the Authorization header.
|
|
12
|
+
# If the type is `:basic`, then these can be a login and password pair.
|
|
13
|
+
# Otherwise, a single value is expected that will be appended after the type.
|
|
14
|
+
# This value can be a proc or an object responding to `.call`, in which case
|
|
15
|
+
# it will be invoked on each request.
|
|
16
|
+
def initialize(app, type, *params)
|
|
17
|
+
@type = type
|
|
18
|
+
@params = params
|
|
19
|
+
super(app)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @param env [Faraday::Env]
|
|
23
|
+
def on_request(env)
|
|
24
|
+
return if env.request_headers[KEY]
|
|
25
|
+
|
|
26
|
+
env.request_headers[KEY] = header_from(@type, env, *@params)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
# @param type [String, Symbol]
|
|
32
|
+
# @param env [Faraday::Env]
|
|
33
|
+
# @param params [Array]
|
|
34
|
+
# @return [String] a header value
|
|
35
|
+
def header_from(type, env, *params)
|
|
36
|
+
if type.to_s.casecmp('basic').zero? && params.size == 2
|
|
37
|
+
Utils.basic_header_from(*params)
|
|
38
|
+
elsif params.size != 1
|
|
39
|
+
raise ArgumentError, "Unexpected params received (got #{params.size} instead of 1)"
|
|
40
|
+
else
|
|
41
|
+
value = params.first
|
|
42
|
+
if (value.is_a?(Proc) && value.arity == 1) || (value.respond_to?(:call) && value.method(:call).arity == 1)
|
|
43
|
+
value = value.call(env)
|
|
44
|
+
elsif value.is_a?(Proc) || value.respond_to?(:call)
|
|
45
|
+
value = value.call
|
|
46
|
+
end
|
|
47
|
+
"#{type} #{value}"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
Faraday::Request.register_middleware(authorization: Faraday::Request::Authorization)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faraday
|
|
4
|
+
class Request
|
|
5
|
+
# Middleware for instrumenting Requests.
|
|
6
|
+
class Instrumentation < Faraday::Middleware
|
|
7
|
+
# Options class used in Request::Instrumentation class.
|
|
8
|
+
Options = Faraday::Options.new(:name, :instrumenter) do
|
|
9
|
+
remove_method :name
|
|
10
|
+
# @return [String]
|
|
11
|
+
def name
|
|
12
|
+
self[:name] ||= 'request.faraday'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
remove_method :instrumenter
|
|
16
|
+
# @return [Class]
|
|
17
|
+
def instrumenter
|
|
18
|
+
self[:instrumenter] ||= ActiveSupport::Notifications
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Instruments requests using Active Support.
|
|
23
|
+
#
|
|
24
|
+
# Measures time spent only for synchronous requests.
|
|
25
|
+
#
|
|
26
|
+
# @example Using ActiveSupport::Notifications to measure time spent
|
|
27
|
+
# for Faraday requests.
|
|
28
|
+
# ActiveSupport::Notifications
|
|
29
|
+
# .subscribe('request.faraday') do |name, starts, ends, _, env|
|
|
30
|
+
# url = env[:url]
|
|
31
|
+
# http_method = env[:method].to_s.upcase
|
|
32
|
+
# duration = ends - starts
|
|
33
|
+
# $stderr.puts '[%s] %s %s (%.3f s)' %
|
|
34
|
+
# [url.host, http_method, url.request_uri, duration]
|
|
35
|
+
# end
|
|
36
|
+
# @param app [#call]
|
|
37
|
+
# @param options [nil, Hash] Options hash
|
|
38
|
+
# @option options [String] :name ('request.faraday')
|
|
39
|
+
# Name of the instrumenter
|
|
40
|
+
# @option options [Class] :instrumenter (ActiveSupport::Notifications)
|
|
41
|
+
# Active Support instrumenter class.
|
|
42
|
+
def initialize(app, options = nil)
|
|
43
|
+
super(app)
|
|
44
|
+
@name, @instrumenter = Options.from(options)
|
|
45
|
+
.values_at(:name, :instrumenter)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @param env [Faraday::Env]
|
|
49
|
+
def call(env)
|
|
50
|
+
@instrumenter.instrument(@name, env) do
|
|
51
|
+
@app.call(env)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
Faraday::Request.register_middleware(instrumentation: Faraday::Request::Instrumentation)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
module Faraday
|
|
6
|
+
class Request
|
|
7
|
+
# Request middleware that encodes the body as JSON.
|
|
8
|
+
#
|
|
9
|
+
# Processes only requests with matching Content-type or those without a type.
|
|
10
|
+
# If a request doesn't have a type but has a body, it sets the Content-type
|
|
11
|
+
# to JSON MIME-type.
|
|
12
|
+
#
|
|
13
|
+
# Doesn't try to encode bodies that already are in string form.
|
|
14
|
+
class Json < Middleware
|
|
15
|
+
MIME_TYPE = 'application/json'
|
|
16
|
+
MIME_TYPE_REGEX = %r{^application/(vnd\..+\+)?json$}
|
|
17
|
+
|
|
18
|
+
def on_request(env)
|
|
19
|
+
match_content_type(env) do |data|
|
|
20
|
+
env[:body] = encode(data)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def encode(data)
|
|
27
|
+
if options[:encoder].is_a?(Array) && options[:encoder].size >= 2
|
|
28
|
+
options[:encoder][0].public_send(options[:encoder][1], data)
|
|
29
|
+
elsif options[:encoder].respond_to?(:dump)
|
|
30
|
+
options[:encoder].dump(data)
|
|
31
|
+
else
|
|
32
|
+
::JSON.generate(data)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def match_content_type(env)
|
|
37
|
+
return unless process_request?(env)
|
|
38
|
+
|
|
39
|
+
env[:request_headers][CONTENT_TYPE] ||= MIME_TYPE
|
|
40
|
+
yield env[:body] unless env[:body].respond_to?(:to_str)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def process_request?(env)
|
|
44
|
+
type = request_type(env)
|
|
45
|
+
body?(env) && (type.empty? || type.match?(MIME_TYPE_REGEX))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def body?(env)
|
|
49
|
+
body = env[:body]
|
|
50
|
+
case body
|
|
51
|
+
when true, false
|
|
52
|
+
true
|
|
53
|
+
when nil
|
|
54
|
+
# NOTE: nil can be converted to `"null"`, but this middleware doesn't process `nil` for the compatibility.
|
|
55
|
+
false
|
|
56
|
+
else
|
|
57
|
+
!(body.respond_to?(:to_str) && body.empty?)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def request_type(env)
|
|
62
|
+
type = env[:request_headers][CONTENT_TYPE].to_s
|
|
63
|
+
type = type.split(';', 2).first if type.index(';')
|
|
64
|
+
type
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
Faraday::Request.register_middleware(json: Faraday::Request::Json)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faraday
|
|
4
|
+
class Request
|
|
5
|
+
# Middleware for supporting urlencoded requests.
|
|
6
|
+
class UrlEncoded < Faraday::Middleware
|
|
7
|
+
unless defined?(::Faraday::Request::UrlEncoded::CONTENT_TYPE)
|
|
8
|
+
CONTENT_TYPE = 'Content-Type'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
attr_accessor :mime_type
|
|
13
|
+
end
|
|
14
|
+
self.mime_type = 'application/x-www-form-urlencoded'
|
|
15
|
+
|
|
16
|
+
# Encodes as "application/x-www-form-urlencoded" if not already encoded or
|
|
17
|
+
# of another type.
|
|
18
|
+
#
|
|
19
|
+
# @param env [Faraday::Env]
|
|
20
|
+
def call(env)
|
|
21
|
+
match_content_type(env) do |data|
|
|
22
|
+
params = Faraday::Utils::ParamsHash[data]
|
|
23
|
+
env.body = params.to_query(env.params_encoder)
|
|
24
|
+
end
|
|
25
|
+
@app.call env
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# @param env [Faraday::Env]
|
|
29
|
+
# @yield [request_body] Body of the request
|
|
30
|
+
def match_content_type(env)
|
|
31
|
+
return unless process_request?(env)
|
|
32
|
+
|
|
33
|
+
env.request_headers[CONTENT_TYPE] ||= self.class.mime_type
|
|
34
|
+
return if env.body.respond_to?(:to_str) || env.body.respond_to?(:read)
|
|
35
|
+
|
|
36
|
+
yield(env.body)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @param env [Faraday::Env]
|
|
40
|
+
#
|
|
41
|
+
# @return [Boolean] True if the request has a body and its Content-Type is
|
|
42
|
+
# urlencoded.
|
|
43
|
+
def process_request?(env)
|
|
44
|
+
type = request_type(env)
|
|
45
|
+
env.body && (type.empty? || (type == self.class.mime_type))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @param env [Faraday::Env]
|
|
49
|
+
#
|
|
50
|
+
# @return [String]
|
|
51
|
+
def request_type(env)
|
|
52
|
+
type = env.request_headers[CONTENT_TYPE].to_s
|
|
53
|
+
type = type.split(';', 2).first if type.index(';')
|
|
54
|
+
type
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
Faraday::Request.register_middleware(url_encoded: Faraday::Request::UrlEncoded)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faraday
|
|
4
|
+
# Used to setup URLs, params, headers, and the request body in a sane manner.
|
|
5
|
+
#
|
|
6
|
+
# @example
|
|
7
|
+
# @connection.post do |req|
|
|
8
|
+
# req.url 'http://localhost', 'a' => '1' # 'http://localhost?a=1'
|
|
9
|
+
# req.headers['b'] = '2' # Header
|
|
10
|
+
# req.params['c'] = '3' # GET Param
|
|
11
|
+
# req['b'] = '2' # also Header
|
|
12
|
+
# req.body = 'abc'
|
|
13
|
+
# end
|
|
14
|
+
#
|
|
15
|
+
# @!attribute http_method
|
|
16
|
+
# @return [Symbol] the HTTP method of the Request
|
|
17
|
+
# @!attribute path
|
|
18
|
+
# @return [URI, String] the path
|
|
19
|
+
# @!attribute params
|
|
20
|
+
# @return [Hash] query parameters
|
|
21
|
+
# @!attribute headers
|
|
22
|
+
# @return [Faraday::Utils::Headers] headers
|
|
23
|
+
# @!attribute body
|
|
24
|
+
# @return [String] body
|
|
25
|
+
# @!attribute options
|
|
26
|
+
# @return [RequestOptions] options
|
|
27
|
+
Request = Struct.new(:http_method, :path, :params, :headers, :body, :options) do
|
|
28
|
+
extend MiddlewareRegistry
|
|
29
|
+
|
|
30
|
+
alias_method :member_get, :[]
|
|
31
|
+
private :member_get
|
|
32
|
+
alias_method :member_set, :[]=
|
|
33
|
+
private :member_set
|
|
34
|
+
|
|
35
|
+
# @param request_method [String]
|
|
36
|
+
# @yield [request] for block customization, if block given
|
|
37
|
+
# @yieldparam request [Request]
|
|
38
|
+
# @return [Request]
|
|
39
|
+
def self.create(request_method)
|
|
40
|
+
new(request_method).tap do |request|
|
|
41
|
+
yield(request) if block_given?
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
remove_method :params=
|
|
46
|
+
# Replace params, preserving the existing hash type.
|
|
47
|
+
#
|
|
48
|
+
# @param hash [Hash] new params
|
|
49
|
+
def params=(hash)
|
|
50
|
+
if params
|
|
51
|
+
params.replace hash
|
|
52
|
+
else
|
|
53
|
+
member_set(:params, hash)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
remove_method :headers=
|
|
58
|
+
# Replace request headers, preserving the existing hash type.
|
|
59
|
+
#
|
|
60
|
+
# @param hash [Hash] new headers
|
|
61
|
+
def headers=(hash)
|
|
62
|
+
if headers
|
|
63
|
+
headers.replace hash
|
|
64
|
+
else
|
|
65
|
+
member_set(:headers, hash)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Update path and params.
|
|
70
|
+
#
|
|
71
|
+
# @param path [URI, String]
|
|
72
|
+
# @param params [Hash, nil]
|
|
73
|
+
# @return [void]
|
|
74
|
+
def url(path, params = nil)
|
|
75
|
+
if path.respond_to? :query
|
|
76
|
+
if (query = path.query)
|
|
77
|
+
path = path.dup
|
|
78
|
+
path.query = nil
|
|
79
|
+
end
|
|
80
|
+
else
|
|
81
|
+
anchor_index = path.index('#')
|
|
82
|
+
path = path.slice(0, anchor_index) unless anchor_index.nil?
|
|
83
|
+
path, query = path.split('?', 2)
|
|
84
|
+
end
|
|
85
|
+
self.path = path
|
|
86
|
+
self.params.merge_query query, options.params_encoder
|
|
87
|
+
self.params.update(params) if params
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# @param key [Object] key to look up in headers
|
|
91
|
+
# @return [Object] value of the given header name
|
|
92
|
+
def [](key)
|
|
93
|
+
headers[key]
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# @param key [Object] key of header to write
|
|
97
|
+
# @param value [Object] value of header
|
|
98
|
+
def []=(key, value)
|
|
99
|
+
headers[key] = value
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Marshal serialization support.
|
|
103
|
+
#
|
|
104
|
+
# @return [Hash] the hash ready to be serialized in Marshal.
|
|
105
|
+
def marshal_dump
|
|
106
|
+
{
|
|
107
|
+
http_method: http_method,
|
|
108
|
+
body: body,
|
|
109
|
+
headers: headers,
|
|
110
|
+
path: path,
|
|
111
|
+
params: params,
|
|
112
|
+
options: options
|
|
113
|
+
}
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Marshal serialization support.
|
|
117
|
+
# Restores the instance variables according to the +serialised+.
|
|
118
|
+
# @param serialised [Hash] the serialised object.
|
|
119
|
+
def marshal_load(serialised)
|
|
120
|
+
self.http_method = serialised[:http_method]
|
|
121
|
+
self.body = serialised[:body]
|
|
122
|
+
self.headers = serialised[:headers]
|
|
123
|
+
self.path = serialised[:path]
|
|
124
|
+
self.params = serialised[:params]
|
|
125
|
+
self.options = serialised[:options]
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# @return [Env] the Env for this Request
|
|
129
|
+
def to_env(connection)
|
|
130
|
+
Env.new(http_method, body, connection.build_exclusive_url(path, params),
|
|
131
|
+
options, headers, connection.ssl, connection.parallel_manager)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
require 'faraday/request/authorization'
|
|
137
|
+
require 'faraday/request/instrumentation'
|
|
138
|
+
require 'faraday/request/json'
|
|
139
|
+
require 'faraday/request/url_encoded'
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
module Faraday
|
|
6
|
+
class Response
|
|
7
|
+
# Parse response bodies as JSON.
|
|
8
|
+
class Json < Middleware
|
|
9
|
+
def initialize(app = nil, parser_options: nil, content_type: /\bjson$/, preserve_raw: false)
|
|
10
|
+
super(app)
|
|
11
|
+
@parser_options = parser_options
|
|
12
|
+
@content_types = Array(content_type)
|
|
13
|
+
@preserve_raw = preserve_raw
|
|
14
|
+
|
|
15
|
+
process_parser_options
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def on_complete(env)
|
|
19
|
+
process_response(env) if parse_response?(env)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def process_response(env)
|
|
25
|
+
env[:raw_body] = env[:body] if @preserve_raw
|
|
26
|
+
env[:body] = parse(env[:body])
|
|
27
|
+
rescue StandardError, SyntaxError => e
|
|
28
|
+
raise Faraday::ParsingError.new(e, env[:response])
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def parse(body)
|
|
32
|
+
return if body.strip.empty?
|
|
33
|
+
|
|
34
|
+
decoder, method_name = @decoder_options
|
|
35
|
+
|
|
36
|
+
decoder.public_send(method_name, body, @parser_options || {})
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def parse_response?(env)
|
|
40
|
+
process_response_type?(env) &&
|
|
41
|
+
env[:body].respond_to?(:to_str)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def process_response_type?(env)
|
|
45
|
+
type = response_type(env)
|
|
46
|
+
@content_types.empty? || @content_types.any? do |pattern|
|
|
47
|
+
pattern.is_a?(Regexp) ? type.match?(pattern) : type == pattern
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def response_type(env)
|
|
52
|
+
type = env[:response_headers][CONTENT_TYPE].to_s
|
|
53
|
+
type = type.split(';', 2).first if type.index(';')
|
|
54
|
+
type
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def process_parser_options
|
|
58
|
+
@decoder_options = @parser_options&.delete(:decoder)
|
|
59
|
+
|
|
60
|
+
@decoder_options =
|
|
61
|
+
if @decoder_options.is_a?(Array) && @decoder_options.size >= 2
|
|
62
|
+
@decoder_options.slice(0, 2)
|
|
63
|
+
elsif @decoder_options&.respond_to?(:load) # rubocop:disable Lint/RedundantSafeNavigation
|
|
64
|
+
# In some versions of Rails, `nil` responds to `load` - hence the safe navigation check above
|
|
65
|
+
[@decoder_options, :load]
|
|
66
|
+
else
|
|
67
|
+
[::JSON, :parse]
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
Faraday::Response.register_middleware(json: Faraday::Response::Json)
|