Class: Dobedobedo::Project
- Inherits:
-
Object
- Object
- Dobedobedo::Project
- Includes:
- ObjToJson
- Defined in:
- lib/dobedobedo/project.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(token, workspace_id, h = {}) ⇒ Project
constructor
A new instance of Project.
- #tasks ⇒ Object
- #update ⇒ Object
Methods included from ObjToJson
#objToJson, #obj_to_json, #obj_to_json2
Constructor Details
#initialize(token, workspace_id, h = {}) ⇒ Project
Returns a new instance of Project.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dobedobedo/project.rb', line 7 def initialize(token, workspace_id, h={}) @token = token @workspace_id = workspace_id if h.nil? #if we're creating a new project object without a hash of data, hit the post resource to create an empty obj h = token.post("/workspaces/#{workspace_id}/projects").parsed end h.each do |k,v| Project.send(:attr_accessor, k.to_sym) self.send("#{k}=".to_sym, v) end end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
5 6 7 |
# File 'lib/dobedobedo/project.rb', line 5 def token @token end |
Class Method Details
Instance Method Details
#delete ⇒ Object
36 37 38 |
# File 'lib/dobedobedo/project.rb', line 36 def delete() @token.delete("/workspaces/#{@workspace_id}/projects/#{@id}") end |
#tasks ⇒ Object
28 29 30 |
# File 'lib/dobedobedo/project.rb', line 28 def tasks @token.get("/workspaces/#{@workspace_id}/projects/#{@id}/tasks").parsed.map {|t| Dobedobedo::Task.new(@token, @id, nil, t)} end |
#update ⇒ Object
32 33 34 |
# File 'lib/dobedobedo/project.rb', line 32 def update() @token.put("/workspaces/#{@workspace_id}/projects/#{@id}", :body => self.objToJson) end |