Sha256: af4cc788cfbe8e8da07643359323cec1cd6d03f94dfe3cf746ab0cc9378fc90a

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

class Caren::Store::LineItem < Caren::Base

  def self.keys
    [:id,                       # Integer (Caren id)
     :sku,                      # String
     :invoice_id,               # Integer (caren invoice id)
     :currency,                 # String (EUR)
     :description,              # String
     :discount_in_cents,        # Integer
     :discount_in_promillage,   # Integer (190 = 19%)
     :price_in_cents,           # Integer
     :quantity,                 # Integer
     :sales_tax_in_cents,       # Integer
     :sales_tax_in_promillage,  # Integer
    ] + super
  end
  
  def delete session
    session.delete self.class.resource_url(self.id)
  end
  
  def as_xml
    {
      :sku => self.sku,
      :currency => self.currency,
      :description => self.description,
      :discount_in_cents => self.discount_in_cents,
      :discount_in_promillage => self.discount_in_promillage,
      :price_in_cents => self.price_in_cents,
      :quantity => self.quantity,
      :sales_tax_in_cents => self.sales_tax_in_cents,
      :sales_tax_in_promillage => self.sales_tax_in_promillage
    }
  end

  def self.array_root
    :line_items
  end

  def self.node_root
    :line_item
  end

  def self.resource_location
    "/api/pro/store/line_items"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caren-api-0.5.0 lib/caren/store/line_item.rb