gen_email.rb
# Figure out the email type, by finding the flag argument and comparing it against a regex to validate what the user
# wants to do. For example: ruby gen_email.rb -t generic <= Will create a generic email to be sent, and copy it to the
# users clipboard.
Figure out the email type, by finding the flag argument and comparing it against a regex to validate what the user
wants to do. For example: ruby gen_email.rb -t generic <= Will create a generic email to be sent, and copy it to the
users clipboard.
Figure out the email type by finding the flag argument and comparing it against a regex to validate what the user wants to do . For example : ruby gen_email . rb - t generic < = Will create a generic email to be sent and copy it to the users clipboard .
def gather_intel
  case OPTIONS[:type]
    when /osha/
      FORMAT.info('Creating OSHA Regional email..')
      EMAILS.osha_reg
    when /pend/
      FORMAT.info('Creating 6 day hold pending email..')
      EMAILS.pend
    when /60/
      FORMAT.info('Creating 60 day hold account deletion email..')
      EMAILS.sixty_day
    when /generic/
      FORMAT.info('Creating generic email..')
      EMAILS.generic
    when /resolve/
      FORMAT.info('Creating resolution ticket..')
      EMAILS.resolve
    when /esc/
      FORMAT.info('Creating escalation ticket..')
      EMAILS.assign
    when /pii/
      FORMAT.info('Creating request to remove personal info..')
      EMAILS.remove_pii
    when /vip/
      FORMAT.info('Creating VIP user email..')
      EMAILS.vip_user
    when /inop/
      FORMAT.info('Creating INOP user email..')
      EMAILS.in_op_user
    when /dev/
      begin
        if OPTIONS[:type].to_s.include?('dev=unlock')
          message = 'unlock'
        elsif OPTIONS[:type].to_s.include?('dev=reset')
          message = 'password reset'
        else
          raise InvalidDevRequestError
        end
        FORMAT.info("Creating dev account #{message} email")
        EMAILS.dev_account(OPTIONS[:type])
      rescue InvalidDevRequestError
        FORMAT.err("#{OPTIONS[:type].to_s.split('=').last} is not a valid dev email, please try again..")
      end
    when /cancel/
      FORMAT.info('Creating cancellation request..')
      EMAILS.cancel_ticket
    else
      raise InvalidOptionError
  end
end
def gather_intel case OPTIONS [ :type ] when / osha / FORMAT . info ( 'Creating OSHA Regional email..' ) EMAILS . osha_reg when / pend / FORMAT . info ( 'Creating 6 day hold pending email..' ) EMAILS . pend when / 60 / FORMAT . info ( 'Creating 60 day hold account deletion email..' ) EMAILS . sixty_day when / generic / FORMAT . info ( 'Creating generic email..' ) EMAILS . generic when / resolve / FORMAT . info ( 'Creating resolution ticket..' ) EMAILS . resolve when / esc / FORMAT . info ( 'Creating escalation ticket..' ) EMAILS . assign when / pii / FORMAT . info ( 'Creating request to remove personal info..' ) EMAILS . remove_pii when / vip / FORMAT . info ( 'Creating VIP user email..' ) EMAILS . vip_user when / inop / FORMAT . info ( 'Creating INOP user email..' ) EMAILS . in_op_user when / dev / begin if OPTIONS [ :type ] . to_s . include? ( 'dev=unlock' ) message = 'unlock' elsif OPTIONS [ :type ] . to_s . include? ( 'dev=reset' ) message = 'password reset' else raise InvalidDevRequestError end FORMAT . info ( "Creating dev account #{message} email" ) EMAILS . dev_account ( OPTIONS [ :type ] ) rescue InvalidDevRequestError FORMAT . err ( "#{OPTIONS[:type].to_s.split('=').last} is not a valid dev email, please try again.." ) end when / cancel / FORMAT . info ( 'Creating cancellation request..' ) EMAILS . cancel_ticket else raise InvalidOptionError end end
Figure out the email type, by finding the flag argument and comparing it against a regex to validate what the user
wants to do.
Figure out the email type by finding the flag argument and comparing it against a regex to validate what the user wants to do .