Class: Clamp::Analytics::Money

Inherits:
Struct
  • Object
show all
Defined in:
lib/clamp_analytics/money.rb

Overview

A typed monetary value attached to any event property.

Clamp::Analytics.track('purchase',
  properties: {
    plan: 'pro',
    total: Clamp::Analytics::Money.new(29.00, 'USD'),
    tax: Clamp::Analytics::Money.new(4.35, 'USD')
  }
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#amountObject

Returns the value of attribute amount

Returns:

  • (Object)

    the current value of amount



14
15
16
# File 'lib/clamp_analytics/money.rb', line 14

def amount
  @amount
end

#currencyObject

Returns the value of attribute currency

Returns:

  • (Object)

    the current value of currency



14
15
16
# File 'lib/clamp_analytics/money.rb', line 14

def currency
  @currency
end

Instance Method Details

#to_wireObject



15
16
17
# File 'lib/clamp_analytics/money.rb', line 15

def to_wire
  { amount: amount, currency: currency }
end