Class: Mixpal::Revenue
- Inherits:
-
Object
- Object
- Mixpal::Revenue
- Defined in:
- lib/mixpal/revenue.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(amount, properties) ⇒ Revenue
constructor
A new instance of Revenue.
- #render ⇒ Object
- #to_store ⇒ Object
Constructor Details
#initialize(amount, properties) ⇒ Revenue
Returns a new instance of Revenue.
5 6 7 8 |
# File 'lib/mixpal/revenue.rb', line 5 def initialize(amount, properties) @amount = amount @properties = properties end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
3 4 5 |
# File 'lib/mixpal/revenue.rb', line 3 def amount @amount end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
3 4 5 |
# File 'lib/mixpal/revenue.rb', line 3 def properties @properties end |
Class Method Details
.from_store(data) ⇒ Object
22 23 24 |
# File 'lib/mixpal/revenue.rb', line 22 def self.from_store(data) new(data['amount'], data['properties']) end |
Instance Method Details
#render ⇒ Object
10 11 12 13 |
# 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 ⇒ Object
15 16 17 18 19 20 |
# File 'lib/mixpal/revenue.rb', line 15 def to_store { 'amount' => amount, 'properties' => properties } end |