Class: Myob::Api::Model::Timesheet
- Defined in:
- lib/myob/api/models/timesheet.rb
Constant Summary
Constants inherited from Base
Base::API_URL, Base::QUERY_OPTIONS
Instance Method Summary collapse
- #for(user_id, start_date, end_date) ⇒ Object
- #model_route ⇒ Object
-
#new_record?(object) ⇒ Boolean
developer.myob.com/api/accountright/v2/payroll/timesheet/ we always want to PUT timesheets, so they are never a “new” record.
-
#url(object = nil, params = nil) ⇒ Object
a timesheet is identified based on an employee UID as well as its start and end date it does not have a UID of its own.
Methods inherited from Base
#all, #all_items, #destroy, #find, #first, #initialize, #next_page, #next_page?, #records, #save
Constructor Details
This class inherits a constructor from Myob::Api::Model::Base
Instance Method Details
#for(user_id, start_date, end_date) ⇒ Object
15 16 17 |
# File 'lib/myob/api/models/timesheet.rb', line 15 def for(user_id, start_date, end_date) self.send(:perform_request, url({'Employee' => {'UID' => user_id}, 'StartDate' => start_date, 'EndDate' => end_date})) end |
#model_route ⇒ Object
5 6 7 |
# File 'lib/myob/api/models/timesheet.rb', line 5 def model_route 'Payroll/Timesheet' end |
#new_record?(object) ⇒ Boolean
developer.myob.com/api/accountright/v2/payroll/timesheet/ we always want to PUT timesheets, so they are never a “new” record
11 12 13 |
# File 'lib/myob/api/models/timesheet.rb', line 11 def new_record?(object) false end |
#url(object = nil, params = nil) ⇒ Object
a timesheet is identified based on an employee UID as well as its start and end date it does not have a UID of its own
21 22 23 24 25 26 27 |
# File 'lib/myob/api/models/timesheet.rb', line 21 def url(object = nil, params = nil) if object "#{super()}/#{object['Employee']['UID']}?StartDate=#{object['StartDate']}&EndDate=#{object['EndDate']}" else super end end |