Class: CoreMerchant::SubscriptionEvent
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- CoreMerchant::SubscriptionEvent
- Defined in:
- lib/core_merchant/subscription_event.rb
Overview
# Retrieve the last event of any type latest_event = subscription.subscription_events.last puts “Last event type: #latest_eventlatest_event.event_type, metadata: #latest_eventlatest_event.metadata” “‘
Direct Known Subclasses
SubscriptionCancellationEvent, SubscriptionPlanChangeEvent, SubscriptionRenewalEvent, SubscriptionStatusChangeEvent
Instance Method Summary collapse
Instance Method Details
#metadata ⇒ Object
40 41 42 43 |
# File 'lib/core_merchant/subscription_event.rb', line 40 def value = self[:metadata] value.is_a?(Hash) ? value : JSON.parse(value || "{}") end |
#metadata=(value) ⇒ Object
45 46 47 |
# File 'lib/core_merchant/subscription_event.rb', line 45 def (value) self[:metadata] = value.is_a?(Hash) ? value.to_json : value end |