Class: WunderlistToGithub::WunderlistSource
- Inherits:
-
Object
- Object
- WunderlistToGithub::WunderlistSource
- Defined in:
- lib/wunderlist_to_github/source.rb
Overview
Collects Tasks from list in Wunderlist.
Instance Method Summary collapse
- #convert_task_to_hash(task) ⇒ Object
-
#initialize(client_id, access_token) ⇒ WunderlistSource
constructor
A new instance of WunderlistSource.
-
#tasks(list_name) ⇒ Object
Returns an array of task hashes containing the most important fields.
Constructor Details
#initialize(client_id, access_token) ⇒ WunderlistSource
Returns a new instance of WunderlistSource.
7 8 9 10 11 12 |
# File 'lib/wunderlist_to_github/source.rb', line 7 def initialize(client_id, access_token) @wl = Wunderlist::API.new( access_token: access_token, client_id: client_id ) end |
Instance Method Details
#convert_task_to_hash(task) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/wunderlist_to_github/source.rb', line 22 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 |
#tasks(list_name) ⇒ Object
Returns an array of task hashes containing the most important fields.
15 16 17 18 19 20 |
# File 'lib/wunderlist_to_github/source.rb', line 15 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 |