One of the key parts of Sirportly is the macros system and your module can get right in on this action. With macro actions, you can define methods which can be configured as part of an administrator-defined macro.
In our Hipchat module, for example, we have a macro action called
poke_via_hipchat which allows anyone to press a button and send a message to the company's Hipchat room to ask someone to take a look at a ticket.
class Hipchat < Module add_macro_action :poke_via_hipchat, "Poke via. Hipchat" do |config, macro, ticket, options| ## The code in this block will be executed whenever a macro which calls this action is ## invoked either through a button or through a rule. end end
This method accepts two parameters:
When executing the block, you are passed 4 objects to work with:
config- contains a hash of the configuration for the account. See the configuration page for further details.
macro- contains the object of the macro which invoked the block
ticket- contains the ticket which the macro is being executed on
options- contains options which are pursuant to the macro invocation for example,
:current_usermay exist if the macro execution is directly attributable to a system user (i.e. they clicked a button to call it).