class Wunderlist::List
A List
is a FilterableList
which can be synchronized with an API
object
Attributes
api[RW]
Reference to the associated API
object. Necessary for many methods.
id[RW]
ID of the list on the Wunderlist
server
inbox[RW]
Value which determines whether this list is a INBOX or or not
name[RW]
Name of the list
Public Class Methods
new(name = nil, inbox = nil, api = nil)
click to toggle source
# File lib/wunderlist/list.rb, line 128 def initialize(name = nil, inbox = nil, api = nil) @name = name @inbox = inbox @api = api end
Public Instance Methods
create_task(name, date = nil)
click to toggle source
Create task with specified name and date
# File lib/wunderlist/list.rb, line 143 def create_task(name, date = nil) Wunderlist::Task.new(name, date, self, @api).save end
destroy(api = nil)
click to toggle source
Destroy list with api
# File lib/wunderlist/list.rb, line 156 def destroy(api = nil) @api ||= api @api.destroy(self) end
flush()
click to toggle source
Remove tasks cache
# File lib/wunderlist/list.rb, line 163 def flush @tasks = nil end
save(api = nil)
click to toggle source
Save list with api
# File lib/wunderlist/list.rb, line 149 def save(api = nil) @api ||= api @api.save(self) end
tasks()
click to toggle source
Get all tasks
# File lib/wunderlist/list.rb, line 136 def tasks @tasks = @api.tasks self if @tasks == nil @tasks end
to_s()
click to toggle source
# File lib/wunderlist/list.rb, line 167 def to_s lines = [] lines << "[List]#{inbox ? " [INBOX]" : ""} #{name} - #{tasks.count != 1 ? (tasks.count.to_s + " tasks") : tasks.count.to_s + " task"}" tasks.each do |task| lines << " #{task}" end lines.join "\n" end