Class: Tane::Commands::Support

Inherits:
Base
  • Object
show all
Defined in:
lib/tane/commands/support.rb

Class Method Summary collapse

Methods inherited from Base

fire

Methods included from Helpers

included

Class Method Details

.email_from_credentials_or_promptObject



21
22
23
24
# File 'lib/tane/commands/support.rb', line 21

def email_from_credentials_or_prompt
  return username if logged_in?
  return term.ask("And your email address is: ")
end

.help_textObject



26
27
28
29
30
31
32
33
34
# File 'lib/tane/commands/support.rb', line 26

def help_text
  <<-EOL
Usage:

tane support

Prompts you for a message to send to the Cloudfuji team.
EOL
end

.process(args) ⇒ Object



3
4
5
6
# File 'lib/tane/commands/support.rb', line 3

def process(args)
  message = term.ask("Your message to the Cloudfuji clan: ")
  send_message_to_cloudfuji(message)
end

.send_message_to_cloudfuji(message) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tane/commands/support.rb', line 8

def send_message_to_cloudfuji(message)
  support_data = {}
  support_data[:source]  = "tane"
  support_data[:email]   = email_from_credentials_or_prompt
  support_data[:message] = message

  RestClient.post support_url, support_data

  term.say("Send the cloudfuji team your message:")
  term.say("\t#{message}")
  term.say("Boy are they gonna be excited to hear from you, #{support_data[:email]}")
end