Class: LiquidPlanner::Resources::Item

Inherits:
LiquidPlannerResource show all
Defined in:
lib/liquidplanner/resources/item.rb

Direct Known Subclasses

Container, Leaf, Project

Instance Method Summary collapse

Methods inherited from LiquidPlannerResource

#load

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class LiquidPlanner::LiquidPlannerResource

Instance Method Details

#attach_document(attached_file_path, options = {}) ⇒ Object



32
33
34
35
36
# File 'lib/liquidplanner/resources/item.rb', line 32

def attach_document( attached_file_path, options={} )
  doc = Document.upload_document( workspace_id, id, attached_file_path, options )
  doc.prefix_options = luggage_params
  doc
end

#comments(scope = :all) ⇒ Object



24
25
26
# File 'lib/liquidplanner/resources/item.rb', line 24

def comments( scope=:all )
  Comment.find( scope, :params => luggage_params )
end

#documents(scope = :all) ⇒ Object



28
29
30
# File 'lib/liquidplanner/resources/item.rb', line 28

def documents( scope=:all )
  Document.find( scope, :params => luggage_params )
end

#estimates(scope = :all) ⇒ Object



42
43
44
# File 'lib/liquidplanner/resources/item.rb', line 42

def estimates( scope=:all )
  Estimate.find( scope, :params => luggage_params )
end

#folderObject



10
11
12
# File 'lib/liquidplanner/resources/item.rb', line 10

def folder
  Folder.find( :one, :from => "/api/workspaces/#{workspace_id}/folders/#{folder_id}" )
end

#item_collectionObject

LiquidPlanner::Item => ‘items’



47
48
49
# File 'lib/liquidplanner/resources/item.rb', line 47

def item_collection
  self.class.to_s.split('::').last.downcase.pluralize
end


38
39
40
# File 'lib/liquidplanner/resources/item.rb', line 38

def links( scope=:all )
  Link.find( scope, :params => luggage_params )
end

#noteObject



18
19
20
21
22
# File 'lib/liquidplanner/resources/item.rb', line 18

def note
  Note.find( :one, :from => "/api/workspaces/#{workspace_id}/#{item_collection}/#{id}/note" ).tap do |n|
    n.prefix_options = luggage_params
  end
end

#tasklistObject



14
15
16
# File 'lib/liquidplanner/resources/item.rb', line 14

def tasklist
  Tasklist.find( :one, :from => "/api/workspaces/#{workspace_id}/tasklists/#{tasklist_id}" )
end

#workspace_idObject



51
52
53
# File 'lib/liquidplanner/resources/item.rb', line 51

def workspace_id
  prefix_options[:workspace_id]
end