Top Level Namespace

Defined Under Namespace

Classes: GmailSender

Instance Method Summary collapse

Instance Method Details

#paramsObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'bin/gmail', line 37

def params
  return @params if @params

  config_file_path = File.join(ENV['HOME'],'.gmail')
  if !File.exists?(config_file_path)
    STDERR.puts "Please first create a ~/.gmail file with some defaults. Example:
      receiver_email: [email protected]
      sender_user: gmail_account_user_name
      sender_password: gmail_account_user_password
    "
    exit 1
  end

  defaults = {'subject' => 'Sent from command line',
              'sender_domain' => 'gmail.com'}

  @params = defaults.merge(YAML.load_file(config_file_path)).merge(Choice.choices)
end