Class: PolarLoop::Types::Mandate
- Inherits:
-
Struct
- Object
- Struct
- PolarLoop::Types::Mandate
- Defined in:
- lib/polarloop/types/mandate.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#last_charged_at ⇒ Object
Returns the value of attribute last_charged_at.
-
#max_total_amount ⇒ Object
Returns the value of attribute max_total_amount.
-
#merchant ⇒ Object
Returns the value of attribute merchant.
-
#payer ⇒ Object
Returns the value of attribute payer.
-
#reference_id ⇒ Object
Returns the value of attribute reference_id.
-
#token ⇒ Object
Returns the value of attribute token.
-
#total_charged ⇒ Object
Returns the value of attribute total_charged.
Class Method Summary collapse
-
.from_abi(values) ⇒ Object
Converts positional array from ABI decoder to Mandate struct.
- .to_hex_bytes32(binary) ⇒ Object
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def active @active end |
#amount ⇒ Object
Returns the value of attribute amount
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def amount @amount end |
#created_at ⇒ Object
Returns the value of attribute created_at
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def created_at @created_at end |
#interval ⇒ Object
Returns the value of attribute interval
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def interval @interval end |
#last_charged_at ⇒ Object
Returns the value of attribute last_charged_at
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def last_charged_at @last_charged_at end |
#max_total_amount ⇒ Object
Returns the value of attribute max_total_amount
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def max_total_amount @max_total_amount end |
#merchant ⇒ Object
Returns the value of attribute merchant
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def merchant @merchant end |
#payer ⇒ Object
Returns the value of attribute payer
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def payer @payer end |
#reference_id ⇒ Object
Returns the value of attribute reference_id
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def reference_id @reference_id end |
#token ⇒ Object
Returns the value of attribute token
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def token @token end |
#total_charged ⇒ Object
Returns the value of attribute total_charged
5 6 7 |
# File 'lib/polarloop/types/mandate.rb', line 5 def total_charged @total_charged end |
Class Method Details
.from_abi(values) ⇒ Object
Converts positional array from ABI decoder to Mandate struct. ABI order matches Solidity struct field order.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/polarloop/types/mandate.rb', line 21 def self.from_abi(values) new( payer: values[0], created_at: values[1].to_i, last_charged_at: values[2].to_i, merchant: values[3], interval: values[4].to_i, active: values[5], token: values[6], amount: values[7].to_i, max_total_amount: values[8].to_i, total_charged: values[9].to_i, reference_id: to_hex_bytes32(values[10]) ) end |
.to_hex_bytes32(binary) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/polarloop/types/mandate.rb', line 37 def self.to_hex_bytes32(binary) return "0x" + "00" * 32 if binary.nil? if binary.is_a?(String) && binary.start_with?("0x") binary.downcase elsif binary.is_a?(String) "0x" + binary.unpack1("H*") else "0x" + binary.to_s(16).rjust(64, "0") end end |