Class: Readiness::SupportSuperFormProcessor::DisableUSGov
- Defined in:
- lib/support_readiness/support_super_form_processor/disable_us_government.rb
Overview
Defines the class DisableUSGov within the module Zendesk.
Class Method Summary collapse
-
.account ⇒ Object
Sets the global variable account.
-
.account_id ⇒ Object
Sets the global variable account_id.
-
.account_query ⇒ Object
Returns a String to get account information.
-
.checks ⇒ Object
Peform validity checks for this request.
-
.errors ⇒ Object
Sets the global variable errors.
-
.fetch_account ⇒ Object
Run a SQOL query to get account information.
-
.message ⇒ Object
Return the string for the issue body.
-
.process!(gitlab_client, gitlab_admin_client, zendesk_client, sfdc_client, sandbox = false) ⇒ Object
Process a Disable US Government request.
-
.project ⇒ Object
Sets the global variable project.
-
.requester ⇒ Object
Sets the global variable requester.
-
.requester_email ⇒ Object
Sets the global variable requester_email.
-
.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
.account ⇒ Object
Sets the global variable account
103 104 105 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 103 def self.account @account ||= fetch_account end |
.account_id ⇒ Object
Sets the global variable account_id
123 124 125 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 123 def self.account_id @account_id ||= ENV.fetch('SFDC_ACCOUNT').split('/')[6] end |
.account_query ⇒ Object
Returns a String to get account information
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 132 def self.account_query <<~STRING SELECT Account_ID_18__c, Name, Ultimate_Parent_Sales_Segment_Employees__c, Account_Owner_Calc__c, Technical_Account_Manager_Name__c, GS_Health_Score_Color__c, Restricted_Account__c, Solutions_Architect_Lookup__r.Name, Support_Hold__c, Support_Instance__c, ( SELECT Id, Name, Zuora__ProductName__c, Zuora__EffectiveEndDate__c, Zuora__Quantity__c, Zuora__TotalContractValue__c, Subscription_Status__c FROM Zuora__R00N40000001lGjTEAU__r ) FROM Account WHERE Id = '#{account_id}' STRING end |
.checks ⇒ Object
Peform validity checks for this request
55 56 57 58 59 60 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 55 def self.checks errors.push("Invalid SFDC account given: #{account_id}") if account.nil? return unless errors.count.zero? errors.push("SFDC account #{account_id} does not have an exception to remove") if account.Support_Instance__c != 'federal-support' end |
.errors ⇒ Object
Sets the global variable errors
67 68 69 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 67 def self.errors @errors ||= [] end |
.fetch_account ⇒ Object
Run a SQOL query to get account information
112 113 114 115 116 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 112 def self.fetch_account query = Readiness::Salesforce::Queries.new(account_query) results = Readiness::Salesforce::Queries.run!(@sfdc_client, query) results.first end |
.message ⇒ Object
Return the string for the issue body
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 167 def self. <<~STRING ## Remove US Government Support exception for #{account.Account_ID_18__c} A request has been filed to remove the US Government Support exception for a SFDC account. The details are as follows: - Requester: @#{requester.username} - SFDC Account: [#{account.Account_ID_18__c}](https://gitlab.lightning.force.com/lightning/r/Account/#{account.Account_ID_18__c}/view) #### Readiness TODO list - [ ] Review above information for accuracy - [ ] Confirm the corresponding organization does not currently have an ongoing tickets - [ ] Follow the process detailed in [this handbook page](https://handbook.gitlab.com/handbook/support/readiness/operations/docs/policies/us_gov_support_exceptions) /assign @#{requester.username} @jcolyer @secole @lyle /label ~"Stage::Development" ~p4 ~zendesk ~administrative ~"Customer::Field" cc @leeeee-gtlb @ktague STRING end |
.process!(gitlab_client, gitlab_admin_client, zendesk_client, sfdc_client, sandbox = false) ⇒ Object
Process a Disable US Government request
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 18 def self.process!(gitlab_client, gitlab_admin_client, zendesk_client, sfdc_client, sandbox = false) @gitlab_client = gitlab_client @gitlab_admin_client = gitlab_admin_client @zendesk_client = zendesk_client @sfdc_client = sfdc_client requester zd_user checks unless errors.count.zero? Readiness::SupportSuperFormProcessor::Shared.invalid_enable_usgov(requester, errors) end issue = Readiness::GitLab::Issues.new if sandbox issue.title = '[SANDBOX REQUEST] Remove US Government Support exception' else issue.title = 'Remove US Government Support exception' end 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
46 47 48 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 46 def self.project @project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119) end |
.requester ⇒ Object
Sets the global variable requester
76 77 78 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.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/disable_us_government.rb', line 94 def self.requester_email @requester_email ||= ENV.fetch('REQUESTER_EMAIL') end |
.zd_user ⇒ Object
Sets the global variable zd_user
85 86 87 |
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 85 def self.zd_user @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email) end |