nanook 0.7.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/CHANGELOG.md +26 -0
  4. data/Gemfile.lock +2 -2
  5. data/README.md +18 -7
  6. data/Rakefile +18 -0
  7. data/docs/0.7.0/apple-touch-icon.png +0 -0
  8. data/docs/0.7.0/classes/Nanook.html +572 -0
  9. data/docs/0.7.0/classes/Nanook/Account.html +909 -0
  10. data/docs/0.7.0/classes/Nanook/Block.html +717 -0
  11. data/docs/0.7.0/classes/Nanook/Error.html +84 -0
  12. data/docs/0.7.0/classes/Nanook/Key.html +253 -0
  13. data/docs/0.7.0/classes/Nanook/Node.html +657 -0
  14. data/docs/0.7.0/classes/Nanook/Rpc.html +247 -0
  15. data/docs/0.7.0/classes/Nanook/Util.html +197 -0
  16. data/docs/0.7.0/classes/Nanook/Wallet.html +986 -0
  17. data/docs/0.7.0/classes/Nanook/WalletAccount.html +446 -0
  18. data/docs/0.7.0/classes/Nanook/WorkPeer.html +294 -0
  19. data/docs/0.7.0/created.rid +14 -0
  20. data/docs/0.7.0/css/github.css +123 -0
  21. data/docs/0.7.0/css/main.css +374 -0
  22. data/docs/0.7.0/css/panel.css +360 -0
  23. data/docs/0.7.0/css/reset.css +48 -0
  24. data/docs/0.7.0/favicon.ico +0 -0
  25. data/docs/0.7.0/files/README_md.html +418 -0
  26. data/docs/0.7.0/files/lib/nanook/account_rb.html +89 -0
  27. data/docs/0.7.0/files/lib/nanook/block_rb.html +89 -0
  28. data/docs/0.7.0/files/lib/nanook/error_rb.html +89 -0
  29. data/docs/0.7.0/files/lib/nanook/key_rb.html +89 -0
  30. data/docs/0.7.0/files/lib/nanook/node_rb.html +89 -0
  31. data/docs/0.7.0/files/lib/nanook/rpc_rb.html +99 -0
  32. data/docs/0.7.0/files/lib/nanook/util_rb.html +89 -0
  33. data/docs/0.7.0/files/lib/nanook/version_rb.html +84 -0
  34. data/docs/0.7.0/files/lib/nanook/wallet_account_rb.html +89 -0
  35. data/docs/0.7.0/files/lib/nanook/wallet_rb.html +89 -0
  36. data/docs/0.7.0/files/lib/nanook/work_peer_rb.html +89 -0
  37. data/docs/0.7.0/files/lib/nanook_rb.html +94 -0
  38. data/docs/0.7.0/i/arrow-down.svg +8 -0
  39. data/docs/0.7.0/i/arrow-right.svg +8 -0
  40. data/docs/0.7.0/i/search.svg +12 -0
  41. data/docs/0.7.0/i/tree_bg.svg +8 -0
  42. data/docs/0.7.0/index.html +11 -0
  43. data/docs/0.7.0/js/highlight.pack.js +1 -0
  44. data/docs/0.7.0/js/jquery-1.3.2.min.js +19 -0
  45. data/docs/0.7.0/js/main.js +25 -0
  46. data/docs/0.7.0/js/navigation.js +142 -0
  47. data/docs/0.7.0/js/search_index.js +1 -0
  48. data/docs/0.7.0/js/searchdoc.js +465 -0
  49. data/docs/0.7.0/js/searcher.js +229 -0
  50. data/docs/0.7.0/panel/index.html +47 -0
  51. data/docs/0.7.0/panel/links.html +32 -0
  52. data/docs/0.7.0/panel/tree.js +1 -0
  53. data/docs/0.8.0/apple-touch-icon.png +0 -0
  54. data/docs/0.8.0/classes/Nanook.html +621 -0
  55. data/docs/0.8.0/classes/Nanook/Account.html +971 -0
  56. data/docs/0.8.0/classes/Nanook/Block.html +759 -0
  57. data/docs/0.8.0/classes/Nanook/Error.html +84 -0
  58. data/docs/0.8.0/classes/Nanook/Key.html +295 -0
  59. data/docs/0.8.0/classes/Nanook/Node.html +657 -0
  60. data/docs/0.8.0/classes/Nanook/Rpc.html +247 -0
  61. data/docs/0.8.0/classes/Nanook/Util.html +264 -0
  62. data/docs/0.8.0/classes/Nanook/Wallet.html +1056 -0
  63. data/docs/0.8.0/classes/Nanook/WalletAccount.html +582 -0
  64. data/docs/0.8.0/classes/Nanook/WorkPeer.html +294 -0
  65. data/docs/0.8.0/created.rid +14 -0
  66. data/docs/0.8.0/css/github.css +123 -0
  67. data/docs/0.8.0/css/main.css +374 -0
  68. data/docs/0.8.0/css/panel.css +360 -0
  69. data/docs/0.8.0/css/reset.css +48 -0
  70. data/docs/0.8.0/favicon.ico +0 -0
  71. data/docs/0.8.0/files/README_md.html +423 -0
  72. data/docs/0.8.0/files/lib/nanook/account_rb.html +89 -0
  73. data/docs/0.8.0/files/lib/nanook/block_rb.html +89 -0
  74. data/docs/0.8.0/files/lib/nanook/error_rb.html +89 -0
  75. data/docs/0.8.0/files/lib/nanook/key_rb.html +89 -0
  76. data/docs/0.8.0/files/lib/nanook/node_rb.html +89 -0
  77. data/docs/0.8.0/files/lib/nanook/rpc_rb.html +99 -0
  78. data/docs/0.8.0/files/lib/nanook/util_rb.html +97 -0
  79. data/docs/0.8.0/files/lib/nanook/version_rb.html +84 -0
  80. data/docs/0.8.0/files/lib/nanook/wallet_account_rb.html +89 -0
  81. data/docs/0.8.0/files/lib/nanook/wallet_rb.html +89 -0
  82. data/docs/0.8.0/files/lib/nanook/work_peer_rb.html +89 -0
  83. data/docs/0.8.0/files/lib/nanook_rb.html +94 -0
  84. data/docs/0.8.0/i/arrow-down.svg +8 -0
  85. data/docs/0.8.0/i/arrow-right.svg +8 -0
  86. data/docs/0.8.0/i/search.svg +12 -0
  87. data/docs/0.8.0/i/tree_bg.svg +8 -0
  88. data/docs/0.8.0/index.html +11 -0
  89. data/docs/0.8.0/js/highlight.pack.js +1 -0
  90. data/docs/0.8.0/js/jquery-1.3.2.min.js +19 -0
  91. data/docs/0.8.0/js/main.js +25 -0
  92. data/docs/0.8.0/js/navigation.js +142 -0
  93. data/docs/0.8.0/js/search_index.js +1 -0
  94. data/docs/0.8.0/js/searchdoc.js +465 -0
  95. data/docs/0.8.0/js/searcher.js +229 -0
  96. data/docs/0.8.0/panel/index.html +47 -0
  97. data/docs/0.8.0/panel/links.html +32 -0
  98. data/docs/0.8.0/panel/tree.js +1 -0
  99. data/docs/1.0.0/apple-touch-icon.png +0 -0
  100. data/docs/1.0.0/classes/Nanook.html +621 -0
  101. data/docs/1.0.0/classes/Nanook/Account.html +971 -0
  102. data/docs/1.0.0/classes/Nanook/Block.html +759 -0
  103. data/docs/1.0.0/classes/Nanook/Error.html +84 -0
  104. data/docs/1.0.0/classes/Nanook/Key.html +295 -0
  105. data/docs/1.0.0/classes/Nanook/Node.html +657 -0
  106. data/docs/1.0.0/classes/Nanook/Rpc.html +247 -0
  107. data/docs/1.0.0/classes/Nanook/Util.html +264 -0
  108. data/docs/1.0.0/classes/Nanook/Wallet.html +1056 -0
  109. data/docs/1.0.0/classes/Nanook/WalletAccount.html +582 -0
  110. data/docs/1.0.0/classes/Nanook/WorkPeer.html +294 -0
  111. data/docs/1.0.0/created.rid +14 -0
  112. data/docs/1.0.0/css/github.css +123 -0
  113. data/docs/1.0.0/css/main.css +374 -0
  114. data/docs/1.0.0/css/panel.css +360 -0
  115. data/docs/1.0.0/css/reset.css +48 -0
  116. data/docs/1.0.0/favicon.ico +0 -0
  117. data/docs/1.0.0/files/README_md.html +423 -0
  118. data/docs/1.0.0/files/lib/nanook/account_rb.html +89 -0
  119. data/docs/1.0.0/files/lib/nanook/block_rb.html +89 -0
  120. data/docs/1.0.0/files/lib/nanook/error_rb.html +89 -0
  121. data/docs/1.0.0/files/lib/nanook/key_rb.html +89 -0
  122. data/docs/1.0.0/files/lib/nanook/node_rb.html +89 -0
  123. data/docs/1.0.0/files/lib/nanook/rpc_rb.html +99 -0
  124. data/docs/1.0.0/files/lib/nanook/util_rb.html +97 -0
  125. data/docs/1.0.0/files/lib/nanook/version_rb.html +84 -0
  126. data/docs/1.0.0/files/lib/nanook/wallet_account_rb.html +89 -0
  127. data/docs/1.0.0/files/lib/nanook/wallet_rb.html +89 -0
  128. data/docs/1.0.0/files/lib/nanook/work_peer_rb.html +89 -0
  129. data/docs/1.0.0/files/lib/nanook_rb.html +94 -0
  130. data/docs/1.0.0/i/arrow-down.svg +8 -0
  131. data/docs/1.0.0/i/arrow-right.svg +8 -0
  132. data/docs/1.0.0/i/search.svg +12 -0
  133. data/docs/1.0.0/i/tree_bg.svg +8 -0
  134. data/docs/1.0.0/index.html +11 -0
  135. data/docs/1.0.0/js/highlight.pack.js +1 -0
  136. data/docs/1.0.0/js/jquery-1.3.2.min.js +19 -0
  137. data/docs/1.0.0/js/main.js +25 -0
  138. data/docs/1.0.0/js/navigation.js +142 -0
  139. data/docs/1.0.0/js/search_index.js +1 -0
  140. data/docs/1.0.0/js/searchdoc.js +465 -0
  141. data/docs/1.0.0/js/searcher.js +229 -0
  142. data/docs/1.0.0/panel/index.html +47 -0
  143. data/docs/1.0.0/panel/links.html +32 -0
  144. data/docs/1.0.0/panel/tree.js +1 -0
  145. data/docs/apple-touch-icon.png +0 -0
  146. data/docs/classes/Nanook.html +572 -0
  147. data/docs/classes/Nanook/Account.html +907 -0
  148. data/docs/classes/Nanook/Block.html +717 -0
  149. data/docs/classes/Nanook/Error.html +84 -0
  150. data/docs/classes/Nanook/Key.html +253 -0
  151. data/docs/classes/Nanook/Node.html +657 -0
  152. data/docs/classes/Nanook/Rpc.html +247 -0
  153. data/docs/classes/Nanook/Util.html +197 -0
  154. data/docs/classes/Nanook/Wallet.html +778 -0
  155. data/docs/classes/Nanook/WalletAccount.html +447 -0
  156. data/docs/classes/Nanook/WorkPeer.html +294 -0
  157. data/docs/created.rid +14 -0
  158. data/docs/css/github.css +123 -0
  159. data/docs/css/main.css +374 -0
  160. data/docs/css/panel.css +360 -0
  161. data/docs/css/reset.css +48 -0
  162. data/docs/favicon.ico +0 -0
  163. data/docs/files/README_md.html +408 -0
  164. data/docs/files/lib/nanook/account_rb.html +89 -0
  165. data/docs/files/lib/nanook/block_rb.html +89 -0
  166. data/docs/files/lib/nanook/error_rb.html +89 -0
  167. data/docs/files/lib/nanook/key_rb.html +89 -0
  168. data/docs/files/lib/nanook/node_rb.html +89 -0
  169. data/docs/files/lib/nanook/rpc_rb.html +99 -0
  170. data/docs/files/lib/nanook/util_rb.html +89 -0
  171. data/docs/files/lib/nanook/version_rb.html +84 -0
  172. data/docs/files/lib/nanook/wallet_account_rb.html +89 -0
  173. data/docs/files/lib/nanook/wallet_rb.html +89 -0
  174. data/docs/files/lib/nanook/work_peer_rb.html +89 -0
  175. data/docs/files/lib/nanook_rb.html +94 -0
  176. data/docs/i/arrow-down.svg +8 -0
  177. data/docs/i/arrow-right.svg +8 -0
  178. data/docs/i/search.svg +12 -0
  179. data/docs/i/tree_bg.svg +8 -0
  180. data/docs/index.html +11 -0
  181. data/docs/js/highlight.pack.js +1 -0
  182. data/docs/js/jquery-1.3.2.min.js +19 -0
  183. data/docs/js/main.js +25 -0
  184. data/docs/js/navigation.js +142 -0
  185. data/docs/js/search_index.js +1 -0
  186. data/docs/js/searchdoc.js +465 -0
  187. data/docs/js/searcher.js +229 -0
  188. data/docs/panel/index.html +47 -0
  189. data/docs/panel/links.html +32 -0
  190. data/docs/panel/tree.js +1 -0
  191. data/lib/nanook.rb +40 -4
  192. data/lib/nanook/account.rb +250 -8
  193. data/lib/nanook/block.rb +25 -2
  194. data/lib/nanook/key.rb +10 -2
  195. data/lib/nanook/node.rb +4 -0
  196. data/lib/nanook/rpc.rb +5 -1
  197. data/lib/nanook/util.rb +9 -1
  198. data/lib/nanook/version.rb +1 -1
  199. data/lib/nanook/wallet.rb +275 -14
  200. data/lib/nanook/wallet_account.rb +63 -11
  201. data/lib/nanook/work_peer.rb +4 -0
  202. metadata +188 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e6170431fd02cf9172ba555460af6fdecfefe79
4
- data.tar.gz: 93049e6146081de1a0019bff1ef9a2c7796114fe
3
+ metadata.gz: 3d14b10331b3dab85b1375935f14fdcaf55a0b88
4
+ data.tar.gz: e61770ece8ad4e6e7026fbfe8dea6e037dcb01c3
5
5
  SHA512:
6
- metadata.gz: ce1761786956bf8111289d74cd042d72fdbc23d0e623dbaee4e85a80f704b5fb22b1db6dc5666ddb9057166f5713d6194438fbd915c5b9e5c3bac6cbbce29f3e
7
- data.tar.gz: 0ebe5795c0a2af3a71483b7b43fe41d091b41f726bfa2fa16959f326656af77b9a3b52c367115a33e91f784699f10777fa12f52a20d8027aae4f145d60eb9dcb
6
+ metadata.gz: 1c146f1f0e070da7e3c36bb76d9b2a312f9b8a9dc857bb786ed4425739bcc5bc59a5db6c81d7c7c6601c861039d758b254351ba82cc165f844de27c2b8822b31
7
+ data.tar.gz: 07d753729b387fec8974c9dc9014acea9966945aa00638346391e65fff1feb640e746d01f23450b34db8c7b8c22af2f5efab86c3dd7c0a3c25d277100918aeef
data/.gitignore CHANGED
@@ -2,7 +2,8 @@
2
2
  /.yardoc
3
3
  /_yardoc/
4
4
  /coverage/
5
- /doc/
6
5
  /pkg/
7
6
  /spec/reports/
7
+ /spec/examples.txt
8
8
  /tmp/
9
+ .ruby-version
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ### Added
10
+
11
+ - Added this CHANGELOG.md
12
+ - All classes have an `inspect` method
13
+ - New `id` method for `Nanook::Account`, `Nanook::Block`, `Nanook::Key` and `Nanook::Wallet` classes
14
+ - `Nanook::WalletAccount` class has an `account_id` and `wallet_id` method
15
+
16
+ ### Changed
17
+
18
+ - Balance checking methods will now return the balance in NANO by default.
19
+ They take an argument `unit:` which can be set to `:raw` to have the
20
+ balance return in raw units.
21
+ - All pay methods continue to take NANO as the default unit, but can now
22
+ also take an argument `unit:` which can be set to `:raw` to have the
23
+ `amount` argument be treated as being in raw instead of NANO.
24
+
25
+
26
+ ### Removed
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanook (0.7.0)
4
+ nanook (1.0.0)
5
5
  symbolized (~> 0.0.1)
6
6
 
7
7
  GEM
@@ -58,4 +58,4 @@ DEPENDENCIES
58
58
  webmock (~> 3.3)
59
59
 
60
60
  BUNDLED WITH
61
- 1.16.0
61
+ 1.16.1
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Nanook
2
2
 
3
- This is a Ruby library for managing a [nano currency](https://nano.org/) node, including making and receiving payments, using the [nano RPC protocol](https://github.com/nanocurrency/raiblocks/wiki/RPC-protocol). Nano is a fee-less, fast, environmentally-friendly cryptocurrency. It's awesome. See [https://nano.org/](https://nano.org/).
3
+ This is a Ruby library for managing a [nano currency](https://nano.org/) node, including making and receiving payments, using the [nano RPC protocol](https://github.com/nanocurrency/raiblocks/wiki/RPC-protocol). Nano is a fee-less, fast, environmentally-friendly cryptocurrency. It's awesome. See [https://nano.org](https://nano.org/).
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/nanook.svg)](https://badge.fury.io/rb/nanook)
6
6
  [![CircleCI](https://circleci.com/gh/lukes/nanook/tree/master.svg?style=shield)](https://circleci.com/gh/lukes/nanook/tree/master)
@@ -11,7 +11,7 @@ This is a Ruby library for managing a [nano currency](https://nano.org/) node, i
11
11
  Add this line to your application's Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'nanook'
14
+ gem 'nanook', "~> 1.0"
15
15
  ```
16
16
 
17
17
  And then execute:
@@ -26,7 +26,7 @@ Or install it yourself as:
26
26
 
27
27
  ## Initializing
28
28
 
29
- Nanook will by default connect to `http://localhost:7076`. If you're using Nanook from the nano node itself this will generally work fine.
29
+ Nanook will by default connect to `http://localhost:7076`.
30
30
 
31
31
  ```ruby
32
32
  nanook = Nanook.new
@@ -35,7 +35,7 @@ nanook = Nanook.new
35
35
  To connect to another host instead:
36
36
 
37
37
  ```ruby
38
- nanook = Nanook.new("http://example.com:7076")
38
+ nanook = Nanook.new("http://ip6-localhost:7076")
39
39
  ```
40
40
 
41
41
  ## Basics
@@ -100,7 +100,7 @@ wallet = Nanook.new.wallet(wallet_id)
100
100
  wallet.receive(into: account_id)
101
101
  ```
102
102
 
103
- The `receive` method when called as above will receive the latest pending payment for an account in a wallet. It will either return a RPC response containing the block if a payment was received, or `false` if there were no pending payments to receive.
103
+ The `receive` method when called as above will receive the latest pending payment for an account in a wallet. It will either return a block hash if a payment was received, or `false` if there were no pending payments to receive.
104
104
 
105
105
  You can also receive a specific pending block if you know it (you may have discovered it through calling `account.pending` for example):
106
106
 
@@ -118,6 +118,8 @@ wallet.receive(block_id, into: account_id)
118
118
 
119
119
  ### Wallets
120
120
 
121
+ See the [full documentation for Nanook::Wallet](https://lukes.github.io/nanook/1.0.0/classes/Nanook/Wallet.html) for a detailed description of each method and example responses.
122
+
121
123
  #### Create wallet:
122
124
 
123
125
  ```ruby
@@ -136,7 +138,9 @@ wallet.change_password(password)
136
138
 
137
139
  wallet.balance
138
140
  wallet.balance(account_break_down: true)
139
- wallet.pay(from: your_account_id, to: recipient_account_id, amount: 0.2, id: unique_id)
141
+ wallet.balance(unit: :raw)
142
+ wallet.pay(from: your_account_id, to: recipient_account_id, amount: 2, id: unique_id)
143
+ wallet.pay(from: your_account_id, to: recipient_account_id, amount: 2, unit: :raw, id: unique_id)
140
144
  wallet.receive(into: account_id)
141
145
  wallet.receive(pending_block_id, into: account_id)
142
146
 
@@ -161,6 +165,7 @@ account = Nanook.new.wallet(wallet_id).account(account_id)
161
165
 
162
166
  account.exists?
163
167
  account.info
168
+ account.info(detailed: true)
164
169
  account.ledger
165
170
  account.ledger(limit: 10)
166
171
  account.history
@@ -171,7 +176,9 @@ account.representative
171
176
  account.weight
172
177
 
173
178
  account.balance
174
- account.pay(to: recipient_account_id, amount: 0.2, id: unique_id)
179
+ account.balance(unit: :raw)
180
+ account.pay(to: recipient_account_id, amount: 2, id: unique_id)
181
+ account.pay(to: recipient_account_id, amount: 2, unit: :raw, id: unique_id)
175
182
  account.pending
176
183
  account.pending(limit: 1)
177
184
  account.receive
@@ -182,11 +189,14 @@ account.destroy
182
189
 
183
190
  #### Working with any account (not necessarily in your wallet):
184
191
 
192
+ See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/1.0.0/classes/Nanook/Account.html) for a detailed description of each method and example responses.
193
+
185
194
  ```ruby
186
195
  account = Nanook.new.account(account_id)
187
196
 
188
197
  account.exists?
189
198
  account.info
199
+ account.info(detailed: true)
190
200
  account.ledger
191
201
  account.ledger(limit: 10)
192
202
  account.history
@@ -197,6 +207,7 @@ account.representative
197
207
  account.weight
198
208
 
199
209
  account.balance
210
+ account.balance(unit: :raw)
200
211
  account.pending
201
212
  account.pending(limit: 1)
202
213
  ```
data/Rakefile CHANGED
@@ -1,2 +1,20 @@
1
1
  require "bundler/gem_tasks"
2
2
  task :default => :spec
3
+
4
+ require 'sdoc' # sdoc https://github.com/zzak/sdoc
5
+ require 'rdoc/task'
6
+ require 'nanook/version'
7
+
8
+ #
9
+ # Note: `rake rerdoc`` forces a fresh generation of docs
10
+ #
11
+
12
+ RDoc::Task.new do |rdoc|
13
+ rdoc.main = 'README.md' # index page
14
+ rdoc.title = "Nanook #{Nanook::VERSION} Documentation"
15
+ rdoc.rdoc_files.include("README.md")
16
+ rdoc.rdoc_files.include('lib/**/*.rb')
17
+ rdoc.rdoc_dir = "docs/#{Nanook::VERSION}" # name of output directory
18
+ rdoc.generator = 'sdoc' # explictly set the sdoc generator
19
+ rdoc.template = 'rails' # template used on api.rubyonrails.org
20
+ end
@@ -0,0 +1,572 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Nanook</title>
5
+ <meta charset="UTF-8" />
6
+ <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
7
+ <link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
8
+ <link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
9
+ <script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
10
+ <script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
11
+ <script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
12
+
13
+
14
+ <meta property="og:title" value="Nanook">
15
+
16
+
17
+
18
+ <meta name="description" content="Initializing Connect to the default RPC host at localhost:7076 and with a timeout of 500 seconds: nanook = Nanook.new To connect to another host instead: nanook = Nanook.">
19
+ <meta property="og:description" content="Initializing Connect to the default RPC host at localhost:7076 and with a timeout of 500 seconds: nanook = Nanook.new To connect to another host instead: nanook = Nanook.">
20
+
21
+
22
+ <meta name="keywords" content="Nanook class">
23
+
24
+ <meta name="keywords" content="new, account, block, key, node, wallet, work_peers">
25
+
26
+ </head>
27
+
28
+ <body>
29
+ <div class="banner">
30
+
31
+ <h1>
32
+ <span class="type">Class</span>
33
+ Nanook
34
+
35
+ <span class="parent">&lt;
36
+
37
+ Object
38
+
39
+ </span>
40
+
41
+ </h1>
42
+ <ul class="files">
43
+
44
+ <li><a href="../files/lib/nanook_rb.html">lib/nanook.rb</a></li>
45
+
46
+ <li><a href="../files/lib/nanook/account_rb.html">lib/nanook/account.rb</a></li>
47
+
48
+ <li><a href="../files/lib/nanook/block_rb.html">lib/nanook/block.rb</a></li>
49
+
50
+ <li><a href="../files/lib/nanook/error_rb.html">lib/nanook/error.rb</a></li>
51
+
52
+ <li><a href="../files/lib/nanook/key_rb.html">lib/nanook/key.rb</a></li>
53
+
54
+ <li><a href="../files/lib/nanook/node_rb.html">lib/nanook/node.rb</a></li>
55
+
56
+ <li><a href="../files/lib/nanook/rpc_rb.html">lib/nanook/rpc.rb</a></li>
57
+
58
+ <li><a href="../files/lib/nanook/util_rb.html">lib/nanook/util.rb</a></li>
59
+
60
+ <li><a href="../files/lib/nanook/version_rb.html">lib/nanook/version.rb</a></li>
61
+
62
+ <li><a href="../files/lib/nanook/wallet_rb.html">lib/nanook/wallet.rb</a></li>
63
+
64
+ <li><a href="../files/lib/nanook/wallet_account_rb.html">lib/nanook/wallet_account.rb</a></li>
65
+
66
+ <li><a href="../files/lib/nanook/work_peer_rb.html">lib/nanook/work_peer.rb</a></li>
67
+
68
+ </ul>
69
+ </div>
70
+ <div id="bodyContent">
71
+ <div id="content">
72
+
73
+ <div class="description">
74
+
75
+ <h4 id="class-Nanook-label-Initializing">Initializing</h4>
76
+
77
+ <p>Connect to the default RPC host at <a
78
+ href="http://localhost:7076">localhost:7076</a> and with a timeout of 500
79
+ seconds:</p>
80
+
81
+ <pre><code>nanook = Nanook.new
82
+ </code></pre>
83
+
84
+ <p>To connect to another host instead:</p>
85
+
86
+ <pre><code>nanook = Nanook.new(&quot;http://ip6-localhost.com:7076&quot;)
87
+ </code></pre>
88
+
89
+ <p>To give a specific timeout value:</p>
90
+
91
+ <pre><code>Nanook.new(timeout: 600)
92
+ Nanook.new(&quot;http://ip6-localhost.com:7076&quot;, timeout: 600)
93
+ </code></pre>
94
+
95
+ </div>
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- Namespace -->
108
+ <div class="sectiontitle">Namespace</div>
109
+ <ul>
110
+
111
+ <li>
112
+ <span class="type">CLASS</span>
113
+ <a href="Nanook/Account.html">Nanook::Account</a>
114
+ </li>
115
+
116
+ <li>
117
+ <span class="type">CLASS</span>
118
+ <a href="Nanook/Block.html">Nanook::Block</a>
119
+ </li>
120
+
121
+ <li>
122
+ <span class="type">CLASS</span>
123
+ <a href="Nanook/Error.html">Nanook::Error</a>
124
+ </li>
125
+
126
+ <li>
127
+ <span class="type">CLASS</span>
128
+ <a href="Nanook/Key.html">Nanook::Key</a>
129
+ </li>
130
+
131
+ <li>
132
+ <span class="type">CLASS</span>
133
+ <a href="Nanook/Node.html">Nanook::Node</a>
134
+ </li>
135
+
136
+ <li>
137
+ <span class="type">CLASS</span>
138
+ <a href="Nanook/Rpc.html">Nanook::Rpc</a>
139
+ </li>
140
+
141
+ <li>
142
+ <span class="type">CLASS</span>
143
+ <a href="Nanook/Util.html">Nanook::Util</a>
144
+ </li>
145
+
146
+ <li>
147
+ <span class="type">CLASS</span>
148
+ <a href="Nanook/Wallet.html">Nanook::Wallet</a>
149
+ </li>
150
+
151
+ <li>
152
+ <span class="type">CLASS</span>
153
+ <a href="Nanook/WalletAccount.html">Nanook::WalletAccount</a>
154
+ </li>
155
+
156
+ <li>
157
+ <span class="type">CLASS</span>
158
+ <a href="Nanook/WorkPeer.html">Nanook::WorkPeer</a>
159
+ </li>
160
+
161
+ </ul>
162
+
163
+
164
+
165
+
166
+ <!-- Method ref -->
167
+ <div class="sectiontitle">Methods</div>
168
+ <dl class="methods">
169
+
170
+ <dt>A</dt>
171
+ <dd>
172
+ <ul>
173
+
174
+
175
+ <li>
176
+ <a href="#method-i-account">account</a>
177
+ </li>
178
+
179
+ </ul>
180
+ </dd>
181
+
182
+ <dt>B</dt>
183
+ <dd>
184
+ <ul>
185
+
186
+
187
+ <li>
188
+ <a href="#method-i-block">block</a>
189
+ </li>
190
+
191
+ </ul>
192
+ </dd>
193
+
194
+ <dt>K</dt>
195
+ <dd>
196
+ <ul>
197
+
198
+
199
+ <li>
200
+ <a href="#method-i-key">key</a>
201
+ </li>
202
+
203
+ </ul>
204
+ </dd>
205
+
206
+ <dt>N</dt>
207
+ <dd>
208
+ <ul>
209
+
210
+
211
+ <li>
212
+ <a href="#method-c-new">new</a>,
213
+ </li>
214
+
215
+
216
+ <li>
217
+ <a href="#method-i-node">node</a>
218
+ </li>
219
+
220
+ </ul>
221
+ </dd>
222
+
223
+ <dt>W</dt>
224
+ <dd>
225
+ <ul>
226
+
227
+
228
+ <li>
229
+ <a href="#method-i-wallet">wallet</a>,
230
+ </li>
231
+
232
+
233
+ <li>
234
+ <a href="#method-i-work_peers">work_peers</a>
235
+ </li>
236
+
237
+ </ul>
238
+ </dd>
239
+
240
+ </dl>
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+ <!-- Section constants -->
255
+ <div class="sectiontitle">Constants</div>
256
+ <table border='0' cellpadding='5'>
257
+
258
+ <tr valign='top'>
259
+ <td class="attr-name">VERSION</td>
260
+ <td>=</td>
261
+ <td class="attr-value">&quot;0.7.0&quot;</td>
262
+ </tr>
263
+
264
+ <tr valign='top'>
265
+ <td>&nbsp;</td>
266
+ <td colspan="2" class="attr-desc"></td>
267
+ </tr>
268
+
269
+
270
+ </table>
271
+
272
+
273
+
274
+
275
+
276
+
277
+ <!-- Methods -->
278
+
279
+ <div class="sectiontitle">Class Public methods</div>
280
+
281
+ <div class="method">
282
+ <div class="title method-title" id="method-c-new">
283
+
284
+ <b>new</b>(uri=Nanook::Rpc::DEFAULT_URI, timeout:Nanook::Rpc::DEFAULT_TIMEOUT)
285
+
286
+ <a href="../classes/Nanook.html#method-c-new" name="method-c-new" class="permalink">Link</a>
287
+ </div>
288
+
289
+
290
+ <div class="description">
291
+ <h4 id="method-c-new-label-Arguments">Arguments</h4>
292
+ <ul><li>
293
+ <p><code>uri</code> - RPC host to connect to (default is “<a
294
+ href="http://localhost:7076">localhost:7076</a>”)</p>
295
+ </li><li>
296
+ <p><code>timeout:</code> - Connection timeout in number of seconds (default is
297
+ 500)</p>
298
+ </li></ul>
299
+
300
+ <h4 id="method-c-new-label-Examples">Examples</h4>
301
+
302
+ <pre><code>Nanook.new # Connect to http://localhost:7076 with 500s timeout
303
+
304
+ Nanook.new(timeout: 600)
305
+ Nanook.new(&quot;http://ip6-localhost.com:7076&quot;, timeout: 600)
306
+ </code></pre>
307
+ </div>
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+ <div class="sourcecode">
317
+
318
+ <p class="source-link">
319
+ Source:
320
+ <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
321
+
322
+ </p>
323
+ <div id="method-c-new_source" class="dyn-source">
324
+ <pre><span class="ruby-comment"># File lib/nanook.rb, line 33</span>
325
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">uri</span>=<span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Rpc</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_URI</span>, <span class="ruby-value">timeout:</span><span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Rpc</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_TIMEOUT</span>)
326
+ <span class="ruby-ivar">@rpc</span> = <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Rpc</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-value">timeout:</span> <span class="ruby-identifier">timeout</span>)
327
+ <span class="ruby-keyword">end</span></pre>
328
+ </div>
329
+ </div>
330
+
331
+ </div>
332
+
333
+
334
+
335
+ <div class="sectiontitle">Instance Public methods</div>
336
+
337
+ <div class="method">
338
+ <div class="title method-title" id="method-i-account">
339
+
340
+ <b>account</b>(account=nil)
341
+
342
+ <a href="../classes/Nanook.html#method-i-account" name="method-i-account" class="permalink">Link</a>
343
+ </div>
344
+
345
+
346
+ <div class="description">
347
+ <p>Returns a <a href="Nanook/Account.html">Nanook::Account</a> instance.</p>
348
+
349
+ <pre><code>nanook = Nanook.new
350
+
351
+ account = nanook.account
352
+ account = nanook.account(&quot;xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000&quot;)
353
+ </code></pre>
354
+ </div>
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+ <div class="sourcecode">
364
+
365
+ <p class="source-link">
366
+ Source:
367
+ <a href="javascript:toggleSource('method-i-account_source')" id="l_method-i-account_source">show</a>
368
+
369
+ </p>
370
+ <div id="method-i-account_source" class="dyn-source">
371
+ <pre><span class="ruby-comment"># File lib/nanook.rb, line 44</span>
372
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">account</span>(<span class="ruby-identifier">account</span>=<span class="ruby-keyword">nil</span>)
373
+ <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Account</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rpc</span>, <span class="ruby-identifier">account</span>)
374
+ <span class="ruby-keyword">end</span></pre>
375
+ </div>
376
+ </div>
377
+
378
+ </div>
379
+
380
+ <div class="method">
381
+ <div class="title method-title" id="method-i-block">
382
+
383
+ <b>block</b>(block=nil)
384
+
385
+ <a href="../classes/Nanook.html#method-i-block" name="method-i-block" class="permalink">Link</a>
386
+ </div>
387
+
388
+
389
+ <div class="description">
390
+
391
+ </div>
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+ <div class="sourcecode">
401
+
402
+ <p class="source-link">
403
+ Source:
404
+ <a href="javascript:toggleSource('method-i-block_source')" id="l_method-i-block_source">show</a>
405
+
406
+ </p>
407
+ <div id="method-i-block_source" class="dyn-source">
408
+ <pre><span class="ruby-comment"># File lib/nanook.rb, line 48</span>
409
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">block</span>(<span class="ruby-identifier">block</span>=<span class="ruby-keyword">nil</span>)
410
+ <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Block</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rpc</span>, <span class="ruby-identifier">block</span>)
411
+ <span class="ruby-keyword">end</span></pre>
412
+ </div>
413
+ </div>
414
+
415
+ </div>
416
+
417
+ <div class="method">
418
+ <div class="title method-title" id="method-i-key">
419
+
420
+ <b>key</b>(key=nil)
421
+
422
+ <a href="../classes/Nanook.html#method-i-key" name="method-i-key" class="permalink">Link</a>
423
+ </div>
424
+
425
+
426
+ <div class="description">
427
+
428
+ </div>
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+ <div class="sourcecode">
438
+
439
+ <p class="source-link">
440
+ Source:
441
+ <a href="javascript:toggleSource('method-i-key_source')" id="l_method-i-key_source">show</a>
442
+
443
+ </p>
444
+ <div id="method-i-key_source" class="dyn-source">
445
+ <pre><span class="ruby-comment"># File lib/nanook.rb, line 52</span>
446
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">key</span>(<span class="ruby-identifier">key</span>=<span class="ruby-keyword">nil</span>)
447
+ <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Key</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rpc</span>, <span class="ruby-identifier">key</span>)
448
+ <span class="ruby-keyword">end</span></pre>
449
+ </div>
450
+ </div>
451
+
452
+ </div>
453
+
454
+ <div class="method">
455
+ <div class="title method-title" id="method-i-node">
456
+
457
+ <b>node</b>()
458
+
459
+ <a href="../classes/Nanook.html#method-i-node" name="method-i-node" class="permalink">Link</a>
460
+ </div>
461
+
462
+
463
+ <div class="description">
464
+
465
+ </div>
466
+
467
+
468
+
469
+
470
+
471
+
472
+
473
+
474
+ <div class="sourcecode">
475
+
476
+ <p class="source-link">
477
+ Source:
478
+ <a href="javascript:toggleSource('method-i-node_source')" id="l_method-i-node_source">show</a>
479
+
480
+ </p>
481
+ <div id="method-i-node_source" class="dyn-source">
482
+ <pre><span class="ruby-comment"># File lib/nanook.rb, line 56</span>
483
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">node</span>
484
+ <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Node</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rpc</span>)
485
+ <span class="ruby-keyword">end</span></pre>
486
+ </div>
487
+ </div>
488
+
489
+ </div>
490
+
491
+ <div class="method">
492
+ <div class="title method-title" id="method-i-wallet">
493
+
494
+ <b>wallet</b>(wallet=nil)
495
+
496
+ <a href="../classes/Nanook.html#method-i-wallet" name="method-i-wallet" class="permalink">Link</a>
497
+ </div>
498
+
499
+
500
+ <div class="description">
501
+
502
+ </div>
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+ <div class="sourcecode">
512
+
513
+ <p class="source-link">
514
+ Source:
515
+ <a href="javascript:toggleSource('method-i-wallet_source')" id="l_method-i-wallet_source">show</a>
516
+
517
+ </p>
518
+ <div id="method-i-wallet_source" class="dyn-source">
519
+ <pre><span class="ruby-comment"># File lib/nanook.rb, line 60</span>
520
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">wallet</span>(<span class="ruby-identifier">wallet</span>=<span class="ruby-keyword">nil</span>)
521
+ <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Wallet</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rpc</span>, <span class="ruby-identifier">wallet</span>)
522
+ <span class="ruby-keyword">end</span></pre>
523
+ </div>
524
+ </div>
525
+
526
+ </div>
527
+
528
+ <div class="method">
529
+ <div class="title method-title" id="method-i-work_peers">
530
+
531
+ <b>work_peers</b>()
532
+
533
+ <a href="../classes/Nanook.html#method-i-work_peers" name="method-i-work_peers" class="permalink">Link</a>
534
+ </div>
535
+
536
+
537
+ <div class="description">
538
+
539
+ </div>
540
+
541
+
542
+
543
+
544
+
545
+
546
+
547
+
548
+ <div class="sourcecode">
549
+
550
+ <p class="source-link">
551
+ Source:
552
+ <a href="javascript:toggleSource('method-i-work_peers_source')" id="l_method-i-work_peers_source">show</a>
553
+
554
+ </p>
555
+ <div id="method-i-work_peers_source" class="dyn-source">
556
+ <pre><span class="ruby-comment"># File lib/nanook.rb, line 64</span>
557
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">work_peers</span>
558
+ <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">WorkPeer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rpc</span>)
559
+ <span class="ruby-keyword">end</span></pre>
560
+ </div>
561
+ </div>
562
+
563
+ </div>
564
+
565
+
566
+
567
+
568
+ </div>
569
+
570
+ </div>
571
+ </body>
572
+ </html>