nanook 0.7.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +26 -0
- data/Gemfile.lock +2 -2
- data/README.md +18 -7
- data/Rakefile +18 -0
- data/docs/0.7.0/apple-touch-icon.png +0 -0
- data/docs/0.7.0/classes/Nanook.html +572 -0
- data/docs/0.7.0/classes/Nanook/Account.html +909 -0
- data/docs/0.7.0/classes/Nanook/Block.html +717 -0
- data/docs/0.7.0/classes/Nanook/Error.html +84 -0
- data/docs/0.7.0/classes/Nanook/Key.html +253 -0
- data/docs/0.7.0/classes/Nanook/Node.html +657 -0
- data/docs/0.7.0/classes/Nanook/Rpc.html +247 -0
- data/docs/0.7.0/classes/Nanook/Util.html +197 -0
- data/docs/0.7.0/classes/Nanook/Wallet.html +986 -0
- data/docs/0.7.0/classes/Nanook/WalletAccount.html +446 -0
- data/docs/0.7.0/classes/Nanook/WorkPeer.html +294 -0
- data/docs/0.7.0/created.rid +14 -0
- data/docs/0.7.0/css/github.css +123 -0
- data/docs/0.7.0/css/main.css +374 -0
- data/docs/0.7.0/css/panel.css +360 -0
- data/docs/0.7.0/css/reset.css +48 -0
- data/docs/0.7.0/favicon.ico +0 -0
- data/docs/0.7.0/files/README_md.html +418 -0
- data/docs/0.7.0/files/lib/nanook/account_rb.html +89 -0
- data/docs/0.7.0/files/lib/nanook/block_rb.html +89 -0
- data/docs/0.7.0/files/lib/nanook/error_rb.html +89 -0
- data/docs/0.7.0/files/lib/nanook/key_rb.html +89 -0
- data/docs/0.7.0/files/lib/nanook/node_rb.html +89 -0
- data/docs/0.7.0/files/lib/nanook/rpc_rb.html +99 -0
- data/docs/0.7.0/files/lib/nanook/util_rb.html +89 -0
- data/docs/0.7.0/files/lib/nanook/version_rb.html +84 -0
- data/docs/0.7.0/files/lib/nanook/wallet_account_rb.html +89 -0
- data/docs/0.7.0/files/lib/nanook/wallet_rb.html +89 -0
- data/docs/0.7.0/files/lib/nanook/work_peer_rb.html +89 -0
- data/docs/0.7.0/files/lib/nanook_rb.html +94 -0
- data/docs/0.7.0/i/arrow-down.svg +8 -0
- data/docs/0.7.0/i/arrow-right.svg +8 -0
- data/docs/0.7.0/i/search.svg +12 -0
- data/docs/0.7.0/i/tree_bg.svg +8 -0
- data/docs/0.7.0/index.html +11 -0
- data/docs/0.7.0/js/highlight.pack.js +1 -0
- data/docs/0.7.0/js/jquery-1.3.2.min.js +19 -0
- data/docs/0.7.0/js/main.js +25 -0
- data/docs/0.7.0/js/navigation.js +142 -0
- data/docs/0.7.0/js/search_index.js +1 -0
- data/docs/0.7.0/js/searchdoc.js +465 -0
- data/docs/0.7.0/js/searcher.js +229 -0
- data/docs/0.7.0/panel/index.html +47 -0
- data/docs/0.7.0/panel/links.html +32 -0
- data/docs/0.7.0/panel/tree.js +1 -0
- data/docs/0.8.0/apple-touch-icon.png +0 -0
- data/docs/0.8.0/classes/Nanook.html +621 -0
- data/docs/0.8.0/classes/Nanook/Account.html +971 -0
- data/docs/0.8.0/classes/Nanook/Block.html +759 -0
- data/docs/0.8.0/classes/Nanook/Error.html +84 -0
- data/docs/0.8.0/classes/Nanook/Key.html +295 -0
- data/docs/0.8.0/classes/Nanook/Node.html +657 -0
- data/docs/0.8.0/classes/Nanook/Rpc.html +247 -0
- data/docs/0.8.0/classes/Nanook/Util.html +264 -0
- data/docs/0.8.0/classes/Nanook/Wallet.html +1056 -0
- data/docs/0.8.0/classes/Nanook/WalletAccount.html +582 -0
- data/docs/0.8.0/classes/Nanook/WorkPeer.html +294 -0
- data/docs/0.8.0/created.rid +14 -0
- data/docs/0.8.0/css/github.css +123 -0
- data/docs/0.8.0/css/main.css +374 -0
- data/docs/0.8.0/css/panel.css +360 -0
- data/docs/0.8.0/css/reset.css +48 -0
- data/docs/0.8.0/favicon.ico +0 -0
- data/docs/0.8.0/files/README_md.html +423 -0
- data/docs/0.8.0/files/lib/nanook/account_rb.html +89 -0
- data/docs/0.8.0/files/lib/nanook/block_rb.html +89 -0
- data/docs/0.8.0/files/lib/nanook/error_rb.html +89 -0
- data/docs/0.8.0/files/lib/nanook/key_rb.html +89 -0
- data/docs/0.8.0/files/lib/nanook/node_rb.html +89 -0
- data/docs/0.8.0/files/lib/nanook/rpc_rb.html +99 -0
- data/docs/0.8.0/files/lib/nanook/util_rb.html +97 -0
- data/docs/0.8.0/files/lib/nanook/version_rb.html +84 -0
- data/docs/0.8.0/files/lib/nanook/wallet_account_rb.html +89 -0
- data/docs/0.8.0/files/lib/nanook/wallet_rb.html +89 -0
- data/docs/0.8.0/files/lib/nanook/work_peer_rb.html +89 -0
- data/docs/0.8.0/files/lib/nanook_rb.html +94 -0
- data/docs/0.8.0/i/arrow-down.svg +8 -0
- data/docs/0.8.0/i/arrow-right.svg +8 -0
- data/docs/0.8.0/i/search.svg +12 -0
- data/docs/0.8.0/i/tree_bg.svg +8 -0
- data/docs/0.8.0/index.html +11 -0
- data/docs/0.8.0/js/highlight.pack.js +1 -0
- data/docs/0.8.0/js/jquery-1.3.2.min.js +19 -0
- data/docs/0.8.0/js/main.js +25 -0
- data/docs/0.8.0/js/navigation.js +142 -0
- data/docs/0.8.0/js/search_index.js +1 -0
- data/docs/0.8.0/js/searchdoc.js +465 -0
- data/docs/0.8.0/js/searcher.js +229 -0
- data/docs/0.8.0/panel/index.html +47 -0
- data/docs/0.8.0/panel/links.html +32 -0
- data/docs/0.8.0/panel/tree.js +1 -0
- data/docs/1.0.0/apple-touch-icon.png +0 -0
- data/docs/1.0.0/classes/Nanook.html +621 -0
- data/docs/1.0.0/classes/Nanook/Account.html +971 -0
- data/docs/1.0.0/classes/Nanook/Block.html +759 -0
- data/docs/1.0.0/classes/Nanook/Error.html +84 -0
- data/docs/1.0.0/classes/Nanook/Key.html +295 -0
- data/docs/1.0.0/classes/Nanook/Node.html +657 -0
- data/docs/1.0.0/classes/Nanook/Rpc.html +247 -0
- data/docs/1.0.0/classes/Nanook/Util.html +264 -0
- data/docs/1.0.0/classes/Nanook/Wallet.html +1056 -0
- data/docs/1.0.0/classes/Nanook/WalletAccount.html +582 -0
- data/docs/1.0.0/classes/Nanook/WorkPeer.html +294 -0
- data/docs/1.0.0/created.rid +14 -0
- data/docs/1.0.0/css/github.css +123 -0
- data/docs/1.0.0/css/main.css +374 -0
- data/docs/1.0.0/css/panel.css +360 -0
- data/docs/1.0.0/css/reset.css +48 -0
- data/docs/1.0.0/favicon.ico +0 -0
- data/docs/1.0.0/files/README_md.html +423 -0
- data/docs/1.0.0/files/lib/nanook/account_rb.html +89 -0
- data/docs/1.0.0/files/lib/nanook/block_rb.html +89 -0
- data/docs/1.0.0/files/lib/nanook/error_rb.html +89 -0
- data/docs/1.0.0/files/lib/nanook/key_rb.html +89 -0
- data/docs/1.0.0/files/lib/nanook/node_rb.html +89 -0
- data/docs/1.0.0/files/lib/nanook/rpc_rb.html +99 -0
- data/docs/1.0.0/files/lib/nanook/util_rb.html +97 -0
- data/docs/1.0.0/files/lib/nanook/version_rb.html +84 -0
- data/docs/1.0.0/files/lib/nanook/wallet_account_rb.html +89 -0
- data/docs/1.0.0/files/lib/nanook/wallet_rb.html +89 -0
- data/docs/1.0.0/files/lib/nanook/work_peer_rb.html +89 -0
- data/docs/1.0.0/files/lib/nanook_rb.html +94 -0
- data/docs/1.0.0/i/arrow-down.svg +8 -0
- data/docs/1.0.0/i/arrow-right.svg +8 -0
- data/docs/1.0.0/i/search.svg +12 -0
- data/docs/1.0.0/i/tree_bg.svg +8 -0
- data/docs/1.0.0/index.html +11 -0
- data/docs/1.0.0/js/highlight.pack.js +1 -0
- data/docs/1.0.0/js/jquery-1.3.2.min.js +19 -0
- data/docs/1.0.0/js/main.js +25 -0
- data/docs/1.0.0/js/navigation.js +142 -0
- data/docs/1.0.0/js/search_index.js +1 -0
- data/docs/1.0.0/js/searchdoc.js +465 -0
- data/docs/1.0.0/js/searcher.js +229 -0
- data/docs/1.0.0/panel/index.html +47 -0
- data/docs/1.0.0/panel/links.html +32 -0
- data/docs/1.0.0/panel/tree.js +1 -0
- data/docs/apple-touch-icon.png +0 -0
- data/docs/classes/Nanook.html +572 -0
- data/docs/classes/Nanook/Account.html +907 -0
- data/docs/classes/Nanook/Block.html +717 -0
- data/docs/classes/Nanook/Error.html +84 -0
- data/docs/classes/Nanook/Key.html +253 -0
- data/docs/classes/Nanook/Node.html +657 -0
- data/docs/classes/Nanook/Rpc.html +247 -0
- data/docs/classes/Nanook/Util.html +197 -0
- data/docs/classes/Nanook/Wallet.html +778 -0
- data/docs/classes/Nanook/WalletAccount.html +447 -0
- data/docs/classes/Nanook/WorkPeer.html +294 -0
- data/docs/created.rid +14 -0
- data/docs/css/github.css +123 -0
- data/docs/css/main.css +374 -0
- data/docs/css/panel.css +360 -0
- data/docs/css/reset.css +48 -0
- data/docs/favicon.ico +0 -0
- data/docs/files/README_md.html +408 -0
- data/docs/files/lib/nanook/account_rb.html +89 -0
- data/docs/files/lib/nanook/block_rb.html +89 -0
- data/docs/files/lib/nanook/error_rb.html +89 -0
- data/docs/files/lib/nanook/key_rb.html +89 -0
- data/docs/files/lib/nanook/node_rb.html +89 -0
- data/docs/files/lib/nanook/rpc_rb.html +99 -0
- data/docs/files/lib/nanook/util_rb.html +89 -0
- data/docs/files/lib/nanook/version_rb.html +84 -0
- data/docs/files/lib/nanook/wallet_account_rb.html +89 -0
- data/docs/files/lib/nanook/wallet_rb.html +89 -0
- data/docs/files/lib/nanook/work_peer_rb.html +89 -0
- data/docs/files/lib/nanook_rb.html +94 -0
- data/docs/i/arrow-down.svg +8 -0
- data/docs/i/arrow-right.svg +8 -0
- data/docs/i/search.svg +12 -0
- data/docs/i/tree_bg.svg +8 -0
- data/docs/index.html +11 -0
- data/docs/js/highlight.pack.js +1 -0
- data/docs/js/jquery-1.3.2.min.js +19 -0
- data/docs/js/main.js +25 -0
- data/docs/js/navigation.js +142 -0
- data/docs/js/search_index.js +1 -0
- data/docs/js/searchdoc.js +465 -0
- data/docs/js/searcher.js +229 -0
- data/docs/panel/index.html +47 -0
- data/docs/panel/links.html +32 -0
- data/docs/panel/tree.js +1 -0
- data/lib/nanook.rb +40 -4
- data/lib/nanook/account.rb +250 -8
- data/lib/nanook/block.rb +25 -2
- data/lib/nanook/key.rb +10 -2
- data/lib/nanook/node.rb +4 -0
- data/lib/nanook/rpc.rb +5 -1
- data/lib/nanook/util.rb +9 -1
- data/lib/nanook/version.rb +1 -1
- data/lib/nanook/wallet.rb +275 -14
- data/lib/nanook/wallet_account.rb +63 -11
- data/lib/nanook/work_peer.rb +4 -0
- 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"><
|
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> </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">"http://localhost:7076"</td>
|
122
|
+
</tr>
|
123
|
+
|
124
|
+
<tr valign='top'>
|
125
|
+
<td> </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">'http'</span>, <span class="ruby-string">'https'</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">"URI must have http or https in it. Was given: #{uri}"</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">"user-agent"</span> <span class="ruby-operator">=></span> <span class="ruby-string">"Ruby nanook gem"</span>})
|
180
|
+
<span class="ruby-ivar">@request</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-string">"application/json"</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">"Encountered net/http error #{response.code}: #{response.class.name}"</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,264 @@
|
|
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, raw_to_NANO, 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"><
|
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
|
+
<dt>R</dt>
|
89
|
+
<dd>
|
90
|
+
<ul>
|
91
|
+
|
92
|
+
|
93
|
+
<li>
|
94
|
+
<a href="#method-c-raw_to_NANO">raw_to_NANO</a>
|
95
|
+
</li>
|
96
|
+
|
97
|
+
</ul>
|
98
|
+
</dd>
|
99
|
+
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<!-- Section constants -->
|
115
|
+
<div class="sectiontitle">Constants</div>
|
116
|
+
<table border='0' cellpadding='5'>
|
117
|
+
|
118
|
+
<tr valign='top'>
|
119
|
+
<td class="attr-name">STEP</td>
|
120
|
+
<td>=</td>
|
121
|
+
<td class="attr-value">BigDecimal.new("10")**BigDecimal.new("30")</td>
|
122
|
+
</tr>
|
123
|
+
|
124
|
+
<tr valign='top'>
|
125
|
+
<td> </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-NANO_to_raw">
|
143
|
+
|
144
|
+
<b>NANO_to_raw</b>(nano)
|
145
|
+
|
146
|
+
<a href="../../classes/Nanook/Util.html#method-c-NANO_to_raw" name="method-c-NANO_to_raw" 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-NANO_to_raw_source')" id="l_method-c-NANO_to_raw_source">show</a>
|
166
|
+
|
167
|
+
</p>
|
168
|
+
<div id="method-c-NANO_to_raw_source" class="dyn-source">
|
169
|
+
<pre><span class="ruby-comment"># File lib/nanook/util.rb, line 8</span>
|
170
|
+
<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>)
|
171
|
+
(<span class="ruby-constant">BigDecimal</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nano</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-operator">*</span> <span class="ruby-constant">STEP</span>).<span class="ruby-identifier">to_i</span>
|
172
|
+
<span class="ruby-keyword">end</span></pre>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
</div>
|
177
|
+
|
178
|
+
<div class="method">
|
179
|
+
<div class="title method-title" id="method-c-coerce_empty_string_to_type">
|
180
|
+
|
181
|
+
<b>coerce_empty_string_to_type</b>(response, type)
|
182
|
+
|
183
|
+
<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>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
|
187
|
+
<div class="description">
|
188
|
+
|
189
|
+
</div>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<div class="sourcecode">
|
199
|
+
|
200
|
+
<p class="source-link">
|
201
|
+
Source:
|
202
|
+
<a href="javascript:toggleSource('method-c-coerce_empty_string_to_type_source')" id="l_method-c-coerce_empty_string_to_type_source">show</a>
|
203
|
+
|
204
|
+
</p>
|
205
|
+
<div id="method-c-coerce_empty_string_to_type_source" class="dyn-source">
|
206
|
+
<pre><span class="ruby-comment"># File lib/nanook/util.rb, line 16</span>
|
207
|
+
<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>)
|
208
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span> <span class="ruby-operator">==</span> <span class="ruby-string">""</span>
|
209
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">new</span>
|
210
|
+
<span class="ruby-keyword">end</span>
|
211
|
+
|
212
|
+
<span class="ruby-identifier">response</span>
|
213
|
+
<span class="ruby-keyword">end</span></pre>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div class="method">
|
220
|
+
<div class="title method-title" id="method-c-raw_to_NANO">
|
221
|
+
|
222
|
+
<b>raw_to_NANO</b>(raw)
|
223
|
+
|
224
|
+
<a href="../../classes/Nanook/Util.html#method-c-raw_to_NANO" name="method-c-raw_to_NANO" class="permalink">Link</a>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
|
228
|
+
<div class="description">
|
229
|
+
|
230
|
+
</div>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
<div class="sourcecode">
|
240
|
+
|
241
|
+
<p class="source-link">
|
242
|
+
Source:
|
243
|
+
<a href="javascript:toggleSource('method-c-raw_to_NANO_source')" id="l_method-c-raw_to_NANO_source">show</a>
|
244
|
+
|
245
|
+
</p>
|
246
|
+
<div id="method-c-raw_to_NANO_source" class="dyn-source">
|
247
|
+
<pre><span class="ruby-comment"># File lib/nanook/util.rb, line 12</span>
|
248
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">raw_to_NANO</span>(<span class="ruby-identifier">raw</span>)
|
249
|
+
<span class="ruby-identifier">raw</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-constant">STEP</span>
|
250
|
+
<span class="ruby-keyword">end</span></pre>
|
251
|
+
</div>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
</div>
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
</div>
|
261
|
+
|
262
|
+
</div>
|
263
|
+
</body>
|
264
|
+
</html>
|