Class: Myob::Api::Model::Timesheet

Inherits:
Base
  • Object
show all
Defined in:
lib/myob/api/models/timesheet.rb

Constant Summary

Constants inherited from Base

Base::API_URL

Instance Method Summary collapse

Methods inherited from Base

#all, #first, #get, #initialize, #save

Constructor Details

This class inherits a constructor from Myob::Api::Model::Base

Instance Method Details

#model_routeObject



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

Returns:

  • (Boolean)


11
12
13
# File 'lib/myob/api/models/timesheet.rb', line 11

def new_record?(object)
  false
end

#url(object = 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



17
18
19
20
21
22
23
# File 'lib/myob/api/models/timesheet.rb', line 17

def url(object = nil)
  if object
    "#{super()}/#{object['Employee']['UID']}?StartDate=#{object['StartDate']}&EndDate=#{object['EndDate']}"
  else
    super
  end
end