Class: Todoable::List

Inherits:
Object
  • Object
show all
Defined in:
lib/todoable/list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_idObject

Returns the value of attribute list_id.



3
4
5
# File 'lib/todoable/list.rb', line 3

def list_id
  @list_id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/todoable/list.rb', line 3

def name
  @name
end

#userObject

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

#indexObject



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