gitlab_support_readiness 1.0.50 → 1.0.51

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 245c5e90798a0488cf2c2bb7681eb48b278e9d59ecdb0e72dee8244b9298c1d7
4
- data.tar.gz: 188b6ff03d707dbbecc18acb7ce5e8d6dc6b61be9b2d09971f54b2748fc127ee
3
+ metadata.gz: d4f9ad1e0298c95871b0cfdc7edc2eac853bd60076df6b2ec7aabe9bcb497c00
4
+ data.tar.gz: 2da63507f1209b6b04cb26a706412dea996b9687d51c408cb98ef2139ca1fbda
5
5
  SHA512:
6
- metadata.gz: bba24c97145efe1c6a892ab9a2c40c008793e100534b9f187be7ebe8b3a954b47f0040da9701d3075b3f075e2c3ce62e93892466f4811a3b621d55cf41baa327
7
- data.tar.gz: f571e32219c91932074d1e8d0b850d677342df01ad8b2448fe3887801c2a4bf046ed9d1448cf3fcc2c01532be628e0f368623d7b841176d2b61f4ec513c27a1a
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
@@ -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.50
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