lib/harvesting/models/time_entry.rb in harvesting-0.2.0 vs lib/harvesting/models/time_entry.rb in harvesting-0.3.0
- old
+ new
@@ -1,36 +1,43 @@
module Harvesting
module Models
- class TimeEntry < Base
+ class TimeEntry < HarvestRecord
attributed :id,
:spent_date,
:hours,
:notes,
- :created_at,
- :updated_at,
:is_locked,
:locked_reason,
:is_closed,
:is_billed,
:timer_started_at,
:started_time,
:ended_time,
:is_running,
- :invoice,
- :external_reference,
:billable,
:budgeted,
:billable_rate,
:cost_rate,
- :project_id,
- :task_id
+ :invoice,
+ :external_reference,
+ :created_at,
+ :updated_at,
+ :user_assignment # temporarily return the hash itself until the model is added
+ modeled project: Project,
+ user: User,
+ task: Task,
+ client: Client,
+ task_assignment: TaskAssignment
+
+
def path
- id.nil? ? "time_entries" : "time_entries/#{id}"
+ @attributes['id'].nil? ? "time_entries" : "time_entries/#{@attributes['id']}"
end
- def user
- Models::User.new(@attributes['user'], client: @client)
+ def to_hash
+ { project_id: project.id, task_id: task.id, user_id: user.id }.merge(super)
end
+
end
end
end