Class: Readiness::SupportSuperFormProcessor::GlobalSetCollaboriationID
- Inherits:
-
Client
- Object
- Client
- Readiness::SupportSuperFormProcessor::GlobalSetCollaboriationID
- Defined in:
- lib/support_readiness/support_super_form_processor/global_set_collaboration_id.rb
Overview
Defines the class GlobalSetCollaboriationID within the module Zendesk.
Class Method Summary collapse
-
.collaboration_project_id ⇒ Object
Sets the global variable collaboration_project_id.
-
.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 setting a collab ID on a Global organization.
-
.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
.collaboration_project_id ⇒ Object
Sets the global variable collaboration_project_id
102 103 104 |
# File 'lib/support_readiness/support_super_form_processor/global_set_collaboration_id.rb', line 102 def self.collaboration_project_id @collaboration_project_id ||= ENV.fetch('PROJECT_ID') end |
.message ⇒ Object
Returns the issue description
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/support_readiness/support_super_form_processor/global_set_collaboration_id.rb', line 111 def self. <<~STRING ## Set the collaboration project ID for an Zendesk Global organization - #{org.id} Greetings @#{requester.username} ! We have set the collaboration project ID of the Zendesk Global organization to that of #{collaboration_project_id} at this time. /label ~"AutomatedRequests::Set Org Collab ID" ~zendesk ~administrative ~"Stage::Completed" ~p4 /iteration [cadence:"Customer Support Operations"] --current /assign @#{requester.username} STRING end |
.org ⇒ Object
Sets the global variable org
84 85 86 |
# File 'lib/support_readiness/support_super_form_processor/global_set_collaboration_id.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_set_collaboration_id.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
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/support_readiness/support_super_form_processor/global_set_collaboration_id.rb', line 132 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" ~zendesk ~administrative ~"Stage::Blocked" ~p4 /iteration [cadence:"Customer Support Operations"] --current /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_set_collaboration_id.rb', line 93 def self.org_id @org_id ||= ENV.fetch('ORG_ID') end |
.process!(gitlab_client, gitlab_admin_client, zendesk_client) ⇒ Object
Process setting a collab ID on a Global organization
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_set_collaboration_id.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 = { "am_project_id" => collaboration_project_id } Readiness::Zendesk::Organizations.update!(@zendesk_client, new_org) issue = Readiness::GitLab::Issues.new issue.title = "Set the collaboration project ID for a Zendesk Global 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_set_collaboration_id.rb', line 75 def self.project @project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119) end |
.requester ⇒ Object
Sets the global variable requester
57 58 59 |
# File 'lib/support_readiness/support_super_form_processor/global_set_collaboration_id.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_set_collaboration_id.rb', line 66 def self.requester_email @requester_email ||= ENV.fetch('REQUESTER_EMAIL') end |