nis-ruby 0.0.6.1 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +119 -0
  3. data/demo/request_account.rb +8 -8
  4. data/demo/request_block.rb +11 -0
  5. data/demo/request_debug.rb +7 -14
  6. data/demo/request_local.rb +20 -0
  7. data/demo/request_namespace.rb +11 -0
  8. data/demo/request_nis.rb +0 -1
  9. data/demo/request_node.rb +31 -0
  10. data/demo/request_transaction.rb +6 -7
  11. data/lib/nis/client.rb +1 -1
  12. data/lib/nis/endpoint/account/get.rb +4 -4
  13. data/lib/nis/endpoint/account/harvests.rb +3 -3
  14. data/lib/nis/endpoint/account/historical.rb +5 -5
  15. data/lib/nis/endpoint/account/lock.rb +1 -1
  16. data/lib/nis/endpoint/account/mosaic.rb +4 -4
  17. data/lib/nis/endpoint/account/namespace.rb +5 -5
  18. data/lib/nis/endpoint/account/status.rb +1 -1
  19. data/lib/nis/endpoint/account/transfers.rb +12 -12
  20. data/lib/nis/endpoint/account/unconfirmed_transactions.rb +7 -2
  21. data/lib/nis/endpoint/account/unlock.rb +1 -1
  22. data/lib/nis/endpoint/block/at.rb +10 -0
  23. data/lib/nis/endpoint/block/get.rb +10 -0
  24. data/lib/nis/endpoint/block.rb +4 -0
  25. data/lib/nis/endpoint/chain/height.rb +11 -0
  26. data/lib/nis/endpoint/chain/last_block.rb +14 -0
  27. data/lib/nis/endpoint/chain/score.rb +11 -0
  28. data/lib/nis/endpoint/local/account/transfers.rb +34 -0
  29. data/lib/nis/endpoint/local/chain.rb +16 -0
  30. data/lib/nis/endpoint/namespace/mosaic.rb +15 -0
  31. data/lib/nis/endpoint/namespace/root.rb +14 -0
  32. data/lib/nis/endpoint/namespace.rb +10 -0
  33. data/lib/nis/endpoint/node/active_peers.rb +11 -0
  34. data/lib/nis/endpoint/node/boot.rb +10 -0
  35. data/lib/nis/endpoint/node/experiences.rb +9 -0
  36. data/lib/nis/endpoint/node/extended_info.rb +9 -0
  37. data/lib/nis/endpoint/node/info.rb +9 -0
  38. data/lib/nis/endpoint/node/peer_list.rb +25 -0
  39. data/lib/nis/endpoint/node.rb +4 -0
  40. data/lib/nis/endpoint/transaction/announce.rb +1 -1
  41. data/lib/nis/endpoint/transaction/prepareAnnounce.rb +1 -1
  42. data/lib/nis/error.rb +1 -0
  43. data/lib/nis/struct/account_meta_data.rb +1 -1
  44. data/lib/nis/struct/account_meta_data_pair.rb +4 -4
  45. data/lib/nis/struct/account_private_key_transactions_page.rb +14 -0
  46. data/lib/nis/struct/application_meta_data.rb +21 -0
  47. data/lib/nis/struct/block.rb +24 -0
  48. data/lib/nis/struct/block_height.rb +22 -0
  49. data/lib/nis/struct/block_score.rb +17 -0
  50. data/lib/nis/struct/boot_node_request.rb +23 -0
  51. data/lib/nis/struct/error.rb +18 -0
  52. data/lib/nis/struct/explorer_block_view_model.rb +17 -0
  53. data/lib/nis/struct/explorer_transfer_view_model.rb +18 -0
  54. data/lib/nis/struct/explorer_view_model_transaction.rb +16 -0
  55. data/lib/nis/struct/extended_node_experience_pair.rb +14 -0
  56. data/lib/nis/struct/harvest_info.rb +2 -2
  57. data/lib/nis/struct/mosaic_definition.rb +2 -0
  58. data/lib/nis/struct/mosaic_definition_meta_data.rb +12 -0
  59. data/lib/nis/struct/mosaic_definition_meta_data_pair.rb +16 -0
  60. data/lib/nis/struct/mosaic_levy.rb +18 -0
  61. data/lib/nis/struct/mosaic_properties.rb +8 -3
  62. data/lib/nis/struct/namespace_meta_data.rb +12 -0
  63. data/lib/nis/struct/namespace_meta_data_pair.rb +16 -0
  64. data/lib/nis/struct/nis_node_info.rb +19 -0
  65. data/lib/nis/struct/node_collection.rb +20 -0
  66. data/lib/nis/struct/node_experience.rb +13 -0
  67. data/lib/nis/struct/node_info.rb +28 -0
  68. data/lib/nis/struct/request_announce.rb +13 -0
  69. data/lib/nis/struct/transaction_meta_data.rb +3 -6
  70. data/lib/nis/struct/transaction_meta_data_pair.rb +2 -5
  71. data/lib/nis/struct/unconfirmed_transaction_meta_data_pair.rb +5 -5
  72. data/lib/nis/util.rb +2 -1
  73. data/lib/nis/version.rb +1 -1
  74. data/lib/nis.rb +21 -0
  75. metadata +46 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46d4e1ecc31936813e70872ae8b78baeb7d71586
4
- data.tar.gz: dfff3b5f9f8823ba28249f0b7bdd16a07d8e0046
3
+ metadata.gz: 061a83269fcef596e746171c60d75f215c1ee99c
4
+ data.tar.gz: 943f352e756874a0622196046708e533c2b43a56
5
5
  SHA512:
6
- metadata.gz: 240fe29c16e64b9ba77de96e6695faabeebcf740719668dbd3f5ec65f43557f86383d49e0a848ff7d547b29ee5543053fce360d97face0582e1da1b9fb6b59aa
7
- data.tar.gz: 6a13e62bc27b7250b382e586fcdc53b4978bbe192102af759027485d6638472b69e3f41b143230cf0d0b6257f04e194afa620546dc9ff380362e227cf2f30de0
6
+ metadata.gz: 430fbd5bebbfd64f3edef98fca026873a7255b710e987af87dc77bd09597f8111aa3c04e15eb2ef6c0b5f7df91d4636cdff685c02f5d02030cfede35c5d53679
7
+ data.tar.gz: a32054344daeef7210c1c4dfbadf08629a2fb213d4f209e545ab36dec02bb56e3f308daeaa50f1bfaeabdd37bec75918ea223f5876db1ff4660e4e58aac46542
data/.rubocop.yml ADDED
@@ -0,0 +1,119 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.2
3
+ DisabledByDefault: true
4
+ Exclude:
5
+ - '**/vendor/**/*'
6
+
7
+ # Prefer &&/|| over and/or.
8
+ Style/AndOr:
9
+ Enabled: true
10
+
11
+ # Do not use braces for hash literals when they are the last argument of a
12
+ # method call.
13
+ Style/BracesAroundHashParameters:
14
+ Enabled: true
15
+
16
+ # Align `when` with `case`.
17
+ Style/CaseIndentation:
18
+ Enabled: true
19
+
20
+ # Align comments with method definitions.
21
+ Style/CommentIndentation:
22
+ Enabled: true
23
+
24
+ # No extra empty lines.
25
+ Style/EmptyLines:
26
+ Enabled: true
27
+
28
+ # In a regular class definition, no empty lines around the body.
29
+ Style/EmptyLinesAroundClassBody:
30
+ Enabled: true
31
+
32
+ # In a regular method definition, no empty lines around the body.
33
+ Style/EmptyLinesAroundMethodBody:
34
+ Enabled: true
35
+
36
+ # In a regular module definition, no empty lines around the body.
37
+ Style/EmptyLinesAroundModuleBody:
38
+ Enabled: true
39
+
40
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
41
+ Style/HashSyntax:
42
+ Enabled: true
43
+
44
+ # Method definitions after `private` or `protected` isolated calls need one
45
+ # extra level of indentation.
46
+ Style/IndentationConsistency:
47
+ Enabled: true
48
+
49
+ # Two spaces, no tabs (for indentation).
50
+ Style/IndentationWidth:
51
+ Enabled: true
52
+
53
+ Style/SpaceAfterColon:
54
+ Enabled: true
55
+
56
+ Style/SpaceAfterComma:
57
+ Enabled: true
58
+
59
+ Style/SpaceAroundEqualsInParameterDefault:
60
+ Enabled: true
61
+
62
+ Style/SpaceAroundKeyword:
63
+ Enabled: true
64
+
65
+ Style/SpaceAroundOperators:
66
+ Enabled: true
67
+
68
+ Style/SpaceBeforeFirstArg:
69
+ Enabled: true
70
+
71
+ # Defining a method with parameters needs parentheses.
72
+ Style/MethodDefParentheses:
73
+ Enabled: true
74
+
75
+ # Use `foo {}` not `foo{}`.
76
+ Style/SpaceBeforeBlockBraces:
77
+ Enabled: true
78
+
79
+ # Use `foo { bar }` not `foo {bar}`.
80
+ Style/SpaceInsideBlockBraces:
81
+ Enabled: true
82
+
83
+ # Use `{ a: 1 }` not `{a:1}`.
84
+ Style/SpaceInsideHashLiteralBraces:
85
+ Enabled: true
86
+
87
+ Style/SpaceInsideParens:
88
+ Enabled: true
89
+
90
+ # Check quotes usage according to lint rule below.
91
+ Style/StringLiterals:
92
+ Enabled: true
93
+ EnforcedStyle: single_quotes
94
+
95
+ # Detect hard tabs, no hard tabs.
96
+ Style/Tab:
97
+ Enabled: true
98
+
99
+ # Blank lines should not have any spaces.
100
+ Style/TrailingBlankLines:
101
+ Enabled: true
102
+
103
+ # No trailing whitespace.
104
+ Style/TrailingWhitespace:
105
+ Enabled: true
106
+
107
+ # Use quotes for string literals when they are enough.
108
+ Style/UnneededPercentQ:
109
+ Enabled: true
110
+
111
+ # Align `end` with the matching keyword or starting expression except for
112
+ # assignments, where it should be aligned with the LHS.
113
+ Lint/EndAlignment:
114
+ Enabled: true
115
+ EnforcedStyleAlignWith: variable
116
+
117
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
118
+ Lint/RequireParentheses:
119
+ Enabled: true
@@ -1,5 +1,5 @@
1
1
  require 'nis'
2
- _hr = '-' * 64
2
+ hr = '-' * 64
3
3
 
4
4
  # create NIS instance
5
5
  nis = Nis.new
@@ -9,32 +9,32 @@ nis = Nis.new
9
9
  # Each endpoint mapped into method name.
10
10
  # It returns Nis::Struct object which mapped API response.
11
11
  keypair = nis.account_generate
12
- puts _hr
12
+ puts hr
13
13
 
14
14
  # Access properties.
15
15
  # Names are same API response.
16
16
  puts keypair.address
17
17
  puts keypair.privateKey
18
18
  puts keypair.publicKey
19
- puts _hr
19
+ puts hr
20
20
 
21
21
  # Ruby style access.
22
22
  # Also can be access property by snakecase.
23
23
  puts keypair.private_key
24
24
  puts keypair.public_key
25
- puts _hr
25
+ puts hr
26
26
 
27
27
  # hash like access.
28
28
  # Also can be access property like hash.
29
29
  puts keypair[:privateKey]
30
30
  puts keypair[:private_key]
31
- puts _hr
31
+ puts hr
32
32
 
33
33
  # Address object
34
34
  # Some property wrapped by value object.
35
35
  puts address = keypair.address
36
36
  puts address.testnet?
37
- puts _hr
37
+ puts hr
38
38
 
39
39
  # /account/get?address={address}
40
40
  # -> account_get address: {address}
@@ -42,11 +42,11 @@ puts _hr
42
42
  account_meta_pair = nis.account_get address: keypair.address
43
43
  account = account_meta_pair[:account]
44
44
  puts account.balance
45
- puts _hr
45
+ puts hr
46
46
 
47
47
  # /account/get/from-public-key?public-key={key}
48
48
  # -> account_get_public_key public_key: {key}
49
49
  account_meta_pair = nis.account_get_from_public_key public_key: keypair.public_key
50
50
  account = account_meta_pair.account
51
51
  puts account.address
52
- puts _hr
52
+ puts hr
@@ -0,0 +1,11 @@
1
+ require 'nis'
2
+ hr = '-' * 64
3
+
4
+ # create NIS instance
5
+ nis = Nis.new
6
+
7
+ puts nis.block_at_public(block_height: 895492)
8
+ puts hr
9
+
10
+ puts nis.block_get(block_hash: '74998229fa8a6eebfce9bcc313c552528bf82caac6166ae05e65578b4fb1f2da')
11
+ puts hr
@@ -1,6 +1,6 @@
1
1
  require 'pp'
2
2
  require 'nis'
3
- _hr = '-' * 64
3
+ hr = '-' * 64
4
4
 
5
5
  # create NIS instance
6
6
  nis = Nis.new
@@ -10,40 +10,33 @@ incoming = nis.debug_connections_incoming
10
10
  incoming[:outstanding].each do |ai|
11
11
  puts ai.to_hash
12
12
  end
13
- puts _hr
13
+ puts hr
14
14
 
15
15
  incoming[:most_recent].each do |ai|
16
16
  puts ai.to_hash
17
17
  end
18
- puts _hr
19
-
20
-
18
+ puts hr
21
19
 
22
20
  outgoing = nis.debug_connections_outgoing
23
21
 
24
22
  outgoing[:outstanding].each do |ai|
25
23
  puts ai.to_hash
26
24
  end
27
- puts _hr
25
+ puts hr
28
26
 
29
27
  outgoing[:most_recent].each do |ai|
30
28
  puts ai.to_hash
31
29
  end
32
- puts _hr
33
-
34
-
30
+ puts hr
35
31
 
36
32
  timers = nis.debug_connections_timers
37
33
  timers.each do |t|
38
34
  puts t.to_hash
39
35
  end
40
- puts _hr
41
-
42
-
36
+ puts hr
43
37
 
44
38
  syncs = nis.debug_time_synchronization
45
39
  syncs.each do |sync|
46
40
  puts sync.to_hash
47
41
  end
48
- puts _hr
49
-
42
+ puts hr
@@ -0,0 +1,20 @@
1
+ require 'nis'
2
+ hr = '-' * 64
3
+
4
+ nis = Nis.new
5
+
6
+ page = Nis::Struct::AccountPrivateKeyTransactionsPage.new(
7
+ value: '00b4a68d16dc505302e9631b860664ba43a8183f0903bc5782a2403b2f9eb3c8a1'
8
+ )
9
+
10
+ puts nis.local_account_transfers_incoming(page: page)
11
+ puts hr
12
+
13
+ puts nis.local_account_transfers_outgoing(page: page)
14
+ puts hr
15
+
16
+ puts nis.local_account_transfers_all(page: page)
17
+ puts hr
18
+
19
+ puts nis.local_chain_blocks_after(block_height: 2649)
20
+ puts hr
@@ -0,0 +1,11 @@
1
+ require 'nis'
2
+ hr = '-' * 64
3
+
4
+ # create NIS instance
5
+ nis = Nis.new
6
+
7
+ puts nis.namespace_mosaic_definition_page(namespace: 'alice.misc')
8
+ puts hr
9
+
10
+ puts nis.namespace_root_page
11
+ puts hr
data/demo/request_nis.rb CHANGED
@@ -21,4 +21,3 @@ puts nis.request :get, 'status'
21
21
 
22
22
  # Nis#request! can raise Error when NIS returns error.
23
23
  puts nis.request! :get, 'account/get', address: 'INVALID_ADDRESS'
24
-
@@ -0,0 +1,31 @@
1
+ require 'nis'
2
+ hr = '-' * 64
3
+
4
+ # create NIS instance
5
+ nis = Nis.new
6
+
7
+ puts nis.node_info
8
+ puts hr
9
+
10
+ puts nis.node_extended_info
11
+ puts hr
12
+
13
+ puts nis.node_experiences
14
+ puts hr
15
+
16
+ puts nis.node_peerlist_all
17
+ puts hr
18
+
19
+ puts nis.node_peerlist_reachable
20
+ puts hr
21
+
22
+ puts nis.node_peerlist_active
23
+ puts hr
24
+
25
+ puts nis.node_active_peers_max_chain_height
26
+ puts hr
27
+
28
+ # bnr = Nis::Struct::BootNodeRequest.new(
29
+ # )
30
+ # puts nis.node_boot(boot_node_request: bnr)
31
+ # puts hr
@@ -1,6 +1,5 @@
1
1
  require 'nis'
2
- require 'pry'
3
- _hr = '-' * 64
2
+ hr = '-' * 64
4
3
 
5
4
  # Account A (Source)
6
5
  A_ADDRESS = 'TAH4MBR6MNLZKJAVW5ZJCMFAL7RS5U2YODUQKLCT'.freeze
@@ -36,14 +35,14 @@ rpa = Nis::Struct::RequestPrepareAnnounce.new(
36
35
  nis = Nis.new
37
36
 
38
37
  # check banalces before sending XEM.
39
- puts "Account A => balance: %d" %
38
+ puts 'Account A => balance: %d' %
40
39
  (nis.account_get address: A_ADDRESS)[:account][:balance]
41
- puts "Account B => balance: %d" %
40
+ puts 'Account B => balance: %d' %
42
41
  (nis.account_get address: B_ADDRESS)[:account][:balance]
43
- puts _hr
42
+ puts hr
44
43
 
45
44
  # Send XEM request.
46
- # res = nis.transaction_prepare_announce(request_prepare_announce: rpa)
47
- # puts res.message
45
+ res = nis.transaction_prepare_announce(request_prepare_announce: rpa)
46
+ puts res.message
48
47
 
49
48
  # After several minutes, check to see Account B received XEM.
data/lib/nis/client.rb CHANGED
@@ -31,7 +31,7 @@ class Nis::Client
31
31
  # @param [Hash] params API Parameters
32
32
  # @return [Hash] Hash converted API Response
33
33
  def request(method, path, params = {})
34
- if params.is_a?(Hash) and !params.empty?
34
+ if params.is_a?(Hash) && !params.empty?
35
35
  params.reject! { |_, value| value.nil? }
36
36
  end
37
37
  res = connection.send(method, path, params)
@@ -1,6 +1,6 @@
1
1
  module Nis::Endpoint
2
2
  module Account::Get
3
- # @option options [String] address
3
+ # @param [String] address
4
4
  # @return [Nis::Struct::AccountMetaDataPair]
5
5
  # @see http://bob.nem.ninja/docs/#requesting-the-account-data
6
6
  def account_get(address:)
@@ -11,7 +11,7 @@ module Nis::Endpoint
11
11
  end
12
12
  end
13
13
 
14
- # @option options [String] public_key
14
+ # @param [String] public_key
15
15
  # @return [Nis::Struct::AccountMetaDataPair]
16
16
  # @see http://bob.nem.ninja/docs/#requesting-the-account-data
17
17
  def account_get_from_public_key(public_key:)
@@ -22,7 +22,7 @@ module Nis::Endpoint
22
22
  end
23
23
  end
24
24
 
25
- # @option options [String] address
25
+ # @param [String] address
26
26
  # @return [Nis::Struct::AccountMetaDataPair]
27
27
  # @see http://bob.nem.ninja/docs/#requesting-the-original-account-data-for-a-delegate-account
28
28
  def account_get_forwarded(address:)
@@ -33,7 +33,7 @@ module Nis::Endpoint
33
33
  end
34
34
  end
35
35
 
36
- # @option options [String] public_key
36
+ # @param [String] public_key
37
37
  # @return [Nis::Struct::AccountMetaDataPair] delegate account
38
38
  # @see http://bob.nem.ninja/docs/#requesting-the-original-account-data-for-a-delegate-account
39
39
  def account_get_forwarded_from_public_key(public_key:)
@@ -1,7 +1,7 @@
1
1
  module Nis::Endpoint
2
2
  module Account::Harvests
3
- # @option options [String] address
4
- # @option options [String] hash
3
+ # @param [String] address
4
+ # @param [String] hash
5
5
  # @return [Array <Nis::Struct::HarvestInfo>]
6
6
  # @see http://bob.nem.ninja/docs/#requesting-harvest-info-data-for-an-account
7
7
  def account_harvests(address:, hash: nil)
@@ -9,7 +9,7 @@ module Nis::Endpoint
9
9
  address: address,
10
10
  hash: hash
11
11
  ) do |res|
12
- res[:data].map{|hvst| Nis::Struct::HarvestInfo.build(hvst) }
12
+ res[:data].map { |hvst| Nis::Struct::HarvestInfo.build(hvst) }
13
13
  end
14
14
  end
15
15
  end
@@ -1,9 +1,9 @@
1
1
  module Nis::Endpoint
2
2
  module Account::Historical
3
- # @option options [String] address
4
- # @option options [Integer] start_height
5
- # @option options [Integer] end_height
6
- # @option options [Integer] increment
3
+ # @param [String] address
4
+ # @param [Integer] start_height
5
+ # @param [Integer] end_height
6
+ # @param [Integer] increment
7
7
  # @return [Array <Nis::Struct::AccountHistoricalDataViewModel>]
8
8
  # @see http://bob.nem.ninja/docs/#retrieving-historical-account-data
9
9
  def account_historical_get(address:, start_height:, end_height:, increment:)
@@ -13,7 +13,7 @@ module Nis::Endpoint
13
13
  endHeight: end_height,
14
14
  increment: increment
15
15
  ) do |res|
16
- res[:data].map{|ahdvm| Nis::Struct::AccountHistoricalDataViewModel(ahdvm) }
16
+ res[:data].map { |ahdvm| Nis::Struct::AccountHistoricalDataViewModel(ahdvm) }
17
17
  end
18
18
  end
19
19
  end
@@ -1,6 +1,6 @@
1
1
  module Nis::Endpoint
2
2
  module Account::Lock
3
- # @option options [String] private_key
3
+ # @param private_key [String]
4
4
  # @return [nil]
5
5
  # @see http://bob.nem.ninja/docs/#locking-and-unlocking-accounts
6
6
  def account_lock(private_key:)
@@ -1,8 +1,8 @@
1
1
  module Nis::Endpoint
2
2
  module Account::Mosaic
3
- # @option options [String] address
4
- # @option options [String] parent
5
- # @option options [String] id
3
+ # @param [String] address
4
+ # @param [String] parent
5
+ # @param [String] id
6
6
  # @return [Array <Nis::Struct::MosaicDefinition>]
7
7
  # @see http://bob.nem.ninja/docs/##retrieving-mosaic-definitions-that-an-account-has-created
8
8
  def account_mosaic_definition_page(address:, parent: nil, id: nil)
@@ -15,7 +15,7 @@ module Nis::Endpoint
15
15
  end
16
16
  end
17
17
 
18
- # @option options [String] address
18
+ # @param [String] address
19
19
  # @return [Array <Nis::Struct::AccountMetaDataPair>]
20
20
  # @see http://bob.nem.ninja/docs/#retrieving-mosaics-that-an-account-owns
21
21
  def account_mosaic_owned(address:)
@@ -1,9 +1,9 @@
1
1
  module Nis::Endpoint
2
2
  module Account::Namespace
3
- # @option options [String] :address
4
- # @option options [String] :parent
5
- # @option options [String] :id
6
- # @option options [Integer] :page_size
3
+ # @param [String] address
4
+ # @param [String] parent
5
+ # @param [String] id
6
+ # @param [Integer] page_size
7
7
  # @return [Array <Nis::Struct::Namespace>]
8
8
  # @see http://bob.nem.ninja/docs/#retrieving-namespaces-that-an-account-owns
9
9
  def account_namespace_page(address:, parent: nil, id: nil, page_size: nil)
@@ -13,7 +13,7 @@ module Nis::Endpoint
13
13
  id: id,
14
14
  pageSize: page_size
15
15
  ) do |res|
16
- res[:data].map{|ns| Nis::Struct::Namespace.build(ns) }
16
+ res[:data].map { |ns| Nis::Struct::Namespace.build(ns) }
17
17
  end
18
18
  end
19
19
  end
@@ -1,6 +1,6 @@
1
1
  module Nis::Endpoint
2
2
  module Account::Status
3
- # @option options [String] :address
3
+ # @param [String] address
4
4
  # @return [AccountMetaData]
5
5
  # @see http://bob.nem.ninja/docs/#requesting-the-account-status
6
6
  def account_status(address:)
@@ -1,8 +1,8 @@
1
1
  module Nis::Endpoint
2
2
  module Account::Transfers
3
- # @option options [String] :address
4
- # @option options [String] :hash
5
- # @option options [String] :id
3
+ # @param [String] address
4
+ # @param [String] hash
5
+ # @param [String] id
6
6
  # @return [Array <Nis::Struct::TransactionMetaDataPair>]
7
7
  # @see http://bob.nem.ninja/docs/#requesting-transaction-data-for-an-account
8
8
  def account_transfers_incoming(address:, hash: nil, id: nil)
@@ -11,13 +11,13 @@ module Nis::Endpoint
11
11
  hash: hash,
12
12
  id: id
13
13
  ) do |res|
14
- res[:data].map{|tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
14
+ res[:data].map { |tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
15
15
  end
16
16
  end
17
17
 
18
- # @option options [String] :address
19
- # @option options [String] :hash
20
- # @option options [String] :id
18
+ # @param [String] address
19
+ # @param [String] hash
20
+ # @param [String] id
21
21
  # @return [Array <Nis::Struct::TransactionMetaDataPair>]
22
22
  # @see http://bob.nem.ninja/docs/#requesting-transaction-data-for-an-account
23
23
  def account_transfers_outgoing(address:, hash: nil, id: nil)
@@ -26,13 +26,13 @@ module Nis::Endpoint
26
26
  hash: hash,
27
27
  id: id
28
28
  ) do |res|
29
- res[:data].map{|tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
29
+ res[:data].map { |tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
30
30
  end
31
31
  end
32
32
 
33
- # @option options [String] :address
34
- # @option options [String] :hash
35
- # @option options [String] :id
33
+ # @param [String] address
34
+ # @param [String] hash
35
+ # @param [String] id
36
36
  # @return [Array <Nis::Struct::TransactionMetaDataPair>]
37
37
  # @see http://bob.nem.ninja/docs/#requesting-transaction-data-for-an-account
38
38
  def account_transfers_all(address:, hash: nil, id: nil)
@@ -41,7 +41,7 @@ module Nis::Endpoint
41
41
  hash: hash,
42
42
  id: id
43
43
  ) do |res|
44
- res[:data].map{|tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
44
+ res[:data].map { |tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
45
45
  end
46
46
  end
47
47
  end
@@ -1,11 +1,16 @@
1
1
  module Nis::Endpoint
2
2
  module Account::UnconfirmedTransactions
3
- # @option options [String] address
3
+ # @param [String] address
4
4
  # @return [Array <Nis::Struct::UnconfirmedTransactionMetaDataPair>]
5
5
  # @see http://bob.nem.ninja/docs/#requesting-transaction-data-for-an-account
6
6
  def account_unconfirmed_transactions(address:)
7
7
  request!(:get, '/account/unconfirmedTransactions', address: address) do |res|
8
- res[:data].map { |utmdp| Nis::Struct::UnconfirmedTransactionMetaDataPair.build(utmdp) }
8
+ res[:data].map do |utmdp|
9
+ Nis::Struct::UnconfirmedTransactionMetaDataPair.build(
10
+ meta: utmdp[:meta],
11
+ transaction: utmdp[:data]
12
+ )
13
+ end
9
14
  end
10
15
  end
11
16
  end
@@ -1,6 +1,6 @@
1
1
  module Nis::Endpoint
2
2
  module Account::Unlock
3
- # @option options [String] private_key
3
+ # @param [String] private_key
4
4
  # @return [nil]
5
5
  # @see http://bob.nem.ninja/docs/#locking-and-unlocking-accounts
6
6
  def account_unlock(private_key:)
@@ -0,0 +1,10 @@
1
+ module Nis::Endpoint
2
+ module Block::At
3
+ # @param [Integer] block_height
4
+ # @return [Nis::Struct::Block]
5
+ # @see http://bob.nem.ninja/docs/#getting-a-block-with-a-given-height
6
+ def block_at_public(block_height:)
7
+ Nis::Struct::Block.build request!(:post, '/block/at/public', height: block_height)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Nis::Endpoint
2
+ module Block::Get
3
+ # @param [String] block_hash
4
+ # @return [Nis::Struct::Block]
5
+ # @see http://bob.nem.ninja/docs/#requesting-parts-of-the-block-chain
6
+ def block_get(block_hash:)
7
+ Nis::Struct::Block.build request!(:get, '/block/get', blockHash: block_hash)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ module Nis::Endpoint
2
+ module Block
3
+ end
4
+ end
@@ -0,0 +1,11 @@
1
+ module Nis::Endpoint
2
+ module Chain
3
+ module Height
4
+ # @return [Nis::Struct::BlockHeight]
5
+ # @see http://bob.nem.ninja/docs/#block-chain-height
6
+ def chain_height
7
+ Nis::Struct::BlockHeight.build request!(:get, '/chain/height')
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ module Nis::Endpoint
2
+ module Chain
3
+ module LastBlock
4
+ # @return [Nis::Struct::Block]
5
+ # @see http://bob.nem.ninja/docs/#last-block-of-the-block-chain-score
6
+ def chain_last_block
7
+ request!(:get, '/chain/last-block') do |res|
8
+ res[:transactions] = res[:transactions].map { |t| Nis::Struct::Transaction.new(t) }
9
+ Nis::Struct::Block.build res
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ module Nis::Endpoint
2
+ module Chain
3
+ module Score
4
+ # @return [Nis::Struct::BlockScore]
5
+ # @see http://bob.nem.ninja/docs/#block-chain-score
6
+ def chain_score
7
+ Nis::Struct::BlockScore.build request!(:get, '/chain/score')
8
+ end
9
+ end
10
+ end
11
+ end