Class: Kounta::Order
- Defined in:
- lib/kounta/order.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#ignored_properties ⇒ Object
we manually map these.
-
#initialize(hash = {}) ⇒ Order
constructor
A new instance of Order.
- #resource_path ⇒ Object
- #to_hash ⇒ Object
Methods inherited from Resource
coerce, #delete!, has_many, has_many_in_time_range, has_one, #new?, #save!
Constructor Details
#initialize(hash = {}) ⇒ Order
Returns a new instance of Order.
25 26 27 28 29 |
# File 'lib/kounta/order.rb', line 25 def initialize(hash = {}) super(hash) self.payments ||= [] self.lines ||= [] end |
Instance Method Details
#ignored_properties ⇒ Object
we manually map these
43 44 45 |
# File 'lib/kounta/order.rb', line 43 def ignored_properties super(i[lock site_id]) end |
#resource_path ⇒ Object
38 39 40 |
# File 'lib/kounta/order.rb', line 38 def resource_path { companies: company_id, orders: id } end |
#to_hash ⇒ Object
31 32 33 34 35 36 |
# 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 |