Class: Todoable::List
- Inherits:
-
Object
- Object
- Todoable::List
- Defined in:
- lib/todoable/list.rb
Instance Attribute Summary collapse
-
#list_id ⇒ Object
Returns the value of attribute list_id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #create(content) ⇒ Object
- #delete(id) ⇒ Object
- #index ⇒ Object
-
#initialize(user) ⇒ List
constructor
A new instance of List.
- #show(id) ⇒ Object
- #update(id, content) ⇒ Object
Constructor Details
#initialize(user) ⇒ List
Returns a new instance of List.
5 6 7 |
# File 'lib/todoable/list.rb', line 5 def initialize(user) @user = user end |
Instance Attribute Details
#list_id ⇒ Object
Returns the value of attribute list_id.
3 4 5 |
# File 'lib/todoable/list.rb', line 3 def list_id @list_id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/todoable/list.rb', line 3 def name @name end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'lib/todoable/list.rb', line 3 def user @user end |
Instance Method Details
#create(content) ⇒ Object
13 14 15 |
# File 'lib/todoable/list.rb', line 13 def create(content) user.make_request(LISTS_PATH, :post, { list: {name: content} }) end |
#delete(id) ⇒ Object
25 26 27 |
# File 'lib/todoable/list.rb', line 25 def delete(id) user.make_request(LISTS_PATH+"/#{id}", :delete) end |
#index ⇒ Object
9 10 11 |
# File 'lib/todoable/list.rb', line 9 def index user.make_request(LISTS_PATH, :get)['lists'] end |
#show(id) ⇒ Object
17 18 19 |
# File 'lib/todoable/list.rb', line 17 def show(id) user.make_request(LISTS_PATH+"/#{id}", :get) end |
#update(id, content) ⇒ Object
21 22 23 |
# File 'lib/todoable/list.rb', line 21 def update(id, content) user.make_request(LISTS_PATH+"/#{id}", :patch, {list: {name: content}} ) end |