Sha256: ad7dba797c91f3b098ab9ed5ddf9d5093d09959a8162def49156bc6313e66a55
Contents?: true
Size: 908 Bytes
Versions: 1
Compression:
Stored size: 908 Bytes
Contents
# frozen_string_literal: true require 'wunderlist' module WunderlistToGithub # Collects Tasks from list in Wunderlist. class WunderlistSource def initialize(client_id, access_token) @wl = Wunderlist::API.new( access_token: access_token, client_id: client_id ) end # Returns an array of task hashes containing the most important fields. def tasks(list_name) complete_tasks = @wl.tasks([list_name], true) incomplete_tasks = @wl.tasks([list_name]) all_tasks = complete_tasks + incomplete_tasks all_tasks.map(&method(:convert_task_to_hash)) end def convert_task_to_hash(task) { title: task.title, completed: task.completed, note: task.note.content, comments: task.task_comments.map(&:text), subtasks: task.subtasks.reverse.map(&:title) # backwards, really? } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wunderlist_to_github-0.1.1 | lib/wunderlist_to_github/source.rb |