Class: C2eCore::Drops::OrderRecipeDrop
- Includes:
- Helpers::OrderConversions
- Defined in:
- /build/app/mailers/c2e_core/drops/order_recipe_drop.rb
Instance Method Summary collapse
-
#children ⇒ Array[OrderRecipeDrop]
-
Returns an array of side dish and cover order recipes for order recipe.
-
-
#finalized_name ⇒ String
-
Name of recipe in moment of submitting order.
-
-
#initialize(order_recipe, order) ⇒ OrderRecipeDrop
constructor
A new instance of OrderRecipeDrop.
-
#note ⇒ String
-
Customers note for recipe.
-
-
#price ⇒ Float
-
Price of current recipe converted into order’s currency.
-
-
#recipe ⇒ RecipeDrop
-
Returns recipe of order recipe as drop object.
-
Methods included from Helpers::OrderConversions
#converted_price, #format_price
Constructor Details
#initialize(order_recipe, order) ⇒ OrderRecipeDrop
Returns a new instance of OrderRecipeDrop.
8 9 10 11 12 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_drop.rb', line 8 def initialize(order_recipe, order) super() @order_recipe = order_recipe @order = order end |
Instance Method Details
#children ⇒ Array[OrderRecipeDrop]
Returns - Returns an array of side dish and cover order recipes for order recipe.
35 36 37 38 39 40 41 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_drop.rb', line 35 def children stored_value __method__ do return [] unless @order_recipe.parent_id.nil? @order_recipe.children.to_a.map { |child_recipe| OrderRecipeDrop.new child_recipe, @order } end end |
#finalized_name ⇒ String
Returns - Name of recipe in moment of submitting order. E.g.: “200g Zbojnický steak”.
15 16 17 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_drop.rb', line 15 def finalized_name @order_recipe.finalized_name_label end |
#note ⇒ String
Returns - Customers note for recipe. If not present, empty string is returned.
30 31 32 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_drop.rb', line 30 def note @order_recipe.notes.info.first&.text.to_s end |
#price ⇒ Float
Returns - Price of current recipe converted into order’s currency. E.g.: 78.
25 26 27 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_drop.rb', line 25 def price converted_price @order_recipe.price end |
#recipe ⇒ RecipeDrop
Returns - Returns recipe of order recipe as drop object.
20 21 22 |
# File '/build/app/mailers/c2e_core/drops/order_recipe_drop.rb', line 20 def recipe RecipeDrop.new @order_recipe.recipe end |