Skip to content

Commit

Permalink
Added config options for sending user email/sending operators email w…
Browse files Browse the repository at this point in the history
…hen opening new ticket. Added internal switch for new tickets
  • Loading branch information
WhiteyDude committed May 30, 2019
1 parent 022cb3c commit 5d3ac7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/supportpal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Error < StandardError; end
class Session
include HTTParty
# Uncomment to debug output
#debug_output $stdout
debug_output $stdout

def initialize(options)
# Make a class variable
Expand Down Expand Up @@ -46,12 +46,17 @@ def open_new_ticket(subject, message, options = {})
params['text'] = message

params['user'] = @config[:ticket_user_id]
params['user'] = options['operator_id'] if options['operator_id']
params['user'] = options['user_id'] if options['user_id']
params['user'] = options[:operator_id] if options[:operator_id]
params['user'] = options[:user_id] if options[:user_id]

params['department'] = (options['department']) ? options['department'] : @config[:ticket_department_id]
params['status'] = (options['status']) ? options['status'] : @config[:ticket_status]
params['priority'] = (options['priority']) ? options['priority'] : @config[:ticket_priority]
params['department'] = (options[:department]) ? options[:department] : @config[:ticket_department_id]
params['status'] = (options[:status]) ? options[:status] : @config[:ticket_status]
params['priority'] = (options[:priority]) ? options[:priority] : @config[:ticket_priority]

params['internal'] = options[:internal] if options[:internal]

params['send_user_email'] = (options[:send_user_email]) ? options[:send_user_email] : @config[:ticket_send_user_email]
params['send_operators_email'] = (options[:send_operators_email]) ? options[:send_operators_email] : @config[:ticket_send_operators_email]

@http_options.merge!({ body: params })
res = self.class.post('/api/ticket/ticket', @http_options)
Expand Down
2 changes: 2 additions & 0 deletions lib/supportpal/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def default_config
:ticket_priority => 1, # Low
:ticket_user_id => nil, # Operator or user
:ticket_department_id => nil,
:ticket_send_user_email => false, # Send an email to the user who opens the ticket when ticket opens
:ticket_send_operators_email => false, # Send an email to all operators when ticket opens
:auth_token => nil, # SupportPal token
}
end
Expand Down

0 comments on commit 5d3ac7b

Please sign in to comment.