Class: Readiness::SupportSuperFormProcessor::GlobalToggleEscalation
- Inherits:
-
Client
- Object
- Client
- Readiness::SupportSuperFormProcessor::GlobalToggleEscalation
- Defined in:
- lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb
Overview
Defines the class GlobalToggleEscalation within the module Zendesk.
Class Method Summary collapse
-
.message ⇒ Object
Returns the issue description.
-
.org ⇒ Object
Sets the global variable org.
-
.org_does_not_exist ⇒ Object
Create issue when organization does not exist.
-
.org_does_not_exist_message ⇒ Object
Returns the issue description.
-
.org_id ⇒ Object
Sets the global variable org_id.
-
.process!(gitlab_client, gitlab_admin_client, zendesk_client) ⇒ Object
Process a Namesquatting Availability check request.
-
.project ⇒ Object
Sets the global variable project.
-
.requester ⇒ Object
Sets the global variable requester.
-
.requester_email ⇒ Object
Sets the global variable requester_email.
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
.message ⇒ Object
Returns the issue description
102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb', line 102 def self. <<~STRING ## Toggle the escalation status of an organization - #{org.id} Greetings @#{requester.username} ! We have now toggled the escalated state of the organization at this time. /label ~"AutomatedRequests::Toggle Org Escalation State" /assign @#{requester.username} STRING end |
.org ⇒ Object
Sets the global variable org
84 85 86 |
# File 'lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb', line 84 def self.org @org ||= Readiness::Zendesk::Organizations.find(@zendesk_client, org_id) end |
.org_does_not_exist ⇒ Object
Create issue when organization does not exist
43 44 45 46 47 48 49 50 |
# File 'lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb', line 43 def self.org_does_not_exist issue = Readiness::GitLab::Issues.new issue.title = "Invalid Request - Organization Not Found" issue.description = create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue) puts "Issue created: #{create.web_url}" exit 0 end |
.org_does_not_exist_message ⇒ Object
Returns the issue description
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb', line 121 def self. <<~STRING ## Invalid Request Organization Not Found Greetings @#{requester.username} ! We received a request from you recently, however the organization ID given #{org_id} is not a valid Zendesk Global Organization ID. As such, we are not able to proceed. Please review the Zendesk Global organization you were wanting to use once more and file a new submission. If you need assistance in locating the organization's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD) /label ~"AutomatedRequests::Invalid Organization" /label ~"Invalid Zendesk Global organization given" /assign @#{requester.username} STRING end |
.org_id ⇒ Object
Sets the global variable org_id
93 94 95 |
# File 'lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb', line 93 def self.org_id @org_id ||= ENV.fetch('ZENDESK_ORGANIZATION_ID') end |
.process!(gitlab_client, gitlab_admin_client, zendesk_client) ⇒ Object
Process a Namesquatting Availability check request
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb', line 18 def self.process!(gitlab_client, gitlab_admin_client, zendesk_client) @gitlab_client = gitlab_client @gitlab_admin_client = gitlab_admin_client @zendesk_client = zendesk_client requester org_does_not_exist if org.is_a? Hash new_org = Readiness::Zendesk::Organizations.new new_org.id = org.id new_org.organization_fields = { "org_in_escalated_state" => !org.custom_fields['org_in_escalated_state'] } Readiness::Zendesk::Organizations.update!(@zendesk_client, new_org) issue = Readiness::GitLab::Issues.new issue.title = "Toggle the escalation status of an organization - #{org.id}" issue.description = create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue) puts "Issue created: #{create.web_url}" exit 0 end |
.project ⇒ Object
Sets the global variable project
75 76 77 |
# File 'lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb', line 75 def self.project @project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 12811526) end |
.requester ⇒ Object
Sets the global variable requester
57 58 59 |
# File 'lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb', line 57 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
66 67 68 |
# File 'lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb', line 66 def self.requester_email @requester_email ||= ENV.fetch('REQUESTER_EMAIL') end |