Skip to content

Commit

Permalink
Fetch user account from yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
nico01f committed Nov 23, 2015
1 parent cbff812 commit d5f29be
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
6 changes: 0 additions & 6 deletions Gemfile

This file was deleted.

2 changes: 2 additions & 0 deletions credencial.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
correo: [email protected]
clave: nifo.simon
24 changes: 19 additions & 5 deletions gmail.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
require 'gmail'
require 'colorize'
require 'yaml'

email, pass = ARGV #Argumentos recibidos de main.rb

CREDENCIAL = YAML.load_file("credencial.yml") unless defined? CREDENCIAL

#Conecta con Gmail
g = Gmail.connect(email, pass)
if g.logged_in? == 'True'
puts "Estas conectado."
def conecta_gmail (email, pass)
g = Gmail.connect(email, pass)
if g.logged_in? == true
puts "Conectado!".green
else
puts "No estas conectado"
puts "No conectado!".red
end
end


def info_credencial()
puts "Usuario: #{CREDENCIAL['correo']}"
puts "Clave: #{CREDENCIAL['clave']}"
conecta_gmail(CREDENCIAL['correo'], CREDENCIAL['clave'])
end

info_credencial()
puts "Saliendo...".yellow



0 comments on commit d5f29be

Please sign in to comment.