Class: Todoable::Item
- Inherits:
- 
      Object
      
        - Object
- Todoable::Item
 
- Defined in:
- lib/todoable.rb
Overview
Class that represents TODO Items
Instance Attribute Summary collapse
- 
  
    
      #finished_at  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute finished_at. 
- 
  
    
      #id  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute id. 
- 
  
    
      #name  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute name. 
Instance Method Summary collapse
- 
  
    
      #delete  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Delete the TODO item from the list. 
- 
  
    
      #initialize(todoable, list, params)  ⇒ Item 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    Create instances of the Item class. 
- 
  
    
      #mark_finished  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Marks the TODO item as finished. 
Constructor Details
#initialize(todoable, list, params) ⇒ Item
Create instances of the Item class
| 96 97 98 99 100 101 102 | # File 'lib/todoable.rb', line 96 def initialize todoable, list, params @todoable = todoable @list = list @name = params['name'] @id = params['id'] @finished_at = params['finished_at'] end | 
Instance Attribute Details
#finished_at ⇒ Object
Returns the value of attribute finished_at
| 84 85 86 | # File 'lib/todoable.rb', line 84 def finished_at @finished_at end | 
#id ⇒ Object
Returns the value of attribute id
| 83 84 85 | # File 'lib/todoable.rb', line 83 def id @id end | 
#name ⇒ Object
Returns the value of attribute name
| 82 83 84 | # File 'lib/todoable.rb', line 82 def name @name end | 
Instance Method Details
#delete ⇒ Object
Delete the TODO item from the list
| 111 112 113 114 | # File 'lib/todoable.rb', line 111 def delete params = {:list_id => @list.id, :item_id => @id} @todoable.request!("delete", ITEM_PATH, params) end | 
#mark_finished ⇒ Object
Marks the TODO item as finished
| 105 106 107 108 | # File 'lib/todoable.rb', line 105 def mark_finished params = {:list_id => @list.id, :item_id => @id} @todoable.request!("put", ITEM_FINISHED_PATH, params) end |