class Contactually::Tasks

Public Class Methods

new(api_key) click to toggle source
# File lib/contactually.rb, line 9
def initialize(api_key)
  @connection = Connection.new(api_key)
end

Public Instance Methods

list() click to toggle source
# 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