module Decidim::Core::ParticipatorySpaceInterface

Public Class Methods

resolve_type(obj, _ctx) click to toggle source
# File lib/decidim/api/interfaces/participatory_space_interface.rb, line 43
def self.resolve_type(obj, _ctx)
  obj.manifest.query_type.constantize
end

Public Instance Methods

components(filter: {}, order: {}) click to toggle source
# File lib/decidim/api/interfaces/participatory_space_interface.rb, line 25
def components(filter: {}, order: {})
  ComponentList.new.call(object, { filter: filter, order: order }, context)
end
stats() click to toggle source
# File lib/decidim/api/interfaces/participatory_space_interface.rb, line 31
def stats
  return if object.respond_to?(:show_statistics) && !object.show_statistics

  published_components = Component.where(participatory_space: object).published

  stats = Decidim.component_manifests.map do |component_manifest|
    component_manifest.stats.with_context(published_components).map { |name, data| [name, data] }.flatten
  end

  stats.reject(&:empty?)
end
type() click to toggle source
# File lib/decidim/api/interfaces/participatory_space_interface.rb, line 16
def type
  object.class.name
end