Class: Wunderlist::List
- Inherits:
-
Object
- Object
- Wunderlist::List
- Defined in:
- lib/wunderlist/list.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#id ⇒ Object
Returns the value of attribute id.
-
#inbox ⇒ Object
Returns the value of attribute inbox.
-
#name ⇒ Object
Returns the value of attribute name.
-
#shared ⇒ Object
Returns the value of attribute shared.
Instance Method Summary collapse
- #create_task(name, date = nil) ⇒ Object
- #destroy(api = nil) ⇒ Object
- #flush ⇒ Object
-
#initialize(name = nil, inbox = nil, api = nil) ⇒ List
constructor
A new instance of List.
- #save(api = nil) ⇒ Object
- #tasks ⇒ Object
- #today ⇒ Object
Constructor Details
#initialize(name = nil, inbox = nil, api = nil) ⇒ List
Returns a new instance of List.
28 29 30 31 32 |
# File 'lib/wunderlist/list.rb', line 28 def initialize(name = nil, inbox = nil, api = nil) @name = name @inbox = inbox @api = api end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
26 27 28 |
# File 'lib/wunderlist/list.rb', line 26 def api @api end |
#id ⇒ Object
Returns the value of attribute id.
26 27 28 |
# File 'lib/wunderlist/list.rb', line 26 def id @id end |
#inbox ⇒ Object
Returns the value of attribute inbox.
26 27 28 |
# File 'lib/wunderlist/list.rb', line 26 def inbox @inbox end |
#name ⇒ Object
Returns the value of attribute name.
26 27 28 |
# File 'lib/wunderlist/list.rb', line 26 def name @name end |
#shared ⇒ Object
Returns the value of attribute shared.
26 27 28 |
# File 'lib/wunderlist/list.rb', line 26 def shared @shared end |
Instance Method Details
#create_task(name, date = nil) ⇒ Object
39 40 41 |
# File 'lib/wunderlist/list.rb', line 39 def create_task(name, date = nil) Wunderlist::Task.new(name, date, self, @api).save end |
#destroy(api = nil) ⇒ Object
54 55 56 57 |
# File 'lib/wunderlist/list.rb', line 54 def destroy(api = nil) @api ||= api @api.destroy(self) end |
#flush ⇒ Object
59 60 61 |
# File 'lib/wunderlist/list.rb', line 59 def flush @tasks = nil end |
#save(api = nil) ⇒ Object
49 50 51 52 |
# File 'lib/wunderlist/list.rb', line 49 def save(api = nil) @api ||= api @api.save(self) end |
#tasks ⇒ Object
34 35 36 37 |
# File 'lib/wunderlist/list.rb', line 34 def tasks @tasks = @api.tasks self if @tasks == nil @tasks end |
#today ⇒ Object
43 44 45 46 47 |
# File 'lib/wunderlist/list.rb', line 43 def today tasks.clone.keep_if do |t| t.date == Date.today end end |