Class: Caren::Store::LineItem
- Inherits:
-
Base
- Object
- Base
- Caren::Store::LineItem
show all
- Defined in:
- lib/caren/store/line_item.rb
Instance Attribute Summary
Attributes inherited from Base
#attributes, #original_xml
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
from_xml, hash_from_image, init_dependent_objects, #initialize, #node_root, #resource_url, resource_url, search_url, #to_xml, to_xml
Constructor Details
This class inherits a constructor from Caren::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Caren::Base
Class Method Details
.array_root ⇒ Object
47
48
49
|
# File 'lib/caren/store/line_item.rb', line 47
def self.array_root
:line_items
end
|
.keys ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/caren/store/line_item.rb', line 3
def self.keys
[:id, :external_id, :sku, :invoice_id, :billable_id, :currency, :description, :affect_credits, :discount_in_cents, :discount_in_promillage, :commission_in_cents, :commission_in_promillage, :price_in_cents, :quantity, :unit, :sales_tax_in_cents, :sales_tax_in_promillage, ] + super
end
|
.node_root ⇒ Object
51
52
53
|
# File 'lib/caren/store/line_item.rb', line 51
def self.node_root
:line_item
end
|
.resource_location ⇒ Object
55
56
57
|
# File 'lib/caren/store/line_item.rb', line 55
def self.resource_location
"/api/pro/store/line_items"
end
|
Instance Method Details
#as_xml ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/caren/store/line_item.rb', line 28
def as_xml
{
:id => self.id,
:external_id => self.external_id,
:sku => self.sku,
:billable_id => self.billable_id,
: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,
:affect_credits => self.affect_credits,
:unit => self.unit,
:sales_tax_in_cents => self.sales_tax_in_cents,
:sales_tax_in_promillage => self.sales_tax_in_promillage
}
end
|
#delete(session) ⇒ Object
24
25
26
|
# File 'lib/caren/store/line_item.rb', line 24
def delete session
session.delete self.class.resource_url(self.id)
end
|