Class: Readiness::SupportSuperFormProcessor::SARequestForSupport
- Defined in:
- lib/support_readiness/support_super_form_processor/sa_request_for_support.rb
Overview
Defines the class SARequestForSupport within the module Zendesk.
Class Method Summary collapse
-
.arr_at_risk ⇒ Object
Sets the global variable arr_at_risk.
-
.body ⇒ Object
Return the ticket body.
-
.category ⇒ Object
Sets the global variable category.
-
.category_value ⇒ Object
Determines category value from global variable.
-
.context ⇒ Object
Sets the global variable internal_request_support_sa_context.
-
.expectations ⇒ Object
Sets the global variable expectations.
-
.issue_description ⇒ Object
Sets the global variable issue_description.
-
.process!(gitlab_client, gitlab_admin_client, zendesk_client, sandbox = false) ⇒ Object
Process a SA Request for Support request.
-
.region ⇒ Object
Sets the global variable region.
-
.region_string ⇒ Object
Return the string to use for the region field.
-
.replication ⇒ Object
Sets the global variable replication.
-
.request_priority ⇒ Object
Sets the global variable request_priority.
-
.requester ⇒ Object
Sets the global variable requester.
-
.requester_email ⇒ Object
Sets the global variable requester_email.
-
.severity ⇒ Object
Return the string to use for the severity field.
-
.sfdc_account ⇒ Object
Sets the global variable sfdc_account.
-
.sfdc_opportunity ⇒ Object
Sets the global variable sfdc_opportunity.
-
.slack_url ⇒ Object
Sets the global variable slack_url.
-
.ticket_subject ⇒ Object
Sets the global variable ticket_subject.
-
.zd_user ⇒ Object
Sets the global variable zd_user.
Methods inherited from Client
auth_error, bad_request_error, convert_actions, convert_conditions, convert_standard_names_to_ids, convert_ticket_form_agent_conditions, convert_ticket_form_brands, convert_ticket_form_end_user_conditions, convert_ticket_form_names_to_ids, convert_view_names_to_ids, convert_view_restrictions, covert_ticket_form_field_ids, create_package!, erb_renderer, handle_request_error, not_found_error, not_processible_error, put_into_archive, recursively_deflate_directory, timestamp_filename, to_clean_json, to_clean_json_with_key, to_hash, to_nearly_clean_json, to_nearly_clean_json_with_key, to_param_string, write_entries
Class Method Details
.arr_at_risk ⇒ Object
Sets the global variable arr_at_risk
229 230 231 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 229 def self.arr_at_risk @arr_at_risk ||= ENV.fetch('ARR_AT_RISK', '0') end |
.body ⇒ Object
Return the ticket body
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 266 def self.body <<~STRING <p> Greetings </p> <p> Please note that this is an <b>INTERNAL</b> ticket and should <b>NEVER</b> be shared with anyone. Please do not CC, BCC, forward, or anything else that can send the information from this ticket. <b>NEVER</b> add <i>anyone</i> outside of GitLab to this ticket or communications stemming from this ticket. </p> <p> A SA has filed a request for assistance with Support. </p> <p> The information for this is as follows: </p> <ul> <li><a href='#{slack_url}' target='_blank'>Slack discussion</a> <li>Preferred Region for Support: #{region}</li> <li>Level of Urgency: #{request_priority}</li> <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account)}</li> <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_opportunity_string(sfdc_opportunity)}</li> <li>ARR at risk: $#{sprintf("%.2f", arr_at_risk.to_f)}</li> <li>Request category: #{category_value}</li> </ul> <p> What is expected from Support? </p> <pre> #{expectations} </pre> <p> Issue description </p> <pre> #{issue_description} </pre> <p> Context/resources </p> <pre> #{context} </pre> <p> Replication information </p> <pre> #{replication} </pre> STRING end |
.category ⇒ Object
Sets the global variable category
238 239 240 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 238 def self.category @category ||= ENV.fetch('SUPPORT_IR_SUBCATEGORY', 'other') end |
.category_value ⇒ Object
Determines category value from global variable
246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 246 def self.category_value case category when 'lnr' 'L&R (License & Registration)' when 'com' 'GitLab.com' when 'sm' 'Self-Managed' when 'dedicated' 'GitLab Dedicated' else 'Unknown' end end |
.context ⇒ Object
Sets the global variable internal_request_support_sa_context
211 212 213 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 211 def self.context @context ||= ENV.fetch('TICKET_REFERENCES') end |
.expectations ⇒ Object
Sets the global variable expectations
166 167 168 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 166 def self.expectations @expectations ||= ENV.fetch('SUPPORT_EXPECTATION') end |
.issue_description ⇒ Object
Sets the global variable issue_description
202 203 204 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 202 def self.issue_description @issue_description ||= ENV.fetch('TICKET_BODY') end |
.process!(gitlab_client, gitlab_admin_client, zendesk_client, sandbox = false) ⇒ Object
Process a SA Request for Support request
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 18 def self.process!(gitlab_client, gitlab_admin_client, zendesk_client, sandbox = false) @gitlab_client = gitlab_client @gitlab_admin_client = gitlab_admin_client @zendesk_client = zendesk_client @ticket_forms = Readiness::Zendesk::TicketForms.list(@zendesk_client) @ticket_fields = Readiness::Zendesk::TicketFields.list(@zendesk_client) @support_ir_form = Readiness::Zendesk::TicketForms.find_by_name(@zendesk_client, 'Support Internal Request', @ticket_forms) @area_of_focus_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Area of Focus', @ticket_fields) @ticket_stage_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Ticket Stage', @ticket_fields) @prfs_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Preferred Region for Support', @ticket_fields) @plan_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'GitLab Plan', @ticket_fields) @sales_name_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Sales contact name', @ticket_fields) @sales_email_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Sales contact email', @ticket_fields) @severity_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Customer Severity (maps to priority, do not change)', @ticket_fields) @arr_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Ticket ARR', @ticket_fields) @priority_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Customer Priority', @ticket_fields) @channel_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Channel (Received at email)', @ticket_fields) requester zd_user ticket = Readiness::Zendesk::Tickets.new ticket.email_ccs = [ { user_id: zd_user.id } ] if sandbox ticket.requester_id = 12816218763676 ticket.submitter_id = 12816218763676 else ticket.requester_id = 379855863520 ticket.submitter_id = 379855863520 end ticket.comment = { html_body: body } ticket.subject = ticket_subject ticket. = %w[support_internal_request support_valid_request support_ir_sa_request_for_support] ticket..push("support_internal_request_category_#{category}") ticket.priority = request_priority ticket.status = 'new' ticket.ticket_form_id = @support_ir_form.id ticket.custom_fields = [ { id: @area_of_focus_field.id, value: 'aof_other' }, { id: @ticket_stage_field.id, value: 'stage-frt' }, { id: @prfs_field.id, value: region_string }, { id: @plan_field.id, value: 'free_plan' }, { id: @sales_name_field.id, value: zd_user.name }, { id: @sales_email_field.id, value: zd_user.email }, { id: @severity_field.id, value: severity }, { id: @arr_field.id, value: '0' }, { id: @priority_field.id, value: request_priority }, { id: @channel_field.id, value: 'created_by_agent' } ] create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket) puts "Ticket created: #{create.id}" end |
.region ⇒ Object
Sets the global variable region
148 149 150 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 148 def self.region @region ||= ENV.fetch('PREFERRED_REGION') end |
.region_string ⇒ Object
Return the string to use for the region field
103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 103 def self.region_string case region when 'AMER' 'americas__usa' when 'APAC' 'asia_pacific' when 'EMEA' 'europe__middle_east__africa' else 'all_regions' end end |
.replication ⇒ Object
Sets the global variable replication
220 221 222 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 220 def self.replication @replication ||= ENV.fetch('TICKET_REPLICATION', '') end |
.request_priority ⇒ Object
Sets the global variable request_priority
139 140 141 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 139 def self.request_priority @request_priority ||= ENV.fetch('URGENCY') end |
.requester ⇒ Object
Sets the global variable requester
76 77 78 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 76 def self.requester @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email) end |
.requester_email ⇒ Object
Sets the global variable requester_email
94 95 96 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 94 def self.requester_email @requester_email ||= ENV.fetch('REQUESTER_EMAIL') end |
.severity ⇒ Object
Return the string to use for the severity field
121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 121 def self.severity case request_priority when 'urgent' 'sev1' when 'high' 'sev2' when 'medium' 'sev3' when 'low' 'sev4' end end |
.sfdc_account ⇒ Object
Sets the global variable sfdc_account
175 176 177 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 175 def self.sfdc_account @sfdc_account ||= ENV.fetch('SFDC_ACCOUNT') end |
.sfdc_opportunity ⇒ Object
Sets the global variable sfdc_opportunity
184 185 186 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 184 def self.sfdc_opportunity @sfdc_opportunity ||= ENV.fetch('SFDC_OPPORTUNITY') end |
.slack_url ⇒ Object
Sets the global variable slack_url
157 158 159 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 157 def self.slack_url @slack_url ||= ENV.fetch('SLACK_LINK') end |
.ticket_subject ⇒ Object
Sets the global variable ticket_subject
193 194 195 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 193 def self.ticket_subject @ticket_subject ||= ENV.fetch('TICKET_SUBJECT', 'Support Internal Request - SA - Request for Support') end |
.zd_user ⇒ Object
Sets the global variable zd_user
85 86 87 |
# File 'lib/support_readiness/support_super_form_processor/sa_request_for_support.rb', line 85 def self.zd_user @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email) end |