Class: Nis::Struct::TransactionMetaDataPair

Inherits:
Object
  • Object
show all
Includes:
Util::Assignable
Defined in:
lib/nis/struct/transaction_meta_data_pair.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Util::Assignable

#[], #initialize, #to_hash, #to_json

Instance Attribute Details

#metaNis::Struct::TransactionMetaData

Returns the current value of meta.

Returns:



5
6
7
# File 'lib/nis/struct/transaction_meta_data_pair.rb', line 5

def meta
  @meta
end

#transactionNis::Struct::Transaction

Returns the current value of transaction.

Returns:



5
6
7
# File 'lib/nis/struct/transaction_meta_data_pair.rb', line 5

def transaction
  @transaction
end

Class Method Details

.build(meta:, transaction:) ⇒ Object



9
10
11
12
13
14
# File 'lib/nis/struct/transaction_meta_data_pair.rb', line 9

def self.build(meta:, transaction:)
  new(
    meta: TransactionMetaData.build(meta),
    transaction: build_transaction_struct(transaction)
  )
end

.build_transaction_struct(data) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/nis/struct/transaction_meta_data_pair.rb', line 16

def self.build_transaction_struct(data)
  type = data[:type]
  klass = case type
          when 0x0101 then Nis::Struct::TransferTransaction
          when 0x0801 then Nis::Struct::ImportanceTransferTransaction
          when 0x1001 then Nis::Struct::MultisigAggregationModificationTransaction
          when 0x1002 then Nis::Struct::MultisigSignatureTransaction
          when 0x1004 then Nis::Struct::MultisigTransaction
          when 0x2001 then Nis::Struct::ProvisionNamespaceTransaction
          when 0x4001 then Nis::Struct::MosaicDefinitionCreationTransaction
          when 0x4002 then Nis::Struct::MosaicSupplyChangeTransaction
    else raise "Not implemented entity type: #{type}"
  end
  klass.build(data)
end