supportpal 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9904edb7c7891fe8166aaa215af16c51e29101f9
4
- data.tar.gz: 26ae545b047d0b35f912e71bf205865466c3c94b
3
+ metadata.gz: 771fd462d23eee2a4d6f4d4f3b8612bdf9d672f0
4
+ data.tar.gz: 59244f2131b0bfca10d2725c5e6dda3e6dba600f
5
5
  SHA512:
6
- metadata.gz: 29d7917c10182eca350ab4a2467eaefd6a563decc96aac49441f1798cacd9411f8453aa41644ef69c9e6eb96f4e590c15a2594dfd7f735073ef71bdeec3edd58
7
- data.tar.gz: c1fb941b967e3a7c7a96eff06aa3334ec9fe504f06810c9908adc17e820f4a96fd8bcd4139271f836f95f478341d6df94ababf92bf8ddf4fd806bbd9be670d42
6
+ metadata.gz: 6b9c284c96a449917c8593e6de0ffa8a436d03c4e0af326c60a7c99373001efe760eed4accae7a1ccb88e8e6e07cb56a7e930b9a3a3c9f04db7ac51cff62b42c
7
+ data.tar.gz: 7b0db60773b24b2116b04ca774962ec45b8516f46c1ffa48f2d844fd27f1eee9c3fb150e17e042e7fd48252f43d16aa81a4bf6fe5c2e4d94c02d5d3e6a09bdb7
@@ -10,7 +10,7 @@ module SupportPal
10
10
  class Session
11
11
  include HTTParty
12
12
  # Uncomment to debug output
13
- #debug_output $stdout
13
+ debug_output $stdout
14
14
 
15
15
  def initialize(options)
16
16
  # Make a class variable
@@ -42,56 +42,61 @@ module SupportPal
42
42
 
43
43
  def open_new_ticket(subject, message, options = {})
44
44
  params = {}
45
- params['subject'] = subject
46
- params['text'] = message
45
+ params['subject'] = subject
46
+ params['text'] = message
47
47
 
48
- params['user'] = @config[:ticket_user_id]
49
- params['user'] = options['operator_id'] if options['operator_id']
50
- params['user'] = options['user_id'] if options['user_id']
48
+ params['user'] = @config[:ticket_user_id]
49
+ params['user'] = options[:operator_id] if options[:operator_id]
50
+ params['user'] = options[:user_id] if options[:user_id]
51
51
 
52
- params['department'] = (options['department']) ? options['department'] : @config[:ticket_department_id]
53
- params['status'] = (options['status']) ? options['status'] : @config[:ticket_status]
54
- params['priority'] = (options['priority']) ? options['priority'] : @config[:ticket_priority]
52
+ params['department'] = (options[:department]) ? options[:department] : @config[:ticket_department_id]
53
+ params['status'] = (options[:status]) ? options[:status] : @config[:ticket_status]
54
+ params['priority'] = (options[:priority]) ? options[:priority] : @config[:ticket_priority]
55
+
56
+ params['internal'] = options[:internal] if options[:internal]
57
+
58
+ params['send_user_email'] = (options[:send_user_email]) ? options[:send_user_email] : @config[:ticket_send_user_email]
59
+ params['send_operators_email'] = (options[:send_operators_email]) ? options[:send_operators_email] : @config[:ticket_send_operators_email]
55
60
 
56
61
  @http_options.merge!({ body: params })
57
62
  res = self.class.post('/api/ticket/ticket', @http_options)
58
63
  response = res.parsed_response
59
64
  if response['status'] == 'success' then
60
65
  return {
61
- :status => 'success',
62
- :ticket_id => response['data']['id']
66
+ :status => 'success',
67
+ :ticket_id => response['data']['id']
63
68
  }
64
69
  else
65
70
  return {
66
- :status => 'failure',
67
- :message => response['message']
71
+ :status => 'failure',
72
+ :message => response['message']
68
73
  }
69
74
  end
70
75
  end
71
76
 
72
77
  def add_ticket_note(ticket_id, message, options = {})
73
78
  params = {}
74
- params['text'] = message
79
+ params['text'] = message
75
80
 
76
- params['user_id'] = @config[:ticket_user_id]
77
- params['user_id'] = options['operator_id'] if options['operator_id']
78
- params['user_id'] = options['user_id'] if options['user_id']
81
+ params['user_id'] = @config[:ticket_user_id]
82
+ params['user_id'] = options['operator_id'] if options['operator_id']
83
+ params['user_id'] = options['user_id'] if options['user_id']
79
84
 
80
- params['ticket_id'] = ticket_id
81
- params['message_type'] = 1 # 1 = note, 0 = reply
85
+ params['ticket_id'] = ticket_id
86
+ params['message_type'] = 1 # 1 = note, 0 = reply
82
87
 
83
88
  @http_options.merge!({ body: params })
84
89
  res = self.class.post("/api/ticket/message", @http_options)
85
90
  response = res.parsed_response
86
91
  if response['status'] == 'success' then
87
92
  return {
88
- :status => 'success',
89
- :message => response['message']
93
+ :status => 'success',
94
+ :message => response['message']
90
95
  }
91
96
  else
92
97
  return {
93
- :status => 'failure',
94
- :message => response['message']
98
+ :status => 'failure',
99
+ :message => response['message']
95
100
  }
96
101
  end
97
102
  end
@@ -103,13 +108,13 @@ module SupportPal
103
108
  response = res.parsed_response
104
109
  if response['status'] == 'success' then
105
110
  return {
106
- :status => 'success',
107
- :message => response['message']
111
+ :status => 'success',
112
+ :message => response['message']
108
113
  }
109
114
  else
110
115
  return {
111
- :status => 'failure',
112
- :message => response['message']
116
+ :status => 'failure',
117
+ :message => response['message']
113
118
  }
114
119
  end
115
120
  end
@@ -4,11 +4,13 @@ module SupportPal
4
4
 
5
5
  def default_config
6
6
  @config = {
7
- :ticket_status => 1, # Open
8
- :ticket_priority => 1, # Low
9
- :ticket_user_id => nil, # Operator or user
10
- :ticket_department_id => nil,
11
- :auth_token => nil, # SupportPal token
7
+ :ticket_status => 1, # Open
8
+ :ticket_priority => 1, # Low
9
+ :ticket_user_id => nil, # Operator or user
10
+ :ticket_department_id => nil,
11
+ :ticket_send_user_email => false, # Send an email to the user who opens the ticket when ticket opens
12
+ :ticket_send_operators_email => false, # Send an email to all operators when ticket opens
13
+ :auth_token => nil, # SupportPal token
12
14
  }
13
15
  end
14
16
 
@@ -1,3 +1,3 @@
1
1
  module SupportPal
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supportpal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew White
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-28 00:00:00.000000000 Z
11
+ date: 2019-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler