Class: Readiness::TicketProcessor::CodeRequestAdvancedSAST
- Defined in:
- lib/support_readiness/ticket_processor/code_request_advanced_sast.rb
Overview
Defines the class CodeRequestAdvancedSAST within the module Zendesk.
Class Method Summary collapse
-
.approval(ticket) ⇒ Object
Update ticket for an approval.
-
.domain ⇒ Object
Return the domain of the zendesk instance being worked with.
-
.legal_slack_message(ticket) ⇒ Object
Return the message for the Slack post.
-
.process!(zendesk_client, slack_client, ticket_id) ⇒ Object
Process a code request for Advanced SAST.
-
.rejection(ticket) ⇒ Object
Update ticket for a rejection.
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
.approval(ticket) ⇒ Object
Update ticket for an approval
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/support_readiness/ticket_processor/code_request_advanced_sast.rb', line 50 def self.approval(ticket) new_ticket = Readiness::Zendesk::Tickets.new new_ticket. = ticket. + ['advanced_sast_code_request_approved'] Readiness::Zendesk::Tickets.update!(@zendesk_client, new_ticket) puts 'done (approval)' print 'Posting in Slack...' Readiness::Slack::Messages.create!(@slack_client, (ticket)) puts 'done' exit 0 end |
.domain ⇒ Object
Return the domain of the zendesk instance being worked with
77 78 79 |
# File 'lib/support_readiness/ticket_processor/code_request_advanced_sast.rb', line 77 def self.domain @zendesk_client.connection.url_prefix.to_s.split('/')[2] end |
.legal_slack_message(ticket) ⇒ Object
Return the message for the Slack post
66 67 68 69 70 |
# File 'lib/support_readiness/ticket_processor/code_request_advanced_sast.rb', line 66 def self.(ticket) <<~STRING Ticket <https://#{domain}/agent/tickets/#{ticket.id}|#{ticket.id}> has requested code information for Advanced SAST. They are being directed to legal@gitlab.com for this request. STRING end |
.process!(zendesk_client, slack_client, ticket_id) ⇒ Object
Process a code request for Advanced SAST
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/support_readiness/ticket_processor/code_request_advanced_sast.rb', line 18 def self.process!(zendesk_client, slack_client, ticket_id) @slack_client = slack_client @zendesk_client = zendesk_client ticket = Readiness::Zendesk::Tickets.find!(@zendesk_client, ticket_id) print 'Processing request...' rejection(ticket) if ticket.organization_id.nil? organization = Readiness::Zendesk::Tickets.find!(@zendesk_client, ticket.organization_id) approval(ticket) if organization.organization_fields['sub_dotcom_ultimate'] approval(ticket) if organization.organization_fields['sub_sm_ultimate'] approval(ticket) if organization.organization_fields['sub_gitlab_dedicated'] approval(ticket) if %w[open_partner select_partner alliance_partner].include? organization.organization_fields['account_type'] rejection(ticket) end |
.rejection(ticket) ⇒ Object
Update ticket for a rejection
37 38 39 40 41 42 43 |
# File 'lib/support_readiness/ticket_processor/code_request_advanced_sast.rb', line 37 def self.rejection(ticket) new_ticket = Readiness::Zendesk::Tickets.new new_ticket. = ticket. + ['advanced_sast_code_request_denied'] Readiness::Zendesk::Tickets.update!(@zendesk_client, new_ticket) puts 'done (rejection)' exit 0 end |