Class: Spree::CSV::CouponCodePresenter
- Inherits:
-
Object
- Object
- Spree::CSV::CouponCodePresenter
- Defined in:
- app/presenters/spree/csv/coupon_code_presenter.rb
Constant Summary collapse
- HEADERS =
[ 'Code', 'State', 'Promotion Name', 'Order Number', 'Created At', 'Updated At' ].freeze
Instance Attribute Summary collapse
-
#coupon_code ⇒ Object
Returns the value of attribute coupon_code.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(coupon_code) ⇒ CouponCodePresenter
constructor
A new instance of CouponCodePresenter.
Constructor Details
#initialize(coupon_code) ⇒ CouponCodePresenter
Returns a new instance of CouponCodePresenter.
13 14 15 |
# File 'app/presenters/spree/csv/coupon_code_presenter.rb', line 13 def initialize(coupon_code) @coupon_code = coupon_code end |
Instance Attribute Details
#coupon_code ⇒ Object
Returns the value of attribute coupon_code.
17 18 19 |
# File 'app/presenters/spree/csv/coupon_code_presenter.rb', line 17 def coupon_code @coupon_code end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/presenters/spree/csv/coupon_code_presenter.rb', line 19 def call [ coupon_code.display_code, coupon_code.state, coupon_code.promotion&.name, coupon_code.order&.number, coupon_code.created_at&.strftime('%Y-%m-%d %H:%M:%S'), coupon_code.updated_at&.strftime('%Y-%m-%d %H:%M:%S') ] end |