class WoerkClient::Models::Shift
Constants
- RESOURCE_PATH
Attributes
params[RW]
Public Class Methods
new(params)
click to toggle source
@params [Hash] the shift params
@return [Shift]
# File lib/woerk_client/models/shift.rb, line 13 def initialize(params) @params = params end
Public Instance Methods
create()
click to toggle source
Submits a POST request to the database
@return [Boolean] if the API call was successful
# File lib/woerk_client/models/shift.rb, line 27 def create Client.post( path: RESOURCE_PATH, payload: { shift: @params } ) end
save()
click to toggle source
Calls update or create
@return [Boolean] if the API call was successful
# File lib/woerk_client/models/shift.rb, line 20 def save @params['id'] ? update : create end
update()
click to toggle source
Submits a PUT request to the database
@return [Boolean] if the API call was successful
# File lib/woerk_client/models/shift.rb, line 37 def update Client.put( path: "#{RESOURCE_PATH}/#{@params['id']}", payload: { shift: @params } ) end