nis-ruby 0.0.5 → 0.0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/demo/request_account.rb +52 -0
- data/demo/request_debug.rb +49 -0
- data/demo/request_nis.rb +24 -0
- data/demo/request_transaction.rb +49 -0
- data/lib/nis/client.rb +5 -2
- data/lib/nis/endpoint/account/generate.rb +9 -0
- data/lib/nis/endpoint/account/get.rb +47 -0
- data/lib/nis/endpoint/account/harvests.rb +16 -0
- data/lib/nis/endpoint/account/historical.rb +20 -0
- data/lib/nis/endpoint/account/importances.rb +11 -0
- data/lib/nis/endpoint/account/lock.rb +13 -0
- data/lib/nis/endpoint/account/mosaic.rb +27 -0
- data/lib/nis/endpoint/account/namespace.rb +20 -0
- data/lib/nis/endpoint/account/status.rb +14 -0
- data/lib/nis/endpoint/account/transfers.rb +48 -0
- data/lib/nis/endpoint/account/unconfirmed_transactions.rb +12 -0
- data/lib/nis/endpoint/account/unlock.rb +12 -0
- data/lib/nis/endpoint/account/unlocked.rb +9 -0
- data/lib/nis/endpoint/account.rb +4 -0
- data/lib/nis/endpoint/debug/connections.rb +33 -0
- data/lib/nis/endpoint/debug/time_synchronization.rb +11 -0
- data/lib/nis/endpoint/debug.rb +4 -0
- data/lib/nis/endpoint/transaction/announce.rb +13 -0
- data/lib/nis/endpoint/transaction/prepareAnnounce.rb +13 -0
- data/lib/nis/endpoint/transaction.rb +4 -0
- data/lib/nis/struct/account_importance_view_model.rb +26 -0
- data/lib/nis/struct/account_info.rb +28 -0
- data/lib/nis/struct/account_meta_data.rb +39 -0
- data/lib/nis/struct/account_meta_data_pair.rb +16 -0
- data/lib/nis/struct/audit_collection.rb +19 -0
- data/lib/nis/struct/audit_info.rb +23 -0
- data/lib/nis/struct/harvest_info.rb +21 -0
- data/lib/nis/struct/key_pair_view_model.rb +20 -0
- data/lib/nis/struct/mosaic.rb +17 -0
- data/lib/nis/struct/mosaic_definition.rb +17 -0
- data/lib/nis/struct/mosaic_id.rb +16 -0
- data/lib/nis/struct/mosaic_properties.rb +26 -0
- data/lib/nis/struct/namespace.rb +14 -0
- data/lib/nis/struct/nem_announce_result.rb +19 -0
- data/lib/nis/struct/nem_async_timer_visitor.rb +30 -0
- data/lib/nis/struct/request_prepare_announce.rb +16 -0
- data/lib/nis/struct/time_synchronization_result.rb +20 -0
- data/lib/nis/struct/transaction.rb +65 -0
- data/lib/nis/struct/transaction_meta_data.rb +17 -0
- data/lib/nis/struct/transaction_meta_data_pair.rb +19 -0
- data/lib/nis/struct/unconfirmed_transaction_meta_data.rb +12 -0
- data/lib/nis/struct/unconfirmed_transaction_meta_data_pair.rb +16 -0
- data/lib/nis/util/assignable.rb +24 -3
- data/lib/nis/util.rb +6 -0
- data/lib/nis/version.rb +1 -1
- data/lib/nis.rb +20 -0
- metadata +48 -2
@@ -0,0 +1,39 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [String] status
|
3
|
+
# @attr [String] remoteStatus
|
4
|
+
# @attr [Array <Nis::Struct::AccountInfo>] cosignatory_of
|
5
|
+
# @attr [Array <Nis::Struct::AccountInfo>] cosignatories
|
6
|
+
# @see http://bob.nem.ninja/docs/#accountMetaData
|
7
|
+
class AccountMetaData
|
8
|
+
include Nis::Util::Assignable
|
9
|
+
attr_accessor :status, :remoteStatus, :cosignatoryOf, :cosignatories
|
10
|
+
|
11
|
+
alias :remote_status :remoteStatus
|
12
|
+
alias :remote_status= :remoteStatus=
|
13
|
+
alias :cosignatory_of :cosignatoryOf
|
14
|
+
alias :cosignatory_of= :cosignatoryOf=
|
15
|
+
|
16
|
+
def self.build(attrs)
|
17
|
+
attrs[:status] = Nis::Unit::Status.new(attrs[:status])
|
18
|
+
attrs[:remoteStatus] = Nis::Unit::Status.new(attrs[:remoteStatus])
|
19
|
+
attrs[:cosignatoryOf] = attrs[:cosignatoryOf].map { |a| AccountInfo.build(a) }
|
20
|
+
attrs[:cosignatories] = attrs[:cosignatories].map { |a| AccountInfo.build(a) }
|
21
|
+
new(attrs)
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [Boolean]
|
25
|
+
def unknown?
|
26
|
+
@status == 'UNKNOWN'
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [Boolean]
|
30
|
+
def locked?
|
31
|
+
@status == 'LOCKED'
|
32
|
+
end
|
33
|
+
|
34
|
+
# @return [Boolean]
|
35
|
+
def unlocked?
|
36
|
+
@status == 'UNLOCKED'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [AccountInfo] address
|
3
|
+
# @attr [AccountMetaData] meta
|
4
|
+
# @see http://bob.nem.ninja/docs/#accountMetaDataPair
|
5
|
+
class AccountMetaDataPair
|
6
|
+
include Nis::Util::Assignable
|
7
|
+
attr_accessor :account, :meta
|
8
|
+
|
9
|
+
def self.build(account:, meta:)
|
10
|
+
new(
|
11
|
+
account: AccountInfo.build(account),
|
12
|
+
meta: AccountMetaData.build(meta)
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [Array] outstanding
|
3
|
+
# @attr [Array] mostRecent
|
4
|
+
# @see http://bob.nem.ninja/docs/#auditCollection
|
5
|
+
class AuditCollection
|
6
|
+
include Nis::Util::Assignable
|
7
|
+
attr_accessor :outstanding, :mostRecent
|
8
|
+
|
9
|
+
alias :most_recent :mostRecent
|
10
|
+
alias :most_recent= :mostRecent=
|
11
|
+
|
12
|
+
def self.build(outstanding:, most_recent:)
|
13
|
+
new(
|
14
|
+
outstanding: outstanding.map { |audt| Nis::Struct::AuditInfo.build(audt) },
|
15
|
+
mostRecent: most_recent.map { |audt| Nis::Struct::AuditInfo.build(audt) }
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [String] path
|
3
|
+
# @attr [Integer] startTime
|
4
|
+
# @attr [String] host
|
5
|
+
# @attr [Integer] elapsedTime
|
6
|
+
# @attr [String] id
|
7
|
+
# @see http://bob.nem.ninja/docs/#auditInfo
|
8
|
+
class AuditInfo
|
9
|
+
include Nis::Util::Assignable
|
10
|
+
attr_accessor :path, :startTime, :host, :elapsedTime, :id
|
11
|
+
|
12
|
+
alias :start_time :startTime
|
13
|
+
alias :start_time= :startTime=
|
14
|
+
alias :elapsed_time :elapsedTime
|
15
|
+
alias :elapsed_time= :elapsedTime=
|
16
|
+
|
17
|
+
def self.build(attrs)
|
18
|
+
attrs[:startTime] = attrs[:'start-time']
|
19
|
+
attrs[:elapsedTime] = attrs[:'elapsed-time']
|
20
|
+
new(attrs)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [Integer] timestamp
|
3
|
+
# @attr [String] id
|
4
|
+
# @attr [Integer] difficulty
|
5
|
+
# @attr [Integer] total_fee
|
6
|
+
# @attr [Integer] height
|
7
|
+
# @see http://bob.nem.ninja/docs/#harvestInfo
|
8
|
+
class HarvestInfo
|
9
|
+
include Nis::Util::Assignable
|
10
|
+
attr_accessor :timeStamp, :id, :difficulty, :totalFee, :height
|
11
|
+
|
12
|
+
alias :timestamp :timeStamp
|
13
|
+
alias :timestamp= :timeStamp=
|
14
|
+
alias :total_fee :totalFee
|
15
|
+
alias :total_fee= :totalFee=
|
16
|
+
|
17
|
+
def self.build(attrs)
|
18
|
+
new(attrs)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [String] privateKey
|
3
|
+
# @attr [String] publicKey
|
4
|
+
# @attr [Nis::Unit::Address] address
|
5
|
+
# @see http://bob.nem.ninja/docs/#keyPairViewModel
|
6
|
+
class KeyPairViewModel
|
7
|
+
include Nis::Util::Assignable
|
8
|
+
attr_accessor :privateKey, :publicKey, :address
|
9
|
+
|
10
|
+
alias :private_key :privateKey
|
11
|
+
alias :private_key= :privateKey=
|
12
|
+
alias :public_key :publicKey
|
13
|
+
alias :public_key= :publicKey=
|
14
|
+
|
15
|
+
def self.build(attrs)
|
16
|
+
attrs[:address] = Nis::Unit::Address.new(attrs[:address])
|
17
|
+
new(attrs)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [Nis::Struct::MosaicId] mosaicId
|
3
|
+
# @attr [Integer] quantity
|
4
|
+
# @see http://bob.nem.ninja/docs/#mosaic
|
5
|
+
class Mosaic
|
6
|
+
include Nis::Util::Assignable
|
7
|
+
attr_accessor :mosaicId, :quantity
|
8
|
+
|
9
|
+
alias :mosaic_id :mosaicId
|
10
|
+
alias :mosaic_id= :mosaicId=
|
11
|
+
|
12
|
+
def self.build(attrs)
|
13
|
+
attrs[:mosaicId] = Nis::Struct::MosaicId.build attrs[:mosaicId]
|
14
|
+
new(attrs)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [String] creator
|
3
|
+
# @attr [String] id
|
4
|
+
# @attr [String] description
|
5
|
+
# @attr [Nis::Struct::MosaicProperties] properties
|
6
|
+
# @attr [Nis::Struct::MosaicLevy] levy
|
7
|
+
# @see http://bob.nem.ninja/docs/#mosaicDefinition
|
8
|
+
class MosaicDefinition
|
9
|
+
include Nis::Util::Assignable
|
10
|
+
attr_accessor :creator, :id, :description, :properties, :levy
|
11
|
+
|
12
|
+
def self.build(attrs)
|
13
|
+
attrs[:properties] = attrs[:properties].map { |p| MosaicProperties.build(p) }
|
14
|
+
new(attrs)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [String] namespaceId
|
3
|
+
# @attr [String] name
|
4
|
+
# @see http://bob.nem.ninja/docs/#mosaicId
|
5
|
+
class MosaicId
|
6
|
+
include Nis::Util::Assignable
|
7
|
+
attr_accessor :namespaceId, :name
|
8
|
+
|
9
|
+
alias :namespace_id :namespaceId
|
10
|
+
alias :namespace_id= :namespaceId=
|
11
|
+
|
12
|
+
def self.build(attrs)
|
13
|
+
new(attrs)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [Array] properties
|
3
|
+
# @attr [Integer] divisibility
|
4
|
+
# @attr [Integer] initial_supply
|
5
|
+
# @attr [Boolean] supply_mutable
|
6
|
+
# @attr [Boolean] transferable
|
7
|
+
# @see http://bob.nem.ninja/docs/#mosaicProperties
|
8
|
+
class MosaicProperties
|
9
|
+
include Nis::Util::Assignable
|
10
|
+
attr_accessor :divisibility, :initial_supply, :supply_mutable, :transferable
|
11
|
+
|
12
|
+
def self.build(attrs)
|
13
|
+
new(attrs)
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Boolean]
|
17
|
+
def supply_mutable?
|
18
|
+
@supply_mutable == 'true'
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Boolean]
|
22
|
+
def transferable?
|
23
|
+
@transferable == 'true'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [String] fqn
|
3
|
+
# @attr [String] owner
|
4
|
+
# @attr [Integer] height
|
5
|
+
# @see http://bob.nem.ninja/docs/#namespace
|
6
|
+
class Namespace
|
7
|
+
include Nis::Util::Assignable
|
8
|
+
attr_accessor :fqn, :owner, :height
|
9
|
+
|
10
|
+
def self.build(attrs)
|
11
|
+
new(attrs)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [String] type
|
3
|
+
# @attr [String] code
|
4
|
+
# @attr [String] message
|
5
|
+
# @attr [String] transactionHash
|
6
|
+
# @attr [String] innerTransactionHash
|
7
|
+
# @see http://bob.nem.ninja/docs/#nemAnnounceResult
|
8
|
+
class NemAnnounceResult
|
9
|
+
include Nis::Util::Assignable
|
10
|
+
attr_accessor :type, :code, :message, :transactionHash, :innerTransactionHash
|
11
|
+
|
12
|
+
alias :transaction_hash :transactionHash
|
13
|
+
alias :inner_transaction_hash :innerTransactionHash
|
14
|
+
|
15
|
+
def self.build(attrs)
|
16
|
+
new(attrs)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [String] last_delay_time
|
3
|
+
# @attr [String] executions
|
4
|
+
# @attr [String] failures
|
5
|
+
# @attr [String] successes
|
6
|
+
# @attr [String] last_operation_start_time
|
7
|
+
# @attr [String] is_executing
|
8
|
+
# @attr [String] name
|
9
|
+
# @attr [String] average_operation_time
|
10
|
+
# @attr [String] last_operation_time
|
11
|
+
# @see http://bob.nem.ninja/docs/#nemAsyncTimerVisitor
|
12
|
+
class NemAsyncTimerVisitor
|
13
|
+
include Nis::Util::Assignable
|
14
|
+
attr_accessor :last_delay_time, :executions, :failures, :successes, :last_operation_start_time, :is_executing, :name, :average_operation_time, :last_operation_time
|
15
|
+
|
16
|
+
def self.build(attrs)
|
17
|
+
attrs[:last_delay_time] = attrs[:'last-delay-time']
|
18
|
+
attrs[:last_operation_start_time] = attrs[:'last-operation-start-time']
|
19
|
+
attrs[:is_executing] = attrs[:'is-executing']
|
20
|
+
attrs[:average_operation_time] = attrs[:'average-operation-time']
|
21
|
+
attrs[:last_operation_time] = attrs[:'last-operation-time']
|
22
|
+
new(attrs)
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Boolean]
|
26
|
+
def executing?
|
27
|
+
@is_executing == 1
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [Nis::Struct::Transaction] transaction
|
3
|
+
# @attr [String] privateKey
|
4
|
+
# @see http://bob.nem.ninja/docs/#requestPrepareAnnounce
|
5
|
+
class RequestPrepareAnnounce
|
6
|
+
include Nis::Util::Assignable
|
7
|
+
attr_accessor :transaction, :privateKey
|
8
|
+
|
9
|
+
alias :private_key :privateKey
|
10
|
+
alias :private_key= :privateKey=
|
11
|
+
|
12
|
+
def self.build(attrs)
|
13
|
+
new(attrs)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [Time] dateTime
|
3
|
+
# @attr [Integer] currentTimeOffset
|
4
|
+
# @attr [Integer] change
|
5
|
+
# @see http://bob.nem.ninja/docs/#timeSynchronizationResult
|
6
|
+
class TimeSynchronizationResult
|
7
|
+
include Nis::Util::Assignable
|
8
|
+
attr_accessor :dateTime, :currentTimeOffset, :change
|
9
|
+
|
10
|
+
alias :datetime :dateTime
|
11
|
+
alias :datetime= :dateTime=
|
12
|
+
alias :current_time_offset :currentTimeOffset
|
13
|
+
alias :current_time_offset= :currentTimeOffset=
|
14
|
+
|
15
|
+
def self.build(attrs)
|
16
|
+
attrs[:dateTime] = Time.parse(attrs[:dateTime])
|
17
|
+
new(attrs)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [Integer] timestamp
|
3
|
+
# @attr [Integer] amount
|
4
|
+
# @attr [Integer] fee
|
5
|
+
# @attr [String] recipient
|
6
|
+
# @attr [Integer] type
|
7
|
+
# @attr [Integer] deadline
|
8
|
+
# @attr [String] message
|
9
|
+
# @attr [Integer] version
|
10
|
+
# @attr [String] signer
|
11
|
+
# @attr [Array <Nis::Struct::MosaicId>] mosaics
|
12
|
+
# @see http://bob.nem.ninja/docs/#transaction
|
13
|
+
# @see http://bob.nem.ninja/docs/#initiating-a-transfer-transaction
|
14
|
+
# @see http://bob.nem.ninja/docs/#version-1-transfer-transactions
|
15
|
+
# @see http://bob.nem.ninja/docs/#version-2-transfer-transactions
|
16
|
+
class Transaction
|
17
|
+
include Nis::Util::Assignable
|
18
|
+
attr_accessor :timeStamp, :amount, :fee, :recipient, :type, :deadline, :message, :version, :signer,
|
19
|
+
:mosaics
|
20
|
+
|
21
|
+
alias :timestamp :timeStamp
|
22
|
+
alias :timestamp= :timeStamp=
|
23
|
+
|
24
|
+
TRANSFER = 0x0101 # 257 (transfer transaction)
|
25
|
+
IMPORTANCE_TRANSFER = 0x0801 # 2049 (importance transfer transaction)
|
26
|
+
MULTISIG_AGGREGATE_MODIFICATION_TRANSFER = 0x1001 # 4097 (multisig aggregate modification transfer transaction)
|
27
|
+
MULTISIG_SIGNATURE = 0x1002 # 4098 (multisig signature transaction)
|
28
|
+
MULTISIG = 0x1004 # 4099 (multisig transaction)
|
29
|
+
PROVISION_NAMESPACE = 0x2001 # 8193 (provision namespace transaction)
|
30
|
+
MOSAIC_DEFINITION_CREATION = 0x4001 # 16385 (mosaic definition creation transaction)
|
31
|
+
MOSAIC_SUPPLY_CHANGE = 0x4002 # 16386 (mosaic supply change transaction)
|
32
|
+
|
33
|
+
TESTNET = 0x98000000 # -1744830464
|
34
|
+
MAINNET = 0x68000000 # 1744830464
|
35
|
+
|
36
|
+
VERSION_1 = 0x00000001 # 1
|
37
|
+
VERSION_2 = 0x00000002 # 2
|
38
|
+
|
39
|
+
TESTNET_VERSION_1 = TESTNET | VERSION_1 # 0x98000001 = -1744830463
|
40
|
+
TESTNET_VERSION_2 = TESTNET | VERSION_2 # 0x98000002 = -1744830462
|
41
|
+
MAINNET_VERSION_1 = MAINNET | VERSION_1 # 0x68000001 = 1744830465
|
42
|
+
MAINNET_VERSION_2 = MAINNET | VERSION_2 # 0x68000002 = 1744830466
|
43
|
+
|
44
|
+
@mosaics = []
|
45
|
+
|
46
|
+
def self.build(attrs)
|
47
|
+
new(attrs)
|
48
|
+
end
|
49
|
+
|
50
|
+
# @return [Integer]
|
51
|
+
def _version
|
52
|
+
(0xFFFFFFF0 & @version)
|
53
|
+
end
|
54
|
+
|
55
|
+
# @return [Boolean]
|
56
|
+
def testnet?
|
57
|
+
(0x0000000F & @version) == TESTNET
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [Boolean]
|
61
|
+
def mainnet?
|
62
|
+
(0x0000000F & @version) == MAINNET
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr []
|
3
|
+
# @attr []
|
4
|
+
# @attr []
|
5
|
+
# @attr []
|
6
|
+
# @attr []
|
7
|
+
# @attr []
|
8
|
+
# @see http://bob.nem.ninja/docs/#transactionMetaData
|
9
|
+
class TransactionMetaData
|
10
|
+
include Nis::Util::Assignable
|
11
|
+
attr_accessor :height, :id, :hash
|
12
|
+
|
13
|
+
def self.build(attrs)
|
14
|
+
new(attrs)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr []
|
3
|
+
# @attr []
|
4
|
+
# @attr []
|
5
|
+
# @attr []
|
6
|
+
# @attr []
|
7
|
+
# @see http://bob.nem.ninja/docs/#transactionMetaDataPair
|
8
|
+
class TransactionMetaDataPair
|
9
|
+
include Nis::Util::Assignable
|
10
|
+
attr_accessor :meta, :transaction
|
11
|
+
|
12
|
+
def self.build(meta:, transaction:)
|
13
|
+
new(
|
14
|
+
meta: TransactionMetaData.build(meta),
|
15
|
+
transaction: Transaction.build(transaction)
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr [String] data
|
3
|
+
# @see http://bob.nem.ninja/docs/#unconfirmedTransactionMetaData
|
4
|
+
class UnconfirmedTransactionMetaData
|
5
|
+
include Nis::Util::Assignable
|
6
|
+
attr_accessor :data
|
7
|
+
|
8
|
+
def self.build(attrs)
|
9
|
+
new(attrs)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Nis::Struct
|
2
|
+
# @attr []
|
3
|
+
# @attr []
|
4
|
+
# @see http://bob.nem.ninja/docs/#unconfirmedTransactionMetaDataPair
|
5
|
+
class UnconfirmedTransactionMetaDataPair
|
6
|
+
include Nis::Util::Assignable
|
7
|
+
attr_accessor :meta, :transaction
|
8
|
+
|
9
|
+
def self.build(attrs)
|
10
|
+
new(
|
11
|
+
meta: UnconfirmedTransactionMetaData.build(attrs[:meta]),
|
12
|
+
transaction: Transaction.build(attrs[:transaction])
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/nis/util/assignable.rb
CHANGED
@@ -15,14 +15,35 @@ module Nis::Util
|
|
15
15
|
|
16
16
|
# @return [Hash] Attribute and value pairs
|
17
17
|
def to_hash
|
18
|
-
instance_variables.each_with_object({}) do |var, hash|
|
18
|
+
hashed_properties = instance_variables.each_with_object({}) do |var, hash|
|
19
19
|
hash[var.to_s.delete('@').to_sym] = instance_variable_get(var)
|
20
20
|
end
|
21
|
+
hashnize(hashed_properties)
|
21
22
|
end
|
22
23
|
|
23
24
|
# @return [String] JSON formatted structure
|
24
|
-
def to_json
|
25
|
-
to_hash.to_json
|
25
|
+
def to_json(state = nil)
|
26
|
+
to_hash.to_json(state)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def hashnize(obj)
|
32
|
+
case true
|
33
|
+
when obj.class.to_s.start_with?('Nis::Unit')
|
34
|
+
obj.to_s
|
35
|
+
when obj.class.to_s.start_with?('Nis::Struct')
|
36
|
+
obj.to_hash
|
37
|
+
when obj.is_a?(Array)
|
38
|
+
obj.map { |el| hashnize(el) }
|
39
|
+
when obj.is_a?(Hash)
|
40
|
+
obj.inject({}) do |hash, (k, v)|
|
41
|
+
hash[k] = hashnize(v)
|
42
|
+
hash
|
43
|
+
end
|
44
|
+
else
|
45
|
+
obj
|
46
|
+
end
|
26
47
|
end
|
27
48
|
end
|
28
49
|
end
|
data/lib/nis/util.rb
CHANGED
data/lib/nis/version.rb
CHANGED
data/lib/nis.rb
CHANGED
@@ -24,4 +24,24 @@ class Nis
|
|
24
24
|
|
25
25
|
include Nis::Endpoint::Heartbeat
|
26
26
|
include Nis::Endpoint::Status
|
27
|
+
|
28
|
+
include Nis::Endpoint::Account::Generate
|
29
|
+
include Nis::Endpoint::Account::Get
|
30
|
+
include Nis::Endpoint::Account::Status
|
31
|
+
include Nis::Endpoint::Account::Transfers
|
32
|
+
include Nis::Endpoint::Account::UnconfirmedTransactions
|
33
|
+
include Nis::Endpoint::Account::Harvests
|
34
|
+
include Nis::Endpoint::Account::Importances
|
35
|
+
include Nis::Endpoint::Account::Namespace
|
36
|
+
include Nis::Endpoint::Account::Mosaic
|
37
|
+
include Nis::Endpoint::Account::Unlock
|
38
|
+
include Nis::Endpoint::Account::Lock
|
39
|
+
include Nis::Endpoint::Account::Unlocked
|
40
|
+
include Nis::Endpoint::Account::Historical
|
41
|
+
|
42
|
+
include Nis::Endpoint::Transaction::PrepareAnnounce
|
43
|
+
include Nis::Endpoint::Transaction::Announce
|
44
|
+
|
45
|
+
include Nis::Endpoint::Debug::Connections
|
46
|
+
include Nis::Endpoint::Debug::TimeSynchronization
|
27
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nis-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshiyuki Ieyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -166,14 +166,60 @@ files:
|
|
166
166
|
- README.md
|
167
167
|
- Rakefile
|
168
168
|
- bin/nis
|
169
|
+
- demo/request_account.rb
|
170
|
+
- demo/request_debug.rb
|
171
|
+
- demo/request_nis.rb
|
172
|
+
- demo/request_transaction.rb
|
169
173
|
- lib/nis.rb
|
170
174
|
- lib/nis/client.rb
|
171
175
|
- lib/nis/endpoint.rb
|
176
|
+
- lib/nis/endpoint/account.rb
|
177
|
+
- lib/nis/endpoint/account/generate.rb
|
178
|
+
- lib/nis/endpoint/account/get.rb
|
179
|
+
- lib/nis/endpoint/account/harvests.rb
|
180
|
+
- lib/nis/endpoint/account/historical.rb
|
181
|
+
- lib/nis/endpoint/account/importances.rb
|
182
|
+
- lib/nis/endpoint/account/lock.rb
|
183
|
+
- lib/nis/endpoint/account/mosaic.rb
|
184
|
+
- lib/nis/endpoint/account/namespace.rb
|
185
|
+
- lib/nis/endpoint/account/status.rb
|
186
|
+
- lib/nis/endpoint/account/transfers.rb
|
187
|
+
- lib/nis/endpoint/account/unconfirmed_transactions.rb
|
188
|
+
- lib/nis/endpoint/account/unlock.rb
|
189
|
+
- lib/nis/endpoint/account/unlocked.rb
|
190
|
+
- lib/nis/endpoint/debug.rb
|
191
|
+
- lib/nis/endpoint/debug/connections.rb
|
192
|
+
- lib/nis/endpoint/debug/time_synchronization.rb
|
172
193
|
- lib/nis/endpoint/heartbeat.rb
|
173
194
|
- lib/nis/endpoint/status.rb
|
195
|
+
- lib/nis/endpoint/transaction.rb
|
196
|
+
- lib/nis/endpoint/transaction/announce.rb
|
197
|
+
- lib/nis/endpoint/transaction/prepareAnnounce.rb
|
174
198
|
- lib/nis/error.rb
|
175
199
|
- lib/nis/struct.rb
|
200
|
+
- lib/nis/struct/account_importance_view_model.rb
|
201
|
+
- lib/nis/struct/account_info.rb
|
202
|
+
- lib/nis/struct/account_meta_data.rb
|
203
|
+
- lib/nis/struct/account_meta_data_pair.rb
|
204
|
+
- lib/nis/struct/audit_collection.rb
|
205
|
+
- lib/nis/struct/audit_info.rb
|
206
|
+
- lib/nis/struct/harvest_info.rb
|
207
|
+
- lib/nis/struct/key_pair_view_model.rb
|
208
|
+
- lib/nis/struct/mosaic.rb
|
209
|
+
- lib/nis/struct/mosaic_definition.rb
|
210
|
+
- lib/nis/struct/mosaic_id.rb
|
211
|
+
- lib/nis/struct/mosaic_properties.rb
|
212
|
+
- lib/nis/struct/namespace.rb
|
213
|
+
- lib/nis/struct/nem_announce_result.rb
|
214
|
+
- lib/nis/struct/nem_async_timer_visitor.rb
|
176
215
|
- lib/nis/struct/nem_request_result.rb
|
216
|
+
- lib/nis/struct/request_prepare_announce.rb
|
217
|
+
- lib/nis/struct/time_synchronization_result.rb
|
218
|
+
- lib/nis/struct/transaction.rb
|
219
|
+
- lib/nis/struct/transaction_meta_data.rb
|
220
|
+
- lib/nis/struct/transaction_meta_data_pair.rb
|
221
|
+
- lib/nis/struct/unconfirmed_transaction_meta_data.rb
|
222
|
+
- lib/nis/struct/unconfirmed_transaction_meta_data_pair.rb
|
177
223
|
- lib/nis/unit.rb
|
178
224
|
- lib/nis/unit/address.rb
|
179
225
|
- lib/nis/unit/balance.rb
|