Module: TodoableWrapper::Client::List
- Included in:
- TodoableWrapper::Client
- Defined in:
- lib/todoable_wrapper/list.rb
Instance Method Summary collapse
- #create_list(list_name) ⇒ Object
- #delete_list(id) ⇒ Object
- #get_list_by_id(id) ⇒ Object
- #lists(options = {}) ⇒ Object
- #update_list(id, list_name) ⇒ Object
Instance Method Details
#create_list(list_name) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/todoable_wrapper/list.rb', line 29 def create_list(list_name) validate_token list = { list: {name: list_name} } = { body: list.to_json, headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.post("/lists", ) response.code end |
#delete_list(id) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/todoable_wrapper/list.rb', line 45 def delete_list(id) validate_token = { headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.delete("/lists/#{id}", ) response.code end |
#get_list_by_id(id) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/todoable_wrapper/list.rb', line 18 def get_list_by_id(id) validate_token = { headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.get("/lists/#{id}", ) if response.success? JSON.parse(response.body) else response end end |
#lists(options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/todoable_wrapper/list.rb', line 7 def lists( = {}) validate_token = { headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.get('/lists', ) if response.success? JSON.parse(response.body) else response end end |
#update_list(id, list_name) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/todoable_wrapper/list.rb', line 37 def update_list(id, list_name) validate_token list = { list: {name: list_name} } = { body: list.to_json, headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.patch("/lists/#{id}", ) response.code end |