Class: C2eCore::Drops::CreditsWalletActivityDrop

Inherits:
BaseDrop
  • Object
show all
Includes:
ActionView::Helpers::NumberHelper
Defined in:
/build/app/mailers/c2e_core/drops/credits_wallet_activity_drop.rb

Instance Method Summary collapse

Constructor Details

#initialize(wallet_activity) ⇒ CreditsWalletActivityDrop

Returns a new instance of CreditsWalletActivityDrop.



8
9
10
11
# File '/build/app/mailers/c2e_core/drops/credits_wallet_activity_drop.rb', line 8

def initialize(wallet_activity)
  super()
  @wallet_activity = wallet_activity
end

Instance Method Details

#amountFloat

Returns - The wallet activity amount, e.g. 123.45.

Returns:

  • (Float)
    • The wallet activity amount, e.g. 123.45.



40
41
42
# File '/build/app/mailers/c2e_core/drops/credits_wallet_activity_drop.rb', line 40

def amount
  @wallet_activity.amount
end

#company_branchCompanyBranchDrop

Returns - Returns company branch to which wallet activity belongs as drop object.

Returns:

  • (CompanyBranchDrop)
    • Returns company branch to which wallet activity belongs as drop object.



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

def company_branch
  stored_value __method__ do
    CompanyBranchDrop.new(@wallet_activity.company_branch)
  end
end

#currencyCurrencyDrop

Returns - Returns currency to which wallet activity belongs as drop object.

Returns:

  • (CurrencyDrop)
    • Returns currency to which wallet activity belongs as drop object.



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

def currency
  stored_value __method__ do
    CurrencyDrop.new @wallet_activity.currency
  end
end

#formatted_amountString

Returns - The wallet activity amount formatted in its currency, e.g. "123,45 Kč".

Returns:

  • (String)
    • The wallet activity amount formatted in its currency, e.g. "123,45 Kč".



45
46
47
# File '/build/app/mailers/c2e_core/drops/credits_wallet_activity_drop.rb', line 45

def formatted_amount
  number_to_currency(amount, unit: @wallet_activity.currency.to_s)
end

#idInteger

Returns - ID of wallet activity in database.

Returns:

  • (Integer)
    • ID of wallet activity in database.



14
15
16
# File '/build/app/mailers/c2e_core/drops/credits_wallet_activity_drop.rb', line 14

def id
  @wallet_activity.id
end

#userUserDrop

Returns - Returns user to which wallet activity belongs as drop object.

Returns:

  • (UserDrop)
    • Returns user to which wallet activity belongs as drop object.



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

def user
  stored_value __method__ do
    UserDrop.new(@wallet_activity.user)
  end
end

#walletCreditsWalletDrop

Returns - Returns wallet to which wallet activity belongs as drop object.

Returns:

  • (CreditsWalletDrop)
    • Returns wallet to which wallet activity belongs as drop object.



33
34
35
36
37
# File '/build/app/mailers/c2e_core/drops/credits_wallet_activity_drop.rb', line 33

def wallet
  stored_value __method__ do
    CreditsWalletDrop.new(@wallet_activity.wallet)
  end
end