Class: X402::Payments::V2::PayloadBuilder
- Inherits:
-
Object
- Object
- X402::Payments::V2::PayloadBuilder
- Defined in:
- lib/x402/payments/v2/payload_builder.rb
Instance Attribute Summary collapse
-
#accepted ⇒ Object
readonly
Returns the value of attribute accepted.
-
#authorization ⇒ Object
readonly
Returns the value of attribute authorization.
-
#extensions ⇒ Object
readonly
Returns the value of attribute extensions.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(authorization:, signature:, resource:, accepted:, extensions: {}) ⇒ PayloadBuilder
constructor
A new instance of PayloadBuilder.
Constructor Details
#initialize(authorization:, signature:, resource:, accepted:, extensions: {}) ⇒ PayloadBuilder
Returns a new instance of PayloadBuilder.
9 10 11 12 13 14 15 |
# File 'lib/x402/payments/v2/payload_builder.rb', line 9 def initialize(authorization:, signature:, resource:, accepted:, extensions: {}) @authorization = @signature = signature @resource = resource @accepted = accepted @extensions = extensions || {} end |
Instance Attribute Details
#accepted ⇒ Object (readonly)
Returns the value of attribute accepted.
7 8 9 |
# File 'lib/x402/payments/v2/payload_builder.rb', line 7 def accepted @accepted end |
#authorization ⇒ Object (readonly)
Returns the value of attribute authorization.
7 8 9 |
# File 'lib/x402/payments/v2/payload_builder.rb', line 7 def @authorization end |
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
7 8 9 |
# File 'lib/x402/payments/v2/payload_builder.rb', line 7 def extensions @extensions end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
7 8 9 |
# File 'lib/x402/payments/v2/payload_builder.rb', line 7 def resource @resource end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
7 8 9 |
# File 'lib/x402/payments/v2/payload_builder.rb', line 7 def signature @signature end |
Class Method Details
.build(authorization:, signature:, resource:, accepted:, extensions: {}) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/x402/payments/v2/payload_builder.rb', line 60 def build(authorization:, signature:, resource:, accepted:, extensions: {}) new( authorization: , signature: signature, resource: resource, accepted: accepted, extensions: extensions ).build end |
Instance Method Details
#build ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/x402/payments/v2/payload_builder.rb', line 17 def build { x402Version: 2, resource: build_resource, accepted: build_accepted, payload: { signature: signature, authorization: { from: [:from], to: [:to], value: [:value], validAfter: [:valid_after], validBefore: [:valid_before], nonce: [:nonce] } }, extensions: extensions } end |