Class: Readiness::SupportSuperFormProcessor::DisableUSGov

Inherits:
Client
  • Object
show all
Defined in:
lib/support_readiness/support_super_form_processor/disable_us_government.rb

Overview

Defines the class DisableUSGov within the module Zendesk.

Author:

  • Jason Colyer

Since:

  • 1.0.97

Class Method Summary collapse

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

.accountObject

Sets the global variable account

Author:

  • Jason Colyer

Since:

  • 1.0.97



103
104
105
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 103

def self.
  @account ||= 
end

.account_idObject

Sets the global variable account_id

Author:

  • Jason Colyer

Since:

  • 1.0.97



123
124
125
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 123

def self.
  @account_id ||= ENV.fetch('SFDC_ACCOUNT').split('/')[6]
end

.account_queryObject

Returns a String to get account information

Author:

  • Jason Colyer

Since:

  • 1.0.97



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.
  <<~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 = '#{}'
  STRING
end

.checksObject

Peform validity checks for this request

Author:

  • Jason Colyer

Since:

  • 1.0.97



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: #{}") if .nil?
  return unless errors.count.zero?

  errors.push("SFDC account #{} does not have an exception to remove") if .Support_Instance__c != 'federal-support'
end

.errorsObject

Sets the global variable errors

Author:

  • Jason Colyer

Since:

  • 1.0.97



67
68
69
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 67

def self.errors
  @errors ||= []
end

.fetch_accountObject

Run a SQOL query to get account information

Author:

  • Jason Colyer

Since:

  • 1.0.97



112
113
114
115
116
# File 'lib/support_readiness/support_super_form_processor/disable_us_government.rb', line 112

def self.
  query = Readiness::Salesforce::Queries.new()
  results = Readiness::Salesforce::Queries.run!(@sfdc_client, query)
  results.first
end

.messageObject

Return the string for the issue body

Author:

  • Jason Colyer

Since:

  • 1.0.97



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.message
  <<~STRING
    ## Remove US Government Support exception for #{.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_ID_18__c}](https://gitlab.lightning.force.com/lightning/r/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

Author:

  • Jason Colyer

Since:

  • 1.0.97



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 = message
  create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
  puts "Issue created: #{create.web_url}"
  exit 0
end

.projectObject

Sets the global variable project

Author:

  • Jason Colyer

Since:

  • 1.0.133



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

.requesterObject

Sets the global variable requester

Author:

  • Jason Colyer

Since:

  • 1.0.97



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_emailObject

Sets the global variable requester_email

Author:

  • Jason Colyer

Since:

  • 1.0.97



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_userObject

Sets the global variable zd_user

Author:

  • Jason Colyer

Since:

  • 1.0.97



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