Class: Basecampeverest::TodoList
- Inherits:
-
Object
- Object
- Basecampeverest::TodoList
- Defined in:
- lib/basecampeverest/resources/todo_list.rb
Class Method Summary collapse
-
.all ⇒ Basecampeverest::TodoList
find all todo lists for all projects via the Basecamp API.
-
.all_assigned(person_id) ⇒ Basecampeverest::TodoList
find all todo_lists assigned to a specific person via the Basecamp API.
-
.all_completed ⇒ Basecampeverest::TodoList
find all completed todo lists for all projects via the Basecamp API.
-
.delete(project_id, todo_list_id) ⇒ Basecampeverest::TodoList
delete a todo_list via the Basecamp API.
-
.find(project_id, todo_list_id) ⇒ Basecampeverest::TodoList
find all todo_lists for a specific project via the Basecamp API.
-
.find_completed(project_id) ⇒ Basecampeverest::TodoList
find all project specific todo lists via the Basecamp API.
- .for_project(project_id) ⇒ Object
-
.new(project_id, options = {}) ⇒ Basecampeverest::TodoList
create a todo_list via the Basecamp API.
-
.update(project_id, todo_list_id, options = {}) ⇒ Basecampeverest::TodoList
update a todo_list via the Basecamp API.
Class Method Details
.all ⇒ Basecampeverest::TodoList
find all todo lists for all projects via the Basecamp API
6 7 8 9 10 11 |
# File 'lib/basecampeverest/resources/todo_list.rb', line 6 def self.all response = Basecampeverest::Connect.get "/todolists.json" # parse the response to remove HTTParty info response.parsed_response end |
.all_assigned(person_id) ⇒ Basecampeverest::TodoList
find all todo_lists assigned to a specific person via the Basecamp API
61 62 63 64 65 66 67 |
# File 'lib/basecampeverest/resources/todo_list.rb', line 61 def self.all_assigned(person_id) url = "/people/#{person_id}/assigned_todos.json" response = Basecampeverest::Connect.get url # parse the response to remove HTTParty info response.parsed_response end |
.all_completed ⇒ Basecampeverest::TodoList
find all completed todo lists for all projects via the Basecamp API
16 17 18 19 20 21 |
# File 'lib/basecampeverest/resources/todo_list.rb', line 16 def self.all_completed response = Basecampeverest::Connect.get "/todolists/completed.json" # parse the response to remove HTTParty info response.parsed_response end |
.delete(project_id, todo_list_id) ⇒ Basecampeverest::TodoList
delete a todo_list via the Basecamp API
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/basecampeverest/resources/todo_list.rb', line 116 def self.delete(project_id, todo_list_id) url = "/projects/#{project_id}/todolists/#{todo_list_id}.json" response = Basecampeverest::Connect.delete url # This checks the response code for validity and error checking if response.code == 204 = "Todo List successfully deleted" elsif response.code == 403 = "You do not have permission to delete this Todo List" else = "Invalid project ID, todo list ID or authentication. The todo_list was not deleted." end # return the message end |
.find(project_id, todo_list_id) ⇒ Basecampeverest::TodoList
find all todo_lists for a specific project via the Basecamp API
41 42 43 44 45 46 47 |
# File 'lib/basecampeverest/resources/todo_list.rb', line 41 def self.find(project_id, todo_list_id) url = "/projects/#{project_id}/todolists/#{todo_list_id}.json" response = Basecampeverest::Connect.get url # parse the response to remove HTTParty info response.parsed_response end |
.find_completed(project_id) ⇒ Basecampeverest::TodoList
find all project specific todo lists via the Basecamp API
27 28 29 30 31 32 33 |
# File 'lib/basecampeverest/resources/todo_list.rb', line 27 def self.find_completed(project_id) url = "/projects/#{project_id}/todolists/completed.json" response = Basecampeverest::Connect.get url # parse the response to remove HTTParty info response.parsed_response end |
.for_project(project_id) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/basecampeverest/resources/todo_list.rb', line 49 def self.for_project(project_id) url = "/projects/#{project_id}/todolists.json" response = Basecampeverest::Connect.get url # parse the response to remove HTTParty info response.parsed_response end |
.new(project_id, options = {}) ⇒ Basecampeverest::TodoList
create a todo_list via the Basecamp API
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/basecampeverest/resources/todo_list.rb', line 74 def self.new(project_id, ={}) # if options[:name].nil? # return "You need a project name" # else # end post_params = { :body => .to_json, :headers => Basecampeverest::Connect.headers.merge({'Content-Type' => 'application/json'}) } url = "/projects/#{project_id}/todolists.json" # make the http basecamp call response = Basecampeverest::Connect.post url, post_params # parse the response to remove HTTParty info response.parsed_response end |
.update(project_id, todo_list_id, options = {}) ⇒ Basecampeverest::TodoList
update a todo_list via the Basecamp API
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/basecampeverest/resources/todo_list.rb', line 98 def self.update(project_id, todo_list_id, ={}) post_params = { :body => .to_json, :headers => Basecampeverest::Connect.merge({'Content-Type' => 'application/json'}) } url = "/projects/#{project_id}/todolists/#{todo_list_id}.json" # make the http basecamp call response = Basecampeverest::Connect.put url, post_params # parse the response to remove HTTParty info response.parsed_response end |