Class: Readiness::TicketProcessor::LockedAccount

Inherits:
Client
  • Object
show all
Defined in:
lib/support_readiness/ticket_processor/locked_account.rb

Overview

Defines the class LockedAccount within the module Zendesk.

Author:

  • Jason Colyer

Since:

  • 1.0.44

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

.locked_account_commentObject

Since:

  • 1.0.44



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/support_readiness/ticket_processor/locked_account.rb', line 40

def self.
  <<~STRING
    Hi,

    Thank you for contacting GitLab support.

    The account may be locked if the system has registered too many login attempts during a short period of time. It will be locked for 30 minutes, after which it will be unlocked automatically.

    On GitLab.com, we can also lock an account when there are 3 or more failed login attempts within 24 hours. Upon successful login, you may be redirected to a verification page and an email message with a 6-digit code is sent to your _primary_ email account. Please check your email (including the spam folder) for a message with a 6-digit code to unlock your account.

    Please let us know if you have any further questions or are unable to receive any emails for your account.
  STRING
end

.process!(zendesk_client, ticket_id) ⇒ Object

Process a Locked Account request

Author:

  • Jason Colyer

Since:

  • 1.0.44



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/ticket_processor/locked_account.rb', line 18

def self.process!(zendesk_client, ticket_id)
  @zendesk_client = zendesk_client
  @ticket_id = ticket_id
  @ticket = Readiness::Zendesk::Tickets.find(@zendesk_client, @ticket_id)
  puts 'No ticket found, so no org notes to add' if @ticket.is_a? Hash
  exit 0 if @ticket.is_a? Hash

  puts 'Ticket is closed, so ticket to process' if @ticket.status == 'closed'
  exit 0 if @ticket.status == 'closed'

  @ticket_fields = Readiness::Zendesk::TicketFields.list(@zendesk_client)
  @ticket_stage_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Ticket Stage', @ticket_fields)        
  new_ticket = Readiness::Zendesk::Tickets.new
  new_ticket.id = @ticket.id
  new_ticket.status = 'pending'
  new_ticket.comment = { body:  }
    new_ticket.custom_fields = [
      { id: @ticket_stage_field.id, value: 'stage-frt' }
    ]
  Readiness::Zendesk::Tickets.update!(zendesk_client, new_ticket)
end