Class: Oshpark::OrderItem
- Inherits:
-
Object
- Object
- Oshpark::OrderItem
show all
- Includes:
- Model, Stateful
- Defined in:
- lib/oshpark/order_item.rb
Constant Summary
collapse
- STATES =
%w| NEW AWAITING_PANEL PANELIZED ORDERED FABBED SHIPPED CANCELLED |
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Stateful
included
Methods included from Model
#dirty?, included, #initialize
Class Method Details
.attrs ⇒ Object
6
7
8
9
|
# File 'lib/oshpark/order_item.rb', line 6
def self.attrs
%w| name batches batch_cost sub_total price quantity state confirmed_at panelized_at
ordered_at fabbed_at shipped_at project_id panel_id order_item_option_selections |
end
|
Instance Method Details
#confirmed_at ⇒ Object
28
29
30
|
# File 'lib/oshpark/order_item.rb', line 28
def confirmed_at
time_from @confirmed_at
end
|
#fabbed_at ⇒ Object
40
41
42
|
# File 'lib/oshpark/order_item.rb', line 40
def fabbed_at
time_from @fabbed_at
end
|
#order_item_option_selections ⇒ Object
22
23
24
25
26
|
# File 'lib/oshpark/order_item.rb', line 22
def order_item_option_selections
Array(@order_item_option_selections).map do |json|
Oshpark::OrderItemOptionSelection.from_json json
end
end
|
#ordered_at ⇒ Object
36
37
38
|
# File 'lib/oshpark/order_item.rb', line 36
def ordered_at
time_from @ordered_at
end
|
#panel ⇒ Object
18
19
20
|
# File 'lib/oshpark/order_item.rb', line 18
def panel
Oshpark::Panel.find @panel_id if @panel_id
end
|
#panelized_at ⇒ Object
32
33
34
|
# File 'lib/oshpark/order_item.rb', line 32
def panelized_at
time_from @panelized
end
|
#project ⇒ Object
14
15
16
|
# File 'lib/oshpark/order_item.rb', line 14
def project
Oshpark::Project.find @project_id if @project_id
end
|
#shipped_at ⇒ Object
44
45
46
|
# File 'lib/oshpark/order_item.rb', line 44
def shipped_at
time_from @shipped_at
end
|