Class: X402::Configuration::Route

Inherits:
Struct
  • Object
show all
Defined in:
lib/x402/configuration.rb

Overview

Route holds a raw +amount_sats+ that may be an Integer or a callable. The +resolve_amount_sats+ method evaluates callables at access time, enabling fiat-denominated pricing with live exchange rates.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#amount_satsObject

Returns the value of attribute amount_sats

Returns:

  • (Object)

    the current value of amount_sats



19
20
21
# File 'lib/x402/configuration.rb', line 19

def amount_sats
  @amount_sats
end

#arc_wait_forObject

Returns the value of attribute arc_wait_for

Returns:

  • (Object)

    the current value of arc_wait_for



19
20
21
# File 'lib/x402/configuration.rb', line 19

def arc_wait_for
  @arc_wait_for
end

#http_methodObject

Returns the value of attribute http_method

Returns:

  • (Object)

    the current value of http_method



19
20
21
# File 'lib/x402/configuration.rb', line 19

def http_method
  @http_method
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



19
20
21
# File 'lib/x402/configuration.rb', line 19

def path
  @path
end

Instance Method Details

#resolve_amount_satsObject

Resolves +amount_sats+ — if it's a callable (Proc/Lambda), it is evaluated each time to get the current sats amount.



22
23
24
# File 'lib/x402/configuration.rb', line 22

def resolve_amount_sats
  amount_sats.respond_to?(:call) ? amount_sats.call : amount_sats
end