Class: UsageCredits::CallbackContext
- Inherits:
-
Struct
- Object
- Struct
- UsageCredits::CallbackContext
- Defined in:
- lib/usage_credits/callback_context.rb
Overview
Immutable context object passed to all callbacks Provides consistent, typed access to event data
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#category ⇒ Object
Returns the value of attribute category.
-
#event ⇒ Object
Returns the value of attribute event.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#new_balance ⇒ Object
Returns the value of attribute new_balance.
-
#operation_name ⇒ Object
Returns the value of attribute operation_name.
-
#previous_balance ⇒ Object
Returns the value of attribute previous_balance.
-
#threshold ⇒ Object
Returns the value of attribute threshold.
-
#transaction ⇒ Object
Returns the value of attribute transaction.
-
#wallet ⇒ Object
Returns the value of attribute wallet.
Instance Method Summary collapse
-
#owner ⇒ Object
Convenience: get owner from wallet.
- #to_h ⇒ Object
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount
6 7 8 |
# File 'lib/usage_credits/callback_context.rb', line 6 def amount @amount end |
#category ⇒ Object
Returns the value of attribute category
6 7 8 |
# File 'lib/usage_credits/callback_context.rb', line 6 def category @category end |
#event ⇒ Object
Returns the value of attribute event
6 7 8 |
# File 'lib/usage_credits/callback_context.rb', line 6 def event @event end |
#metadata ⇒ Object
Returns the value of attribute metadata
6 7 8 |
# File 'lib/usage_credits/callback_context.rb', line 6 def @metadata end |
#new_balance ⇒ Object
Returns the value of attribute new_balance
6 7 8 |
# File 'lib/usage_credits/callback_context.rb', line 6 def new_balance @new_balance end |
#operation_name ⇒ Object
Returns the value of attribute operation_name
6 7 8 |
# File 'lib/usage_credits/callback_context.rb', line 6 def operation_name @operation_name end |
#previous_balance ⇒ Object
Returns the value of attribute previous_balance
6 7 8 |
# File 'lib/usage_credits/callback_context.rb', line 6 def previous_balance @previous_balance end |
#threshold ⇒ Object
Returns the value of attribute threshold
6 7 8 |
# File 'lib/usage_credits/callback_context.rb', line 6 def threshold @threshold end |
#transaction ⇒ Object
Returns the value of attribute transaction
6 7 8 |
# File 'lib/usage_credits/callback_context.rb', line 6 def transaction @transaction end |
#wallet ⇒ Object
Returns the value of attribute wallet
6 7 8 |
# File 'lib/usage_credits/callback_context.rb', line 6 def wallet @wallet end |
Instance Method Details
#owner ⇒ Object
Convenience: get owner from wallet
24 25 26 |
# File 'lib/usage_credits/callback_context.rb', line 24 def owner wallet&.owner end |
#to_h ⇒ Object
19 20 21 |
# File 'lib/usage_credits/callback_context.rb', line 19 def to_h super.compact end |