Class: Contactually::Tasks
- Inherits:
-
Object
- Object
- Contactually::Tasks
- Defined in:
- lib/contactually.rb
Instance Method Summary collapse
-
#initialize(api_key) ⇒ Tasks
constructor
A new instance of Tasks.
- #list ⇒ Object
Constructor Details
#initialize(api_key) ⇒ Tasks
Returns a new instance of Tasks.
9 10 11 |
# File 'lib/contactually.rb', line 9 def initialize(api_key) @connection = Connection.new(api_key) end |
Instance Method Details
#list ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/contactually.rb', line 13 def list tasks = @connection.tasks_list rows = [] tasks["tasks"].each do |t| if t['completed_at'].nil? time = Time.parse(t['due_date']) rows << [time.strftime('%e %b'), t['associated_contact']['full_name'], t['title']] end end table = Terminal::Table.new :rows => rows puts table end |