Skip to content

Commit

Permalink
Rewritten in O.O
Browse files Browse the repository at this point in the history
  • Loading branch information
nico01f committed Jan 1, 2016
1 parent 6d078be commit 6a4b211
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions gmail_oo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'gmail'
require 'colorize'
require 'yaml'

class Check_email
ACCOUNT = YAML.load_file('account.yml') unless defined? ACCOUNT
G = Gmail.connect(ACCOUNT['email'], ACCOUNT['password'])

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

def logout
G.logout
end
end

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

0 comments on commit 6a4b211

Please sign in to comment.