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 +4 -4
- data/lib/supportpal.rb +32 -27
- data/lib/supportpal/config.rb +7 -5
- data/lib/supportpal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 771fd462d23eee2a4d6f4d4f3b8612bdf9d672f0
|
4
|
+
data.tar.gz: 59244f2131b0bfca10d2725c5e6dda3e6dba600f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b9c284c96a449917c8593e6de0ffa8a436d03c4e0af326c60a7c99373001efe760eed4accae7a1ccb88e8e6e07cb56a7e930b9a3a3c9f04db7ac51cff62b42c
|
7
|
+
data.tar.gz: 7b0db60773b24b2116b04ca774962ec45b8516f46c1ffa48f2d844fd27f1eee9c3fb150e17e042e7fd48252f43d16aa81a4bf6fe5c2e4d94c02d5d3e6a09bdb7
|
data/lib/supportpal.rb
CHANGED
@@ -10,7 +10,7 @@ module SupportPal
|
|
10
10
|
class Session
|
11
11
|
include HTTParty
|
12
12
|
# Uncomment to debug output
|
13
|
-
|
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']
|
46
|
-
params['text']
|
45
|
+
params['subject'] = subject
|
46
|
+
params['text'] = message
|
47
47
|
|
48
|
-
params['user']
|
49
|
-
params['user']
|
50
|
-
params['user']
|
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']
|
53
|
-
params['status']
|
54
|
-
params['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
|
62
|
-
|
66
|
+
:status => 'success',
|
67
|
+
:ticket_id => response['data']['id']
|
63
68
|
}
|
64
69
|
else
|
65
70
|
return {
|
66
|
-
:status
|
67
|
-
: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']
|
79
|
+
params['text'] = message
|
75
80
|
|
76
|
-
params['user_id']
|
77
|
-
params['user_id']
|
78
|
-
params['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']
|
81
|
-
params['message_type']
|
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
|
89
|
-
:message
|
93
|
+
:status => 'success',
|
94
|
+
:message => response['message']
|
90
95
|
}
|
91
96
|
else
|
92
97
|
return {
|
93
|
-
:status
|
94
|
-
: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
|
107
|
-
:message
|
111
|
+
:status => 'success',
|
112
|
+
:message => response['message']
|
108
113
|
}
|
109
114
|
else
|
110
115
|
return {
|
111
|
-
:status
|
112
|
-
:message
|
116
|
+
:status => 'failure',
|
117
|
+
:message => response['message']
|
113
118
|
}
|
114
119
|
end
|
115
120
|
end
|
data/lib/supportpal/config.rb
CHANGED
@@ -4,11 +4,13 @@ module SupportPal
|
|
4
4
|
|
5
5
|
def default_config
|
6
6
|
@config = {
|
7
|
-
:ticket_status
|
8
|
-
:ticket_priority
|
9
|
-
:ticket_user_id
|
10
|
-
:ticket_department_id
|
11
|
-
:
|
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
|
|
data/lib/supportpal/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|