Skip to content

Commit

Permalink
Added some new functionalities
Browse files Browse the repository at this point in the history
  • Loading branch information
nico01f committed Jan 2, 2016
1 parent 7f91648 commit 9ffc174
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


#Account file
Create account file, include credetentials to gmail account:
Create account file, include credentials to gmail account:

`touch account.yml`

Expand Down
20 changes: 19 additions & 1 deletion gmail_oo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,34 @@
class Check_email
ACCOUNT = YAML.load_file('account.yml') unless defined? ACCOUNT
G = Gmail.connect(ACCOUNT['email'], ACCOUNT['password'])


def info
puts "Account: #{ACCOUNT['email']}"
password_hided = '*' * ACCOUNT['password'].length
puts "Password: #{password_hided}"
puts '==============='
end

def unread
n = G.inbox.count(:unread)
end

def connected?
if G.logged_in? == true
puts 'Connected!'.green
else
puts 'Doh! Not connected'.red
end
end

def logout
G.logout
end

end

connection = Check_email.new
connection.info
connection.connected?
puts "There\'s #{connection.unread} unread email"
connection.logout

0 comments on commit 9ffc174

Please sign in to comment.