class ZendeskAPI::Macro

Public Class Methods

cbp_path_regexes() click to toggle source
# File lib/zendesk_api/resources.rb, line 728
def self.cbp_path_regexes
  [/^macros$/]
end

Public Instance Methods

apply(ticket = nil) click to toggle source

Returns the update to a ticket that happens when a macro will be applied. @param [Ticket] ticket Optional {Ticket} to apply this macro to

# File lib/zendesk_api/resources.rb, line 748
def apply(ticket = nil)
  apply!(ticket)
rescue Faraday::ClientError
  SilentMash.new
end
apply!(ticket = nil) click to toggle source

Returns the update to a ticket that happens when a macro will be applied. @param [Ticket] ticket Optional {Ticket} to apply this macro to. @raise [Faraday::ClientError] Raised for any non-200 response.

# File lib/zendesk_api/resources.rb, line 735
def apply!(ticket = nil)
  path = "#{self.path}/apply"

  if ticket
    path = "#{ticket.path}/#{path}"
  end

  response = @client.connection.get(path)
  SilentMash.new(response.body.fetch("result", {}))
end