class Mixpal::Revenue

Attributes

amount[R]
properties[R]

Public Class Methods

from_store(data) click to toggle source
# File lib/mixpal/revenue.rb, line 22
def self.from_store(data)
  new(data['amount'], data['properties'])
end
new(amount, properties) click to toggle source
# File lib/mixpal/revenue.rb, line 5
def initialize(amount, properties)
  @amount = amount
  @properties = properties
end

Public Instance Methods

render() click to toggle source
# File lib/mixpal/revenue.rb, line 10
def render
  args = "#{amount}, #{properties_as_js_object_for_mixpanel}"
  "mixpanel.people.track_charge(#{args});".html_safe
end
to_store() click to toggle source
# File lib/mixpal/revenue.rb, line 15
def to_store
  {
    'amount' => amount,
    'properties' => properties
  }
end

Private Instance Methods

properties_as_js_object_for_mixpanel() click to toggle source
# File lib/mixpal/revenue.rb, line 28
def properties_as_js_object_for_mixpanel
  Mixpal::Util.hash_to_js_object_string(properties)
end