Class: C2eCore::Drops::PromoCodeProgressDrop

Inherits:
BaseDrop
  • Object
show all
Defined in:
/build/app/mailers/c2e_core/drops/promo_code_progress_drop.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ PromoCodeProgressDrop

Returns a new instance of PromoCodeProgressDrop.



7
8
9
10
11
12
13
14
15
# File '/build/app/mailers/c2e_core/drops/promo_code_progress_drop.rb', line 7

def initialize(args)
  super()
  @company_branch = args[:company_branch]
  @customer = args[:customer]
  @options = args[:options]
  @applicable_count = args[:applicable_count]
  @remaining_count = args[:remaining_count]
  @validity = args[:validity]
end

Instance Method Details

#applicable_countInteger

Returns - Number of items (pizzas / orders) customer already collected during this action. E.g.: 8.

Returns:

  • (Integer)
    • Number of items (pizzas / orders) customer already collected during this action. E.g.: 8



36
37
38
# File '/build/app/mailers/c2e_core/drops/promo_code_progress_drop.rb', line 36

def applicable_count
  @applicable_count
end

#company_branchCompanyBranchDrop

Returns - Company branch which given this promo code as drop object.

Returns:



18
19
20
21
22
# File '/build/app/mailers/c2e_core/drops/promo_code_progress_drop.rb', line 18

def company_branch
  stored_value __method__ do
    CompanyBranchDrop.new @company_branch
  end
end

#descriptionString

Returns - Description of rule this notification is associated.

Returns:

  • (String)
    • Description of rule this notification is associated.



31
32
33
# File '/build/app/mailers/c2e_core/drops/promo_code_progress_drop.rb', line 31

def description
  C2eCore::JsonLocalization.locale_for(@options["description"]["full"], I18n.locale).to_s
end

#remaining_countInteger

Returns - Number of items (pizzas / orders) customer need to collect to claim promo code. E.g.: 2.

Returns:

  • (Integer)
    • Number of items (pizzas / orders) customer need to collect to claim promo code. E.g.: 2



41
42
43
# File '/build/app/mailers/c2e_core/drops/promo_code_progress_drop.rb', line 41

def remaining_count
  @remaining_count
end

#rules_urlString?

Returns - URL with rules of this action.

Returns:

  • (String, nil)
    • URL with rules of this action.



46
47
48
# File '/build/app/mailers/c2e_core/drops/promo_code_progress_drop.rb', line 46

def rules_url
  @options["url"]
end

#unsubscribe_urlString

Returns - URL for unsubscribing from marketing actions.

Returns:

  • (String)
    • URL for unsubscribing from marketing actions.



51
52
53
# File '/build/app/mailers/c2e_core/drops/promo_code_progress_drop.rb', line 51

def unsubscribe_url
  C2eCore::Users::MarketingService.new(customer_id: @customer.id, company_branch_id: @company_branch.id).unsubscribe_url
end

#validityDateTime

Returns - Datetime object containing validity of information in this email. E.g.: “2020-11-16T11:38:56+01:00”.

Returns:

  • (DateTime)
    • Datetime object containing validity of information in this email.

    E.g.: “2020-11-16T11:38:56+01:00”.



26
27
28
# File '/build/app/mailers/c2e_core/drops/promo_code_progress_drop.rb', line 26

def validity
  @validity
end