Sha256: 239881fcc9b133a8e94fa2e24e845a9900587be24909a94c2ae3319b3937c063

Contents?: true

Size: 926 Bytes

Versions: 3

Compression:

Stored size: 926 Bytes

Contents

class Tane::Commands::Support < Tane::Commands::Base
  class << self
    def process(args)
      message = term.ask("Your message to the Cloudfuji clan: ")
      send_message_to_cloudfuji(message)
    end

    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

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

    def help_text
      <<-EOL
Usage:

    tane support

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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tane-0.0.5 lib/tane/commands/support.rb
tane-0.0.4 lib/tane/commands/support.rb
tane-0.0.3 lib/tane/commands/support.rb