Class: Harvesting::Models::Project

Inherits:
HarvestRecord show all
Defined in:
lib/harvesting/models/project.rb

Overview

A project record from your Harvest account.

For more information: help.getharvest.com/api-v2/projects-api/projects/projects/

Instance Attribute Summary

Attributes inherited from Base

#attributes, #harvest_client

Instance Method Summary collapse

Methods inherited from HarvestRecord

#create, #save, #update

Methods inherited from Base

#create, #delete, #fetch, get, #initialize, #save, #update

Constructor Details

This class inherits a constructor from Harvesting::Models::Base

Instance Method Details

#pathObject



33
34
35
# File 'lib/harvesting/models/project.rb', line 33

def path
  @attributes['id'].nil? ? "projects" : "projects/#{@attributes['id']}"
end

#task_assignmentsObject

Provides access to the task assignments that are associated with this project.



53
54
55
# File 'lib/harvesting/models/project.rb', line 53

def task_assignments
  harvest_client.task_assignments(project_id: self.id)
end

#time_entriesObject



41
42
43
# File 'lib/harvesting/models/project.rb', line 41

def time_entries
  harvest_client.time_entries(project_id: self.id)
end

#to_hashObject



37
38
39
# File 'lib/harvesting/models/project.rb', line 37

def to_hash
  { client_id: client.id }.merge(super)
end

#user_assignmentsObject

Provides access to the user assignments that are associated with this project.



47
48
49
# File 'lib/harvesting/models/project.rb', line 47

def user_assignments
  harvest_client.user_assignments(project_id: self.id)
end