module TodoableWrapper::Client::List
Public Instance Methods
create_list(list_name)
click to toggle source
# File lib/todoable_wrapper/list.rb, line 29 def create_list(list_name) validate_token list = { list: {name: list_name} } options = { body: list.to_json, headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.post("/lists", options) response.code end
delete_list(id)
click to toggle source
# File lib/todoable_wrapper/list.rb, line 45 def delete_list(id) validate_token options = { headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.delete("/lists/#{id}", options) response.code end
get_list_by_id(id)
click to toggle source
# File lib/todoable_wrapper/list.rb, line 18 def get_list_by_id(id) validate_token options = { headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.get("/lists/#{id}", options) if response.success? JSON.parse(response.body) else response end end
lists(options = {})
click to toggle source
# File lib/todoable_wrapper/list.rb, line 7 def lists(options = {}) validate_token options = { headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.get('/lists', options) if response.success? JSON.parse(response.body) else response end end
update_list(id, list_name)
click to toggle source
# File lib/todoable_wrapper/list.rb, line 37 def update_list(id, list_name) validate_token list = { list: {name: list_name} } options = { body: list.to_json, headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.patch("/lists/#{id}", options) response.code end