decidim-restfull-core 0.3.11
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 +7 -0
- data/app/commands/decidim/rest_full/core/create_api_client.rb +40 -0
- data/app/commands/decidim/rest_full/core/impersonate_resource_owner_from_credentials.rb +151 -0
- data/app/commands/decidim/rest_full/core/syncronize_unconfirmed_host.rb +45 -0
- data/app/controllers/concerns/decidim/api/rest_full/async_api_job_enqueuing.rb +69 -0
- data/app/controllers/concerns/decidim/api/rest_full/collection_pagination.rb +78 -0
- data/app/controllers/concerns/decidim/api/rest_full/collection_pagination_meta.rb +25 -0
- data/app/controllers/concerns/decidim/api/rest_full/conditional_get_rendering.rb +49 -0
- data/app/controllers/concerns/decidim/api/rest_full/extended_data_endpoints.rb +96 -0
- data/app/controllers/concerns/decidim/api/rest_full/job_response_linking.rb +31 -0
- data/app/controllers/decidim/api/rest_full/application_controller.rb +245 -0
- data/app/controllers/decidim/api/rest_full/attachments/attachments_controller.rb +81 -0
- data/app/controllers/decidim/api/rest_full/components/component_extended_data_controller.rb +31 -0
- data/app/controllers/decidim/api/rest_full/components/components_controller.rb +68 -0
- data/app/controllers/decidim/api/rest_full/core/resources_controller.rb +142 -0
- data/app/controllers/decidim/api/rest_full/core.rb +11 -0
- data/app/controllers/decidim/api/rest_full/jobs/jobs_controller.rb +109 -0
- data/app/controllers/decidim/api/rest_full/organizations/organization_extended_data_controller.rb +31 -0
- data/app/controllers/decidim/api/rest_full/organizations/organizations_controller.rb +234 -0
- data/app/controllers/decidim/api/rest_full/roles/roles_controller.rb +125 -0
- data/app/controllers/decidim/api/rest_full/spaces/space_extended_data_controller.rb +29 -0
- data/app/controllers/decidim/api/rest_full/spaces/spaces_controller.rb +225 -0
- data/app/controllers/decidim/api/rest_full/users/magic_links_controller.rb +81 -0
- data/app/controllers/decidim/api/rest_full/users/user_extended_data_controller.rb +92 -0
- data/app/controllers/decidim/api/rest_full/users/users_controller.rb +40 -0
- data/app/controllers/decidim/api/rest_full/webhooks/webhook_events_controller.rb +33 -0
- data/app/controllers/decidim/api/rest_full/webhooks/webhook_registrations_controller.rb +106 -0
- data/app/controllers/decidim/rest_full/pages_controller.rb +9 -0
- data/app/controllers/decidim/rest_full/system/api_clients_controller.rb +69 -0
- data/app/controllers/decidim/rest_full/system/permissions_controller.rb +30 -0
- data/app/controllers/decidim/rest_full/system/webhook_registrations_controller.rb +49 -0
- data/app/forms/decidim/rest_full/core/admin/config_form.rb +49 -0
- data/app/forms/decidim/rest_full/core/api_client_form.rb +20 -0
- data/app/forms/decidim/rest_full/core/api_permissions.rb +18 -0
- data/app/forms/decidim/rest_full/core/magic_link_redirect_url_form.rb +114 -0
- data/app/forms/decidim/rest_full/core/webhook_event_form.rb +35 -0
- data/app/forms/decidim/rest_full/core/webhook_registration_form.rb +49 -0
- data/app/jobs/decidim/rest_full/application_job.rb +10 -0
- data/app/jobs/decidim/rest_full/core/space_webhook_job.rb +60 -0
- data/app/jobs/decidim/rest_full/core/syncronize_unconfirmed_host_job.rb +18 -0
- data/app/jobs/decidim/rest_full/core/webhook_job.rb +13 -0
- data/app/jobs/decidim/rest_full/execute_api_job_job.rb +55 -0
- data/app/models/decidim/rest_full/api_job.rb +74 -0
- data/app/models/decidim/rest_full/core/ability.rb +195 -0
- data/app/models/decidim/rest_full/core/api_client.rb +56 -0
- data/app/models/decidim/rest_full/core/magic_token.rb +45 -0
- data/app/models/decidim/rest_full/core/permission.rb +15 -0
- data/app/models/decidim/rest_full/core/resource_extended_data.rb +16 -0
- data/app/models/decidim/rest_full/core/webhook_registration.rb +61 -0
- data/app/overrides/system_host_input.rb +40 -0
- data/app/serializers/decidim/api/rest_full/core/application_serializer.rb +19 -0
- data/app/serializers/decidim/api/rest_full/core/assembly_serializer.rb +13 -0
- data/app/serializers/decidim/api/rest_full/core/attachment_serializer.rb +76 -0
- data/app/serializers/decidim/api/rest_full/core/awesome_iframe_component_serializer.rb +12 -0
- data/app/serializers/decidim/api/rest_full/core/awesome_map_component_serializer.rb +12 -0
- data/app/serializers/decidim/api/rest_full/core/component_serializer.rb +97 -0
- data/app/serializers/decidim/api/rest_full/core/helpers/resource_links_helper.rb +48 -0
- data/app/serializers/decidim/api/rest_full/core/magic_link_redirect_serializer.rb +43 -0
- data/app/serializers/decidim/api/rest_full/core/magic_link_serializer.rb +44 -0
- data/app/serializers/decidim/api/rest_full/core/organization_serializer.rb +60 -0
- data/app/serializers/decidim/api/rest_full/core/organization_webhook_serializer.rb +21 -0
- data/app/serializers/decidim/api/rest_full/core/page_component_serializer.rb +20 -0
- data/app/serializers/decidim/api/rest_full/core/page_serializer.rb +12 -0
- data/app/serializers/decidim/api/rest_full/core/participatory_process_serializer.rb +13 -0
- data/app/serializers/decidim/api/rest_full/core/resource_serializer.rb +84 -0
- data/app/serializers/decidim/api/rest_full/core/role_serializer.rb +21 -0
- data/app/serializers/decidim/api/rest_full/core/serializer_lookup.rb +55 -0
- data/app/serializers/decidim/api/rest_full/core/space_serializer.rb +117 -0
- data/app/serializers/decidim/api/rest_full/core/space_webhook_serializer.rb +64 -0
- data/app/serializers/decidim/api/rest_full/core/user_serializer.rb +43 -0
- data/app/serializers/decidim/api/rest_full/core/user_webhook_serializer.rb +21 -0
- data/app/serializers/decidim/api/rest_full/core/webhook_registration_serializer.rb +25 -0
- data/app/serializers/decidim/api/rest_full/core/webhook_serializer.rb +68 -0
- data/app/serializers/decidim/api/rest_full/core.rb +10 -0
- data/app/services/decidim/rest_full/core/api_system_operations.rb +505 -0
- data/app/services/decidim/rest_full/core/fire_webhook.rb +114 -0
- data/app/services/decidim/rest_full/core/participatory_process_step_activated_webhook_handler.rb +39 -0
- data/app/services/decidim/rest_full/participatory_space_visibility.rb +64 -0
- data/app/views/decidim/rest_full/core/admin/_organization_settings_tab.html.erb +35 -0
- data/app/views/decidim/rest_full/pages/show.html.erb +60 -0
- data/app/views/decidim/rest_full/system/api_clients/_edit_info_tab.erb +261 -0
- data/app/views/decidim/rest_full/system/api_clients/_edit_webhook_tab.erb +74 -0
- data/app/views/decidim/rest_full/system/api_clients/_form.html.erb +23 -0
- data/app/views/decidim/rest_full/system/api_clients/_permissions_scope.html.erb +22 -0
- data/app/views/decidim/rest_full/system/api_clients/edit.html.erb +53 -0
- data/app/views/decidim/rest_full/system/api_clients/index.html.erb +37 -0
- data/app/views/decidim/rest_full/system/api_clients/new.html.erb +13 -0
- data/app/views/decidim/rest_full/system/api_clients/show.html.erb +10 -0
- data/config/i18n-tasks.yml +381 -0
- data/config/locales/decidim_rest_full.en.yml +184 -0
- data/config/routes.rb +116 -0
- data/db/migrate/20241125061513_create_api_client_permissions.rb +12 -0
- data/db/migrate/20250112155305_create_proposal_application_id.rb +11 -0
- data/db/migrate/20250131155931_add_users_magic_token.rb +14 -0
- data/db/migrate/20250609083335_create_webhooks_table.rb +16 -0
- data/db/migrate/20250609091039_add_is_event_to_api_client_permissions.rb +7 -0
- data/db/migrate/20250624080106_create_organization_extended_data.rb +11 -0
- data/db/migrate/20260321120000_add_redirect_url_to_decidim_rest_full_user_magic_tokens.rb +7 -0
- data/db/migrate/20260511120000_create_decidim_rest_full_api_jobs.rb +23 -0
- data/db/migrate/20260515120000_add_poll_and_oauth_context_to_rest_full_api_jobs.rb +38 -0
- data/db/migrate/20260516153000_remove_poll_secret_from_decidim_rest_full_api_jobs.rb +7 -0
- data/db/migrate/20260516160000_add_org_status_index_to_rest_full_api_jobs.rb +9 -0
- data/db/migrate/20260805070000_create_resource_extended_data.rb +44 -0
- data/lib/decidim/rest_full/api_execution_context.rb +58 -0
- data/lib/decidim/rest_full/api_job_command_runner.rb +48 -0
- data/lib/decidim/rest_full/api_job_payload.rb +19 -0
- data/lib/decidim/rest_full/cli/base.rb +84 -0
- data/lib/decidim/rest_full/cli/create.rb +122 -0
- data/lib/decidim/rest_full/cli/delete.rb +48 -0
- data/lib/decidim/rest_full/cli/get.rb +53 -0
- data/lib/decidim/rest_full/cli/grant.rb +58 -0
- data/lib/decidim/rest_full/cli/revoke.rb +53 -0
- data/lib/decidim/rest_full/cli.rb +70 -0
- data/lib/decidim/rest_full/core/apartment_tenant_switch.rb +23 -0
- data/lib/decidim/rest_full/core/api_exception.rb +179 -0
- data/lib/decidim/rest_full/core/attachments_operations.rb +232 -0
- data/lib/decidim/rest_full/core/configuration.rb +116 -0
- data/lib/decidim/rest_full/core/definition_registry.rb +509 -0
- data/lib/decidim/rest_full/core/doorkeeper_config.rb +130 -0
- data/lib/decidim/rest_full/core/engine.rb +167 -0
- data/lib/decidim/rest_full/core/extended_data_at_path.rb +22 -0
- data/lib/decidim/rest_full/core/gem_spec_paths.rb +56 -0
- data/lib/decidim/rest_full/core/has_extended_data.rb +70 -0
- data/lib/decidim/rest_full/core/http_cache/collection_fingerprint.rb +97 -0
- data/lib/decidim/rest_full/core/http_cache/fingerprint_contributor_registry.rb +53 -0
- data/lib/decidim/rest_full/core/http_cache/request_oauth_context.rb +34 -0
- data/lib/decidim/rest_full/core/http_cache/resource_show_fingerprint.rb +74 -0
- data/lib/decidim/rest_full/core/menu.rb +18 -0
- data/lib/decidim/rest_full/core/module_availability.rb +181 -0
- data/lib/decidim/rest_full/core/open_api_definition_paths.rb +59 -0
- data/lib/decidim/rest_full/core/overrides/application_mailer_override.rb +50 -0
- data/lib/decidim/rest_full/core/overrides/organization_client_ids_override.rb +17 -0
- data/lib/decidim/rest_full/core/overrides/update_organization_command_override.rb +27 -0
- data/lib/decidim/rest_full/core/overrides/update_organization_form_override.rb +46 -0
- data/lib/decidim/rest_full/core/overrides/user_extended_data_ransack.rb +15 -0
- data/lib/decidim/rest_full/core/overrides/user_magic_token_override.rb +27 -0
- data/lib/decidim/rest_full/core/permission_registry.rb +65 -0
- data/lib/decidim/rest_full/core/ransackers.rb +99 -0
- data/lib/decidim/rest_full/core/rest_enhancement_builder.rb +115 -0
- data/lib/decidim/rest_full/core/rest_enhancement_registration.rb +21 -0
- data/lib/decidim/rest_full/core/roles/role_id_codec.rb +50 -0
- data/lib/decidim/rest_full/core/roles/roles_aggregator.rb +203 -0
- data/lib/decidim/rest_full/core/roles/roles_writer.rb +343 -0
- data/lib/decidim/rest_full/core/route_registry.rb +123 -0
- data/lib/decidim/rest_full/core/serializer_additions_registry.rb +100 -0
- data/lib/decidim/rest_full/core/settings_tab.rb +22 -0
- data/lib/decidim/rest_full/core/swagger_spec_paths.rb +61 -0
- data/lib/decidim/rest_full/core/tokens_availability.rb +23 -0
- data/lib/decidim/rest_full/core/webhook_dispatcher.rb +55 -0
- data/lib/decidim/rest_full/core/webhook_event_catalog.rb +136 -0
- data/lib/decidim/rest_full/extension.rb +276 -0
- data/lib/decidim/rest_full/rest_full.rb +12 -0
- data/lib/decidim/rest_full/routes.rb +58 -0
- data/lib/decidim/rest_full/routing.rb +53 -0
- data/lib/decidim/rest_full/sync_runner.rb +14 -0
- data/lib/decidim/rest_full/test/apartment.rb +52 -0
- data/lib/decidim/rest_full/test/definitions/README.md +96 -0
- data/lib/decidim/rest_full/test/definitions/attachment.rb +64 -0
- data/lib/decidim/rest_full/test/definitions/collection_meta.rb +20 -0
- data/lib/decidim/rest_full/test/definitions/component.rb +99 -0
- data/lib/decidim/rest_full/test/definitions/component_type.rb +8 -0
- data/lib/decidim/rest_full/test/definitions/core.rb +16 -0
- data/lib/decidim/rest_full/test/definitions/creation_date.rb +11 -0
- data/lib/decidim/rest_full/test/definitions/edition_date.rb +11 -0
- data/lib/decidim/rest_full/test/definitions/error.rb +40 -0
- data/lib/decidim/rest_full/test/definitions/filter_param.rb +105 -0
- data/lib/decidim/rest_full/test/definitions/grant_param.rb +82 -0
- data/lib/decidim/rest_full/test/definitions/health.rb +12 -0
- data/lib/decidim/rest_full/test/definitions/introspect_data.rb +67 -0
- data/lib/decidim/rest_full/test/definitions/job.rb +130 -0
- data/lib/decidim/rest_full/test/definitions/locales_param.rb +19 -0
- data/lib/decidim/rest_full/test/definitions/magic_link.rb +37 -0
- data/lib/decidim/rest_full/test/definitions/magic_link_redirect.rb +32 -0
- data/lib/decidim/rest_full/test/definitions/manifests.rb +28 -0
- data/lib/decidim/rest_full/test/definitions/oauth_token_response.rb +18 -0
- data/lib/decidim/rest_full/test/definitions/organization.rb +75 -0
- data/lib/decidim/rest_full/test/definitions/organization_extended_data.rb +19 -0
- data/lib/decidim/rest_full/test/definitions/publication_date.rb +11 -0
- data/lib/decidim/rest_full/test/definitions/relationship_identifier.rb +29 -0
- data/lib/decidim/rest_full/test/definitions/resource_extended_data.rb +20 -0
- data/lib/decidim/rest_full/test/definitions/role.rb +61 -0
- data/lib/decidim/rest_full/test/definitions/shared.rb +22 -0
- data/lib/decidim/rest_full/test/definitions/space.rb +112 -0
- data/lib/decidim/rest_full/test/definitions/tags/attachments_tag.rb +26 -0
- data/lib/decidim/rest_full/test/definitions/tags/component_tag.rb +26 -0
- data/lib/decidim/rest_full/test/definitions/tags/jobs_tag.rb +20 -0
- data/lib/decidim/rest_full/test/definitions/tags/oauth_tag.rb +28 -0
- data/lib/decidim/rest_full/test/definitions/tags/organization_extended_data_tag.rb +22 -0
- data/lib/decidim/rest_full/test/definitions/tags/organizations_tag.rb +24 -0
- data/lib/decidim/rest_full/test/definitions/tags/roles_tag.rb +14 -0
- data/lib/decidim/rest_full/test/definitions/tags/space_tag.rb +22 -0
- data/lib/decidim/rest_full/test/definitions/tags/users_tag.rb +14 -0
- data/lib/decidim/rest_full/test/definitions/tags/webhooks_tag.rb +31 -0
- data/lib/decidim/rest_full/test/definitions/tags.rb +12 -0
- data/lib/decidim/rest_full/test/definitions/time_zone.rb +10 -0
- data/lib/decidim/rest_full/test/definitions/translated_prop.rb +11 -0
- data/lib/decidim/rest_full/test/definitions/user.rb +93 -0
- data/lib/decidim/rest_full/test/definitions/user_extended_data.rb +14 -0
- data/lib/decidim/rest_full/test/definitions/webhook.rb +95 -0
- data/lib/decidim/rest_full/test/definitions.rb +15 -0
- data/lib/decidim/rest_full/test/factories/api_client.rb +16 -0
- data/lib/decidim/rest_full/test/factories/magic_token.rb +13 -0
- data/lib/decidim/rest_full/test/factories/webhook_registration.rb +10 -0
- data/lib/decidim/rest_full/test/factories.rb +5 -0
- data/lib/decidim/rest_full/test/global_context.rb +11 -0
- data/lib/decidim/rest_full/test/on_api_endpoint_methods.rb +190 -0
- data/lib/decidim/rest_full/test/open_api_tag_registry.rb +25 -0
- data/lib/decidim/rest_full/test/openapi_specs.rb +107 -0
- data/lib/decidim/rest_full/test/shared_examples/has_extended_data.rb +41 -0
- data/lib/decidim/rest_full/test/shared_examples.rb +345 -0
- data/lib/decidim/rest_full/version.rb +27 -0
- data/lib/decidim/rest_full.rb +99 -0
- data/lib/decidim-restfull-core.rb +3 -0
- data/lib/tasks/decidim/rest_full/fire_webhook.rake +52 -0
- data/lib/tasks/decidim/rest_full/integrator_sandbox.rake +37 -0
- data/lib/tasks/decidim/rest_full/rest_full_upgrade.rake +64 -0
- data/lib/tasks/decidim/rest_full/rest_full_webpacker.rake +58 -0
- data/spec/commands/decidim/rest_full/core/impersonate_resource_owner_from_credentials_spec.rb +159 -0
- data/spec/commands/decidim/rest_full/core/syncronize_unconfirmed_host_spec.rb +117 -0
- data/spec/controllers/concerns/decidim/api/rest_full/collection_pagination_spec.rb +128 -0
- data/spec/decidim/rest_full/core/configuration_engine_disabled_routes_spec.rb +24 -0
- data/spec/forms/decidim/rest_full/core/magic_link_redirect_url_form_spec.rb +69 -0
- data/spec/forms/decidim/rest_full/core/webhook_registration_form_spec.rb +42 -0
- data/spec/jobs/decidim/rest_full/core/space_webhook_job_spec.rb +62 -0
- data/spec/jobs/decidim/rest_full/core/syncronize_unconfirmed_host_job_spec.rb +34 -0
- data/spec/jobs/decidim/rest_full/core/webhook_job_spec.rb +29 -0
- data/spec/jobs/decidim/rest_full/execute_api_job_job_spec.rb +45 -0
- data/spec/lib/decidim/rest_full/core/apartment_tenant_switch_spec.rb +26 -0
- data/spec/lib/decidim/rest_full/core/api_exception/bad_request_spec.rb +62 -0
- data/spec/lib/decidim/rest_full/core/definition_registry_add_resource_relationships_spec.rb +19 -0
- data/spec/lib/decidim/rest_full/core/gem_spec_paths_spec.rb +27 -0
- data/spec/lib/decidim/rest_full/core/http_cache/collection_fingerprint_spec.rb +59 -0
- data/spec/lib/decidim/rest_full/core/http_cache/fingerprint_contributor_registry_spec.rb +60 -0
- data/spec/lib/decidim/rest_full/core/http_cache/resource_show_fingerprint_spec.rb +33 -0
- data/spec/lib/decidim/rest_full/core/module_availability_spec.rb +130 -0
- data/spec/lib/decidim/rest_full/core/open_api_definition_paths_spec.rb +54 -0
- data/spec/lib/decidim/rest_full/core/optional_feature_gems_spec.rb +172 -0
- data/spec/lib/decidim/rest_full/core/roles/role_id_codec_spec.rb +62 -0
- data/spec/lib/decidim/rest_full/core/roles/roles_aggregator_spec.rb +53 -0
- data/spec/lib/decidim/rest_full/core/roles/roles_writer_spec.rb +38 -0
- data/spec/lib/decidim/rest_full/core/route_registry_spec.rb +90 -0
- data/spec/lib/decidim/rest_full/core/serializer_additions_registry_spec.rb +100 -0
- data/spec/lib/decidim/rest_full/core/settings_tab_spec.rb +15 -0
- data/spec/lib/decidim/rest_full/core/swagger_spec_paths_spec.rb +50 -0
- data/spec/lib/decidim/rest_full/core/webhook_dispatcher_proposal_published_spec.rb +63 -0
- data/spec/lib/decidim/rest_full/core/webhook_event_catalog_spec.rb +34 -0
- data/spec/lib/decidim/rest_full/routing_spec.rb +62 -0
- data/spec/lib/decidim/rest_full/test/apartment_spec.rb +17 -0
- data/spec/models/decidim/rest_full/api_job_spec.rb +51 -0
- data/spec/models/decidim/rest_full/application_mailer_override_spec.rb +60 -0
- data/spec/models/decidim/rest_full/core/has_extended_data_spec.rb +16 -0
- data/spec/models/decidim/rest_full/core/magic_token_spec.rb +68 -0
- data/spec/models/decidim/rest_full/core/webhook_registration_spec.rb +161 -0
- data/spec/models/decidim/rest_full/user_magic_token_spec.rb +51 -0
- data/spec/requests/decidim/api/rest_full/application_controller_introspect_spec.rb +85 -0
- data/spec/requests/decidim/api/rest_full/application_controller_ropc_spec.rb +299 -0
- data/spec/requests/decidim/api/rest_full/application_controller_token_spec.rb +57 -0
- data/spec/requests/decidim/api/rest_full/attachments/attachments_controller_direct_upload_spec.rb +39 -0
- data/spec/requests/decidim/api/rest_full/attachments/attachments_controller_index_spec.rb +41 -0
- data/spec/requests/decidim/api/rest_full/attachments/attachments_controller_show_spec.rb +34 -0
- data/spec/requests/decidim/api/rest_full/components/component_extended_data_controller_spec.rb +78 -0
- data/spec/requests/decidim/api/rest_full/components/components_controller_search_spec.rb +197 -0
- data/spec/requests/decidim/api/rest_full/components/components_controller_search_sql_spec.rb +48 -0
- data/spec/requests/decidim/api/rest_full/jobs/api_jobs_async_and_conditional_get_spec.rb +209 -0
- data/spec/requests/decidim/api/rest_full/jobs/jobs_controller_destroy_spec.rb +58 -0
- data/spec/requests/decidim/api/rest_full/jobs/jobs_controller_index_spec.rb +126 -0
- data/spec/requests/decidim/api/rest_full/jobs/jobs_controller_show_spec.rb +89 -0
- data/spec/requests/decidim/api/rest_full/module_availability_gate_spec.rb +77 -0
- data/spec/requests/decidim/api/rest_full/organizations/organization_extended_data_controller_index_spec.rb +88 -0
- data/spec/requests/decidim/api/rest_full/organizations/organization_extended_data_controller_update_spec.rb +194 -0
- data/spec/requests/decidim/api/rest_full/organizations/organizations_controller_index_spec.rb +57 -0
- data/spec/requests/decidim/api/rest_full/organizations/organizations_controller_show_spec.rb +66 -0
- data/spec/requests/decidim/api/rest_full/organizations/organizations_controller_update_spec.rb +120 -0
- data/spec/requests/decidim/api/rest_full/roles/roles_controller_create_spec.rb +230 -0
- data/spec/requests/decidim/api/rest_full/roles/roles_controller_destroy_spec.rb +52 -0
- data/spec/requests/decidim/api/rest_full/roles/roles_controller_index_spec.rb +127 -0
- data/spec/requests/decidim/api/rest_full/roles/roles_controller_show_spec.rb +215 -0
- data/spec/requests/decidim/api/rest_full/routes_boot_spec.rb +58 -0
- data/spec/requests/decidim/api/rest_full/scenarios/upsert_user_by_phone_and_set_locale_spec.rb +69 -0
- data/spec/requests/decidim/api/rest_full/spaces/space_extended_data_controller_spec.rb +78 -0
- data/spec/requests/decidim/api/rest_full/spaces/spaces_controller_index_spec.rb +167 -0
- data/spec/requests/decidim/api/rest_full/spaces/spaces_controller_search_spec.rb +280 -0
- data/spec/requests/decidim/api/rest_full/spaces/spaces_controller_show_spec.rb +98 -0
- data/spec/requests/decidim/api/rest_full/users/magic_links_controller_create_spec.rb +124 -0
- data/spec/requests/decidim/api/rest_full/users/magic_links_controller_show_spec.rb +84 -0
- data/spec/requests/decidim/api/rest_full/users/user_extended_data_controller_index_spec.rb +74 -0
- data/spec/requests/decidim/api/rest_full/users/user_extended_data_controller_update_spec.rb +192 -0
- data/spec/requests/decidim/api/rest_full/users/users_controller_index_spec.rb +182 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_events_controller_show_spec.rb +52 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_registrations_controller_create_spec.rb +95 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_registrations_controller_destroy_spec.rb +34 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_registrations_controller_index_spec.rb +43 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_registrations_controller_show_spec.rb +51 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_registrations_controller_update_spec.rb +57 -0
- data/spec/requests/decidim/rest_full/system/api_clients_controller_spec.rb +69 -0
- data/spec/serializers/decidim/api/rest_full/core/organization_webhook_serializer_spec.rb +18 -0
- data/spec/serializers/decidim/api/rest_full/core/space_webhook_serializer_spec.rb +44 -0
- data/spec/serializers/decidim/api/rest_full/core/user_webhook_serializer_spec.rb +19 -0
- data/spec/services/decidim/rest_full/core/api_system_operations_resource_extended_data_update_spec.rb +35 -0
- data/spec/services/decidim/rest_full/core/fire_webhook_spec.rb +59 -0
- data/spec/services/decidim/rest_full/core/participatory_process_step_activated_webhook_handler_spec.rb +57 -0
- metadata +482 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module RestFull
|
|
5
|
+
module Definitions
|
|
6
|
+
module Tags
|
|
7
|
+
COMPONENT = {
|
|
8
|
+
name: "Components",
|
|
9
|
+
description: <<~TXT.strip,
|
|
10
|
+
Participatory-space **components** (`Decidim::Component`): modular features (proposals, blogs, meetings, surveys, …) attached to a space.
|
|
11
|
+
|
|
12
|
+
Use **`GET /components/search`** to discover components by manifest, id, participatory space, or name—within the organization resolved from the request host.
|
|
13
|
+
|
|
14
|
+
Manifest-specific sub-resources (e.g. `proposal_components`, `blog_components`) expose typed settings for that feature.
|
|
15
|
+
|
|
16
|
+
**Extended data**: `GET/PUT /components/{id}/extended_data` (+ `/sync`); filter with `filter[extended_data_cont]` on search. See [Extended data](#{Decidim::RestFull.config.docs_url}/integrator/extended-data).
|
|
17
|
+
TXT
|
|
18
|
+
externalDocs: {
|
|
19
|
+
description: "Extended data integrator guide",
|
|
20
|
+
url: "#{Decidim::RestFull.config.docs_url}/integrator/extended-data"
|
|
21
|
+
}
|
|
22
|
+
}.freeze
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module RestFull
|
|
5
|
+
module Definitions
|
|
6
|
+
module Tags
|
|
7
|
+
JOBS = {
|
|
8
|
+
name: "Jobs",
|
|
9
|
+
description: <<~TXT.strip
|
|
10
|
+
Durable records for **asynchronous API writes** (`decidim_rest_full_api_jobs`).
|
|
11
|
+
|
|
12
|
+
When a mutating route returns **HTTP 202**, the body includes `job_id` (UUID). Poll **`GET /jobs/{id}`** without a Bearer token—the UUID is the capability—or list jobs with the **same OAuth application and resource owner** via **`GET /jobs`** (Bearer required).
|
|
13
|
+
|
|
14
|
+
Filter the index with `filter[command_key]` (job name, e.g. `draft_proposals#create`) and `filter[status]` (`pending`, `processing`, `completed`, `failed`). Delete a job with **`DELETE /jobs/{id}`** (same OAuth context as the list).
|
|
15
|
+
TXT
|
|
16
|
+
}.freeze
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module RestFull
|
|
5
|
+
module Definitions
|
|
6
|
+
module Tags
|
|
7
|
+
OAUTH = {
|
|
8
|
+
name: "OAuth",
|
|
9
|
+
description: [
|
|
10
|
+
<<~TXT.squish,
|
|
11
|
+
Obtain access tokens for this API:
|
|
12
|
+
**client_credentials** (machine-to-machine)
|
|
13
|
+
or **password** with `auth_type` **login** or **impersonation**
|
|
14
|
+
(Resource Owner Password Credentials flow).
|
|
15
|
+
TXT
|
|
16
|
+
"* **Machine-to-machine**: client credentials grant",
|
|
17
|
+
"* **User**: ROPC with `auth_type` **login** or **impersonation**"
|
|
18
|
+
].join("\n"),
|
|
19
|
+
|
|
20
|
+
externalDocs: {
|
|
21
|
+
description: "How to authenticate",
|
|
22
|
+
url: "#{Decidim::RestFull.config.docs_url}/category/authentication"
|
|
23
|
+
}
|
|
24
|
+
}.freeze
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module RestFull
|
|
5
|
+
module Definitions
|
|
6
|
+
module Tags
|
|
7
|
+
ORGANIZATION_EXTENDED_DATA = {
|
|
8
|
+
name: "Organizations Extended Data",
|
|
9
|
+
description: <<~README,
|
|
10
|
+
Read organization `extended_data` and merge updates under a dot-path via sync (`PUT /organizations/{id}/extended_data/sync`). Supports recursive merge, dot paths (use `.` for the root), path creation, and clearing keys by setting them to null or empty—see the operation description for full examples. Requires `system` scopes as documented on each operation.
|
|
11
|
+
|
|
12
|
+
Overview: [Extended data](#{Decidim::RestFull.config.docs_url}/integrator/extended-data).
|
|
13
|
+
README
|
|
14
|
+
externalDocs: {
|
|
15
|
+
description: "Extended data integrator guide",
|
|
16
|
+
url: "#{Decidim::RestFull.config.docs_url}/integrator/extended-data"
|
|
17
|
+
}
|
|
18
|
+
}.freeze
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module RestFull
|
|
5
|
+
module Definitions
|
|
6
|
+
module Tags
|
|
7
|
+
ORGANIZATIONS = {
|
|
8
|
+
name: "Organizations",
|
|
9
|
+
description: <<~README
|
|
10
|
+
**Organization** settings (Decidim tenant boundary: primary `host`, secondary hosts, locale defaults, and related configuration).
|
|
11
|
+
|
|
12
|
+
One deployment hosts many **Organizations**. Each organization has:
|
|
13
|
+
|
|
14
|
+
- `host`: primary domain name
|
|
15
|
+
- `secondary_hosts`: additional hostnames that redirect (301) to `host`
|
|
16
|
+
|
|
17
|
+
The active **Organization** is resolved from the request Host header, so different `host` values resolve to that host's organization data.
|
|
18
|
+
README
|
|
19
|
+
|
|
20
|
+
}.freeze
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module RestFull
|
|
5
|
+
module Definitions
|
|
6
|
+
module Tags
|
|
7
|
+
ROLES = {
|
|
8
|
+
name: "Roles",
|
|
9
|
+
description: "Manage user roles within an organization and its participatory spaces."
|
|
10
|
+
}.freeze
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module RestFull
|
|
5
|
+
module Definitions
|
|
6
|
+
module Tags
|
|
7
|
+
SPACE = {
|
|
8
|
+
name: "Spaces",
|
|
9
|
+
description: <<~TXT.strip,
|
|
10
|
+
Search, list, and fetch participatory spaces (e.g. Assemblies, Participatory Processes).
|
|
11
|
+
|
|
12
|
+
**Extended data**: `GET/PUT /spaces/{manifest}/{id}/extended_data` (+ `/sync`); filter with `filter[extended_data_cont]` on search and index. See [Extended data](#{Decidim::RestFull.config.docs_url}/integrator/extended-data).
|
|
13
|
+
TXT
|
|
14
|
+
externalDocs: {
|
|
15
|
+
description: "Extended data integrator guide",
|
|
16
|
+
url: "#{Decidim::RestFull.config.docs_url}/integrator/extended-data"
|
|
17
|
+
}
|
|
18
|
+
}.freeze
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module RestFull
|
|
5
|
+
module Definitions
|
|
6
|
+
module Tags
|
|
7
|
+
USER = {
|
|
8
|
+
name: "Users",
|
|
9
|
+
description: "List users; read and update your extended data; create and consume magic links for sign-in (scopes and permissions per operation)."
|
|
10
|
+
}.freeze
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module RestFull
|
|
5
|
+
module Definitions
|
|
6
|
+
module Tags
|
|
7
|
+
WEBHOOKS = {
|
|
8
|
+
name: "Webhooks",
|
|
9
|
+
description: <<~TXT.strip
|
|
10
|
+
**Outbound HTTP callbacks** plus REST management of registrations.
|
|
11
|
+
|
|
12
|
+
### Manage registrations
|
|
13
|
+
- `GET|POST /webhook_registrations` — list / create (signing secret returned **only on create**)
|
|
14
|
+
- `GET|PUT|DELETE /webhook_registrations/{id}` — show / update / destroy (scoped to the API client)
|
|
15
|
+
- `GET /webhook_events/{event_type}` — canned example payload for typed clients
|
|
16
|
+
|
|
17
|
+
Subscribe via this API or in **System admin → API clients → Webhooks**.
|
|
18
|
+
|
|
19
|
+
Verify deliveries with `X-Webhook-Signature` (`v1=` + HMAC-SHA256 hex of `timestamp + "." + raw body`) and `X-Webhook-Timestamp`.
|
|
20
|
+
|
|
21
|
+
Payload envelope: schema **WebhookDeliveryEnvelope** (discriminated on `type`).
|
|
22
|
+
|
|
23
|
+
### Event catalog
|
|
24
|
+
|
|
25
|
+
#{Decidim::RestFull::Core::WebhookEventCatalog.markdown_table}
|
|
26
|
+
TXT
|
|
27
|
+
}.freeze
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "tags/oauth_tag"
|
|
4
|
+
require_relative "tags/component_tag"
|
|
5
|
+
require_relative "tags/space_tag"
|
|
6
|
+
require_relative "tags/users_tag"
|
|
7
|
+
require_relative "tags/organizations_tag"
|
|
8
|
+
require_relative "tags/organization_extended_data_tag"
|
|
9
|
+
require_relative "tags/roles_tag"
|
|
10
|
+
require_relative "tags/jobs_tag"
|
|
11
|
+
require_relative "tags/webhooks_tag"
|
|
12
|
+
require_relative "tags/attachments_tag"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:time_zone) do
|
|
4
|
+
{
|
|
5
|
+
type: :string,
|
|
6
|
+
title: "Time Zone",
|
|
7
|
+
description: "Time Zone identifier",
|
|
8
|
+
enum: (["UTC"] + ActiveSupport::TimeZone.all.map { |t| t.tzinfo.name }).sort
|
|
9
|
+
}.freeze
|
|
10
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:translated_prop) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "Translated data",
|
|
7
|
+
description: "Hash with translated data, key=locale value=translation",
|
|
8
|
+
properties: Decidim.available_locales.to_h { |locale| [locale.to_s, { type: :string, description: "Translation in #{locale}" }] },
|
|
9
|
+
additionalProperties: false
|
|
10
|
+
}.freeze
|
|
11
|
+
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_resource(:user) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "User",
|
|
7
|
+
properties: {
|
|
8
|
+
id: { type: :string },
|
|
9
|
+
type: { type: :string, enum: ["user"] },
|
|
10
|
+
meta: {
|
|
11
|
+
title: "User Metadata",
|
|
12
|
+
type: :object,
|
|
13
|
+
properties: {
|
|
14
|
+
blocked: { type: :boolean, description: "If the user is blocked, and need to be unblocked to signin" },
|
|
15
|
+
locked: { type: :boolean, description: "If the user is locked, and need to click on the mail link to unlock" }
|
|
16
|
+
|
|
17
|
+
},
|
|
18
|
+
required: [:blocked, :locked],
|
|
19
|
+
additionalProperties: false
|
|
20
|
+
},
|
|
21
|
+
relationships: {
|
|
22
|
+
type: :object,
|
|
23
|
+
title: "User Relationships",
|
|
24
|
+
properties: {
|
|
25
|
+
roles: {
|
|
26
|
+
type: :object,
|
|
27
|
+
title: "User Roles",
|
|
28
|
+
properties: {
|
|
29
|
+
data: {
|
|
30
|
+
type: :array,
|
|
31
|
+
items: {
|
|
32
|
+
type: :object,
|
|
33
|
+
title: "User Role",
|
|
34
|
+
properties: {
|
|
35
|
+
id: { type: :string },
|
|
36
|
+
type: { type: :string, enum: ["user_role"] }
|
|
37
|
+
},
|
|
38
|
+
required: [:id, :type],
|
|
39
|
+
additionalProperties: false
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
required: [:data],
|
|
44
|
+
additionalProperties: false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
attributes: {
|
|
49
|
+
type: :object,
|
|
50
|
+
title: "User Attributes",
|
|
51
|
+
properties: {
|
|
52
|
+
name: {
|
|
53
|
+
description: "User name, use to display the Profile identity. Public",
|
|
54
|
+
type: :string
|
|
55
|
+
},
|
|
56
|
+
nickname: {
|
|
57
|
+
description: "User nickname, unique identifier for the user. Public",
|
|
58
|
+
type: :string
|
|
59
|
+
},
|
|
60
|
+
personal_url: {
|
|
61
|
+
description: "Personal website URL or social link. Public",
|
|
62
|
+
type: :string
|
|
63
|
+
},
|
|
64
|
+
about: {
|
|
65
|
+
description: "Short bio of the user. Public",
|
|
66
|
+
type: :string
|
|
67
|
+
},
|
|
68
|
+
locale: {
|
|
69
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:locale),
|
|
70
|
+
:description => "User locale. Fallback to default locale of the organization. Private"
|
|
71
|
+
},
|
|
72
|
+
email: {
|
|
73
|
+
description: "Email of the user. Private",
|
|
74
|
+
type: :string
|
|
75
|
+
},
|
|
76
|
+
extended_data: {
|
|
77
|
+
type: :object,
|
|
78
|
+
title: "User Extended Data",
|
|
79
|
+
description: "Additional data. Private",
|
|
80
|
+
properties: {},
|
|
81
|
+
additionalProperties: true
|
|
82
|
+
},
|
|
83
|
+
created_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:creation_date) },
|
|
84
|
+
updated_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:edition_date) }
|
|
85
|
+
},
|
|
86
|
+
additionalProperties: false,
|
|
87
|
+
required: [:created_at, :updated_at, :name, :nickname, :locale, :extended_data]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
required: [:id, :type, :attributes],
|
|
91
|
+
additionalProperties: false
|
|
92
|
+
}.freeze
|
|
93
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:user_extended_data) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "User extended data",
|
|
7
|
+
properties: {},
|
|
8
|
+
additionalProperties: true,
|
|
9
|
+
description: <<~README
|
|
10
|
+
Client metadata hash on the current user. Kept out of the Decidim admin UI.
|
|
11
|
+
See [Extended data](#{Decidim::RestFull.config.docs_url}/integrator/extended-data) (user path: `/me/extended_data`).
|
|
12
|
+
README
|
|
13
|
+
}.freeze
|
|
14
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Placeholder envelope; replaced by finalize_webhook_delivery_schemas! after feature schemas load.
|
|
4
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:webhook_delivery_envelope) do
|
|
5
|
+
{
|
|
6
|
+
title: "Webhook delivery envelope",
|
|
7
|
+
type: :object,
|
|
8
|
+
description: "JSON body POSTed to integrator URLs when a subscribed event fires.",
|
|
9
|
+
properties: {
|
|
10
|
+
type: {
|
|
11
|
+
type: :string,
|
|
12
|
+
description: "Event name (matches permission / subscription key, e.g. `proposal_creation.succeeded`)"
|
|
13
|
+
},
|
|
14
|
+
data: {
|
|
15
|
+
type: :object,
|
|
16
|
+
description: "JSON:API-shaped resource payload for the event"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
required: [:type, :data],
|
|
20
|
+
additionalProperties: false
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:webhook_registration_attributes) do
|
|
25
|
+
{
|
|
26
|
+
title: "Webhook Registration Attributes",
|
|
27
|
+
type: :object,
|
|
28
|
+
properties: {
|
|
29
|
+
url: { type: :string, format: :uri, description: "HTTP or HTTPS callback URL" },
|
|
30
|
+
subscriptions: {
|
|
31
|
+
type: :array,
|
|
32
|
+
items: { type: :string },
|
|
33
|
+
description: "Event keys this registration receives"
|
|
34
|
+
},
|
|
35
|
+
signing_secret: {
|
|
36
|
+
type: :string,
|
|
37
|
+
description: "HMAC signing secret (returned only on create)"
|
|
38
|
+
},
|
|
39
|
+
created_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:creation_date) },
|
|
40
|
+
updated_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:edition_date) }
|
|
41
|
+
},
|
|
42
|
+
required: [:url, :subscriptions, :created_at, :updated_at],
|
|
43
|
+
additionalProperties: false
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:webhook_registration_create_attributes) do
|
|
48
|
+
{
|
|
49
|
+
title: "Webhook Registration Create Attributes",
|
|
50
|
+
type: :object,
|
|
51
|
+
properties: {
|
|
52
|
+
url: { type: :string, format: :uri, description: "HTTP or HTTPS callback URL" },
|
|
53
|
+
subscriptions: {
|
|
54
|
+
type: :array,
|
|
55
|
+
items: { type: :string },
|
|
56
|
+
minItems: 1,
|
|
57
|
+
description: "Event keys to subscribe (must be granted as event permissions on the API client)"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
required: [:url, :subscriptions],
|
|
61
|
+
additionalProperties: false
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:webhook_registration_create_body) do
|
|
66
|
+
{
|
|
67
|
+
title: "Webhook Registration Create Body",
|
|
68
|
+
type: :object,
|
|
69
|
+
properties: {
|
|
70
|
+
data: {
|
|
71
|
+
type: :object,
|
|
72
|
+
properties: {
|
|
73
|
+
attributes: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:webhook_registration_create_attributes) }
|
|
74
|
+
},
|
|
75
|
+
required: [:attributes]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
required: [:data],
|
|
79
|
+
additionalProperties: false
|
|
80
|
+
}
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_resource(:webhook_registration) do
|
|
84
|
+
{
|
|
85
|
+
type: :object,
|
|
86
|
+
title: "Webhook Registration",
|
|
87
|
+
properties: {
|
|
88
|
+
id: { type: :string },
|
|
89
|
+
type: { type: :string, enum: ["webhook_registration"] },
|
|
90
|
+
attributes: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:webhook_registration_attributes) }
|
|
91
|
+
},
|
|
92
|
+
required: [:id, :type, :attributes],
|
|
93
|
+
additionalProperties: false
|
|
94
|
+
}.freeze
|
|
95
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
return if defined?(Decidim::RestFull::Test::DEFINITIONS_LOADED)
|
|
4
|
+
|
|
5
|
+
Decidim::RestFull::Test::DEFINITIONS_LOADED = true
|
|
6
|
+
|
|
7
|
+
# Core-owned schemas only. Feature gems register barrels via Extension#open_api_definitions.
|
|
8
|
+
require_relative "definitions/shared"
|
|
9
|
+
require_relative "definitions/core"
|
|
10
|
+
require_relative "../core/open_api_definition_paths"
|
|
11
|
+
|
|
12
|
+
Decidim::RestFull::Core::OpenApiDefinitionPaths.load_all!
|
|
13
|
+
|
|
14
|
+
Decidim::RestFull::Core::DefinitionRegistry.finalize_openapi_component_resource_schema!
|
|
15
|
+
Decidim::RestFull::Core::DefinitionRegistry.finalize_webhook_delivery_schemas!
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
FactoryBot.define do
|
|
4
|
+
factory :rest_full_permission, class: "Decidim::RestFull::Core::Permission" do
|
|
5
|
+
api_client { create(:api_client) }
|
|
6
|
+
permission { "dummy" }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
factory :api_client, class: "Decidim::RestFull::Core::ApiClient" do
|
|
10
|
+
name { Faker::App.name } # Generate a random app name
|
|
11
|
+
redirect_uri { Faker::Internet.url } # Generate a random URL
|
|
12
|
+
scopes { [] }
|
|
13
|
+
organization factory: [:organization]
|
|
14
|
+
permissions { [] }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
FactoryBot.define do
|
|
4
|
+
factory :magic_token, class: "Decidim::RestFull::Core::MagicToken" do
|
|
5
|
+
user factory: [:user]
|
|
6
|
+
magic_token { Devise.friendly_token(20) }
|
|
7
|
+
expires_at { 5.minutes.from_now }
|
|
8
|
+
|
|
9
|
+
trait :with_redirect_url do
|
|
10
|
+
redirect_url { "https://example.org/callback" }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
FactoryBot.define do
|
|
4
|
+
factory :webhook_registration, class: "Decidim::RestFull::Core::WebhookRegistration" do
|
|
5
|
+
sequence(:url) { |n| "https://example.org/webhook/#{n}" }
|
|
6
|
+
private_key { SecureRandom.hex(32) }
|
|
7
|
+
subscriptions { ["proposal_creation.succeeded"] }
|
|
8
|
+
api_client factory: [:api_client], scopes: ["public"]
|
|
9
|
+
end
|
|
10
|
+
end
|