Class: UsageCredits::CallbackContext

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#amountObject

Returns the value of attribute amount

Returns:

  • (Object)

    the current value of amount



6
7
8
# File 'lib/usage_credits/callback_context.rb', line 6

def amount
  @amount
end

#categoryObject

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



6
7
8
# File 'lib/usage_credits/callback_context.rb', line 6

def category
  @category
end

#eventObject

Returns the value of attribute event

Returns:

  • (Object)

    the current value of event



6
7
8
# File 'lib/usage_credits/callback_context.rb', line 6

def event
  @event
end

#metadataObject

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



6
7
8
# File 'lib/usage_credits/callback_context.rb', line 6

def 
  @metadata
end

#new_balanceObject

Returns the value of attribute new_balance

Returns:

  • (Object)

    the current value of new_balance



6
7
8
# File 'lib/usage_credits/callback_context.rb', line 6

def new_balance
  @new_balance
end

#operation_nameObject

Returns the value of attribute operation_name

Returns:

  • (Object)

    the current value of operation_name



6
7
8
# File 'lib/usage_credits/callback_context.rb', line 6

def operation_name
  @operation_name
end

#previous_balanceObject

Returns the value of attribute previous_balance

Returns:

  • (Object)

    the current value of previous_balance



6
7
8
# File 'lib/usage_credits/callback_context.rb', line 6

def previous_balance
  @previous_balance
end

#thresholdObject

Returns the value of attribute threshold

Returns:

  • (Object)

    the current value of threshold



6
7
8
# File 'lib/usage_credits/callback_context.rb', line 6

def threshold
  @threshold
end

#transactionObject

Returns the value of attribute transaction

Returns:

  • (Object)

    the current value of transaction



6
7
8
# File 'lib/usage_credits/callback_context.rb', line 6

def transaction
  @transaction
end

#walletObject

Returns the value of attribute wallet

Returns:

  • (Object)

    the current value of wallet



6
7
8
# File 'lib/usage_credits/callback_context.rb', line 6

def wallet
  @wallet
end

Instance Method Details

#ownerObject

Convenience: get owner from wallet



24
25
26
# File 'lib/usage_credits/callback_context.rb', line 24

def owner
  wallet&.owner
end

#to_hObject



19
20
21
# File 'lib/usage_credits/callback_context.rb', line 19

def to_h
  super.compact
end