Class: Kounta::Shift

Inherits:
Resource
  • Object
show all
Defined in:
lib/kounta/shift.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

coerce, #delete!, has_many, has_many_in_time_range, has_one, #ignored_properties, #new?, #save!

Constructor Details

#initialize(hash = {}) ⇒ Shift

Returns a new instance of Shift.



14
15
16
17
# File 'lib/kounta/shift.rb', line 14

def initialize(hash = {})
  super(hash)
  self.breaks ||= []
end

Instance Method Details

#to_hashObject



19
20
21
22
23
# File 'lib/kounta/shift.rb', line 19

def to_hash
  returning = {}
  returning[:breaks] = breaks.map(&:to_hash) if breaks && !breaks.empty?
  super(returning)
end