Class: Readiness::SupportSuperFormProcessor::Shared
- Defined in:
- lib/support_readiness/support_super_form_processor/shared.rb
Overview
Defines the class Shared within the module Zendesk.
Class Method Summary collapse
-
.cannot_self_approve(address) ⇒ Object
Sends an email if not a valid Wider Community License request.
-
.cannot_self_approve_message ⇒ String
Returns the email body message when not a valid Wider Community License request.
-
.generate_mailgun_connection ⇒ Object
Generates a Mailgun connection.
-
.gitlab_user_check(client, email) ⇒ Object
Performs a gitlab.com user check.
-
.invalid_article_creation(requester, errors) ⇒ Object
Sends an email if not a valid article creation request.
-
.invalid_article_creation_message(requester, errors) ⇒ String
Returns the email body message when not a valid article creation submission.
-
.invalid_enable_usgov(requester, errors) ⇒ Object
Sends an email if not a valid enable us gov request.
-
.invalid_enable_usgov_message(requester, errors) ⇒ String
Returns the email body message when not a valid enable us gov submission.
-
.invalid_namespace(address, namespace) ⇒ Object
Sends an email if the namespace provided was invalid.
-
.invalid_namespace_message(namespace) ⇒ String
Returns the email body message when the namespace is invalid.
-
.invalid_nfr_request(address) ⇒ Object
Sends an email if not a valid NFR request.
-
.invalid_nfr_request_message ⇒ String
Returns the email body message when not a valid NFR request.
-
.invalid_opportunity_link(requester, opportunity_link) ⇒ Object
Sends an email if not a valid opportunity link for a gratis request.
-
.invalid_opportunity_link_message(requester, opportunity_link) ⇒ String
Returns the email body message when not a valid SFDC opportunity link for gratis requests.
-
.mailgun_client ⇒ Object
Sets a global variable for an instance of Mailgun::Client.
-
.namespace_exists?(client, namespace) ⇒ Boolean
Performs a gitlab.com namespace check.
-
.no_such_gitlab_user(address) ⇒ Object
Sends an email if a gitlab.com user check fails.
-
.no_such_gitlab_user_message(email) ⇒ String
Returns the email body message for a failed gitlab.com user check.
-
.no_such_zendesk_user(address) ⇒ Object
Sends an email if a Zendesk user check fails.
-
.no_such_zendesk_user_message(email) ⇒ String
Returns the email body message for a failed Zendesk user check.
-
.not_oem_member(address) ⇒ Object
Sends an email if not an OEM member.
-
.not_oem_member_message ⇒ String
Returns the email body message for a failed OEM check.
-
.not_order_management_member(address) ⇒ Object
Sends an email if not an Order Management member.
-
.not_order_management_member_message ⇒ String
Returns the email body message for a failed Order Management check.
-
.not_partner_support_member(address) ⇒ Object
Sends an email if not an Partner Support member.
-
.not_partner_support_member_message ⇒ String
Returns the email body message when not a Partner Supprot member.
- .sfdc_account_string(link) ⇒ Object
- .sfdc_chattr_string(link) ⇒ Object
- .sfdc_opportunity_string(link) ⇒ Object
- .sfdc_upload_string(link) ⇒ Object
-
.zendesk_user_check(client, email) ⇒ Object
Performs a Zendesk user check.
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
.cannot_self_approve(address) ⇒ Object
Sends an email if not a valid Wider Community License request
179 180 181 182 183 184 185 186 187 188 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 179 def self.cannot_self_approve(address) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = address email.subject = 'Invalid Support Super Form submission' email.text = Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "Invalid WCL request made by #{address}" exit 0 end |
.cannot_self_approve_message ⇒ String
Returns the email body message when not a valid Wider Community License request
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 436 def self. <<~STRING Greetings, The Internal Request Form submission you recently filed was not able to be filed due to one of the following issues: - You cannot be the approver for community licenses lasting more than 90 days. Please rectify the above issues and re-submit your Internal Request via the form. Thank you, GitLab Support Please note this is sent from an unmonitored inbox and replies to it will not be followed up on. STRING end |
.generate_mailgun_connection ⇒ Object
Generates a Mailgun connection
254 255 256 257 258 259 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 254 def self.generate_mailgun_connection mailgun_config = Readiness::Mailgun::Configuration.new mailgun_config.domain = 'mg.gitlab.com' mailgun_config.token = ENV.fetch('MAILGUN_KEY') Readiness::Mailgun::Client.new(mailgun_config) end |
.gitlab_user_check(client, email) ⇒ Object
Performs a gitlab.com user check
33 34 35 36 37 38 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 33 def self.gitlab_user_check(client, email) user_search = Readiness::GitLab::Users.search_by_email(client, email) requester = user_search.detect { |u| u.email == email } no_such_gitlab_user(email) if requester.nil? requester end |
.invalid_article_creation(requester, errors) ⇒ Object
Sends an email if not a valid article creation request
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 195 def self.invalid_article_creation(requester, errors) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = requester.email email.subject = 'Invalid Support Super Form submission' email.text = (requester, errors) Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "Invalid article creation submission by #{requester.email}" exit 0 end |
.invalid_article_creation_message(requester, errors) ⇒ String
Returns the email body message when not a valid article creation submission
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 460 def self.(requester, errors) <<~STRING Greetings @#{requester.username} , Your recent request to create a Zendesk article was not able to be filed due to the following issues: #{errors.map { |e| "- #{e}" }.join("\n")} Please rectify the above issues and re-submit your request via the form. Thank you, GitLab Support Please note this is sent from an unmonitored inbox and replies to it will not be followed up on. STRING end |
.invalid_enable_usgov(requester, errors) ⇒ Object
Sends an email if not a valid enable us gov request
211 212 213 214 215 216 217 218 219 220 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 211 def self.invalid_enable_usgov(requester, errors) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = requester.email email.subject = 'Invalid Support Super Form submission' email.text = (requester, errors) Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "Invalid enable/disable us gov submission by #{requester.email}" exit 0 end |
.invalid_enable_usgov_message(requester, errors) ⇒ String
Returns the email body message when not a valid enable us gov submission
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 484 def self.(requester, errors) <<~STRING Greetings @#{requester.username} , Your recent request to enable/disable US Goverment support was not able to be filed due to the following issues: #{errors.map { |e| "- #{e}" }.join("\n")} Please rectify the above issues and re-submit your request via the form. Thank you, GitLab Support Please note this is sent from an unmonitored inbox and replies to it will not be followed up on. STRING end |
.invalid_namespace(address, namespace) ⇒ Object
Sends an email if the namespace provided was invalid
128 129 130 131 132 133 134 135 136 137 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 128 def self.invalid_namespace(address, namespace) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = address email.subject = 'Invalid Support Super Form submission' email.text = (namespace) Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "#{address} provided invalid namespace - #{namespace}" exit 0 end |
.invalid_namespace_message(namespace) ⇒ String
Returns the email body message when the namespace is invalid
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 363 def self.(namespace) <<~STRING Greetings, The Internal Request Form submission you recently filed was not able to be filed due to the following issues: - Invalid namespace: '#{namespace}'. Ensure the provided namespace is an existing top-level group, as only those are accepted. Please rectify the above issues and re-submit your Internal Request via the form. Thank you, GitLab Support Please note this is sent from an unmonitored inbox and replies to it will not be followed up on. STRING end |
.invalid_nfr_request(address) ⇒ Object
Sends an email if not a valid NFR request
162 163 164 165 166 167 168 169 170 171 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 162 def self.invalid_nfr_request(address) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = address email.subject = 'Invalid Support Super Form submission' email.text = Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "Invalid NFR request made by #{address}" exit 0 end |
.invalid_nfr_request_message ⇒ String
Returns the email body message when not a valid NFR request
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 411 def self. <<~STRING Greetings, The Internal Request Form submission you recently filed was not able to be filed due to one of the following issues: - NFR licenses cannot exceed 25 seats - NFR licenses cannot have an expiration more than one year in the future Please rectify the above issues and re-submit your Internal Request via the form. Thank you, GitLab Support Please note this is sent from an unmonitored inbox and replies to it will not be followed up on. STRING end |
.invalid_opportunity_link(requester, opportunity_link) ⇒ Object
Sends an email if not a valid opportunity link for a gratis request
227 228 229 230 231 232 233 234 235 236 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 227 def self.invalid_opportunity_link(requester, opportunity_link) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = requester.email email.subject = 'Invalid Support Super Form submission' email.text = (requester, opportunity_link) Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "Invalid opportunity link provided for gratis request by #{requester.email}" exit 0 end |
.invalid_opportunity_link_message(requester, opportunity_link) ⇒ String
Returns the email body message when not a valid SFDC opportunity link for gratis requests
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 508 def self.(requester, opportunity_link) <<~STRING Greetings @#{requester.username} , Your recent gratis request was not able to be filed due to the following issues: - Invalid SFDC opportunity link provided: #{opportunity_link} Please rectify the above issues and re-submit your request via the form. Thank you, GitLab Support Please note this is sent from an unmonitored inbox and replies to it will not be followed up on. STRING end |
.mailgun_client ⇒ Object
Sets a global variable for an instance of Mailgun::Client
244 245 246 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 244 def self.mailgun_client @mailgun_client ||= generate_mailgun_connection end |
.namespace_exists?(client, namespace) ⇒ Boolean
Performs a gitlab.com namespace check
20 21 22 23 24 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 20 def self.namespace_exists?(client, namespace) return Readiness::GitLab::Namespaces.exists?(client, namespace) if namespace.to_i.zero? Readiness::GitLab::Namespaces.find(client, namespace).is_a? Readiness::GitLab::Namespaces end |
.no_such_gitlab_user(address) ⇒ Object
Sends an email if a gitlab.com user check fails
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 60 def self.no_such_gitlab_user(address) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = address email.subject = 'Invalid Support Super Form submission' email.text = (email) Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "No such gitlab.com account tied to #{address}" exit 0 end |
.no_such_gitlab_user_message(email) ⇒ String
Returns the email body message for a failed gitlab.com user check
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 267 def self.(email) <<~STRING Greetings, Recently a Support Super Form submission was made stating the requester email was #{email}. We were unable to find a gitlab.com account using that email address as the primary email. As such, the request could not be completed. If you have a gitlab.com account using that as a secondary email, please modify your gitlab.com account to make your official GitLab email the primary. Once that has been rectified, please re-submit your request. Thank you, GitLab Support STRING end |
.no_such_zendesk_user(address) ⇒ Object
Sends an email if a Zendesk user check fails
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 77 def self.no_such_zendesk_user(address) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = address email.subject = 'Invalid Support Super Form submission' email.text = (address) Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "No such Zendesk account tied to #{address}" exit 0 end |
.no_such_zendesk_user_message(email) ⇒ String
Returns the email body message for a failed Zendesk user check
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 291 def self.(email) <<~STRING Greetings, The Internal Request Form submission you recently filed was not able to be filed due to the following issues: - Invalid Zendesk user: #{email} Please rectify the above issues and re-submit your Internal Request via the form. Thank you, GitLab Support Please note this is sent from an unmonitored inbox and replies to it will not be followed up on. STRING end |
.not_oem_member(address) ⇒ Object
Sends an email if not an OEM member
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 94 def self.not_oem_member(address) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = address email.subject = 'Invalid Support Super Form submission' email.text = Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "Not an OEM member - #{address}" exit 0 end |
.not_oem_member_message ⇒ String
Returns the email body message for a failed OEM check
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 315 def self. <<~STRING Greetings, The Internal Request Form submission you recently filed was not able to be filed due to the following issues: - You are not a member of the OEM management team. Please rectify the above issues and re-submit your Internal Request via the form. Thank you, GitLab Support Please note this is sent from an unmonitored inbox and replies to it will not be followed up on. STRING end |
.not_order_management_member(address) ⇒ Object
Sends an email if not an Order Management member
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 111 def self.not_order_management_member(address) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = address email.subject = 'Invalid Support Super Form submission' email.text = Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "Not an Order Management member - #{address}" exit 0 end |
.not_order_management_member_message ⇒ String
Returns the email body message for a failed Order Management check
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 339 def self. <<~STRING Greetings, The Internal Request Form submission you recently filed was not able to be filed due to the following issues: - You are not a member of the order management team. Please rectify the above issues and re-submit your Internal Request via the form. Thank you, GitLab Support Please note this is sent from an unmonitored inbox and replies to it will not be followed up on. STRING end |
.not_partner_support_member(address) ⇒ Object
Sends an email if not an Partner Support member
145 146 147 148 149 150 151 152 153 154 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 145 def self.not_partner_support_member(address) email = Readiness::Mailgun::Emails.new email.from = 'GitLab Support <techsupport@gitlab.com>' email.to = address email.subject = 'Invalid Support Super Form submission' email.text = Readiness::Mailgun::Emails.send!(mailgun_client, email) puts "Not an Order Management member - #{address}" exit 0 end |
.not_partner_support_member_message ⇒ String
Returns the email body message when not a Partner Supprot member
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 387 def self. <<~STRING Greetings, The Internal Request Form submission you recently filed was not able to be filed due to the following issues: - You are not a member of the partner support team. Please rectify the above issues and re-submit your Internal Request via the form. Thank you, GitLab Support Please note this is sent from an unmonitored inbox and replies to it will not be followed up on. STRING end |
.sfdc_account_string(link) ⇒ Object
526 527 528 529 530 531 532 533 534 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 526 def self.sfdc_account_string(link) id = if link =~ /lightning/ link.split('/')[-2] else link.split('/').last end lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/Account/#{id}/view' target='_blank'>#{id}</a>" "SFDC Account: #{lightning}" end |
.sfdc_chattr_string(link) ⇒ Object
556 557 558 559 560 561 562 563 564 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 556 def self.sfdc_chattr_string(link) id = if link =~ /lightning/ link.split('/')[-2] else link.split('/').last end lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/#{id}/view' target='_blank'>#{id}</a>" "Chattr link containing approval: #{lightning}" end |
.sfdc_opportunity_string(link) ⇒ Object
536 537 538 539 540 541 542 543 544 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 536 def self.sfdc_opportunity_string(link) id = if link =~ /lightning/ link.split('/')[-2] else link.split('/').last end lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/Opportunity/#{id}/view' target='_blank'>#{id}</a>" "SFDC Opportunity: #{lightning}" end |
.sfdc_upload_string(link) ⇒ Object
546 547 548 549 550 551 552 553 554 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 546 def self.sfdc_upload_string(link) id = if link =~ /lightning/ link.split('/')[-2] else link.split('/').last end lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/ContentDocument/#{id}/view' target='_blank'>#{id}</a>" "Customer verification proof: #{lightning}" end |
.zendesk_user_check(client, email) ⇒ Object
Performs a Zendesk user check
47 48 49 50 51 52 |
# File 'lib/support_readiness/support_super_form_processor/shared.rb', line 47 def self.zendesk_user_check(client, email) user_search = Readiness::Zendesk::Search.users(client, "email:#{email} -role:end-user") user = user_search.detect { |u| u.email.downcase == email.downcase } no_such_zendesk_user(email) if user.nil? user end |