Class: Logan::Project
- Inherits:
-
Object
- Object
- Logan::Project
- Includes:
- HashConstructed
- Defined in:
- lib/logan/project.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#all_todolists ⇒ Array<Logan::TodoList>
get both active and completed todo lists for this project from Basecamp API.
-
#completed_todolists ⇒ Array<Logan::TodoList>
get completed todo lists for this project from Basecamp API.
-
#create_todolist(todo_list) ⇒ Logan::TodoList
create a todo list in this project via Basecamp API.
-
#todolist(list_id) ⇒ Logan::TodoList
get an individual todo list for this project from Basecamp API.
-
#todolists ⇒ Array<Logan::TodoList>
get active todo lists for this project from Basecamp API.
Methods included from HashConstructed
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/logan/project.rb', line 8 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/logan/project.rb', line 9 def name @name end |
Instance Method Details
#all_todolists ⇒ Array<Logan::TodoList>
get both active and completed todo lists for this project from Basecamp API
34 35 36 |
# File 'lib/logan/project.rb', line 34 def all_todolists todolists + completed_todolists end |
#completed_todolists ⇒ Array<Logan::TodoList>
get completed todo lists for this project from Basecamp API
24 25 26 27 28 29 |
# File 'lib/logan/project.rb', line 24 def completed_todolists completed_response = Logan::Client.get "/projects/#{@id}/todolists/completed.json" lists_array = completed_response.parsed_response.map do |h| Logan::TodoList.new h.merge({ :project_id => @id }) end end |
#create_todolist(todo_list) ⇒ Logan::TodoList
create a todo list in this project via Basecamp API
51 52 53 54 55 56 57 58 59 |
# File 'lib/logan/project.rb', line 51 def create_todolist(todo_list) post_params = { :body => todo_list.post_json, :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'}) } response = Logan::Client.post "/projects/#{@id}/todolists.json", post_params Logan::TodoList.new response.merge({ :project_id => @id }) end |
#todolist(list_id) ⇒ Logan::TodoList
get an individual todo list for this project from Basecamp API
42 43 44 45 |
# File 'lib/logan/project.rb', line 42 def todolist(list_id) response = Logan::Client.get "/projects/#{@id}/todolists/#{list_id}.json" Logan::TodoList.new response.parsed_response.merge({ :project_id => @id }) end |
#todolists ⇒ Array<Logan::TodoList>
get active todo lists for this project from Basecamp API
14 15 16 17 18 19 |
# File 'lib/logan/project.rb', line 14 def todolists active_response = Logan::Client.get "/projects/#{@id}/todolists.json" lists_array = active_response.parsed_response.map do |h| Logan::TodoList.new h.merge({ :project_id => @id }) end end |