gitlab_support_readiness 1.0.91 → 1.0.92
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/support_readiness/repos/triggers.rb +69 -0
- data/lib/support_readiness/zendesk/schedules.rb +95 -0
- data/lib/support_readiness/zendesk/ticket_fields.rb +8 -3
- data/lib/support_readiness/zendesk/ticket_forms.rb +8 -3
- data/lib/support_readiness/zendesk/trigger_categories.rb +100 -0
- data/lib/support_readiness/zendesk/triggers.rb +1 -1
- data/lib/support_readiness/zendesk/webhooks.rb +108 -0
- data/lib/support_readiness/zendesk.rb +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e1bb9e106c7315b3948c30aea40a2c71996207ee7634d42a038b98365ce3879
|
4
|
+
data.tar.gz: e3ae654689797c2858906ba85ead2a827b96ad790b7420eb5f740f9dca98368f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f81a922e72e1e01418d998972953bdfd1a0bbdd3df1e48752d78b1870155dbfacc93c372a417bf86eec76e4f7e32e9beda4a0c262fc2e3cdfa32cb86d45d1eed
|
7
|
+
data.tar.gz: d4112092e1db77c60d52e5d0908f7a16bf231d5868b90017510766a8055cf55026fe6cfd99360724987813217173e052d05cf58b020f00f439739020e425d06f
|
@@ -53,6 +53,7 @@ module Readiness
|
|
53
53
|
# pp diffs[:updates.count]
|
54
54
|
# # => 2
|
55
55
|
def self.compare(zendesk_client, location = 'data', verbose = false)
|
56
|
+
@zendesk_client = zendesk_client
|
56
57
|
diffs = {
|
57
58
|
updates: [],
|
58
59
|
creates: []
|
@@ -134,6 +135,11 @@ module Readiness
|
|
134
135
|
# pp repo.count
|
135
136
|
# # => 35
|
136
137
|
def self.gather(location = 'data')
|
138
|
+
@categories = Readiness::Zendesk::TriggerCategories.list(@zendesk_client)
|
139
|
+
@schedules = Readiness::Zendesk::Schedules.list(@zendesk_client)
|
140
|
+
@ticket_fields = Readiness::Zendesk::TicketFields.list(@zendesk_client)
|
141
|
+
@ticket_forms = Readiness::Zendesk::TicketForms.list(@zendesk_client)
|
142
|
+
@webhooks = Readiness::Zendesk::Webhooks.list(@zendesk_client)
|
137
143
|
@errors = []
|
138
144
|
@location = location
|
139
145
|
array = []
|
@@ -142,6 +148,11 @@ module Readiness
|
|
142
148
|
object = convert_managed_content(object, f) if object['contains_managed_content']
|
143
149
|
object['default'] = false
|
144
150
|
#object = convert_managed_webhook(object, f) if object['contains_managed_webhook']
|
151
|
+
object = convert_names_to_ids(object)
|
152
|
+
if object['category_id'].to_i.zero?
|
153
|
+
trigger_category = Readiness::Zendesk::TriggerCategories.find_by_name(@zendesk_client, object['category_id'], @categories)
|
154
|
+
object['category_id'] = trigger_category.id.to_s
|
155
|
+
end
|
145
156
|
validity_check(f, object)
|
146
157
|
object['id'] = nil
|
147
158
|
array.push(Zendesk::Triggers.new(object))
|
@@ -151,6 +162,64 @@ module Readiness
|
|
151
162
|
array
|
152
163
|
end
|
153
164
|
|
165
|
+
##
|
166
|
+
# Converts various user Strings to the proper ID value
|
167
|
+
#
|
168
|
+
# @author Jason Colyer
|
169
|
+
# @since 1.0.92
|
170
|
+
# @param trigger [Hash] The trigger information from the YAMl file
|
171
|
+
# @return [Hash]
|
172
|
+
def self.convert_names_to_ids(trigger)
|
173
|
+
%w[any all].each do |type|
|
174
|
+
trigger['conditions'][type].each_with_index do |c, i|
|
175
|
+
if c['field'] == 'ticket_form_id'
|
176
|
+
if c['value'] =~ /Form\:\ /
|
177
|
+
name = c['value'].split('Form: ').last
|
178
|
+
ticket_form = Readiness::Zendesk::TicketForms.find_by_name(@zendesk_client, name, @ticket_forms)
|
179
|
+
trigger['conditions'][type][i]['value'] = ticket_form.id.to_s
|
180
|
+
end
|
181
|
+
end
|
182
|
+
if c['field'] =~ /Field\:\ /
|
183
|
+
name = c['field'].split('Field: ').last
|
184
|
+
ticket_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, name, @ticket_fields)
|
185
|
+
trigger['conditions'][type][i]['value'] = "custom_fields_#{ticket_field.id}"
|
186
|
+
end
|
187
|
+
if c['value'].to_s =~ /Schedule\:\ /
|
188
|
+
name = c['value'].split('Schedule: ').last
|
189
|
+
schedule = Readiness::Zendesk::Schedules.find_by_name(@zendesk_client, name, @schedules)
|
190
|
+
trigger['conditions'][type][i]['value'] = schedule.id.to_s
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
trigger['actions'].each_with_index do |a, i|
|
195
|
+
if a['field'] == 'notification_webhook'
|
196
|
+
if a['value'].first =~ /^Webhook\:\ /
|
197
|
+
name = a['value'].first.split('Webhook: ').last
|
198
|
+
webhook = Readiness::Zendesk::Webhooks.find_by_name(@zendesk_client, name, @webhooks)
|
199
|
+
trigger['actions'][i]['value'][0] = webhook.id.to_s
|
200
|
+
end
|
201
|
+
end
|
202
|
+
if a['field'] == 'ticket_form_id'
|
203
|
+
if a['value'] =~ /Form\:\ /
|
204
|
+
name = a['value'].split('Form: ').last
|
205
|
+
ticket_form = Readiness::Zendesk::TicketForms.find_by_name(@zendesk_client, name, @ticket_forms)
|
206
|
+
trigger['actions'][i]['value'] = ticket_form.id.to_s
|
207
|
+
end
|
208
|
+
end
|
209
|
+
if a['field'] =~ /Field\:\ /
|
210
|
+
name = a['field'].split('Field: ').last
|
211
|
+
ticket_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, name, @ticket_fields)
|
212
|
+
trigger['actions'][i]['field'] = "custom_fields_#{ticket_field.id}"
|
213
|
+
end
|
214
|
+
if a['field'] == 'set_schedule' && a['value'].to_s =~ /Schedule\:\ /
|
215
|
+
name = a['value'].split('Schedule: ').last
|
216
|
+
schedule = Readiness::Zendesk::Schedules.find_by_name(@zendesk_client, name, @schedules)
|
217
|
+
trigger['actions'][i]['value'] = schedule.id.to_s
|
218
|
+
end
|
219
|
+
end
|
220
|
+
trigger
|
221
|
+
end
|
222
|
+
|
154
223
|
##
|
155
224
|
# Outputs an error report and exits with a status code of 1
|
156
225
|
#
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Defines the module Readiness.
|
4
|
+
module Readiness
|
5
|
+
# Defines the module Zendesk
|
6
|
+
module Zendesk
|
7
|
+
##
|
8
|
+
# Defines the class Webhooks within the module {Readiness::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.92
|
12
|
+
# @todo Find methods
|
13
|
+
# @todo Create method
|
14
|
+
# @todo Update method
|
15
|
+
# @todo Delete method
|
16
|
+
# @todo Holiday methods
|
17
|
+
# @todo Update Intervals method
|
18
|
+
class Schedules < Readiness::Client
|
19
|
+
attr_accessor :id, :intervals, :name, :time_zone
|
20
|
+
|
21
|
+
##
|
22
|
+
# Creates a new {Readiness::Zendesk::Schedules} instance
|
23
|
+
#
|
24
|
+
# @author Jason Colyer
|
25
|
+
# @since 1.0.92
|
26
|
+
# @param object [Object] An instance of {Readiness::Zendesk::Schedules}
|
27
|
+
# @example
|
28
|
+
# require 'support_readiness'
|
29
|
+
# Readiness::Zendesk::Schedules.new
|
30
|
+
def initialize(object = {})
|
31
|
+
@id = object['id']
|
32
|
+
@intervals = object['intervals']
|
33
|
+
@name = object['name']
|
34
|
+
@time_zone = object['time_zone']
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Lists schedules
|
39
|
+
#
|
40
|
+
# @author Jason Colyer
|
41
|
+
# @since 1.0.92
|
42
|
+
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
43
|
+
# @return [Array]
|
44
|
+
# @see https://developer.zendesk.com/api-reference/ticketing/ticket-management/schedules/#list-schedules Zendesk API > Schedules > List Schedules
|
45
|
+
# @example
|
46
|
+
# require 'support_readiness'
|
47
|
+
# config = Readiness::Zendesk::Configuration.new
|
48
|
+
# config.username = 'alice@example.com'
|
49
|
+
# config.token = 'test123abc'
|
50
|
+
# config.url = 'https://example.zendesk.com/api/v2'
|
51
|
+
# client = Readiness::Zendesk::Client.new(config)
|
52
|
+
# categories = Readiness::Zendesk::Schedules.list(client)
|
53
|
+
# pp categories.first.id
|
54
|
+
# # => 10001
|
55
|
+
def self.list(client)
|
56
|
+
response = client.connection.get 'business_hours/schedules'
|
57
|
+
handle_request_error(0, 'Zendesk', response.status) unless response.status == 200
|
58
|
+
body = Oj.load(response.body)
|
59
|
+
body['schedules'].map { |t| Schedules.new(t) }
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# Locates a schehdule within Zendesk by name. Can utilize a cacheh for quicker results
|
64
|
+
#
|
65
|
+
# @author Jason Colyer
|
66
|
+
# @since 1.0.92
|
67
|
+
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
68
|
+
# @param name [String] The webhook name to look for
|
69
|
+
# @param cache [Array] The results of {Readiness::Zendesk::Schedules#list}
|
70
|
+
# @return [Object] An instance of {Readiness::Zendesk::Schedules}
|
71
|
+
# @example
|
72
|
+
# require 'support_readiness'
|
73
|
+
# config = Readiness::Zendesk::Configuration.new
|
74
|
+
# config.username = 'alice@example.com'
|
75
|
+
# config.token = 'test123abc'
|
76
|
+
# config.url = 'https://example.zendesk.com/api/v2'
|
77
|
+
# client = Readiness::Zendesk::Client.new(config)
|
78
|
+
# schedule = Readiness::Zendesk::Schedules.find_by_name!(client, 'North America')
|
79
|
+
# pp schedule.id
|
80
|
+
# # => 1
|
81
|
+
# list = Readiness::Zendesk::Schedules.list(client)
|
82
|
+
# schedule = Readiness::Zendesk::Schedules.find_by_name!(client, 'North America', list)
|
83
|
+
# pp schedule.id
|
84
|
+
# # => 1
|
85
|
+
def self.find_by_name(client, name, cache = nil)
|
86
|
+
list = if cache.nil?
|
87
|
+
Schedules.list(client)
|
88
|
+
else
|
89
|
+
cache
|
90
|
+
end
|
91
|
+
list.detect { |c| c.name == name }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -154,12 +154,13 @@ module Readiness
|
|
154
154
|
end
|
155
155
|
|
156
156
|
##
|
157
|
-
# Locates a ticket field within Zendesk by name.
|
157
|
+
# Locates a ticket field within Zendesk by name. Can utilize a cacheh for quicker results
|
158
158
|
#
|
159
159
|
# @author Jason Colyer
|
160
160
|
# @since 1.0.12
|
161
161
|
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
162
162
|
# @param name [String] The ticket field name to look for
|
163
|
+
# @param cache [Array] The results of {Readiness::Zendesk::Webhooks#list}
|
163
164
|
# @return [Object] An instance of {Readiness::Zendesk::TicketFields}
|
164
165
|
# @example
|
165
166
|
# require 'support_readiness'
|
@@ -171,8 +172,12 @@ module Readiness
|
|
171
172
|
# field = Readiness::Zendesk::TicketFields.find_by_name(client, 'Age')
|
172
173
|
# pp field.id
|
173
174
|
# # => 89
|
174
|
-
def self.find_by_name(client, name)
|
175
|
-
fields =
|
175
|
+
def self.find_by_name(client, name, cache = nil)
|
176
|
+
fields = if cache.nil?
|
177
|
+
TicketFields.list(client)
|
178
|
+
else
|
179
|
+
cache
|
180
|
+
end
|
176
181
|
fields.detect { |f| f.title == name }
|
177
182
|
end
|
178
183
|
|
@@ -154,12 +154,13 @@ module Readiness
|
|
154
154
|
end
|
155
155
|
|
156
156
|
##
|
157
|
-
# Locates a ticket form within Zendesk by name.
|
157
|
+
# Locates a ticket form within Zendesk by name. Can utilize a cacheh for quicker results
|
158
158
|
#
|
159
159
|
# @author Jason Colyer
|
160
160
|
# @since 1.0.12
|
161
161
|
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
162
162
|
# @param name [String] The ticket form name to look for
|
163
|
+
# @param cache [Array] The results of {Readiness::Zendesk::Webhooks#list}
|
163
164
|
# @return [Object] An instance of {Readiness::Zendesk::TicketForms}
|
164
165
|
# @example
|
165
166
|
# require 'support_readiness'
|
@@ -171,8 +172,12 @@ module Readiness
|
|
171
172
|
# form = Readiness::Zendesk::TicketForms.find_by_name(client, 'Snowboard Problem')
|
172
173
|
# pp form.id
|
173
174
|
# # => 47
|
174
|
-
def self.find_by_name(client, name)
|
175
|
-
forms =
|
175
|
+
def self.find_by_name(client, name, cache = nil)
|
176
|
+
forms = if cache.nil?
|
177
|
+
TicketForms.list(client)
|
178
|
+
else
|
179
|
+
cache
|
180
|
+
end
|
176
181
|
forms.detect { |f| f.name == name }
|
177
182
|
end
|
178
183
|
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Defines the module Readiness.
|
4
|
+
module Readiness
|
5
|
+
# Defines the module Zendesk
|
6
|
+
module Zendesk
|
7
|
+
##
|
8
|
+
# Defines the class TriggerCategories within the module {Readiness::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.92
|
12
|
+
# @todo Find methods
|
13
|
+
# @todo Create method
|
14
|
+
# @todo Update method
|
15
|
+
# @todo Delete method
|
16
|
+
class TriggerCategories < Readiness::Client
|
17
|
+
attr_accessor :id, :name, :position
|
18
|
+
|
19
|
+
##
|
20
|
+
# Creates a new {Readiness::Zendesk::TriggerCategories} instance
|
21
|
+
#
|
22
|
+
# @author Jason Colyer
|
23
|
+
# @since 1.0.92
|
24
|
+
# @param object [Object] An instance of {Readiness::Zendesk::TriggerCategories}
|
25
|
+
# @example
|
26
|
+
# require 'support_readiness'
|
27
|
+
# Readiness::Zendesk::TriggerCategories.new
|
28
|
+
def initialize(object = {})
|
29
|
+
@id = object['id']
|
30
|
+
@name = object['name']
|
31
|
+
@position = object['position']
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# Lists trigger categories
|
36
|
+
#
|
37
|
+
# @author Jason Colyer
|
38
|
+
# @since 1.0.92
|
39
|
+
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
40
|
+
# @return [Array]
|
41
|
+
# @see https://developer.zendesk.com/api-reference/ticketing/business-rules/trigger_categories/#list-ticket-trigger-categories Zendesk API > Ticket Trigger Categories > List Ticket Trigger Categories
|
42
|
+
# @example
|
43
|
+
# require 'support_readiness'
|
44
|
+
# config = Readiness::Zendesk::Configuration.new
|
45
|
+
# config.username = 'alice@example.com'
|
46
|
+
# config.token = 'test123abc'
|
47
|
+
# config.url = 'https://example.zendesk.com/api/v2'
|
48
|
+
# client = Readiness::Zendesk::Client.new(config)
|
49
|
+
# categories = Readiness::Zendesk::TriggerCategories.list(client)
|
50
|
+
# pp categories.first.id
|
51
|
+
# # => 10001
|
52
|
+
def self.list(client)
|
53
|
+
array = []
|
54
|
+
opts = "page[size]=100"
|
55
|
+
loop do
|
56
|
+
response = client.connection.get("trigger_categories?#{opts}")
|
57
|
+
handle_request_error(0, 'Zendesk', response.status) unless response.status == 200
|
58
|
+
body = Oj.load(response.body)
|
59
|
+
array += body['trigger_categories'].map { |t| TriggerCategories.new(t) }
|
60
|
+
break unless body['meta']['has_more']
|
61
|
+
|
62
|
+
opts = body['links']['next'].split('?').last
|
63
|
+
end
|
64
|
+
array
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# Locates a trigger category within Zendesk by name. Can utilize a cacheh for quicker results
|
69
|
+
#
|
70
|
+
# @author Jason Colyer
|
71
|
+
# @since 1.0.92
|
72
|
+
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
73
|
+
# @param name [String] The trigger category name to look for
|
74
|
+
# @param cache [Array] The results of {Readiness::Zendesk::TriggerCategories#list}
|
75
|
+
# @return [Object] An instance of {Readiness::Zendesk::TriggerCategories}
|
76
|
+
# @example
|
77
|
+
# require 'support_readiness'
|
78
|
+
# config = Readiness::Zendesk::Configuration.new
|
79
|
+
# config.username = 'alice@example.com'
|
80
|
+
# config.token = 'test123abc'
|
81
|
+
# config.url = 'https://example.zendesk.com/api/v2'
|
82
|
+
# client = Readiness::Zendesk::Client.new(config)
|
83
|
+
# category = Readiness::Zendesk::TriggerCategories.find_by_name!(client, 'Notification App')
|
84
|
+
# pp category.id
|
85
|
+
# # => 10092446182300
|
86
|
+
# list = Readiness::Zendesk::TriggerCategories.list(client)
|
87
|
+
# category = Readiness::Zendesk::TriggerCategories.find_by_name!(client, 'Notification App', list)
|
88
|
+
# pp category.id
|
89
|
+
# # => 10092446182300
|
90
|
+
def self.find_by_name(client, name, cache = nil)
|
91
|
+
categories = if cache.nil?
|
92
|
+
TriggerCategories.list(client)
|
93
|
+
else
|
94
|
+
cache
|
95
|
+
end
|
96
|
+
categories.detect { |c| c.name == name }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Defines the module Readiness.
|
4
|
+
module Readiness
|
5
|
+
# Defines the module Zendesk
|
6
|
+
module Zendesk
|
7
|
+
##
|
8
|
+
# Defines the class Webhooks within the module {Readiness::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.92
|
12
|
+
# @todo Find methods
|
13
|
+
# @todo Create method
|
14
|
+
# @todo Update method
|
15
|
+
# @todo Patch method
|
16
|
+
# @todo Test method
|
17
|
+
# @todo Delete method
|
18
|
+
class Webhooks < Readiness::Client
|
19
|
+
attr_accessor :authenticiation, :custom_headers, :endpoint, :http_method, :id, :name, :request_format, :status, :subscriptions
|
20
|
+
|
21
|
+
##
|
22
|
+
# Creates a new {Readiness::Zendesk::Webhooks} instance
|
23
|
+
#
|
24
|
+
# @author Jason Colyer
|
25
|
+
# @since 1.0.92
|
26
|
+
# @param object [Object] An instance of {Readiness::Zendesk::Webhooks}
|
27
|
+
# @example
|
28
|
+
# require 'support_readiness'
|
29
|
+
# Readiness::Zendesk::Webhooks.new
|
30
|
+
def initialize(object = {})
|
31
|
+
@authenticiation = object['authenticiation']
|
32
|
+
@custom_headers = object['custom_headers']
|
33
|
+
@endpoint = object['endpoint']
|
34
|
+
@http_method = object['http_method']
|
35
|
+
@id = object['id']
|
36
|
+
@name = object['name']
|
37
|
+
@request_format = object['request_format']
|
38
|
+
@status = object['status']
|
39
|
+
@subscriptions = object['subscriptions']
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Lists webhooks
|
44
|
+
#
|
45
|
+
# @author Jason Colyer
|
46
|
+
# @since 1.0.92
|
47
|
+
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
48
|
+
# @return [Array]
|
49
|
+
# @see https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#list-webhooks Zendesk API > Webhooks > List Webhooks
|
50
|
+
# @example
|
51
|
+
# require 'support_readiness'
|
52
|
+
# config = Readiness::Zendesk::Configuration.new
|
53
|
+
# config.username = 'alice@example.com'
|
54
|
+
# config.token = 'test123abc'
|
55
|
+
# config.url = 'https://example.zendesk.com/api/v2'
|
56
|
+
# client = Readiness::Zendesk::Client.new(config)
|
57
|
+
# categories = Readiness::Zendesk::Webhooks.list(client)
|
58
|
+
# pp categories.first.id
|
59
|
+
# # => 10001
|
60
|
+
def self.list(client)
|
61
|
+
array = []
|
62
|
+
opts = "page[size]=100"
|
63
|
+
loop do
|
64
|
+
response = client.connection.get("webhooks?#{opts}")
|
65
|
+
handle_request_error(0, 'Zendesk', response.status) unless response.status == 200
|
66
|
+
body = Oj.load(response.body)
|
67
|
+
array += body['webhooks'].map { |t| Webhooks.new(t) }
|
68
|
+
break if !body['meta']['has_more']
|
69
|
+
|
70
|
+
opts = body['links']['next'].split('?').last
|
71
|
+
end
|
72
|
+
array
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Locates a webhook within Zendesk by name. Can utilize a cacheh for quicker results
|
77
|
+
#
|
78
|
+
# @author Jason Colyer
|
79
|
+
# @since 1.0.92
|
80
|
+
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
81
|
+
# @param name [String] The webhook name to look for
|
82
|
+
# @param cache [Array] The results of {Readiness::Zendesk::Webhooks#list}
|
83
|
+
# @return [Object] An instance of {Readiness::Zendesk::Webhooks}
|
84
|
+
# @example
|
85
|
+
# require 'support_readiness'
|
86
|
+
# config = Readiness::Zendesk::Configuration.new
|
87
|
+
# config.username = 'alice@example.com'
|
88
|
+
# config.token = 'test123abc'
|
89
|
+
# config.url = 'https://example.zendesk.com/api/v2'
|
90
|
+
# client = Readiness::Zendesk::Client.new(config)
|
91
|
+
# webhook = Readiness::Zendesk::Webhooks.find_by_name!(client, 'Post update to ticket')
|
92
|
+
# pp webhook.id
|
93
|
+
# # => "01FQKTKVAQJ2BYDZ47KT35SCP9"
|
94
|
+
# list = Readiness::Zendesk::Webhhooks.list(client)
|
95
|
+
# webhook = Readiness::Zendesk::Webhooks.find_by_name!(client, 'Post update to ticket', list)
|
96
|
+
# pp webhook.id
|
97
|
+
# # => "01FQKTKVAQJ2BYDZ47KT35SCP9"
|
98
|
+
def self.find_by_name(client, name, cache = nil)
|
99
|
+
list = if cache.nil?
|
100
|
+
Webhooks.list(client)
|
101
|
+
else
|
102
|
+
cache
|
103
|
+
end
|
104
|
+
list.detect { |c| c.name == name }
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -25,6 +25,7 @@ module Readiness
|
|
25
25
|
require "#{__dir__}/zendesk/organizations"
|
26
26
|
require "#{__dir__}/zendesk/roles"
|
27
27
|
require "#{__dir__}/zendesk/search"
|
28
|
+
require "#{__dir__}/zendesk/schedules"
|
28
29
|
require "#{__dir__}/zendesk/sla_policies"
|
29
30
|
require "#{__dir__}/zendesk/theme_job_statuses"
|
30
31
|
require "#{__dir__}/zendesk/themes"
|
@@ -33,9 +34,11 @@ module Readiness
|
|
33
34
|
require "#{__dir__}/zendesk/ticket_forms"
|
34
35
|
require "#{__dir__}/zendesk/tickets"
|
35
36
|
require "#{__dir__}/zendesk/triggers"
|
37
|
+
require "#{__dir__}/zendesk/trigger_categories"
|
36
38
|
require "#{__dir__}/zendesk/user_field_options"
|
37
39
|
require "#{__dir__}/zendesk/user_fields"
|
38
40
|
require "#{__dir__}/zendesk/users"
|
39
41
|
require "#{__dir__}/zendesk/views"
|
42
|
+
require "#{__dir__}/zendesk/webhooks"
|
40
43
|
end
|
41
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_support_readiness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.92
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Colyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -401,6 +401,7 @@ files:
|
|
401
401
|
- lib/support_readiness/zendesk/organization_memberships.rb
|
402
402
|
- lib/support_readiness/zendesk/organizations.rb
|
403
403
|
- lib/support_readiness/zendesk/roles.rb
|
404
|
+
- lib/support_readiness/zendesk/schedules.rb
|
404
405
|
- lib/support_readiness/zendesk/search.rb
|
405
406
|
- lib/support_readiness/zendesk/sla_policies.rb
|
406
407
|
- lib/support_readiness/zendesk/theme_job_statuses.rb
|
@@ -409,11 +410,13 @@ files:
|
|
409
410
|
- lib/support_readiness/zendesk/ticket_fields.rb
|
410
411
|
- lib/support_readiness/zendesk/ticket_forms.rb
|
411
412
|
- lib/support_readiness/zendesk/tickets.rb
|
413
|
+
- lib/support_readiness/zendesk/trigger_categories.rb
|
412
414
|
- lib/support_readiness/zendesk/triggers.rb
|
413
415
|
- lib/support_readiness/zendesk/user_field_options.rb
|
414
416
|
- lib/support_readiness/zendesk/user_fields.rb
|
415
417
|
- lib/support_readiness/zendesk/users.rb
|
416
418
|
- lib/support_readiness/zendesk/views.rb
|
419
|
+
- lib/support_readiness/zendesk/webhooks.rb
|
417
420
|
homepage: https://gitlab.com/gitlab-support-readiness/gitlab_support_readiness_gem
|
418
421
|
licenses:
|
419
422
|
- MIT
|