gitlab_support_readiness 1.0.49 → 1.0.51

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
  SHA256:
3
- metadata.gz: f5ec777cb67781d35e7adf304810f87ec38a88d73e2465e0e6c7e203bc20254f
4
- data.tar.gz: c7ceeea129c70de4fb9f9f02e251388457405fc20162b8b75872f1ac5516ee2a
3
+ metadata.gz: d4f9ad1e0298c95871b0cfdc7edc2eac853bd60076df6b2ec7aabe9bcb497c00
4
+ data.tar.gz: 2da63507f1209b6b04cb26a706412dea996b9687d51c408cb98ef2139ca1fbda
5
5
  SHA512:
6
- metadata.gz: 6006e1b63ccd5018eadcaa780a9a2c52353df6d812790c8a0c4d2e36b14a198b2220755aaa7aa21e08a50fa283b4cc7f748ff06618283302b07b3e955b8c6df0
7
- data.tar.gz: c21bb79e2e662c4c40390b008d343b6a6e51aa6d5d0ada090611fe4e18aca07c9ae6b7c0416a593d0f821751dabaf08bcb760b7e7f70f4c4256fbc32df3becbd
6
+ metadata.gz: 5c1ce97552cddc69435b54ceca4a352673ffbb9782aba4c53430c97beebbd04a893d0a0f60525bc79f296dc80e2046f44423aa7b458fba4e527ccb26a7d7eb19
7
+ data.tar.gz: a728cb90f98aeea3f303264628efb053d794195ce27f98063ea604fb54057a0710393a1ed2f9462b6beb7022ee373322437668f264f06298fb1edfaf1be5466c
@@ -0,0 +1,191 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Defines the module Readiness.
4
+ module Readiness
5
+ # Defines the module SupportSuperFormProcessor
6
+ module SupportSuperFormProcessor
7
+ ##
8
+ # Defines the class GratisRequest within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.51
12
+ class GratisRequest < Readiness::Client
13
+ ##
14
+ # Process a Gratis Request request
15
+ #
16
+ # @author Jason Colyer
17
+ # @since 1.0.51
18
+ def self.process!(sfdc_client, zendesk_client)
19
+ @sfdc_client = sfdc_client
20
+ @zendesk_client = zendesk_client
21
+ zd_user
22
+ ticket = Readiness::Zendesk::Tickets.new
23
+ ticket.email_ccs = [
24
+ { user_id: zd_user.id }
25
+ ]
26
+ ticket.requester = { name: customer_name, email: customer_email }
27
+ ticket.comment = { html_body: body }
28
+ ticket.subject = 'Gratis Support Request'
29
+ ticket.tags = %w[support_gratis_request manual_support_upgrade]
30
+ ticket.priority = 'medium'
31
+ ticket.status = 'new'
32
+ ticket.ticket_form_id = 12829030177948
33
+ ticket.custom_fields = [
34
+ { id: 360020614420, value: 'aof_other' },
35
+ { id: 360020735259, value: 'stage-frt' },
36
+ { id: 360004394559, value: 'free_plan' },
37
+ { id: 360005183820, value: zd_user.name },
38
+ { id: 360005248219, value: zd_user.email },
39
+ { id: 360020735319, value: 'medium' },
40
+ { id: 360020288373, value: ticket_arr },
41
+ { id: 360014776453, value: 'medium' },
42
+ { id: 45195248, value: 'created_by_agent' },
43
+ { id: 360018253094, value: region },
44
+ { id: 6978327875612, value: opportunity_link.split('/')[-2] }
45
+ ]
46
+ create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket)
47
+ puts "Ticket created: https://gitlab.zendesk.com/agent/tickets/#{create.id}"
48
+ end
49
+
50
+ ##
51
+ # Sets the global variable requester
52
+ #
53
+ # @author Jason Colyer
54
+ # @since 1.0.51
55
+ def self.requester
56
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
57
+ end
58
+
59
+ ##
60
+ # Sets the global variable requester_email
61
+ #
62
+ # @author Jason Colyer
63
+ # @since 1.0.51
64
+ def self.requester_email
65
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
66
+ end
67
+
68
+ ##
69
+ # Sets the global variable zd_user
70
+ #
71
+ # @author Jason Colyer
72
+ # @since 1.0.51
73
+ def self.zd_user
74
+ @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
75
+ end
76
+
77
+ ##
78
+ # Sets the global variable customer_email
79
+ #
80
+ # @author Jason Colyer
81
+ # @since 1.0.51
82
+ def self.customer_email
83
+ @customer_email ||= ENV.fetch('GRATIS_CUSTOMER_EMAIL')
84
+ end
85
+
86
+ ##
87
+ # Sets the global variable customer_name
88
+ #
89
+ # @author Jason Colyer
90
+ # @since 1.0.51
91
+ def self.customer_name
92
+ @customer_name ||= ENV.fetch('GRATIS_CUSTOMER_NAME')
93
+ end
94
+
95
+ ##
96
+ # Sets the global variable opportunity_link
97
+ #
98
+ # @author Jason Colyer
99
+ # @since 1.0.51
100
+ def self.opportunity_link
101
+ @opportunity_link ||= ENV.fetch('GRATIS_OPPORTUNITY_LINK')
102
+ end
103
+
104
+ ##
105
+ # Sets the global variable context
106
+ #
107
+ # @author Jason Colyer
108
+ # @since 1.0.51
109
+ def self.context
110
+ @context ||= ENV.fetch('GRATIS_CONTEXT')
111
+ end
112
+
113
+ ##
114
+ # Sets the global variable region
115
+ #
116
+ # @author Jason Colyer
117
+ # @since 1.0.51
118
+ def self.region
119
+ @region ||= ENV.fetch('GRATIS_REGION')
120
+ end
121
+
122
+ ##
123
+ # Sets the global variable sfdc_opportunity
124
+ #
125
+ # @author Jason Colyer
126
+ # @since 1.0.51
127
+ def self.sfdc_opportunity
128
+ @sfdc_opportunity ||= fetch_sfdc_opportunity
129
+ end
130
+
131
+ ##
132
+ # Gets the SFDC Opportunity information
133
+ #
134
+ # @author Jason Colyer
135
+ # @since 1.0.51
136
+ def self.fetch_sfdc_opportunity
137
+ query = Readiness::Salesforce::Queries.new(opportunity_query)
138
+ results = Readiness::Salesforce::Queries.run!(@sfdc_client, query)
139
+ results.first
140
+ end
141
+
142
+ ##
143
+ # Returns a SOQL query string to get Opportunity info
144
+ #
145
+ # @author Jason Colyer
146
+ # @since 1.0.51
147
+ def self.opportunity_query
148
+ <<~STRING
149
+ SELECT
150
+ Opportunity.Id,
151
+ Opportunity.ARR__c
152
+ FROM Opportunity
153
+ WHERE
154
+ Opportunity.Id = '#{opportunity_link.split('/')[-2]}'
155
+ STRING
156
+ end
157
+
158
+ ##
159
+ # Returns the ARR to use for a ticket
160
+ #
161
+ # @author Jason Colyer
162
+ # @since 1.0.51
163
+ def self.ticket_arr
164
+ (sfdc_opportunity.nil? ? 0 : sfdc_opportunity.ARR__c.to_i)
165
+ end
166
+
167
+ ##
168
+ # Returns the body to use for a ticket
169
+ #
170
+ # @author Jason Colyer
171
+ # @since 1.0.51
172
+ def self.body
173
+ <<~STRING
174
+ Greetings #{customer_name} !
175
+
176
+ We have been notified you are in need of some assistance. The context we were provided is as follows:
177
+
178
+ <pre>
179
+ #{context}
180
+ </pre>
181
+
182
+ Our Support team will review this request, but please feel free to reply back with any further information that may assist us in assisting you.
183
+
184
+ Thank you,
185
+
186
+ GitLab Support
187
+ STRING
188
+ end
189
+ end
190
+ end
191
+ end
@@ -91,8 +91,8 @@ module Readiness
91
91
  # @author Jason Colyer
92
92
  # @since 1.0.42
93
93
  def self.determine_manager
94
- user_search = Readiness::GitLab::Users.search_by_email(@gitlab_admin_client, manager_handle)
95
- found_user = user_search.detect { |u| u.email.downcase == email.downcase }
94
+ user_search = Readiness::GitLab::Users.search_by_username(@gitlab_admin_client, manager_handle)
95
+ found_user = user_search.detect { |u| u.email.downcase == manager_handle.downcase }
96
96
  return nil if found_user.nil?
97
97
 
98
98
  found_user
@@ -195,8 +195,8 @@ module Readiness
195
195
  # @author Jason Colyer
196
196
  # @since 1.0.42
197
197
  def self.determine_manager
198
- user_search = Readiness::GitLab::Users.search_by_email(@gitlab_admin_client, manager_handle)
199
- found_user = user_search.detect { |u| u.email.downcase == email.downcase }
198
+ user_search = Readiness::GitLab::Users.search_by_username(@gitlab_admin_client, manager_handle)
199
+ found_user = user_search.detect { |u| u.email.downcase == manager_handle.downcase }
200
200
  return nil if found_user.nil?
201
201
 
202
202
  found_user
@@ -162,8 +162,8 @@ module Readiness
162
162
  # @author Jason Colyer
163
163
  # @since 1.0.42
164
164
  def self.determine_manager
165
- user_search = Readiness::GitLab::Users.search_by_email(@gitlab_admin_client, manager_handle)
166
- found_user = user_search.detect { |u| u.email.downcase == email.downcase }
165
+ user_search = Readiness::GitLab::Users.search_by_username(@gitlab_admin_client, manager_handle)
166
+ found_user = user_search.detect { |u| u.email.downcase == manager_handle.downcase }
167
167
  return nil if found_user.nil?
168
168
 
169
169
  found_user
@@ -146,8 +146,8 @@ module Readiness
146
146
  # @author Jason Colyer
147
147
  # @since 1.0.42
148
148
  def self.determine_manager
149
- user_search = Readiness::GitLab::Users.search_by_email(@gitlab_admin_client, manager_handle)
150
- found_user = user_search.detect { |u| u.email.downcase == email.downcase }
149
+ user_search = Readiness::GitLab::Users.search_by_username(@gitlab_admin_client, manager_handle)
150
+ found_user = user_search.detect { |u| u.email.downcase == manager_handle.downcase }
151
151
  return nil if found_user.nil?
152
152
 
153
153
  found_user
@@ -195,8 +195,8 @@ module Readiness
195
195
  # @author Jason Colyer
196
196
  # @since 1.0.42
197
197
  def self.determine_manager
198
- user_search = Readiness::GitLab::Users.search_by_email(@gitlab_admin_client, manager_handle)
199
- found_user = user_search.detect { |u| u.email.downcase == email.downcase }
198
+ user_search = Readiness::GitLab::Users.search_by_username(@gitlab_admin_client, manager_handle)
199
+ found_user = user_search.detect { |u| u.email.downcase == manager_handle.downcase }
200
200
  return nil if found_user.nil?
201
201
 
202
202
  found_user
@@ -204,8 +204,8 @@ module Readiness
204
204
  # @author Jason Colyer
205
205
  # @since 1.0.42
206
206
  def self.determine_manager
207
- user_search = Readiness::GitLab::Users.search_by_email(@gitlab_admin_client, manager_handle)
208
- found_user = user_search.detect { |u| u.email.downcase == email.downcase }
207
+ user_search = Readiness::GitLab::Users.search_by_username(@gitlab_admin_client, manager_handle)
208
+ found_user = user_search.detect { |u| u.email.downcase == manager_handle.downcase }
209
209
  return nil if found_user.nil?
210
210
 
211
211
  found_user
@@ -40,6 +40,7 @@ module Readiness
40
40
  require "#{__dir__}/support_super_form_processor/global_ir_wider_community_license"
41
41
  require "#{__dir__}/support_super_form_processor/global_set_collaboration_id"
42
42
  require "#{__dir__}/support_super_form_processor/global_toggle_escalation"
43
+ require "#{__dir__}/support_super_form_processor/gratis_request"
43
44
  require "#{__dir__}/support_super_form_processor/gratis_support_extension"
44
45
  require "#{__dir__}/support_super_form_processor/gratis_support_former_customer"
45
46
  require "#{__dir__}/support_super_form_processor/gratis_support_migration"
@@ -10,7 +10,7 @@ module Readiness
10
10
  # @author Jason Colyer
11
11
  # @since 1.0.0
12
12
  class Tickets < Readiness::Client
13
- attr_accessor :assignee_id, :additional_tags, :brand_id, :collaborator_ids, :comment, :created_at, :custom_fields, :custom_status_id, :description, :due_at, :email_cc_ids, :email_ccs, :fields, :follower_ids, :followup_ids, :group_id, :has_incidents, :id, :is_public, :organization_id, :priority, :problem_id, :remove_tags, :requester_id, :satisfaction_rating, :status, :subject, :submitter_id, :tags, :ticket_form_id, :type, :updated_at, :via, :via_followup_source_id
13
+ attr_accessor :assignee_id, :additional_tags, :brand_id, :collaborator_ids, :comment, :created_at, :custom_fields, :custom_status_id, :description, :due_at, :email_cc_ids, :email_ccs, :fields, :follower_ids, :followup_ids, :group_id, :has_incidents, :id, :is_public, :organization_id, :priority, :problem_id, :remove_tags, :requester, :requester_id, :satisfaction_rating, :status, :subject, :submitter_id, :tags, :ticket_form_id, :type, :updated_at, :via, :via_followup_source_id
14
14
 
15
15
  ##
16
16
  # Creates a new {Readiness::Zendesk::Tickets} instance
@@ -45,6 +45,7 @@ module Readiness
45
45
  @priority = object['priority']
46
46
  @problem_id = object['problem_id']
47
47
  @remove_tags = object['remove_tags']
48
+ @requester = object['requester']
48
49
  @requester_id = object['request_id']
49
50
  @satisfaction_rating = object['satisfaction_rating']
50
51
  @status = object['status']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_support_readiness
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.49
4
+ version: 1.0.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Colyer
@@ -347,6 +347,7 @@ files:
347
347
  - lib/support_readiness/support_super_form_processor/global_set_collaboration_id.rb
348
348
  - lib/support_readiness/support_super_form_processor/global_set_org_ase.rb
349
349
  - lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb
350
+ - lib/support_readiness/support_super_form_processor/gratis_request.rb
350
351
  - lib/support_readiness/support_super_form_processor/gratis_support_extension.rb
351
352
  - lib/support_readiness/support_super_form_processor/gratis_support_former_customer.rb
352
353
  - lib/support_readiness/support_super_form_processor/gratis_support_migration.rb