Class: LiquidPlanner::Resources::Leaf
- Inherits:
-
Treeitem
- Object
- ActiveResource::Base
- LiquidPlannerResource
- WorkspaceResource
- Treeitem
- LiquidPlanner::Resources::Leaf
- Includes:
- Movable, Packageable
- Defined in:
- lib/liquidplanner/resources/leaf.rb
Constant Summary collapse
- TRACK_TIME_KEYS =
[ :work, :activity_id, :member_id, :low, :high, :is_done, :done_on, :work_performed_on, :comment ].freeze
Instance Method Summary collapse
Methods included from Packageable
#package_after, #package_before
Methods included from MoveOrPackage
Methods included from Movable
Methods inherited from Treeitem
#activities, #attach_document, #client, #comments, #documents, #estimates, #item_collection, #links, #note, #package, #parent, #project, #workspace_id
Methods inherited from LiquidPlannerResource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class LiquidPlanner::LiquidPlannerResource
Instance Method Details
#track_time(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/liquidplanner/resources/leaf.rb', line 11 def track_time( ={} ) .assert_valid_keys( *TRACK_TIME_KEYS ) request_body = .to_json # ActiveResource post() by default: # response = post(:track_time, {}, request_body) # will set this route with 'new': /api/workspaces/36/tasks/new/activities.json # it's because of how it sets @persisted = true by default, calling custom_method_new_element_url() # what we want is: /api/workspaces/36/tasks/:id/activities.json, which is accomplished here: response = connection.post(custom_method_element_url(:track_time, ), request_body) load( self.class.format.decode( response.body ) ) end |