Class: Spree::AgentTools::DescribeReporting

Inherits:
Spree::AgentTool show all
Defined in:
app/tools/spree/agent_tools/describe_reporting.rb

Overview

Tells the model which metrics and dimensions this store can be asked about, so it composes a query from the real vocabulary rather than guessing names and reading errors back to the merchant.

Constant Summary

Constants inherited from Spree::AgentTool

Spree::AgentTool::PARENT_ID_DESCRIPTION

Instance Attribute Summary

Attributes inherited from Spree::AgentTool

#context

Instance Method Summary collapse

Methods inherited from Spree::AgentTool

additive!, audience, description, destructive?, #initialize, input_schema, mutating!, mutating?, param, params, permission, #permitted?, tool_name, #unknown_resource

Constructor Details

This class inherits a constructor from Spree::AgentTool

Instance Method Details

#call ⇒ Object



12
13
14
15
16
17
# File 'app/tools/spree/agent_tools/describe_reporting.rb', line 12

def call
  Spree::Reporting::Schema.new(
    store: context.store,
    allowed: ->(member) { allowed?(member) }
  ).to_h
end

#summary(_arguments) ⇒ Object



19
20
21
# File 'app/tools/spree/agent_tools/describe_reporting.rb', line 19

def summary(_arguments)
  'List the reporting metrics and dimensions'
end