class Kounta::Order

Public Class Methods

new(hash = {}) click to toggle source
Calls superclass method Kounta::Resource::new
# File lib/kounta/order.rb, line 25
def initialize(hash = {})
  super(hash)
  self.payments ||= []
  self.lines ||= []
end

Public Instance Methods

ignored_properties() click to toggle source

we manually map these

Calls superclass method Kounta::Resource#ignored_properties
# File lib/kounta/order.rb, line 43
def ignored_properties
  super(%i[lock site_id])
end
resource_path() click to toggle source
# File lib/kounta/order.rb, line 38
def resource_path
  { companies: company_id, orders: id }
end
to_hash() click to toggle source
Calls superclass method Kounta::Resource#to_hash
# File lib/kounta/order.rb, line 31
def to_hash
  returning = {}
  returning[:lines] = lines.map(&:to_hash) if lines && !lines.empty?
  returning[:payments] = payments.map(&:to_hash) if payments && !payments.empty?
  super(returning)
end