Class: Readiness::SupportSuperFormProcessor::USGovIRSMSubscriptionsTemp

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

Overview

Defines the class USGovIRSMSubscriptionsTemp within the module Zendesk.

Author:

  • Jason Colyer

Since:

  • 1.0.42

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

.bodyString

Returns the ticket body

Returns:

  • (String)

Author:

  • Jason Colyer

Since:

  • 1.0.42



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 187

def self.body
  <<~STRING
    <p>
      Greetings,
    </p>
    <p>
      Please note that this is an <b>INTERNAL</b> ticket and should <b>NEVER</b> be shared with anyone. Please do not CC, BCC, forward, or anything else that can send the information from this ticket. <b>NEVER</b> add <i>anyone</i> outside of GitLab to this ticket or communications stemming from this ticket.
    </p>
    <p>
      A request has been filed for Extend an (almost) expired subscription (SM).
    </p>
    <p>
      The information for this is as follows:
    </p>
    <ul>
      <li>Contact's name: #{contact_name}</li>
      <li>Contact's email: #{contact_email}</li>
      <li>Contact's company: #{company}</li>
      <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_opportunity_string(opp_link)}</li>
      <li>Desired expiration date: #{extension_date}</li>
      <li>Seats needed in temp license: #{current}</li>
      <li>True-ups needed in temp license: #{trueup}</li>
      <li>Plan for temp license: #{plan}</li>
      <li>#{Readiness::SupportSuperFormProcessor::Shared.()}</li>
      <li>Reason for extension: #{reason}</li>
      <li>GitLab Version: #{version}</li>
    </ul>
    <p>
      <b>
        Verify the provided proof of approval of the extension before proceeding
      </b>
    </p>
    <p>
      Some additional context for this request is:
    </p>
    <pre>
      #{context}
    </pre>
  STRING
end

.companyObject

Sets the global variable company

Author:

  • Jason Colyer

Since:

  • 1.0.42



105
106
107
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 105

def self.company
  @company ||= ENV.fetch('COMPANY')
end

.contact_emailObject

Sets the global variable contact_email

Author:

  • Jason Colyer

Since:

  • 1.0.42



96
97
98
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 96

def self.contact_email
  @contact_email ||= ENV.fetch('CONTACT_EMAIL')
end

.contact_nameObject

Sets the global variable contact_name

Author:

  • Jason Colyer

Since:

  • 1.0.42



87
88
89
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 87

def self.contact_name
  @contact_name ||= ENV.fetch('CONTACT_NAME')
end

.contextObject

Sets the global variable context

Author:

  • Jason Colyer

Since:

  • 1.0.42



78
79
80
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 78

def self.context
  @context ||= ENV.fetch('LNR_OTHER_CONTEXT')
end

.currentObject

Sets the global variable current

Author:

  • Jason Colyer

Since:

  • 1.0.42



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

def self.current
  @current ||= ENV.fetch('SEAT_COUNT')
end

.extension_dateObject

Sets the global variable extension_date

Author:

  • Jason Colyer

Since:

  • 1.0.42



150
151
152
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 150

def self.extension_date
  @extension_date ||= ENV.fetch('EXPIRATION_DATE')
end

Sets the global variable opp_link

Author:

  • Jason Colyer

Since:

  • 1.0.42



114
115
116
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 114

def self.opp_link
  @opp_link ||= ENV.fetch('SFDC_OPPORTUNITY')
end

.planObject

Sets the global variable plan

Author:

  • Jason Colyer

Since:

  • 1.0.42



141
142
143
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 141

def self.plan
  @plan ||= ENV.fetch('SM_PLAN')
end

.process!(gitlab_client, gitlab_admin_client, zendesk_client) ⇒ Object

Process a US Government Internal Request Self-Managed Subscriptions Temp request

Author:

  • Jason Colyer

Since:

  • 1.0.42



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.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
  @ticket_forms = Readiness::Zendesk::TicketForms.list(@zendesk_client)
  @ticket_fields = Readiness::Zendesk::TicketFields.list(@zendesk_client)
  @license_issue_form = Readiness::Zendesk::TicketForms.find_by_name(@zendesk_client, 'License Issue', @ticket_forms)
  @ir_category_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'IR Category', @ticket_fields)
  @ir_submitter_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'IR Submitter', @ticket_fields)        
  requester
  zd_user
  ticket = Readiness::Zendesk::Tickets.new
  ticket.requester_id = zd_user.id
  ticket.submitter_id = zd_user.id
  ticket.comment = { html_body: body }
  ticket.subject = 'Internal Request - SM - Extend an (almost) expired subscription'
  ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_sm_license lnr_sm_license_extension]
  ticket.priority = 'normal'
  ticket.status = 'new'
  ticket.ticket_form_id = @license_issue_form.id
  ticket.custom_fields = [
    { id: @ir_category_field.id, value: 'ir_sm_temp' },
    { id: @ir_submitter_field.id,  value: zd_user.email }
  ]
  create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket)
  puts "Ticket created: #{create.id}"
end

.reasonObject

Sets the global variable reason

Author:

  • Jason Colyer

Since:

  • 1.0.42



159
160
161
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 159

def self.reason
  @reason ||= ENV.fetch('EXTENSION_REASON')
end

.requesterObject

Sets the global variable requester

Author:

  • Jason Colyer

Since:

  • 1.0.42



51
52
53
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 51

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.42



69
70
71
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 69

def self.requester_email
  @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
end

.sfdc_accountObject

Sets the global variable sfdc_account

Author:

  • Jason Colyer

Since:

  • 1.0.42



168
169
170
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 168

def self.
  @sfdc_account ||= ENV.fetch('SFDC_ACCOUNT')
end

.trueupObject

Sets the global variable trueup

Author:

  • Jason Colyer

Since:

  • 1.0.42



132
133
134
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 132

def self.trueup
  @trueup ||= ENV.fetch('TRUEUP_COUNT')
end

.versionObject

Sets the global variable version

Author:

  • Jason Colyer

Since:

  • 1.0.42



177
178
179
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 177

def self.version
  @version ||= ENV.fetch('SM_VERSION')
end

.zd_userObject

Sets the global variable zd_user

Author:

  • Jason Colyer

Since:

  • 1.0.42



60
61
62
# File 'lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb', line 60

def self.zd_user
  @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
end