Module: TodoableWrapper::Client::Item
- Included in:
- TodoableWrapper::Client
- Defined in:
- lib/todoable_wrapper/item.rb
Instance Method Summary collapse
- #add_item(list_id, item_name) ⇒ Object
- #delete_item(list_id, item_id) ⇒ Object
- #finish_item(list_id, item_id) ⇒ Object
Instance Method Details
#add_item(list_id, item_name) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/todoable_wrapper/item.rb', line 7 def add_item(list_id, item_name) validate_token item = { item: {name: item_name} } = { body: item.to_json, headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.post("/lists/#{list_id}/items", ) response.code end |
#delete_item(list_id, item_id) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/todoable_wrapper/item.rb', line 15 def delete_item(list_id, item_id) validate_token = { headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.delete("/lists/#{list_id}/items/#{item_id}", ) response.code end |
#finish_item(list_id, item_id) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/todoable_wrapper/item.rb', line 22 def finish_item(list_id, item_id) validate_token = { headers: {"Authorization" => "Token token=\"#{@token}\""} } response = self.class.put("/lists/#{list_id}/items/#{item_id}/finish", ) response.code end |