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
@@ -0,0 +1,247 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Nanook::Rpc</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::Rpc">
15
+
16
+
17
+
18
+ <meta name="keywords" content="Nanook::Rpc class">
19
+
20
+ <meta name="keywords" content="new, call">
21
+
22
+ </head>
23
+
24
+ <body>
25
+ <div class="banner">
26
+
27
+ <h1>
28
+ <span class="type">Class</span>
29
+ Nanook::Rpc
30
+
31
+ <span class="parent">&lt;
32
+
33
+ Object
34
+
35
+ </span>
36
+
37
+ </h1>
38
+ <ul class="files">
39
+
40
+ <li><a href="../../files/lib/nanook/rpc_rb.html">lib/nanook/rpc.rb</a></li>
41
+
42
+ </ul>
43
+ </div>
44
+ <div id="bodyContent">
45
+ <div id="content">
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+ <!-- Method ref -->
61
+ <div class="sectiontitle">Methods</div>
62
+ <dl class="methods">
63
+
64
+ <dt>C</dt>
65
+ <dd>
66
+ <ul>
67
+
68
+
69
+ <li>
70
+ <a href="#method-i-call">call</a>
71
+ </li>
72
+
73
+ </ul>
74
+ </dd>
75
+
76
+ <dt>N</dt>
77
+ <dd>
78
+ <ul>
79
+
80
+
81
+ <li>
82
+ <a href="#method-c-new">new</a>
83
+ </li>
84
+
85
+ </ul>
86
+ </dd>
87
+
88
+ </dl>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <!-- Section constants -->
103
+ <div class="sectiontitle">Constants</div>
104
+ <table border='0' cellpadding='5'>
105
+
106
+ <tr valign='top'>
107
+ <td class="attr-name">DEFAULT_TIMEOUT</td>
108
+ <td>=</td>
109
+ <td class="attr-value">500</td>
110
+ </tr>
111
+
112
+ <tr valign='top'>
113
+ <td>&nbsp;</td>
114
+ <td colspan="2" class="attr-desc"></td>
115
+ </tr>
116
+
117
+
118
+ <tr valign='top'>
119
+ <td class="attr-name">DEFAULT_URI</td>
120
+ <td>=</td>
121
+ <td class="attr-value">&quot;http://localhost:7076&quot;</td>
122
+ </tr>
123
+
124
+ <tr valign='top'>
125
+ <td>&nbsp;</td>
126
+ <td colspan="2" class="attr-desc"></td>
127
+ </tr>
128
+
129
+
130
+ </table>
131
+
132
+
133
+
134
+
135
+
136
+
137
+ <!-- Methods -->
138
+
139
+ <div class="sectiontitle">Class Public methods</div>
140
+
141
+ <div class="method">
142
+ <div class="title method-title" id="method-c-new">
143
+
144
+ <b>new</b>(uri=DEFAULT_URI, timeout:DEFAULT_TIMEOUT)
145
+
146
+ <a href="../../classes/Nanook/Rpc.html#method-c-new" name="method-c-new" class="permalink">Link</a>
147
+ </div>
148
+
149
+
150
+ <div class="description">
151
+
152
+ </div>
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+ <div class="sourcecode">
162
+
163
+ <p class="source-link">
164
+ Source:
165
+ <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
166
+
167
+ </p>
168
+ <div id="method-c-new_source" class="dyn-source">
169
+ <pre><span class="ruby-comment"># File lib/nanook/rpc.rb, line 10</span>
170
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">uri</span>=<span class="ruby-constant">DEFAULT_URI</span>, <span class="ruby-value">timeout:</span><span class="ruby-constant">DEFAULT_TIMEOUT</span>)
171
+ <span class="ruby-identifier">rpc_server</span> = <span class="ruby-constant">URI</span>(<span class="ruby-identifier">uri</span>)
172
+
173
+ <span class="ruby-keyword">unless</span> [<span class="ruby-string">&#39;http&#39;</span>, <span class="ruby-string">&#39;https&#39;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">scheme</span>)
174
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;URI must have http or https in it. Was given: #{uri}&quot;</span>)
175
+ <span class="ruby-keyword">end</span>
176
+
177
+ <span class="ruby-ivar">@http</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">port</span>)
178
+ <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">read_timeout</span> = <span class="ruby-identifier">timeout</span>
179
+ <span class="ruby-ivar">@request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">request_uri</span>, {<span class="ruby-string">&quot;user-agent&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;Ruby nanook gem&quot;</span>})
180
+ <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-string">&quot;application/json&quot;</span>
181
+ <span class="ruby-keyword">end</span></pre>
182
+ </div>
183
+ </div>
184
+
185
+ </div>
186
+
187
+
188
+
189
+ <div class="sectiontitle">Instance Public methods</div>
190
+
191
+ <div class="method">
192
+ <div class="title method-title" id="method-i-call">
193
+
194
+ <b>call</b>(action, params={})
195
+
196
+ <a href="../../classes/Nanook/Rpc.html#method-i-call" name="method-i-call" class="permalink">Link</a>
197
+ </div>
198
+
199
+
200
+ <div class="description">
201
+
202
+ </div>
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+ <div class="sourcecode">
212
+
213
+ <p class="source-link">
214
+ Source:
215
+ <a href="javascript:toggleSource('method-i-call_source')" id="l_method-i-call_source">show</a>
216
+
217
+ </p>
218
+ <div id="method-i-call_source" class="dyn-source">
219
+ <pre><span class="ruby-comment"># File lib/nanook/rpc.rb, line 23</span>
220
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">call</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">params</span>={})
221
+ <span class="ruby-comment"># Stringify param values</span>
222
+ <span class="ruby-identifier">params</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-identifier">params</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>] }]
223
+
224
+ <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">body</span> = { <span class="ruby-value">action:</span> <span class="ruby-identifier">action</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">params</span>).<span class="ruby-identifier">to_json</span>
225
+
226
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-ivar">@request</span>)
227
+
228
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPSuccess</span>)
229
+ <span class="ruby-identifier">hash</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)
230
+ <span class="ruby-identifier">process_hash</span>(<span class="ruby-identifier">hash</span>)
231
+ <span class="ruby-keyword">else</span>
232
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Encountered net/http error #{response.code}: #{response.class.name}&quot;</span>)
233
+ <span class="ruby-keyword">end</span>
234
+ <span class="ruby-keyword">end</span></pre>
235
+ </div>
236
+ </div>
237
+
238
+ </div>
239
+
240
+
241
+
242
+
243
+ </div>
244
+
245
+ </div>
246
+ </body>
247
+ </html>
@@ -0,0 +1,197 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Nanook::Util</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::Util">
15
+
16
+
17
+
18
+ <meta name="keywords" content="Nanook::Util class">
19
+
20
+ <meta name="keywords" content="NANO_to_raw, coerce_empty_string_to_type">
21
+
22
+ </head>
23
+
24
+ <body>
25
+ <div class="banner">
26
+
27
+ <h1>
28
+ <span class="type">Class</span>
29
+ Nanook::Util
30
+
31
+ <span class="parent">&lt;
32
+
33
+ Object
34
+
35
+ </span>
36
+
37
+ </h1>
38
+ <ul class="files">
39
+
40
+ <li><a href="../../files/lib/nanook/util_rb.html">lib/nanook/util.rb</a></li>
41
+
42
+ </ul>
43
+ </div>
44
+ <div id="bodyContent">
45
+ <div id="content">
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+ <!-- Method ref -->
61
+ <div class="sectiontitle">Methods</div>
62
+ <dl class="methods">
63
+
64
+ <dt>N</dt>
65
+ <dd>
66
+ <ul>
67
+
68
+
69
+ <li>
70
+ <a href="#method-c-NANO_to_raw">NANO_to_raw</a>
71
+ </li>
72
+
73
+ </ul>
74
+ </dd>
75
+
76
+ <dt>C</dt>
77
+ <dd>
78
+ <ul>
79
+
80
+
81
+ <li>
82
+ <a href="#method-c-coerce_empty_string_to_type">coerce_empty_string_to_type</a>
83
+ </li>
84
+
85
+ </ul>
86
+ </dd>
87
+
88
+ </dl>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- Methods -->
108
+
109
+ <div class="sectiontitle">Class Public methods</div>
110
+
111
+ <div class="method">
112
+ <div class="title method-title" id="method-c-NANO_to_raw">
113
+
114
+ <b>NANO_to_raw</b>(nano)
115
+
116
+ <a href="../../classes/Nanook/Util.html#method-c-NANO_to_raw" name="method-c-NANO_to_raw" class="permalink">Link</a>
117
+ </div>
118
+
119
+
120
+ <div class="description">
121
+
122
+ </div>
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+ <div class="sourcecode">
132
+
133
+ <p class="source-link">
134
+ Source:
135
+ <a href="javascript:toggleSource('method-c-NANO_to_raw_source')" id="l_method-c-NANO_to_raw_source">show</a>
136
+
137
+ </p>
138
+ <div id="method-c-NANO_to_raw_source" class="dyn-source">
139
+ <pre><span class="ruby-comment"># File lib/nanook/util.rb, line 4</span>
140
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-constant">NANO_to_raw</span>(<span class="ruby-identifier ruby-title">nano</span>)
141
+ <span class="ruby-identifier">nano</span> <span class="ruby-operator">*</span> (<span class="ruby-value">10</span><span class="ruby-operator">**</span><span class="ruby-value">30</span>)
142
+ <span class="ruby-keyword">end</span></pre>
143
+ </div>
144
+ </div>
145
+
146
+ </div>
147
+
148
+ <div class="method">
149
+ <div class="title method-title" id="method-c-coerce_empty_string_to_type">
150
+
151
+ <b>coerce_empty_string_to_type</b>(response, type)
152
+
153
+ <a href="../../classes/Nanook/Util.html#method-c-coerce_empty_string_to_type" name="method-c-coerce_empty_string_to_type" class="permalink">Link</a>
154
+ </div>
155
+
156
+
157
+ <div class="description">
158
+
159
+ </div>
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+ <div class="sourcecode">
169
+
170
+ <p class="source-link">
171
+ Source:
172
+ <a href="javascript:toggleSource('method-c-coerce_empty_string_to_type_source')" id="l_method-c-coerce_empty_string_to_type_source">show</a>
173
+
174
+ </p>
175
+ <div id="method-c-coerce_empty_string_to_type_source" class="dyn-source">
176
+ <pre><span class="ruby-comment"># File lib/nanook/util.rb, line 8</span>
177
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">coerce_empty_string_to_type</span>(<span class="ruby-identifier">response</span>, <span class="ruby-identifier">type</span>)
178
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span>
179
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">new</span>
180
+ <span class="ruby-keyword">end</span>
181
+
182
+ <span class="ruby-identifier">response</span>
183
+ <span class="ruby-keyword">end</span></pre>
184
+ </div>
185
+ </div>
186
+
187
+ </div>
188
+
189
+
190
+
191
+
192
+
193
+ </div>
194
+
195
+ </div>
196
+ </body>
197
+ </html>
@@ -0,0 +1,778 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Nanook::Wallet</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::Wallet">
15
+
16
+
17
+
18
+ <meta name="keywords" content="Nanook::Wallet class">
19
+
20
+ <meta name="keywords" content="new, account, accounts, balance, create, destroy, export, contains?, pay, receive, locked?, unlock, change_password, all">
21
+
22
+ </head>
23
+
24
+ <body>
25
+ <div class="banner">
26
+
27
+ <h1>
28
+ <span class="type">Class</span>
29
+ Nanook::Wallet
30
+
31
+ <span class="parent">&lt;
32
+
33
+ Object
34
+
35
+ </span>
36
+
37
+ </h1>
38
+ <ul class="files">
39
+
40
+ <li><a href="../../files/lib/nanook/wallet_rb.html">lib/nanook/wallet.rb</a></li>
41
+
42
+ </ul>
43
+ </div>
44
+ <div id="bodyContent">
45
+ <div id="content">
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+ <!-- Method ref -->
61
+ <div class="sectiontitle">Methods</div>
62
+ <dl class="methods">
63
+
64
+ <dt>A</dt>
65
+ <dd>
66
+ <ul>
67
+
68
+
69
+ <li>
70
+ <a href="#method-i-account">account</a>,
71
+ </li>
72
+
73
+
74
+ <li>
75
+ <a href="#method-i-accounts">accounts</a>,
76
+ </li>
77
+
78
+
79
+ <li>
80
+ <a href="#method-i-all">all</a>
81
+ </li>
82
+
83
+ </ul>
84
+ </dd>
85
+
86
+ <dt>B</dt>
87
+ <dd>
88
+ <ul>
89
+
90
+
91
+ <li>
92
+ <a href="#method-i-balance">balance</a>
93
+ </li>
94
+
95
+ </ul>
96
+ </dd>
97
+
98
+ <dt>C</dt>
99
+ <dd>
100
+ <ul>
101
+
102
+
103
+ <li>
104
+ <a href="#method-i-change_password">change_password</a>,
105
+ </li>
106
+
107
+
108
+ <li>
109
+ <a href="#method-i-contains-3F">contains?</a>,
110
+ </li>
111
+
112
+
113
+ <li>
114
+ <a href="#method-i-create">create</a>
115
+ </li>
116
+
117
+ </ul>
118
+ </dd>
119
+
120
+ <dt>D</dt>
121
+ <dd>
122
+ <ul>
123
+
124
+
125
+ <li>
126
+ <a href="#method-i-destroy">destroy</a>
127
+ </li>
128
+
129
+ </ul>
130
+ </dd>
131
+
132
+ <dt>E</dt>
133
+ <dd>
134
+ <ul>
135
+
136
+
137
+ <li>
138
+ <a href="#method-i-export">export</a>
139
+ </li>
140
+
141
+ </ul>
142
+ </dd>
143
+
144
+ <dt>L</dt>
145
+ <dd>
146
+ <ul>
147
+
148
+
149
+ <li>
150
+ <a href="#method-i-locked-3F">locked?</a>
151
+ </li>
152
+
153
+ </ul>
154
+ </dd>
155
+
156
+ <dt>N</dt>
157
+ <dd>
158
+ <ul>
159
+
160
+
161
+ <li>
162
+ <a href="#method-c-new">new</a>
163
+ </li>
164
+
165
+ </ul>
166
+ </dd>
167
+
168
+ <dt>P</dt>
169
+ <dd>
170
+ <ul>
171
+
172
+
173
+ <li>
174
+ <a href="#method-i-pay">pay</a>
175
+ </li>
176
+
177
+ </ul>
178
+ </dd>
179
+
180
+ <dt>R</dt>
181
+ <dd>
182
+ <ul>
183
+
184
+
185
+ <li>
186
+ <a href="#method-i-receive">receive</a>
187
+ </li>
188
+
189
+ </ul>
190
+ </dd>
191
+
192
+ <dt>U</dt>
193
+ <dd>
194
+ <ul>
195
+
196
+
197
+ <li>
198
+ <a href="#method-i-unlock">unlock</a>
199
+ </li>
200
+
201
+ </ul>
202
+ </dd>
203
+
204
+ </dl>
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+ <!-- Methods -->
224
+
225
+ <div class="sectiontitle">Class Public methods</div>
226
+
227
+ <div class="method">
228
+ <div class="title method-title" id="method-c-new">
229
+
230
+ <b>new</b>(rpc, wallet)
231
+
232
+ <a href="../../classes/Nanook/Wallet.html#method-c-new" name="method-c-new" class="permalink">Link</a>
233
+ </div>
234
+
235
+
236
+ <div class="description">
237
+
238
+ </div>
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+ <div class="sourcecode">
248
+
249
+ <p class="source-link">
250
+ Source:
251
+ <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
252
+
253
+ </p>
254
+ <div id="method-c-new_source" class="dyn-source">
255
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 4</span>
256
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">rpc</span>, <span class="ruby-identifier">wallet</span>)
257
+ <span class="ruby-ivar">@rpc</span> = <span class="ruby-identifier">rpc</span>
258
+ <span class="ruby-ivar">@wallet</span> = <span class="ruby-identifier">wallet</span>
259
+ <span class="ruby-keyword">end</span></pre>
260
+ </div>
261
+ </div>
262
+
263
+ </div>
264
+
265
+
266
+
267
+ <div class="sectiontitle">Instance Public methods</div>
268
+
269
+ <div class="method">
270
+ <div class="title method-title" id="method-i-account">
271
+
272
+ <b>account</b>(account=nil)
273
+
274
+ <a href="../../classes/Nanook/Wallet.html#method-i-account" name="method-i-account" class="permalink">Link</a>
275
+ </div>
276
+
277
+
278
+ <div class="description">
279
+
280
+ </div>
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+ <div class="sourcecode">
290
+
291
+ <p class="source-link">
292
+ Source:
293
+ <a href="javascript:toggleSource('method-i-account_source')" id="l_method-i-account_source">show</a>
294
+
295
+ </p>
296
+ <div id="method-i-account_source" class="dyn-source">
297
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 9</span>
298
+ <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>)
299
+ <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">WalletAccount</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rpc</span>, <span class="ruby-ivar">@wallet</span>, <span class="ruby-identifier">account</span>)
300
+ <span class="ruby-keyword">end</span></pre>
301
+ </div>
302
+ </div>
303
+
304
+ </div>
305
+
306
+ <div class="method">
307
+ <div class="title method-title" id="method-i-accounts">
308
+
309
+ <b>accounts</b>()
310
+
311
+ <a href="../../classes/Nanook/Wallet.html#method-i-accounts" name="method-i-accounts" class="permalink">Link</a>
312
+ </div>
313
+
314
+
315
+ <div class="description">
316
+
317
+ </div>
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+ <div class="sourcecode">
327
+
328
+ <p class="source-link">
329
+ Source:
330
+ <a href="javascript:toggleSource('method-i-accounts_source')" id="l_method-i-accounts_source">show</a>
331
+
332
+ </p>
333
+ <div id="method-i-accounts_source" class="dyn-source">
334
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 13</span>
335
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accounts</span>
336
+ <span class="ruby-identifier">wallet_required!</span>
337
+ <span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:account_list</span>)[<span class="ruby-value">:accounts</span>]
338
+ <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">coerce_empty_string_to_type</span>(<span class="ruby-identifier">response</span>, <span class="ruby-constant">Array</span>)
339
+ <span class="ruby-keyword">end</span></pre>
340
+ </div>
341
+ </div>
342
+
343
+ </div>
344
+
345
+ <div class="method">
346
+ <div class="title method-title" id="method-i-all">
347
+
348
+ <b>all</b>()
349
+
350
+ <a href="../../classes/Nanook/Wallet.html#method-i-all" name="method-i-all" class="permalink">Link</a>
351
+ </div>
352
+
353
+
354
+ <div class="description">
355
+
356
+ </div>
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+ <div class="sourcecode">
366
+
367
+ <p class="source-link">
368
+ Source:
369
+ <a href="javascript:toggleSource('method-i-all_source')" id="l_method-i-all_source">show</a>
370
+
371
+ </p>
372
+ <div id="method-i-all_source" class="dyn-source">
373
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 78</span>
374
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">all</span>
375
+ <span class="ruby-identifier">wallet_required!</span>
376
+ <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:account_list</span>)[<span class="ruby-value">:accounts</span>]
377
+ <span class="ruby-keyword">end</span></pre>
378
+ </div>
379
+ </div>
380
+
381
+ </div>
382
+
383
+ <div class="method">
384
+ <div class="title method-title" id="method-i-balance">
385
+
386
+ <b>balance</b>(account_break_down: false)
387
+
388
+ <a href="../../classes/Nanook/Wallet.html#method-i-balance" name="method-i-balance" class="permalink">Link</a>
389
+ </div>
390
+
391
+
392
+ <div class="description">
393
+
394
+ </div>
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+ <div class="sourcecode">
404
+
405
+ <p class="source-link">
406
+ Source:
407
+ <a href="javascript:toggleSource('method-i-balance_source')" id="l_method-i-balance_source">show</a>
408
+
409
+ </p>
410
+ <div id="method-i-balance_source" class="dyn-source">
411
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 19</span>
412
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">balance</span>(<span class="ruby-value">account_break_down:</span> <span class="ruby-keyword">false</span>)
413
+ <span class="ruby-identifier">wallet_required!</span>
414
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">account_break_down</span>
415
+ <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">coerce_empty_string_to_type</span>(<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_balances</span>)[<span class="ruby-value">:balances</span>], <span class="ruby-constant">Hash</span>)
416
+ <span class="ruby-keyword">else</span>
417
+ <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_balance_total</span>)
418
+ <span class="ruby-keyword">end</span>
419
+ <span class="ruby-keyword">end</span></pre>
420
+ </div>
421
+ </div>
422
+
423
+ </div>
424
+
425
+ <div class="method">
426
+ <div class="title method-title" id="method-i-change_password">
427
+
428
+ <b>change_password</b>(password)
429
+
430
+ <a href="../../classes/Nanook/Wallet.html#method-i-change_password" name="method-i-change_password" class="permalink">Link</a>
431
+ </div>
432
+
433
+
434
+ <div class="description">
435
+
436
+ </div>
437
+
438
+
439
+
440
+
441
+
442
+
443
+
444
+
445
+ <div class="sourcecode">
446
+
447
+ <p class="source-link">
448
+ Source:
449
+ <a href="javascript:toggleSource('method-i-change_password_source')" id="l_method-i-change_password_source">show</a>
450
+
451
+ </p>
452
+ <div id="method-i-change_password_source" class="dyn-source">
453
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 73</span>
454
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_password</span>(<span class="ruby-identifier">password</span>)
455
+ <span class="ruby-identifier">wallet_required!</span>
456
+ <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:password_change</span>, <span class="ruby-value">password:</span> <span class="ruby-identifier">password</span>)[<span class="ruby-value">:changed</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
457
+ <span class="ruby-keyword">end</span></pre>
458
+ </div>
459
+ </div>
460
+
461
+ </div>
462
+
463
+ <div class="method">
464
+ <div class="title method-title" id="method-i-contains-3F">
465
+
466
+ <b>contains?</b>(account)
467
+
468
+ <a href="../../classes/Nanook/Wallet.html#method-i-contains-3F" name="method-i-contains-3F" class="permalink">Link</a>
469
+ </div>
470
+
471
+
472
+ <div class="description">
473
+
474
+ </div>
475
+
476
+
477
+
478
+
479
+
480
+
481
+
482
+
483
+ <div class="sourcecode">
484
+
485
+ <p class="source-link">
486
+ Source:
487
+ <a href="javascript:toggleSource('method-i-contains-3F_source')" id="l_method-i-contains-3F_source">show</a>
488
+
489
+ </p>
490
+ <div id="method-i-contains-3F_source" class="dyn-source">
491
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 44</span>
492
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">contains?</span>(<span class="ruby-identifier">account</span>)
493
+ <span class="ruby-identifier">wallet_required!</span>
494
+ <span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_contains</span>, <span class="ruby-value">account:</span> <span class="ruby-identifier">account</span>)
495
+ <span class="ruby-operator">!</span><span class="ruby-identifier">response</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">response</span>[<span class="ruby-value">:exists</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
496
+ <span class="ruby-keyword">end</span></pre>
497
+ </div>
498
+ </div>
499
+
500
+ </div>
501
+
502
+ <div class="method">
503
+ <div class="title method-title" id="method-i-create">
504
+
505
+ <b>create</b>()
506
+
507
+ <a href="../../classes/Nanook/Wallet.html#method-i-create" name="method-i-create" class="permalink">Link</a>
508
+ </div>
509
+
510
+
511
+ <div class="description">
512
+
513
+ </div>
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+
522
+ <div class="sourcecode">
523
+
524
+ <p class="source-link">
525
+ Source:
526
+ <a href="javascript:toggleSource('method-i-create_source')" id="l_method-i-create_source">show</a>
527
+
528
+ </p>
529
+ <div id="method-i-create_source" class="dyn-source">
530
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 28</span>
531
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">create</span>
532
+ <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_create</span>)[<span class="ruby-value">:wallet</span>]
533
+ <span class="ruby-keyword">end</span></pre>
534
+ </div>
535
+ </div>
536
+
537
+ </div>
538
+
539
+ <div class="method">
540
+ <div class="title method-title" id="method-i-destroy">
541
+
542
+ <b>destroy</b>()
543
+
544
+ <a href="../../classes/Nanook/Wallet.html#method-i-destroy" name="method-i-destroy" class="permalink">Link</a>
545
+ </div>
546
+
547
+
548
+ <div class="description">
549
+
550
+ </div>
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+
559
+ <div class="sourcecode">
560
+
561
+ <p class="source-link">
562
+ Source:
563
+ <a href="javascript:toggleSource('method-i-destroy_source')" id="l_method-i-destroy_source">show</a>
564
+
565
+ </p>
566
+ <div id="method-i-destroy_source" class="dyn-source">
567
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 32</span>
568
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">destroy</span>
569
+ <span class="ruby-identifier">wallet_required!</span>
570
+ <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_destroy</span>)
571
+ <span class="ruby-keyword">true</span>
572
+ <span class="ruby-keyword">end</span></pre>
573
+ </div>
574
+ </div>
575
+
576
+ </div>
577
+
578
+ <div class="method">
579
+ <div class="title method-title" id="method-i-export">
580
+
581
+ <b>export</b>()
582
+
583
+ <a href="../../classes/Nanook/Wallet.html#method-i-export" name="method-i-export" class="permalink">Link</a>
584
+ </div>
585
+
586
+
587
+ <div class="description">
588
+ <p>Returns string of JSON</p>
589
+ </div>
590
+
591
+
592
+
593
+
594
+
595
+
596
+
597
+
598
+ <div class="sourcecode">
599
+
600
+ <p class="source-link">
601
+ Source:
602
+ <a href="javascript:toggleSource('method-i-export_source')" id="l_method-i-export_source">show</a>
603
+
604
+ </p>
605
+ <div id="method-i-export_source" class="dyn-source">
606
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 39</span>
607
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">export</span>
608
+ <span class="ruby-identifier">wallet_required!</span>
609
+ <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_export</span>)[<span class="ruby-value">:json</span>]
610
+ <span class="ruby-keyword">end</span></pre>
611
+ </div>
612
+ </div>
613
+
614
+ </div>
615
+
616
+ <div class="method">
617
+ <div class="title method-title" id="method-i-locked-3F">
618
+
619
+ <b>locked?</b>()
620
+
621
+ <a href="../../classes/Nanook/Wallet.html#method-i-locked-3F" name="method-i-locked-3F" class="permalink">Link</a>
622
+ </div>
623
+
624
+
625
+ <div class="description">
626
+
627
+ </div>
628
+
629
+
630
+
631
+
632
+
633
+
634
+
635
+
636
+ <div class="sourcecode">
637
+
638
+ <p class="source-link">
639
+ Source:
640
+ <a href="javascript:toggleSource('method-i-locked-3F_source')" id="l_method-i-locked-3F_source">show</a>
641
+
642
+ </p>
643
+ <div id="method-i-locked-3F_source" class="dyn-source">
644
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 62</span>
645
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">locked?</span>
646
+ <span class="ruby-identifier">wallet_required!</span>
647
+ <span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_locked</span>)
648
+ <span class="ruby-operator">!</span><span class="ruby-identifier">response</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">response</span>[<span class="ruby-value">:locked</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
649
+ <span class="ruby-keyword">end</span></pre>
650
+ </div>
651
+ </div>
652
+
653
+ </div>
654
+
655
+ <div class="method">
656
+ <div class="title method-title" id="method-i-pay">
657
+
658
+ <b>pay</b>(from:, to:, amount:, id:)
659
+
660
+ <a href="../../classes/Nanook/Wallet.html#method-i-pay" name="method-i-pay" class="permalink">Link</a>
661
+ </div>
662
+
663
+
664
+ <div class="description">
665
+
666
+ </div>
667
+
668
+
669
+
670
+
671
+
672
+
673
+
674
+
675
+ <div class="sourcecode">
676
+
677
+ <p class="source-link">
678
+ Source:
679
+ <a href="javascript:toggleSource('method-i-pay_source')" id="l_method-i-pay_source">show</a>
680
+
681
+ </p>
682
+ <div id="method-i-pay_source" class="dyn-source">
683
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 50</span>
684
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pay</span>(<span class="ruby-value">from:</span>, <span class="ruby-value">to:</span>, <span class="ruby-value">amount:</span>, <span class="ruby-value">id:</span>)
685
+ <span class="ruby-identifier">wallet_required!</span>
686
+ <span class="ruby-identifier">validate_wallet_contains_account!</span>(<span class="ruby-identifier">from</span>)
687
+ <span class="ruby-identifier">account</span>(<span class="ruby-identifier">from</span>).<span class="ruby-identifier">pay</span>(<span class="ruby-value">to:</span> <span class="ruby-identifier">to</span>, <span class="ruby-value">amount:</span> <span class="ruby-identifier">amount</span>, <span class="ruby-value">id:</span> <span class="ruby-identifier">id</span>)
688
+ <span class="ruby-keyword">end</span></pre>
689
+ </div>
690
+ </div>
691
+
692
+ </div>
693
+
694
+ <div class="method">
695
+ <div class="title method-title" id="method-i-receive">
696
+
697
+ <b>receive</b>(block=nil, into:)
698
+
699
+ <a href="../../classes/Nanook/Wallet.html#method-i-receive" name="method-i-receive" class="permalink">Link</a>
700
+ </div>
701
+
702
+
703
+ <div class="description">
704
+
705
+ </div>
706
+
707
+
708
+
709
+
710
+
711
+
712
+
713
+
714
+ <div class="sourcecode">
715
+
716
+ <p class="source-link">
717
+ Source:
718
+ <a href="javascript:toggleSource('method-i-receive_source')" id="l_method-i-receive_source">show</a>
719
+
720
+ </p>
721
+ <div id="method-i-receive_source" class="dyn-source">
722
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 56</span>
723
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">receive</span>(<span class="ruby-identifier">block</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-value">into:</span>)
724
+ <span class="ruby-identifier">wallet_required!</span>
725
+ <span class="ruby-identifier">validate_wallet_contains_account!</span>(<span class="ruby-identifier">into</span>)
726
+ <span class="ruby-identifier">account</span>(<span class="ruby-identifier">into</span>).<span class="ruby-identifier">receive</span>(<span class="ruby-identifier">block</span>)
727
+ <span class="ruby-keyword">end</span></pre>
728
+ </div>
729
+ </div>
730
+
731
+ </div>
732
+
733
+ <div class="method">
734
+ <div class="title method-title" id="method-i-unlock">
735
+
736
+ <b>unlock</b>(password)
737
+
738
+ <a href="../../classes/Nanook/Wallet.html#method-i-unlock" name="method-i-unlock" class="permalink">Link</a>
739
+ </div>
740
+
741
+
742
+ <div class="description">
743
+
744
+ </div>
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+ <div class="sourcecode">
754
+
755
+ <p class="source-link">
756
+ Source:
757
+ <a href="javascript:toggleSource('method-i-unlock_source')" id="l_method-i-unlock_source">show</a>
758
+
759
+ </p>
760
+ <div id="method-i-unlock_source" class="dyn-source">
761
+ <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 68</span>
762
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unlock</span>(<span class="ruby-identifier">password</span>)
763
+ <span class="ruby-identifier">wallet_required!</span>
764
+ <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:password_enter</span>, <span class="ruby-value">password:</span> <span class="ruby-identifier">password</span>)[<span class="ruby-value">:valid</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
765
+ <span class="ruby-keyword">end</span></pre>
766
+ </div>
767
+ </div>
768
+
769
+ </div>
770
+
771
+
772
+
773
+
774
+ </div>
775
+
776
+ </div>
777
+ </body>
778
+ </html>