Class: Nis::Apostille
- Inherits:
-
Object
- Object
- Nis::Apostille
- Defined in:
- lib/nis/apostille.rb
Constant Summary collapse
- CHECKSUM =
'fe4e5459'.freeze
Instance Method Summary collapse
- #apostille_format(transaction_hash) ⇒ Object
-
#initialize(keypair, file, hashing = :sha256, multisig: false, private: false, network: :testnet) ⇒ Apostille
constructor
A new instance of Apostille.
- #multisig? ⇒ Boolean
- #private? ⇒ Boolean
- #transaction ⇒ Object
Constructor Details
#initialize(keypair, file, hashing = :sha256, multisig: false, private: false, network: :testnet) ⇒ Apostille
Returns a new instance of Apostille.
14 15 16 17 18 19 20 21 |
# File 'lib/nis/apostille.rb', line 14 def initialize(keypair, file, hashing = :sha256, multisig: false, private: false, network: :testnet) @keypair = keypair @file = file @hashing = hashing @multisig = multisig @private = private @network = network end |
Instance Method Details
#apostille_format(transaction_hash) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/nis/apostille.rb', line 42 def apostille_format(transaction_hash) ext = File.extname(@file.path) name = File.basename(@file.path, ext) date = Date.today.strftime('%Y-%m-%d') '%s -- Apostille TX %s -- Date %s%s' % [ name, transaction_hash, date, ext ] end |
#multisig? ⇒ Boolean
27 28 29 |
# File 'lib/nis/apostille.rb', line 27 def multisig? @multisig end |
#private? ⇒ Boolean
23 24 25 |
# File 'lib/nis/apostille.rb', line 23 def private? @private end |
#transaction ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/nis/apostille.rb', line 31 def transaction if private? raise 'Not implemented private apostille.' else dedicated_address = apostille[:sink] apostille_hash = calc_hash end Nis::Transaction::Transfer.new(dedicated_address, 0, apostille_hash) end |