Method: Enom::CLI#initialize

Defined in:
lib/enom/cli.rb

#initializeCLI

Returns a new instance of CLI.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/enom/cli.rb', line 6

def initialize
  # If the username and password are set elsewhere, they take precedence
  unless Enom::Client.username && Enom::Client.password
    file = File.expand_path("~/.enomconfig")
    if File.exists?(file)
      credentials = YAML.load(File.new(file))
      Enom::Client.username = credentials["username"]
      Enom::Client.password = credentials["password"]
    else
      raise InvalidCredentials, "Please provide a username/password as arguments create a config file with credentials in ~/.enomconfig"
    end
  end
end