gitlab-customer-support-operations_zendesk 1.0.0
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 +7 -0
- data/lib/support_ops_zendesk/packages.rb +89 -0
- data/lib/support_ops_zendesk/zendesk/app_installations.rb +62 -0
- data/lib/support_ops_zendesk/zendesk/app_job_statuses.rb +157 -0
- data/lib/support_ops_zendesk/zendesk/apps.rb +476 -0
- data/lib/support_ops_zendesk/zendesk/articles.rb +362 -0
- data/lib/support_ops_zendesk/zendesk/audit_logs.rb +166 -0
- data/lib/support_ops_zendesk/zendesk/automations.rb +390 -0
- data/lib/support_ops_zendesk/zendesk/base.rb +472 -0
- data/lib/support_ops_zendesk/zendesk/brands.rb +172 -0
- data/lib/support_ops_zendesk/zendesk/client.rb +91 -0
- data/lib/support_ops_zendesk/zendesk/comments.rb +37 -0
- data/lib/support_ops_zendesk/zendesk/configuration.rb +138 -0
- data/lib/support_ops_zendesk/zendesk/custom_roles.rb +224 -0
- data/lib/support_ops_zendesk/zendesk/dynamic_content.rb +297 -0
- data/lib/support_ops_zendesk/zendesk/dynamic_content_variants.rb +309 -0
- data/lib/support_ops_zendesk/zendesk/group_memberships.rb +337 -0
- data/lib/support_ops_zendesk/zendesk/groups.rb +385 -0
- data/lib/support_ops_zendesk/zendesk/help_center_categories.rb +332 -0
- data/lib/support_ops_zendesk/zendesk/help_center_content_tags.rb +237 -0
- data/lib/support_ops_zendesk/zendesk/help_center_management_permission_groups.rb +271 -0
- data/lib/support_ops_zendesk/zendesk/help_center_sections.rb +378 -0
- data/lib/support_ops_zendesk/zendesk/help_center_topics.rb +274 -0
- data/lib/support_ops_zendesk/zendesk/help_center_user_segments.rb +279 -0
- data/lib/support_ops_zendesk/zendesk/job_statuses.rb +231 -0
- data/lib/support_ops_zendesk/zendesk/locales.rb +326 -0
- data/lib/support_ops_zendesk/zendesk/macros.rb +407 -0
- data/lib/support_ops_zendesk/zendesk/oauth_clients.rb +186 -0
- data/lib/support_ops_zendesk/zendesk/oauth_tokens.rb +114 -0
- data/lib/support_ops_zendesk/zendesk/organization_fields.rb +282 -0
- data/lib/support_ops_zendesk/zendesk/organization_memberships.rb +336 -0
- data/lib/support_ops_zendesk/zendesk/organizations.rb +568 -0
- data/lib/support_ops_zendesk/zendesk/requester_roles.rb +58 -0
- data/lib/support_ops_zendesk/zendesk/satisfaction_reasons.rb +161 -0
- data/lib/support_ops_zendesk/zendesk/schedule_holidays.rb +27 -0
- data/lib/support_ops_zendesk/zendesk/schedules.rb +192 -0
- data/lib/support_ops_zendesk/zendesk/search.rb +185 -0
- data/lib/support_ops_zendesk/zendesk/sla_policies.rb +302 -0
- data/lib/support_ops_zendesk/zendesk/targets.rb +96 -0
- data/lib/support_ops_zendesk/zendesk/theme_job_statuses.rb +154 -0
- data/lib/support_ops_zendesk/zendesk/themes.rb +328 -0
- data/lib/support_ops_zendesk/zendesk/ticket_field_options.rb +154 -0
- data/lib/support_ops_zendesk/zendesk/ticket_fields.rb +357 -0
- data/lib/support_ops_zendesk/zendesk/ticket_forms.rb +370 -0
- data/lib/support_ops_zendesk/zendesk/ticket_user_types.rb +67 -0
- data/lib/support_ops_zendesk/zendesk/tickets.rb +837 -0
- data/lib/support_ops_zendesk/zendesk/translations.rb +310 -0
- data/lib/support_ops_zendesk/zendesk/trigger_categories.rb +275 -0
- data/lib/support_ops_zendesk/zendesk/triggers.rb +427 -0
- data/lib/support_ops_zendesk/zendesk/user_field_options.rb +153 -0
- data/lib/support_ops_zendesk/zendesk/user_fields.rb +312 -0
- data/lib/support_ops_zendesk/zendesk/users.rb +889 -0
- data/lib/support_ops_zendesk/zendesk/via_types.rb +137 -0
- data/lib/support_ops_zendesk/zendesk/views.rb +636 -0
- data/lib/support_ops_zendesk/zendesk/webhooks.rb +206 -0
- data/lib/support_ops_zendesk/zendesk.rb +66 -0
- data/lib/support_ops_zendesk.rb +29 -0
- metadata +274 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 950534203deda40c1904a8d60a7b4508ff4c6da8e5957d8d5dcf853ea4064fcc
|
4
|
+
data.tar.gz: 885b715a608b92039ee319e5b1413c5ee1e9d013ec9c16e2260f256abb276c44
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1bc75a0f801939a845caf4e99cf2698c490992e2a259c9568165bd7c66996b5ba0b61e24a897677fcdb843ddd192340952363c7f4d9807a874bd1d094a2cd245
|
7
|
+
data.tar.gz: 97bf57bfaebe458579344da2cbcc121e5b65f7d5a9f37c9b1b7958803a3d6e6cda10dbe08a22c2d43383480b331a12dd6308e1d4970cdc8b3d484c5067366a7b
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Defines the module SupportOps.
|
4
|
+
module SupportOps
|
5
|
+
##
|
6
|
+
# Defines the class Packages within the module {SupportOps}.
|
7
|
+
#
|
8
|
+
# @author Jason Colyer
|
9
|
+
# @since 1.0.0
|
10
|
+
class Packages
|
11
|
+
##
|
12
|
+
# Creates a zipfile
|
13
|
+
#
|
14
|
+
# @author Jason Colyer
|
15
|
+
# @since 1.0.0
|
16
|
+
# @overload create_zipfile!(key: value)
|
17
|
+
# @param item_list [Array required] The list of entries to add to the
|
18
|
+
# zipfile; it will recursively grab files if given directories in the
|
19
|
+
# list
|
20
|
+
# @param output_file [String option] The zipfile name to create
|
21
|
+
# @param input_dir [String option] The relative path where the items are
|
22
|
+
# located
|
23
|
+
# @return [String] The The zipfile that was created
|
24
|
+
# @example
|
25
|
+
# require 'support_ops_zendesk'
|
26
|
+
#
|
27
|
+
# list = [
|
28
|
+
# 'data/1',
|
29
|
+
# 'data/2',
|
30
|
+
# 'data/3',
|
31
|
+
# 'data/a/b/c'
|
32
|
+
# ]
|
33
|
+
# file = SupportOps::Packages.create_zipfile!(item_list: list)
|
34
|
+
# pp file
|
35
|
+
# # => "data/20250407135848913.zip"
|
36
|
+
# file = SupportOps::Packages.create_zipfile!(item_list: list, output_file: 'data/application.zip')
|
37
|
+
# pp file
|
38
|
+
# # => "data/application.zip"
|
39
|
+
def self.create_zipfile!(**args)
|
40
|
+
raise 'No file list provided' if args[:item_list].nil?
|
41
|
+
raise 'No file list entries provided' unless args[:item_list].is_a? Array
|
42
|
+
raise 'No file list entries provided' if args[:item_list].count.zero?
|
43
|
+
args[:output_file] = "data/#{Time.now.strftime('%Y%m%d%H%M%S%L')}.zip" unless args[:output_file]
|
44
|
+
args[:input_dir] = './' unless args[:input_dir]
|
45
|
+
@input_dir = args[:input_dir]
|
46
|
+
FileUtils.rm_f args[:output_file] if File.exist? args[:output_file]
|
47
|
+
Zip::File.open(args[:output_file], create: true) do |zipfile|
|
48
|
+
write_zipfile_entries args[:item_list], zipfile
|
49
|
+
end
|
50
|
+
args[:output_file]
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Writes an entry to a zipfile
|
55
|
+
#
|
56
|
+
# @author Jason Colyer
|
57
|
+
# @since 1.0.0
|
58
|
+
# @param items [Array] The list of items being worked with
|
59
|
+
# @param path [String] The path being worked with (defaults to '')
|
60
|
+
# @param zipfile [Object]
|
61
|
+
def self.write_zipfile_entries(items, path = '', zipfile)
|
62
|
+
items.each do |i|
|
63
|
+
zipfile_path = path == '' ? i : File.join(path, i)
|
64
|
+
disk_path = File.join(@input_dir, zipfile_path)
|
65
|
+
if File.directory? disk_path
|
66
|
+
handle_zipfile_directory zipfile, zipfile_path, disk_path
|
67
|
+
elsif File.file? disk_path
|
68
|
+
zipfile.add(zipfile_path, disk_path)
|
69
|
+
else
|
70
|
+
puts "Unable to locate #{i}, skipping it."
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Handles writing a directory recursively to a zipfile
|
77
|
+
#
|
78
|
+
# @author Jason Colyer
|
79
|
+
# @since 1.0.0
|
80
|
+
# @param zipfile [Object]
|
81
|
+
# @param zipfile_path [String] The path of the item being worked on in the zipfile
|
82
|
+
# @param disk_path [String] The path of the item being worked on in the disk
|
83
|
+
def self.handle_zipfile_directory(zipfile, zipfile_path, disk_path)
|
84
|
+
zipfile.mkdir zipfile_path
|
85
|
+
subdir = Dir.entries(disk_path) - %w[. ..]
|
86
|
+
write_zipfile_entries subdir, zipfile_path, zipfile
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Defines the module SupportOps.
|
4
|
+
module SupportOps
|
5
|
+
# Defines the module Zendesk
|
6
|
+
module Zendesk
|
7
|
+
##
|
8
|
+
# Defines the class AppInstallations within the module {SupportOps::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.0
|
12
|
+
# @attr [Integer] app_id id of the app
|
13
|
+
# @attr [Boolean] collapsible If true, the app can be minimized in the Zendesk user interface (UI)
|
14
|
+
# @attr [String] created_at When the app installation was created
|
15
|
+
# @attr [Boolean] enabled If true, the app installation is enabled
|
16
|
+
# @attr [Array] group_restrictions Group restrictions for the app installation
|
17
|
+
# @attr [Boolean] has_incomplete_subscription If true, the app installation's Stripe payment subscription is incomplete
|
18
|
+
# @attr [Boolean] has_unpaid_subscription If true, the app installation's Stripe payment subscription is unpaid
|
19
|
+
# @attr [Integer] id id of the app installation
|
20
|
+
# @attr [Boolean] paid If true, the app is a paid app
|
21
|
+
# @attr [Boolean] pending_installation If true, the app installation is pending
|
22
|
+
# @attr [String] pending_job_id id for the app installation job
|
23
|
+
# @attr [Object] plan_information Information about the Stripe payment plan for the app installation
|
24
|
+
# @attr [String] product Zendesk product the app is installed on
|
25
|
+
# @attr [Boolean] recurring_payment If true, the app installation has a recurring Stripe payment subscription
|
26
|
+
# @attr [Boolean] redirect_path URL path used to redirect admins after installing the app in the Zendesk UI
|
27
|
+
# @attr [Array] role_restrictions Role restrictions for the app installation
|
28
|
+
# @attr [Boolean] servable If true, user making the API request can use the app installation
|
29
|
+
# @attr [Object] settings Installation settings for the app, formatted as a flat object
|
30
|
+
# @attr [Array] settings_objects Installation settings for the app, formatted as an array of objects
|
31
|
+
# @attr [String] stripe_account App developer's Stripe account id
|
32
|
+
# @attr [String] stripe_publishable_key Publishable key for the app developer's Stripe account
|
33
|
+
# @attr [String] stripe_subscription_id Stripe subscription id for the app installation
|
34
|
+
# @attr [String] updated When the app was last updated
|
35
|
+
# @attr [String] updated_at When the app installation was last updated
|
36
|
+
# @todo Install App > https://developer.zendesk.com/api-reference/ticketing/apps/apps/#install-app
|
37
|
+
# @todo List App Installations > https://developer.zendesk.com/api-reference/ticketing/apps/apps/#list-app-installations
|
38
|
+
# @todo Show App Installation > https://developer.zendesk.com/api-reference/ticketing/apps/apps/#show-app-installation
|
39
|
+
# @todo Update App Installation > https://developer.zendesk.com/api-reference/ticketing/apps/apps/#update-app-installation
|
40
|
+
# @todo Remove App Installation > https://developer.zendesk.com/api-reference/ticketing/apps/apps/#remove-app-installation
|
41
|
+
# @todo List Requirements > https://developer.zendesk.com/api-reference/ticketing/apps/apps/#list-requirements
|
42
|
+
# @todo Get Requirements Install Status > https://developer.zendesk.com/api-reference/ticketing/apps/apps/#get-requirements-install-status
|
43
|
+
class AppInstallations < SupportOps::Zendesk::Base
|
44
|
+
define_attributes :app_id, :collapsible, :created_at, :enabled,
|
45
|
+
:group_restrictions, :has_incomplete_subscription,
|
46
|
+
:has_unpaid_subscription, :id, :paid,
|
47
|
+
:pending_installation, :pending_job_id,
|
48
|
+
:plan_information, :product, :recurring_payment,
|
49
|
+
:redirect_path, :role_restrictions, :servable,
|
50
|
+
:settings, :settings_objects, :stripe_account,
|
51
|
+
:stripe_publishable_key, :stripe_subscription_id,
|
52
|
+
:updated, :updated_at
|
53
|
+
readonly_attributes :collapsible, :created_at,
|
54
|
+
:has_incomplete_subscription,
|
55
|
+
:has_unpaid_subscription, :id, :paid,
|
56
|
+
:pending_installation, :pending_job_id,
|
57
|
+
:plan_information, :product, :servable,
|
58
|
+
:stripe_account, :stripe_publishable_key,
|
59
|
+
:stripe_subscription_id, :updated, :updated_at
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Defines the module SupportOps.
|
4
|
+
module SupportOps
|
5
|
+
# Defines the module Zendesk
|
6
|
+
module Zendesk
|
7
|
+
##
|
8
|
+
# Defines the class AppJobStatuses within the module {SupportOps::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.0
|
12
|
+
# @attr [Integer] app_id The ID of the app created by this job, if it exists
|
13
|
+
# @attr [String] id Automatically assigned when the job is queued
|
14
|
+
# @attr [String] message Message from the job worker, if any
|
15
|
+
# @attr [Integer] progress Number of tasks completed
|
16
|
+
# @attr [Integer] retry_in Number of seconds after which you may re-check status
|
17
|
+
# @attr [String] status One of "queued", "working", "failed", "completed", "killed"
|
18
|
+
# @attr [Integer] total The total number of tasks this job is batching through
|
19
|
+
class AppJobStatuses < SupportOps::Zendesk::Base
|
20
|
+
# @!parse
|
21
|
+
# # Waits for an app job to complete. Be mindful of API limits when setting the wait interval
|
22
|
+
# #
|
23
|
+
# # @author Jason Colyer
|
24
|
+
# # @since 1.0.0
|
25
|
+
# # @overload wait_for_completetion(key: value)
|
26
|
+
# # @param interval [Integer optional] The time to wait between checks. Defaults to 5
|
27
|
+
# # @param verbose [Boolean optional] If you want info lines output. Defaults to false
|
28
|
+
# # @return [Object] Instance of {SupportOps::Zendesk::JobStatuses}
|
29
|
+
# # @note This is inherited from {SupportOps::Zendesk::Base#wait_for_completetion}
|
30
|
+
# # @example
|
31
|
+
# # require 'support_ops_zendesk'
|
32
|
+
# #
|
33
|
+
# # SupportOps::Zendesk::Configuration.configure do |config|
|
34
|
+
# # config.url = 'https://gitlab.zendesk.com/api/v2'
|
35
|
+
# # config.username = 'jason@example.com'
|
36
|
+
# # config.token = 'abc123'
|
37
|
+
# # end
|
38
|
+
# #
|
39
|
+
# # job = SupportOps::Zendesk::AppJobStatuses.get!('8b726e606741012ffc2d782bcb7848fe')
|
40
|
+
# # job.wait_for_completetion(interval: 10, verbose: true)
|
41
|
+
# # # => Waiting 10 seconds before checking 8b726e606741012ffc2d782bcb7848fe
|
42
|
+
# # # => Rechecking status of 8b726e606741012ffc2d782bcb7848fe...status is queued
|
43
|
+
# # # => Waiting 10 seconds before checking 8b726e606741012ffc2d782bcb7848fe
|
44
|
+
# # # => Rechecking status of 8b726e606741012ffc2d782bcb7848fe...status is working
|
45
|
+
# # # => Waiting 10 seconds before checking 8b726e606741012ffc2d782bcb7848fe
|
46
|
+
# # # => Rechecking status of 8b726e606741012ffc2d782bcb7848fe...status is completed
|
47
|
+
# # # => Job is finished with status of completed
|
48
|
+
# # pp job.status
|
49
|
+
# # # => "completed"
|
50
|
+
# # @example
|
51
|
+
# # require 'support_ops_zendesk'
|
52
|
+
# #
|
53
|
+
# # SupportOps::Zendesk::Configuration.configure do |config|
|
54
|
+
# # config.url = 'https://gitlab.zendesk.com/api/v2'
|
55
|
+
# # config.username = 'jason@example.com'
|
56
|
+
# # config.token = 'abc123'
|
57
|
+
# # end
|
58
|
+
# #
|
59
|
+
# # job = SupportOps::Zendesk::AppJobStatuses.get!('8b726e606741012ffc2d782bcb7848fe')
|
60
|
+
# # job.wait_for_completetion(interval: 5, verbose: false)
|
61
|
+
# # pp job.status
|
62
|
+
# # # => "completed"
|
63
|
+
# def wait_for_completetion; end
|
64
|
+
define_attributes :app_id, :id, :message, :progress, :retry_in, :status,
|
65
|
+
:total
|
66
|
+
readonly_attributes :app_id, :id, :message, :progress, :retry_in, :status,
|
67
|
+
:total
|
68
|
+
|
69
|
+
##
|
70
|
+
# Locates a specific app job status in the Zendesk system
|
71
|
+
#
|
72
|
+
# @author Jason Colyer
|
73
|
+
# @since 1.0.0
|
74
|
+
# @see
|
75
|
+
# https://developer.zendesk.com/api-reference/ticketing/apps/apps/#get-job-status
|
76
|
+
# Zendesk API > Apps > Get job status
|
77
|
+
# @see SupportOps::Zendesk::Configuration Setting up a client
|
78
|
+
# @example
|
79
|
+
# require 'support_ops_zendesk'
|
80
|
+
#
|
81
|
+
# SupportOps::Zendesk::Configuration.configure do |config|
|
82
|
+
# config.url = 'https://gitlab.zendesk.com/api/v2'
|
83
|
+
# config.username = 'jason@example.com'
|
84
|
+
# config.token = 'abc123'
|
85
|
+
# end
|
86
|
+
#
|
87
|
+
# job_status = SupportOps::Zendesk::AppJobStatuses.get('82de0b044094f0c67893ac9fe64f1a99')
|
88
|
+
# pp job_status.status
|
89
|
+
# # => "queued"
|
90
|
+
def self.get(object)
|
91
|
+
if object.is_a? AppJobStatuses
|
92
|
+
AppJobStatuses.new(id: id).find
|
93
|
+
else
|
94
|
+
AppJobStatuses.new(id: object).find
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
##
|
99
|
+
# Locates a specific app job status in the Zendesk system
|
100
|
+
#
|
101
|
+
# @author Jason Colyer
|
102
|
+
# @since 1.0.0
|
103
|
+
# @see
|
104
|
+
# https://developer.zendesk.com/api-reference/ticketing/apps/apps/#get-job-status
|
105
|
+
# Zendesk API > Apps > Get job status
|
106
|
+
# @see SupportOps::Zendesk::Configuration Setting up a client
|
107
|
+
# @example
|
108
|
+
# require 'support_ops_zendesk'
|
109
|
+
#
|
110
|
+
# SupportOps::Zendesk::Configuration.configure do |config|
|
111
|
+
# config.url = 'https://gitlab.zendesk.com/api/v2'
|
112
|
+
# config.username = 'jason@example.com'
|
113
|
+
# config.token = 'abc123'
|
114
|
+
# end
|
115
|
+
#
|
116
|
+
# job_status = SupportOps::Zendesk::AppJobStatuses.get!('82de0b044094f0c67893ac9fe64f1a99')
|
117
|
+
# pp job_status.status
|
118
|
+
# # => "queued"
|
119
|
+
def self.get!(object)
|
120
|
+
if object.is_a? AppJobStatuses
|
121
|
+
AppJobStatuses.new(id: id).find!
|
122
|
+
else
|
123
|
+
AppJobStatuses.new(id: object).find!
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
129
|
+
##
|
130
|
+
# @private
|
131
|
+
def get_record
|
132
|
+
response = self.client.connection.get("apps/job_statuses/#{self.id}")
|
133
|
+
return nil if response.status != 200
|
134
|
+
|
135
|
+
Oj.load(response.body)
|
136
|
+
end
|
137
|
+
|
138
|
+
##
|
139
|
+
# @private
|
140
|
+
def wait_for_completetion_record(**args)
|
141
|
+
job_to_check = AppJobStatuses.get!(self.id)
|
142
|
+
verbose = (args[:verbose] ? true : false)
|
143
|
+
interval = (args[:interval].to_i.zero? ? 5 : args[:interval].to_i)
|
144
|
+
loop do
|
145
|
+
puts "Waiting #{interval} seconds before checking #{job_to_check.id}" if verbose
|
146
|
+
sleep interval
|
147
|
+
job_to_check = AppJobStatuses.get!(job_to_check.id)
|
148
|
+
puts "status is #{job_to_check.status}" if verbose
|
149
|
+
break if %w[failed completed killed].include? job_to_check.status
|
150
|
+
end
|
151
|
+
puts "Job is finished with status of #{job_to_check.status}" if verbose
|
152
|
+
response = self.client.connection.get("apps/job_statuses/#{job_to_check.id}")
|
153
|
+
Oj.load(response.body)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|