Module: EffectiveProductsStampWizard
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/effective_products_stamp_wizard.rb
Overview
EffectiveProductsStampWizard
Mark your owner model with effective_products_stamp_wizard to get all the includes
Defined Under Namespace
Modules: Base, ClassMethods
Instance Method Summary collapse
- #assign_pricing ⇒ Object
- #build_stamp ⇒ Object
- #done? ⇒ Boolean
- #in_progress? ⇒ Boolean
- #stamp ⇒ Object
-
#stamp! ⇒ Object
After the configure Stamp step.
-
#to_s ⇒ Object
Instance Methods.
Instance Method Details
#assign_pricing ⇒ Object
120 121 122 123 124 125 126 127 128 |
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 120 def assign_pricing raise('assign_pricing() to be implemented by including class') # price = (stamp.physical? ? 100_00 : 50_00) # qb_item_name = "Professional Stamp" # tax_exempt = false # stamp.assign_attributes(price: price, qb_item_name: qb_item_name, tax_exempt: tax_exempt) end |
#build_stamp ⇒ Object
110 111 112 113 114 115 116 117 118 |
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 110 def build_stamp stamp = stamps.build(owner: owner) if (address = owner.try(:shipping_address) || owner.try(:billing_address)).present? stamp.shipping_address = address end stamp end |
#done? ⇒ Boolean
102 103 104 |
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 102 def done? submitted? end |
#in_progress? ⇒ Boolean
98 99 100 |
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 98 def in_progress? draft? end |
#stamp ⇒ Object
106 107 108 |
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 106 def stamp stamps.first end |
#stamp! ⇒ Object
After the configure Stamp step
131 132 133 134 135 |
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 131 def stamp! assign_pricing() if stamp.present? raise('expected stamp to have a price') if stamp.price.blank? save! end |
#to_s ⇒ Object
Instance Methods
94 95 96 |
# File 'app/models/concerns/effective_products_stamp_wizard.rb', line 94 def to_s persisted? ? "#{model_name.human} ##{id}" : model_name.human end |