Class: C2eCore::Drops::OrderRecipeFlatDrop
- Includes:
- Helpers::OrderConversions
- Defined in:
- /build/app/mailers/c2e_core/drops/order_recipe_flat_drop.rb
Instance Method Summary collapse
-
#cover_price ⇒ Float
-
Total price recipe covers converted into order’s currency.
-
-
#covers ⇒ Array[OrderRecipeDrop]
-
Returns an array of cover order recipes for order recipe flat.
-
-
#initialize(order_recipe_flat_hash, order) ⇒ OrderRecipeFlatDrop
constructor
A new instance of OrderRecipeFlatDrop.
-
#note ⇒ String
-
Customers note for recipe.
-
-
#price ⇒ Float
-
Unit price of recipe converted into order’s currency.
-
-
#quantity ⇒ Integer
-
count of current recipe in order.
-
-
#recipe ⇒ RecipeDrop
-
Returns recipe for order recipe flat as drop object.
-
-
#side_dishes ⇒ Array[OrderRecipeDrop]
-
Returns an array of side dish order recipes for order recipe flat.
-
-
#total_price ⇒ Float
-
Total price of recipe including covers and side dishes converted into order’s currency.
-
Methods included from Helpers::OrderConversions
#converted_price, #format_price
Constructor Details
#initialize(order_recipe_flat_hash, order) ⇒ OrderRecipeFlatDrop
Returns a new instance of OrderRecipeFlatDrop.
8 9 10 11 12 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_flat_drop.rb', line 8 def initialize(order_recipe_flat_hash, order) super() @order_recipe_flat_hash = OpenStruct.new order_recipe_flat_hash @order = order end |
Instance Method Details
#cover_price ⇒ Float
Returns - Total price recipe covers converted into order’s currency. E.g.: 20.
36 37 38 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_flat_drop.rb', line 36 def cover_price converted_price @order_recipe_flat_hash.cover_price end |
#covers ⇒ Array[OrderRecipeDrop]
Returns - Returns an array of cover order recipes for order recipe flat.
47 48 49 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_flat_drop.rb', line 47 def covers @order_recipe_flat_hash.covers.map { |cover| OrderRecipeDrop.new cover, @order } end |
#note ⇒ String
Returns - Customers note for recipe. If not present, empty string is returned.
52 53 54 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_flat_drop.rb', line 52 def note @order_recipe_flat_hash.note end |
#price ⇒ Float
Returns - Unit price of recipe converted into order’s currency. E.g.: 78.
25 26 27 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_flat_drop.rb', line 25 def price converted_price @order_recipe_flat_hash.price end |
#quantity ⇒ Integer
Returns - count of current recipe in order. E.g.: 2.
20 21 22 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_flat_drop.rb', line 20 def quantity @order_recipe_flat_hash.quantity end |
#recipe ⇒ RecipeDrop
Returns - Returns recipe for order recipe flat as drop object.
15 16 17 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_flat_drop.rb', line 15 def recipe RecipeDrop.new @order_recipe_flat_hash.recipe end |
#side_dishes ⇒ Array[OrderRecipeDrop]
Returns - Returns an array of side dish order recipes for order recipe flat.
41 42 43 44 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_flat_drop.rb', line 41 def side_dishes @order_recipe_flat_hash.children_without_covers_sorted .map { |order_recipe| OrderRecipeDrop.new order_recipe, @order } end |
#total_price ⇒ Float
Returns - Total price of recipe including covers and side dishes converted into order’s currency. E.g.: 130.
31 32 33 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_flat_drop.rb', line 31 def total_price converted_price @order_recipe_flat_hash.total_price end |