Class: Readiness::SupportSuperFormProcessor::TeamMemberLicense
- Defined in:
- lib/support_readiness/support_super_form_processor/team_member_license.rb
Overview
Defines the class TeamMemberLicense within the module Zendesk.
Class Method Summary collapse
-
.expiration ⇒ Object
Sets the global variable expiration.
-
.over_a_year_comment ⇒ Object
Returns a String used for a comment body.
-
.plan ⇒ Object
Sets the global variable plan.
-
.previous ⇒ Object
Sets the global variable previous.
-
.process!(client, admin_client, sandbox = false) ⇒ Object
Process a Team Member License 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.
-
.seats ⇒ Object
Sets the global variable seats.
-
.team_member_license_message ⇒ Object
Returns the issue description for a team member license request.
-
.trueup ⇒ Object
Sets the global variable trueup.
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
.expiration ⇒ Object
Sets the global variable expiration
130 131 132 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 130 def self.expiration @expiration ||= ENV.fetch('EXPIRATION_DATE') end |
.over_a_year_comment ⇒ Object
Returns a String used for a comment body
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 45 def self.over_a_year_comment <<~STRING Greetings @#{requester.username} ! We have detected the license you are requesting would have an expiration date over the standard allowance of one year. To proceed, please take one of the following actions: - Comment stating the maximum standard allowance of one year (#{Date.today + 1.years}) is acceptable - Comment explaining the reason for an exception to the maximum standard allowance of one year (#{Date.today + 1.years}) Please note without one of the above actions being done, we would not be able to proceed on this request. Thanks! STRING end |
.plan ⇒ Object
Sets the global variable plan
94 95 96 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 94 def self.plan @plan ||= ENV.fetch('SM_PLAN') end |
.previous ⇒ Object
Sets the global variable previous
121 122 123 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 121 def self.previous @previous ||= ENV.fetch('PREVIOUS_COUNT') end |
.process!(client, admin_client, sandbox = false) ⇒ Object
Process a Team Member License check request
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 18 def self.process!(client, admin_client, sandbox = false) @gitlab_client = client @gitlab_admin_client = admin_client requester issue = Readiness::GitLab::Issues.new if sandbox issue.title = "[SANDBOX REQUEST] GitLab Team Member License request - #{requester.name}" else issue.title = "GitLab Team Member License request - #{requester.name}" end issue.description = create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue) puts "Issue created: #{create.web_url}" if Date.parse(expiration) > Date.today + 1.years comment_params = { body: over_a_year_comment } Readiness::GitLab::Issues.create_comment!(@gitlab_client, project, create, comment_params) end exit 0 end |
.project ⇒ Object
Sets the global variable project
85 86 87 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 85 def self.project @project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119) end |
.requester ⇒ Object
Sets the global variable requester
67 68 69 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 67 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
76 77 78 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 76 def self.requester_email @requester_email ||= ENV.fetch('REQUESTER_EMAIL') end |
.seats ⇒ Object
Sets the global variable seats
103 104 105 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 103 def self.seats @seats ||= ENV.fetch('SEAT_COUNT') end |
.team_member_license_message ⇒ Object
Returns the issue description for a team member license request
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 139 def self. <<~STRING # GitLab Team Member License request ## Please Note the Following - This is for requesting an **internal** self-managed GitLab license. This license should **only** be used by **GitLab team members**. - This is solely for **self-managed** GitLab instances. If you are wanting a subscription put on a GitLab.com namespace, please file an AR to IT Ops using the appropriate template. - The license can only exist for one year at a time - The license will be generated via our cDot **staging** environment only. ## Information - Name: #{requester.name} - Email: #{requester.email} - GitLab username: @#{requester.username} - License plan: #{plan.capitalize} - Number of users: #{seats} - True-up count: #{trueup} - Previous user count: #{previous} - Expiration date: #{expiration} ### Support Operations * [ ] Follow the directions of the workflow, which can be found [here](https://handbook.gitlab.com/handbook/security/customer-support-operations/docs/team_member_licenses/) --- /confidential /assign @nabeel.bilgrami @avilla4 @secole @rverschoor /label ~"Stage::Development" ~administrative ~p4 /iteration [cadence:"Customer Support Operations"] --current STRING end |
.trueup ⇒ Object
Sets the global variable trueup
112 113 114 |
# File 'lib/support_readiness/support_super_form_processor/team_member_license.rb', line 112 def self.trueup @trueup ||= ENV.fetch('TRUEUP_COUNT') end |