Class: GmailToDo
- Inherits:
-
Object
- Object
- GmailToDo
- Defined in:
- lib/gmail_todo.rb
Constant Summary collapse
- CREDENTIALS =
ENV['HOME'] + '/.gmail_todo_credentials.yml'
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize ⇒ GmailToDo
constructor
A new instance of GmailToDo.
- #send(todo, details = nil) ⇒ Object
Constructor Details
#initialize ⇒ GmailToDo
Returns a new instance of GmailToDo.
10 11 12 13 14 15 16 |
# File 'lib/gmail_todo.rb', line 10 def initialize if File.exists?(CREDENTIALS) load_credentials else prompt_for_credentials end end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
8 9 10 |
# File 'lib/gmail_todo.rb', line 8 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
7 8 9 |
# File 'lib/gmail_todo.rb', line 7 def username @username end |
Instance Method Details
#send(todo, details = nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gmail_todo.rb', line 18 def send(todo, details = nil) gmail = Gmail.connect(username, password) gmail.deliver do to gmail.username subject "[ToDo] #{todo}" body "#{details}" end gmail.logout end |