decidim-culturoscope 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.md +661 -0
  3. data/README.md +134 -0
  4. data/Rakefile +92 -0
  5. data/app/controllers/decidim/culturoscope/flux_controller.rb +71 -0
  6. data/app/forms/decidim/culturoscope/admin/organization_config_form.rb +17 -0
  7. data/app/models/decidim/culturoscope/application_record.rb +9 -0
  8. data/app/models/decidim/culturoscope/event.rb +22 -0
  9. data/config/locales/de.yml +20 -0
  10. data/config/locales/en.yml +20 -0
  11. data/config/locales/fr.yml +20 -0
  12. data/config/locales/it.yml +20 -0
  13. data/db/migrate/20260914001000_create_culturoscope_events.rb +16 -0
  14. data/lib/decidim/culturoscope/availability.rb +15 -0
  15. data/lib/decidim/culturoscope/bindings.rb +40 -0
  16. data/lib/decidim/culturoscope/bound_meetings.rb +67 -0
  17. data/lib/decidim/culturoscope/configuration.rb +16 -0
  18. data/lib/decidim/culturoscope/date_status.rb +31 -0
  19. data/lib/decidim/culturoscope/engine.rb +64 -0
  20. data/lib/decidim/culturoscope/event_mapper.rb +106 -0
  21. data/lib/decidim/culturoscope/event_status.rb +22 -0
  22. data/lib/decidim/culturoscope/feed_builder.rb +76 -0
  23. data/lib/decidim/culturoscope/feed_report.rb +53 -0
  24. data/lib/decidim/culturoscope/flux.schema.json +78 -0
  25. data/lib/decidim/culturoscope/image_url.rb +88 -0
  26. data/lib/decidim/culturoscope/meeting_bindable.rb +17 -0
  27. data/lib/decidim/culturoscope/schema.rb +21 -0
  28. data/lib/decidim/culturoscope/seeds.rb +110 -0
  29. data/lib/decidim/culturoscope/tenant.rb +23 -0
  30. data/lib/decidim/culturoscope/test/factories.rb +10 -0
  31. data/lib/decidim/culturoscope/upgrade.rb +37 -0
  32. data/lib/decidim/culturoscope/venue_mapper.rb +80 -0
  33. data/lib/decidim/culturoscope/version.rb +13 -0
  34. data/lib/decidim/culturoscope/vocabulary.rb +27 -0
  35. data/lib/decidim/culturoscope.rb +37 -0
  36. data/lib/decidim-culturoscope.rb +3 -0
  37. data/lib/tasks/decidim/culturoscope/upgrade.rake +13 -0
  38. data/lib/tasks/decidim/culturoscope.rake +19 -0
  39. metadata +137 -0
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails"
4
+ require "decidim/toggle"
5
+
6
+ module Decidim
7
+ module Culturoscope
8
+ class Engine < ::Rails::Engine
9
+ isolate_namespace Decidim::Culturoscope
10
+
11
+ routes do
12
+ get "flux", to: "flux#show", defaults: { format: :json }
13
+ end
14
+
15
+ initializer "decidim_culturoscope.organization_settings_tab",
16
+ after: "decidim_toggle.organization_settings_tabs" do
17
+ Decidim::Toggle.settings_tabs :organization_settings do |tabs|
18
+ tabs.add_tab :decidim_culturoscope,
19
+ I18n.t("decidim_toggle.system.decidim_culturoscope.tab"),
20
+ form: Admin::OrganizationConfigForm,
21
+ command: Decidim::Toggle::UpdateModuleConfigCommand,
22
+ module_name: MODULE_NAME
23
+ end
24
+ end
25
+
26
+ initializer "decidim_culturoscope.mount_routes" do
27
+ Rails.application.routes.append do
28
+ mount Decidim::Culturoscope::Engine, at: "/culturoscope", as: "decidim_culturoscope"
29
+ end
30
+ end
31
+
32
+ initializer "decidim_culturoscope.prepare" do
33
+ config.to_prepare do
34
+ Engine.extend_meeting!
35
+ end
36
+ end
37
+
38
+ config.after_initialize do
39
+ Engine.register_env_binding!
40
+ end
41
+
42
+ def self.extend_meeting!
43
+ klass = Decidim::Meetings::Meeting
44
+ return if klass.included_modules.include?(MeetingBindable)
45
+
46
+ klass.include(MeetingBindable)
47
+ end
48
+
49
+ def self.register_env_binding!
50
+ component_id = ENV.fetch("CULTUROSCOPE_COMPONENT_ID", nil)
51
+ return if component_id.blank?
52
+ return if Bindings.registered?(component_id)
53
+
54
+ Bindings.add(
55
+ component_id:,
56
+ event_categories: ->(_meeting) { %w(AN) }
57
+ )
58
+ Rails.logger.warn(
59
+ "Culturoscope env fallback binding component_id=#{component_id.to_i} categories=AN"
60
+ )
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Culturoscope
5
+ class EventMapper
6
+ ALLOWED_TAGS = %w(a p b strong u li hr br).freeze
7
+ ZONE = "Europe/Zurich"
8
+ CLOCK = "%Y-%m-%d %H:%M"
9
+
10
+ def initialize(meeting, categories)
11
+ @meeting = meeting
12
+ @categories = Array(categories)
13
+ end
14
+
15
+ def to_h
16
+ Vocabulary.validate_categories!(@categories)
17
+ required.merge(optional).compact
18
+ end
19
+
20
+ private
21
+
22
+ attr_reader :meeting
23
+
24
+ def required
25
+ {
26
+ "event_id" => meeting.id,
27
+ "event_title" => translated(:title),
28
+ "event_description" => description,
29
+ "event_categories" => @categories,
30
+ "event_status" => EventStatus.for(meeting),
31
+ "event_dates" => [date_payload],
32
+ "detail_url" => detail_url,
33
+ "image_url" => image_url
34
+ }
35
+ end
36
+
37
+ def optional
38
+ venue.merge("booking_url" => booking_url)
39
+ end
40
+
41
+ def translated(field)
42
+ value = meeting.public_send(field)
43
+ return value.to_s unless value.is_a?(Hash)
44
+
45
+ value[I18n.locale.to_s].presence || value["en"].presence || value.values.first
46
+ end
47
+
48
+ def description
49
+ sanitize([translated(:description), announcement].compact_blank.join("\n"))
50
+ end
51
+
52
+ def announcement
53
+ settings = meeting.component.try(:settings)
54
+ return if settings.blank? || !settings.respond_to?(:announcement)
55
+
56
+ value = settings.announcement
57
+ return if value.blank?
58
+ return value unless value.is_a?(Hash)
59
+
60
+ value[I18n.locale.to_s].presence || value.values.first
61
+ end
62
+
63
+ def sanitize(html)
64
+ Rails::Html::SafeListSanitizer.new.sanitize(html.to_s, tags: ALLOWED_TAGS)
65
+ end
66
+
67
+ def date_payload
68
+ status = DateStatus.for(meeting)
69
+ { "start_date" => clock(meeting.start_time), "end_date" => clock(meeting.end_time), "date_status" => status }.compact
70
+ end
71
+
72
+ def clock(time)
73
+ return if time.blank?
74
+
75
+ time.in_time_zone(ZONE).strftime(CLOCK)
76
+ end
77
+
78
+ def detail_url
79
+ ensure_host!
80
+ Decidim::ResourceLocatorPresenter.new(meeting).url
81
+ end
82
+
83
+ def ensure_host!
84
+ host = meeting.organization.host
85
+ Rails.application.routes.default_url_options[:host] ||= host
86
+ end
87
+
88
+ def image_url
89
+ ImageUrl.for(meeting) || raise(Error, I18n.t("decidim.culturoscope.errors.image_url_required"))
90
+ end
91
+
92
+ def booking_url
93
+ return meeting.registration_url if meeting.try(:on_different_platform?)
94
+ return detail_url if meeting.registrations_enabled?
95
+
96
+ nil
97
+ end
98
+
99
+ def venue
100
+ return {} if meeting.online?
101
+
102
+ VenueMapper.new(meeting).to_h
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Culturoscope
5
+ # Flux event_status:
6
+ # PUBLIC = listed on Culturoscope + prévisionnel (published, public, not hidden)
7
+ # PRIVATE = prévisionnel only (unpublished and/or private_meeting)
8
+ module EventStatus
9
+ def self.for(meeting)
10
+ public_listing?(meeting) ? "PUBLIC" : "PRIVATE"
11
+ end
12
+
13
+ def self.public_listing?(meeting)
14
+ meeting.published? && !meeting.private_meeting? && !hidden?(meeting)
15
+ end
16
+
17
+ def self.hidden?(meeting)
18
+ meeting.respond_to?(:hidden?) && meeting.hidden?
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Culturoscope
5
+ class FeedBuilder
6
+ def self.call(organization, strict: false)
7
+ new(organization, strict:).call
8
+ end
9
+
10
+ def initialize(organization, strict: false)
11
+ @organization = organization
12
+ @strict = strict
13
+ @errors = []
14
+ end
15
+
16
+ attr_reader :errors
17
+
18
+ def call
19
+ raise Error, I18n.t("decidim.culturoscope.errors.api_key_required") if api_key.blank?
20
+
21
+ built = payload
22
+ raise Error, @errors.join("\n") if @strict && @errors.any?
23
+
24
+ Schema.validate!(built)
25
+ built
26
+ end
27
+
28
+ def payload
29
+ @payload ||= { "api_key" => api_key, "events" => events }
30
+ end
31
+
32
+ private
33
+
34
+ def events
35
+ @events ||= scoped_events
36
+ end
37
+
38
+ # Map inside the tenant. Meeting ids collide across schemas, and the
39
+ # route proxy only has meeting_url for the component in that schema.
40
+ def scoped_events
41
+ Tenant.call(@organization.host) { map_events } || []
42
+ end
43
+
44
+ def map_events
45
+ BoundMeetings.listed(@organization).filter_map { |meeting| event_for(meeting) }
46
+ end
47
+
48
+ def event_for(meeting)
49
+ payload = EventMapper.new(meeting, categories(meeting)).to_h
50
+ Schema.validate!(single(payload))
51
+ payload
52
+ rescue StandardError => e
53
+ remember(meeting, e)
54
+ nil
55
+ end
56
+
57
+ def categories(meeting)
58
+ Bindings.for(meeting).event_categories.call(meeting)
59
+ end
60
+
61
+ def single(event)
62
+ { "api_key" => api_key, "events" => [event] }
63
+ end
64
+
65
+ def remember(meeting, error)
66
+ message = "meeting=#{meeting.id} #{error.message}"
67
+ @errors << message
68
+ Rails.logger.warn("Culturoscope skip #{message}")
69
+ end
70
+
71
+ def api_key
72
+ Decidim::Culturoscope.config.api_key.to_s
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Culturoscope
5
+ class FeedReport
6
+ def self.call
7
+ new.call
8
+ end
9
+
10
+ def call
11
+ list = BoundMeetings.organizations
12
+ warn "Culturoscope: no bound meetings components" if list.empty?
13
+ list.each { |organization| report(organization) }
14
+ end
15
+
16
+ private
17
+
18
+ def report(organization)
19
+ builder = FeedBuilder.new(organization)
20
+ payload = safe_payload(builder)
21
+ warn summary(organization, payload, builder)
22
+ builder.errors.each { |error| warn "Culturoscope skip #{error}" }
23
+ end
24
+
25
+ def safe_payload(builder)
26
+ builder.call
27
+ rescue Error => e
28
+ warn "Culturoscope invalid #{e.message}"
29
+ builder.payload
30
+ end
31
+
32
+ def summary(organization, payload, builder)
33
+ count = payload.fetch("events").size
34
+ "Culturoscope flux host=#{organization.host} events=#{count} skipped=#{builder.errors.size} url=#{url_for(organization)}"
35
+ end
36
+
37
+ def url_for(organization)
38
+ "#{scheme}://#{organization.host}/culturoscope/flux.json#{token_query}"
39
+ end
40
+
41
+ def scheme
42
+ Rails.application.config.force_ssl ? "https" : "http"
43
+ end
44
+
45
+ def token_query
46
+ token = Decidim::Culturoscope.config.flux_token.to_s
47
+ return "" if token.blank?
48
+
49
+ "?token=#{CGI.escape(token)}"
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,78 @@
1
+ {
2
+ "title": "Culturoscope flux",
3
+ "type": "object",
4
+ "required": ["api_key", "events"],
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "api_key": { "type": "string", "minLength": 1 },
8
+ "events": {
9
+ "type": "array",
10
+ "items": { "$ref": "#/definitions/event" }
11
+ }
12
+ },
13
+ "definitions": {
14
+ "event": {
15
+ "type": "object",
16
+ "required": [
17
+ "event_id",
18
+ "event_title",
19
+ "event_categories",
20
+ "event_status",
21
+ "event_dates",
22
+ "detail_url",
23
+ "image_url"
24
+ ],
25
+ "properties": {
26
+ "event_id": { "type": "integer" },
27
+ "event_title": { "type": "string", "minLength": 1 },
28
+ "event_description": { "type": "string" },
29
+ "event_categories": {
30
+ "type": "array",
31
+ "minItems": 1,
32
+ "items": { "enum": ["EX", "TH", "MU", "AN", "DA", "CI", "LI", "PR", "PA"] }
33
+ },
34
+ "event_category_label": { "type": "string" },
35
+ "event_status": { "enum": ["PUBLIC", "PRIVATE"] },
36
+ "event_dates": {
37
+ "type": "array",
38
+ "minItems": 1,
39
+ "items": { "$ref": "#/definitions/date" }
40
+ },
41
+ "event_flags": { "type": "array", "items": { "type": "string" } },
42
+ "detail_url": { "type": "string", "format": "uri" },
43
+ "image_url": { "type": "string", "format": "uri" },
44
+ "image_credit": { "type": "string" },
45
+ "booking_url": { "type": "string", "format": "uri" },
46
+ "booking_phone": { "type": "string" },
47
+ "booking_mail": { "type": "string" },
48
+ "venue_name": { "type": "string" },
49
+ "venue_address": { "type": "string" },
50
+ "venue_zip": { "type": "integer" },
51
+ "venue_city": { "type": "string" }
52
+ },
53
+ "if": {
54
+ "properties": {
55
+ "event_categories": { "contains": { "const": "EX" } }
56
+ },
57
+ "required": ["event_categories"]
58
+ },
59
+ "then": {
60
+ "properties": {
61
+ "event_categories": { "maxItems": 1 },
62
+ "event_dates": {
63
+ "items": { "required": ["start_date", "end_date"] }
64
+ }
65
+ }
66
+ }
67
+ },
68
+ "date": {
69
+ "type": "object",
70
+ "required": ["start_date"],
71
+ "properties": {
72
+ "start_date": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$" },
73
+ "end_date": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$" },
74
+ "date_status": { "enum": ["SOLDOUT", "CANCELLED", "RESCHEDULDED", "RESCHEDULED"] }
75
+ }
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Culturoscope
5
+ # jpeg/png only. rails_blob_url is a stable redirect, not a short-lived disk token.
6
+ class ImageUrl
7
+ RASTER_NAME = /\.(jpe?g|png)\z/i
8
+ RASTER_TYPE = %w(image/jpeg image/png).freeze
9
+
10
+ def self.for(meeting)
11
+ new(meeting).call
12
+ end
13
+
14
+ def initialize(meeting)
15
+ @meeting = meeting
16
+ end
17
+
18
+ def call
19
+ photo || logo || fallback
20
+ end
21
+
22
+ private
23
+
24
+ attr_reader :meeting
25
+
26
+ def photo
27
+ item = meeting.photos.find { |candidate| public_raster?(candidate) }
28
+ blob_url(item&.file&.blob)
29
+ end
30
+
31
+ def public_raster?(candidate)
32
+ return false if candidate.try(:private_download_required?)
33
+
34
+ raster?(candidate.content_type, candidate.file.filename)
35
+ end
36
+
37
+ def logo
38
+ attached = meeting.organization.logo
39
+ return unless attached.attached?
40
+ return unless raster?(attached.blob.content_type, attached.blob.filename)
41
+
42
+ blob_url(attached.blob)
43
+ end
44
+
45
+ def fallback
46
+ url = Decidim::Culturoscope.config.fallback_image_url.to_s
47
+ return if url.blank?
48
+ return unless url.match?(RASTER_NAME)
49
+
50
+ absolute(url)
51
+ end
52
+
53
+ def raster?(content_type, filename)
54
+ return false if webp?(content_type, filename)
55
+
56
+ raster_type?(content_type) && raster_name?(filename)
57
+ end
58
+
59
+ def webp?(content_type, filename)
60
+ content_type.to_s == "image/webp" || filename.to_s.match?(/\.webp\z/i)
61
+ end
62
+
63
+ def raster_type?(content_type)
64
+ RASTER_TYPE.include?(content_type.to_s)
65
+ end
66
+
67
+ def raster_name?(filename)
68
+ filename.to_s.match?(RASTER_NAME)
69
+ end
70
+
71
+ def blob_url(blob)
72
+ return if blob.blank?
73
+
74
+ helpers.rails_blob_url(blob, host: meeting.organization.host)
75
+ end
76
+
77
+ def helpers
78
+ Rails.application.routes.url_helpers
79
+ end
80
+
81
+ def absolute(url)
82
+ return url if url.match?(/\Ahttps?:/i)
83
+
84
+ "https://#{meeting.organization.host}#{url}"
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Culturoscope
5
+ module MeetingBindable
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ has_one :culturoscope,
10
+ class_name: "Decidim::Culturoscope::Event",
11
+ foreign_key: :decidim_meetings_meeting_id,
12
+ inverse_of: :meeting,
13
+ dependent: :destroy
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json-schema"
4
+
5
+ module Decidim
6
+ module Culturoscope
7
+ module Schema
8
+ PATH = File.expand_path("flux.schema.json", __dir__)
9
+
10
+ def self.validate!(feed)
11
+ JSON::Validator.validate!(document, feed, validate_schema: false)
12
+ rescue JSON::Schema::ValidationError => e
13
+ raise Error, e.message
14
+ end
15
+
16
+ def self.document
17
+ @document ||= JSON.parse(File.read(PATH))
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Culturoscope
5
+ class Seeds
6
+ PROCESS_SLUG = "culturoscope-qa"
7
+
8
+ def self.call
9
+ new.call
10
+ end
11
+
12
+ def call
13
+ return if organization.blank?
14
+
15
+ load_factories!
16
+ attach_logo!
17
+ enable!
18
+ create_meetings!
19
+ print_binding_hint
20
+ end
21
+
22
+ private
23
+
24
+ def load_factories!
25
+ require "factory_bot"
26
+ require "decidim/core/test/factories"
27
+ require "decidim/participatory_processes/test/factories"
28
+ require "decidim/meetings/test/factories"
29
+ end
30
+
31
+ def organization
32
+ @organization ||= Decidim::Organization.first
33
+ end
34
+
35
+ def enable!
36
+ Decidim::Toggle.save_config!(organization, MODULE_NAME, { "enabled" => true })
37
+ end
38
+
39
+ def attach_logo!
40
+ return if organization.logo.attached?
41
+
42
+ organization.logo.attach(io: File.open(logo_path), filename: "city.jpeg", content_type: "image/jpeg")
43
+ end
44
+
45
+ def logo_path
46
+ Decidim::Dev.asset("city.jpeg")
47
+ end
48
+
49
+ def process
50
+ @process ||= existing_process || FactoryBot.create(:participatory_process, :published, organization:, slug: PROCESS_SLUG)
51
+ end
52
+
53
+ def existing_process
54
+ Decidim::ParticipatoryProcess.find_by(slug: PROCESS_SLUG, organization:)
55
+ end
56
+
57
+ def component
58
+ @component ||= existing_component || FactoryBot.create(:meeting_component, participatory_space: process)
59
+ end
60
+
61
+ def existing_component
62
+ Decidim::Component.find_by(participatory_space: process, manifest_name: "meetings")
63
+ end
64
+
65
+ def create_meetings!
66
+ meeting_attrs.each { |attrs| FactoryBot.create(:meeting, *attrs[:traits], **attrs[:opts], component:) }
67
+ create_sold_out_meeting!
68
+ end
69
+
70
+ def create_sold_out_meeting!
71
+ meeting = FactoryBot.create(
72
+ :meeting, :published, :official, :in_person, :upcoming, :with_registrations_enabled,
73
+ component:, address: "Rue du Jura 12, 2800 Delémont",
74
+ available_slots: 1, reserved_slots: 0
75
+ )
76
+ fill_registrations!(meeting)
77
+ end
78
+
79
+ def fill_registrations!(meeting)
80
+ meeting.remaining_slots.times do
81
+ FactoryBot.create(:registration, meeting:, user: seed_user("soldout"))
82
+ end
83
+ end
84
+
85
+ def seed_user(tag)
86
+ FactoryBot.create(:user, organization:, email: "qa-#{tag}-#{SecureRandom.hex(6)}@example.org")
87
+ end
88
+
89
+ def meeting_attrs
90
+ swiss = { address: "Rue du Jura 12, 2800 Delémont" }
91
+ public_in_person = [:published, :official, :in_person, :upcoming]
92
+ [
93
+ { traits: public_in_person, opts: swiss },
94
+ { traits: [:published, :participant_author, :in_person, :upcoming], opts: swiss.merge(author: seed_user("author")) },
95
+ { traits: [:published, :official, :online, :upcoming], opts: {} },
96
+ { traits: [:published, :official, :hybrid, :upcoming], opts: swiss },
97
+ { traits: public_in_person + [:with_registrations_enabled], opts: swiss },
98
+ { traits: [:official, :in_person, :upcoming], opts: swiss },
99
+ { traits: public_in_person + [:withdrawn], opts: swiss },
100
+ { traits: public_in_person, opts: swiss.merge(private_meeting: true) },
101
+ { traits: public_in_person + [:moderated], opts: swiss }
102
+ ]
103
+ end
104
+
105
+ def print_binding_hint
106
+ warn "Culturoscope QA component_id=#{component.id} flux=http://#{organization.host}/culturoscope/flux.json"
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Culturoscope
5
+ # ponytail: component ids are per schema; callers only read the host's tenant.
6
+ module Tenant
7
+ module_function
8
+
9
+ def apartment?
10
+ Gem.loaded_specs.has_key?("decidim-apartment")
11
+ end
12
+
13
+ def call(host, &)
14
+ return yield unless apartment?
15
+
16
+ key = Decidim::Apartment::DistributionKey.for_host(host)
17
+ return unless key
18
+
19
+ key.switch(&)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ FactoryBot.define do
4
+ factory :culturoscope_event, class: "Decidim::Culturoscope::Event" do
5
+ meeting { create(:meeting, :published) }
6
+ culturoscope_id { meeting.id }
7
+ url { "https://www.culturoscope.ch/evt/#{culturoscope_id}" }
8
+ synced_at { Time.current }
9
+ end
10
+ end