Module: Decidim::Core::ParticipatorySpaceInterface

Includes:
Api::Types::BaseInterface
Defined in:
lib/decidim/api/interfaces/participatory_space_interface.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.resolve_type(obj, _ctx) ⇒ Object



43
44
45
# File 'lib/decidim/api/interfaces/participatory_space_interface.rb', line 43

def self.resolve_type(obj, _ctx)
  obj.manifest.query_type.constantize
end

Instance Method Details

#components(filter: {}, order: {}) ⇒ Object



31
32
33
# File 'lib/decidim/api/interfaces/participatory_space_interface.rb', line 31

def components(filter: {}, order: {})
  ComponentList.new.call(object, { filter:, order: }, context)
end

#manifestObject



27
28
29
# File 'lib/decidim/api/interfaces/participatory_space_interface.rb', line 27

def manifest
  ParticipatorySpaceManifestPresenter.new(object.manifest, object.organization)
end

#statsObject



35
36
37
38
39
40
41
# File 'lib/decidim/api/interfaces/participatory_space_interface.rb', line 35

def stats
  return if object.respond_to?(:show_statistics) && !object.show_statistics

  Decidim::ParticipatoryProcesses::ParticipatoryProcessStatsPresenter.new(participatory_process: object).collection.map do |stat|
    [object.organization, stat]
  end
end

#typeObject



23
24
25
# File 'lib/decidim/api/interfaces/participatory_space_interface.rb', line 23

def type
  object.class.name
end