Class: X402::SettlementResponse
- Inherits:
-
Object
- Object
- X402::SettlementResponse
- Defined in:
- lib/x402/settlement_response.rb
Instance Attribute Summary collapse
-
#error_reason ⇒ Object
Returns the value of attribute error_reason.
-
#network ⇒ Object
Returns the value of attribute network.
-
#payer ⇒ Object
Returns the value of attribute payer.
-
#success ⇒ Object
Returns the value of attribute success.
-
#transaction ⇒ Object
Returns the value of attribute transaction.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ SettlementResponse
constructor
A new instance of SettlementResponse.
- #success? ⇒ Boolean
- #to_base64 ⇒ Object
- #to_h ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ SettlementResponse
Returns a new instance of SettlementResponse.
7 8 9 10 11 12 13 |
# File 'lib/x402/settlement_response.rb', line 7 def initialize(attributes = {}) @success = attributes[:success] || attributes["success"] @transaction = attributes[:transaction] || attributes["transaction"] @network = attributes[:network] || attributes["network"] @payer = attributes[:payer] || attributes["payer"] @error_reason = attributes[:error_reason] || attributes["errorReason"] end |
Instance Attribute Details
#error_reason ⇒ Object
Returns the value of attribute error_reason.
5 6 7 |
# File 'lib/x402/settlement_response.rb', line 5 def error_reason @error_reason end |
#network ⇒ Object
Returns the value of attribute network.
5 6 7 |
# File 'lib/x402/settlement_response.rb', line 5 def network @network end |
#payer ⇒ Object
Returns the value of attribute payer.
5 6 7 |
# File 'lib/x402/settlement_response.rb', line 5 def payer @payer end |
#success ⇒ Object
Returns the value of attribute success.
5 6 7 |
# File 'lib/x402/settlement_response.rb', line 5 def success @success end |
#transaction ⇒ Object
Returns the value of attribute transaction.
5 6 7 |
# File 'lib/x402/settlement_response.rb', line 5 def transaction @transaction end |
Instance Method Details
#success? ⇒ Boolean
15 16 17 |
# File 'lib/x402/settlement_response.rb', line 15 def success? success == true end |
#to_base64 ⇒ Object
33 34 35 |
# File 'lib/x402/settlement_response.rb', line 33 def to_base64 Base64.strict_encode64(to_json) end |
#to_h ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/x402/settlement_response.rb', line 19 def to_h { success: success, transaction: transaction, network: network, payer: payer, errorReason: error_reason } end |
#to_json(*args) ⇒ Object
29 30 31 |
# File 'lib/x402/settlement_response.rb', line 29 def to_json(*args) to_h.to_json(*args) end |