jyt_pay 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/CODE_OF_CONDUCT.md +49 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +72 -0
  9. data/Rakefile +16 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/doc/JytPay/Api/AuthCard.html +375 -0
  13. data/doc/JytPay/Api/QueryBalance.html +299 -0
  14. data/doc/JytPay/Api/QueryOrder.html +372 -0
  15. data/doc/JytPay/Api/QuickDraw.html +433 -0
  16. data/doc/JytPay/Api/QuickPay.html +435 -0
  17. data/doc/JytPay/Api.html +117 -0
  18. data/doc/JytPay/Client.html +323 -0
  19. data/doc/JytPay/Encrypt/Des.html +258 -0
  20. data/doc/JytPay/Encrypt/Rsa.html +232 -0
  21. data/doc/JytPay/Encrypt.html +127 -0
  22. data/doc/JytPay/Http/RetCode.html +391 -0
  23. data/doc/JytPay/Http.html +242 -0
  24. data/doc/JytPay/Sign/Rsa.html +178 -0
  25. data/doc/JytPay/Sign.html +115 -0
  26. data/doc/JytPay/Utils.html +358 -0
  27. data/doc/JytPay/Xml/MyPrecious.html +220 -0
  28. data/doc/JytPay/Xml.html +210 -0
  29. data/doc/JytPay.html +140 -0
  30. data/doc/_index.html +317 -0
  31. data/doc/class_list.html +51 -0
  32. data/doc/css/common.css +1 -0
  33. data/doc/css/full_list.css +58 -0
  34. data/doc/css/style.css +492 -0
  35. data/doc/file.README.html +150 -0
  36. data/doc/file_list.html +56 -0
  37. data/doc/frames.html +17 -0
  38. data/doc/index.html +150 -0
  39. data/doc/js/app.js +248 -0
  40. data/doc/js/full_list.js +216 -0
  41. data/doc/js/jquery.js +4 -0
  42. data/doc/method_list.html +203 -0
  43. data/doc/top-level-namespace.html +110 -0
  44. data/jyt_pay.gemspec +34 -0
  45. data/lib/jyt_pay/api/auth_card.rb +60 -0
  46. data/lib/jyt_pay/api/query_balance.rb +50 -0
  47. data/lib/jyt_pay/api/query_order.rb +71 -0
  48. data/lib/jyt_pay/api/quick_draw.rb +75 -0
  49. data/lib/jyt_pay/api/quick_pay.rb +76 -0
  50. data/lib/jyt_pay/client.rb +37 -0
  51. data/lib/jyt_pay/encrypt/des.rb +30 -0
  52. data/lib/jyt_pay/encrypt/encrypt.rb +7 -0
  53. data/lib/jyt_pay/encrypt/rsa.rb +20 -0
  54. data/lib/jyt_pay/http/communicate.rb +77 -0
  55. data/lib/jyt_pay/http/ret_code.rb +60 -0
  56. data/lib/jyt_pay/sign/rsa.rb +14 -0
  57. data/lib/jyt_pay/utils.rb +42 -0
  58. data/lib/jyt_pay/version.rb +3 -0
  59. data/lib/jyt_pay/xml/xml.rb +74 -0
  60. data/lib/jyt_pay.rb +32 -0
  61. metadata +166 -0
@@ -0,0 +1,178 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: JytPay::Sign::Rsa
8
+
9
+ &mdash; Documentation by YARD 0.9.9
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "JytPay::Sign::Rsa";
19
+ relpath = '../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../_index.html">Index (R)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../JytPay.html" title="JytPay (module)">JytPay</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Sign.html" title="JytPay::Sign (module)">Sign</a></span></span>
41
+ &raquo;
42
+ <span class="title">Rsa</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: JytPay::Sign::Rsa
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/jyt_pay/sign/rsa.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+ <h2>
95
+ Class Method Summary
96
+ <small><a href="#" class="summary_toggle">collapse</a></small>
97
+ </h2>
98
+
99
+ <ul class="summary">
100
+
101
+ <li class="public ">
102
+ <span class="summary_signature">
103
+
104
+ <a href="#sign-class_method" title="sign (class method)">.<strong>sign</strong>(rsa_private_key, str) &#x21d2; Object </a>
105
+
106
+
107
+
108
+ </span>
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <span class="summary_desc"><div class='inline'></div></span>
119
+
120
+ </li>
121
+
122
+
123
+ </ul>
124
+
125
+
126
+
127
+
128
+ <div id="class_method_details" class="method_details_list">
129
+ <h2>Class Method Details</h2>
130
+
131
+
132
+ <div class="method_details first">
133
+ <h3 class="signature first" id="sign-class_method">
134
+
135
+ .<strong>sign</strong>(rsa_private_key, str) &#x21d2; <tt>Object</tt>
136
+
137
+
138
+
139
+
140
+
141
+ </h3><table class="source_code">
142
+ <tr>
143
+ <td>
144
+ <pre class="lines">
145
+
146
+
147
+ 6
148
+ 7
149
+ 8
150
+ 9
151
+ 10</pre>
152
+ </td>
153
+ <td>
154
+ <pre class="code"><span class="info file"># File 'lib/jyt_pay/sign/rsa.rb', line 6</span>
155
+
156
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span><span class='id identifier rubyid_rsa_private_key'>rsa_private_key</span><span class='comma'>,</span> <span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
157
+ <span class='id identifier rubyid_digest'>digest</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Digest</span><span class='op'>::</span><span class='const'>SHA1</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
158
+ <span class='id identifier rubyid_signature_orig'>signature_orig</span> <span class='op'>=</span> <span class='id identifier rubyid_rsa_private_key'>rsa_private_key</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span><span class='id identifier rubyid_digest'>digest</span><span class='comma'>,</span> <span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
159
+ <span class='id identifier rubyid_signature_orig'>signature_orig</span><span class='period'>.</span><span class='id identifier rubyid_unpack'>unpack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>H*</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
160
+ <span class='kw'>end</span></pre>
161
+ </td>
162
+ </tr>
163
+ </table>
164
+ </div>
165
+
166
+ </div>
167
+
168
+ </div>
169
+
170
+ <div id="footer">
171
+ Generated on Thu Nov 2 20:02:48 2017 by
172
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
173
+ 0.9.9 (ruby-2.3.5).
174
+ </div>
175
+
176
+ </div>
177
+ </body>
178
+ </html>
@@ -0,0 +1,115 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: JytPay::Sign
8
+
9
+ &mdash; Documentation by YARD 0.9.9
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "JytPay::Sign";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../JytPay.html" title="JytPay (module)">JytPay</a></span></span>
41
+ &raquo;
42
+ <span class="title">Sign</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: JytPay::Sign
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/jyt_pay/sign/rsa.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Defined Under Namespace</h2>
87
+ <p class="children">
88
+
89
+
90
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Sign/Rsa.html" title="JytPay::Sign::Rsa (module)">Rsa</a></span>
91
+
92
+
93
+
94
+
95
+ </p>
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+ </div>
106
+
107
+ <div id="footer">
108
+ Generated on Thu Nov 2 20:02:48 2017 by
109
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
110
+ 0.9.9 (ruby-2.3.5).
111
+ </div>
112
+
113
+ </div>
114
+ </body>
115
+ </html>
@@ -0,0 +1,358 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: JytPay::Utils
8
+
9
+ &mdash; Documentation by YARD 0.9.9
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "JytPay::Utils";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (U)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../JytPay.html" title="JytPay (module)">JytPay</a></span></span>
41
+ &raquo;
42
+ <span class="title">Utils</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: JytPay::Utils
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/jyt_pay/utils.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+ <h2>
95
+ Class Method Summary
96
+ <small><a href="#" class="summary_toggle">collapse</a></small>
97
+ </h2>
98
+
99
+ <ul class="summary">
100
+
101
+ <li class="public ">
102
+ <span class="summary_signature">
103
+
104
+ <a href="#gen_flow_id-class_method" title="gen_flow_id (class method)">.<strong>gen_flow_id</strong>(time = Time.now) &#x21d2; String </a>
105
+
106
+
107
+
108
+ </span>
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <span class="summary_desc"><div class='inline'>
119
+ <p>通过时间,返回唯一一个24位flow id(支持分布) 同一秒,同一台机器,同一个进程,最多可以产生 16777214 个不一样的订单号.</p>
120
+ </div></span>
121
+
122
+ </li>
123
+
124
+
125
+ <li class="public ">
126
+ <span class="summary_signature">
127
+
128
+ <a href="#symbolize_keys-class_method" title="symbolize_keys (class method)">.<strong>symbolize_keys</strong>(hash) &#x21d2; Hash </a>
129
+
130
+
131
+
132
+ </span>
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+ <span class="summary_desc"><div class='inline'>
143
+ <p>把 hash 中的 key,都转化为 symbol 类型.</p>
144
+ </div></span>
145
+
146
+ </li>
147
+
148
+
149
+ </ul>
150
+
151
+
152
+
153
+
154
+ <div id="class_method_details" class="method_details_list">
155
+ <h2>Class Method Details</h2>
156
+
157
+
158
+ <div class="method_details first">
159
+ <h3 class="signature first" id="gen_flow_id-class_method">
160
+
161
+ .<strong>gen_flow_id</strong>(time = Time.now) &#x21d2; <tt>String</tt>
162
+
163
+
164
+
165
+
166
+
167
+ </h3><div class="docstring">
168
+ <div class="discussion">
169
+
170
+ <p>通过时间,返回唯一一个24位flow id(支持分布) 同一秒,同一台机器,同一个进程,最多可以产生 16777214 个不一样的订单号</p>
171
+
172
+
173
+ </div>
174
+ </div>
175
+ <div class="tags">
176
+
177
+ <div class="examples">
178
+ <p class="tag_title">Examples:</p>
179
+
180
+
181
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../JytPay.html" title="JytPay (module)">JytPay</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="JytPay::Utils (module)">Utils</a></span></span><span class='period'>.</span><span class='id identifier rubyid_gen_flow_id'>gen_flow_id</span></code></pre>
182
+
183
+ </div>
184
+ <p class="tag_title">Parameters:</p>
185
+ <ul class="param">
186
+
187
+ <li>
188
+
189
+ <span class='name'>时间(默认是</span>
190
+
191
+
192
+ <span class='type'>(<tt>Integer</tt>)</span>
193
+
194
+
195
+
196
+ &mdash;
197
+ <div class='inline'>
198
+ <p>now)</p>
199
+ </div>
200
+
201
+ </li>
202
+
203
+ </ul>
204
+
205
+ <p class="tag_title">Returns:</p>
206
+ <ul class="return">
207
+
208
+ <li>
209
+
210
+
211
+ <span class='type'>(<tt>String</tt>)</span>
212
+
213
+
214
+
215
+ &mdash;
216
+ <div class='inline'>
217
+ <p>flow id</p>
218
+ </div>
219
+
220
+ </li>
221
+
222
+ </ul>
223
+
224
+ </div><table class="source_code">
225
+ <tr>
226
+ <td>
227
+ <pre class="lines">
228
+
229
+
230
+ 30
231
+ 31
232
+ 32
233
+ 33
234
+ 34
235
+ 35
236
+ 36
237
+ 37
238
+ 38
239
+ 39</pre>
240
+ </td>
241
+ <td>
242
+ <pre class="code"><span class="info file"># File 'lib/jyt_pay/utils.rb', line 30</span>
243
+
244
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_gen_flow_id'>gen_flow_id</span><span class='lparen'>(</span><span class='id identifier rubyid_time'>time</span><span class='op'>=</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='rparen'>)</span>
245
+ <span class='id identifier rubyid_machine_id'>machine_id</span> <span class='op'>=</span> <span class='const'>Digest</span><span class='op'>::</span><span class='const'>MD5</span><span class='period'>.</span><span class='id identifier rubyid_digest'>digest</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Mac</span><span class='period'>.</span><span class='id identifier rubyid_addr'>addr</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_unpack'>unpack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>N</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
246
+ <span class='id identifier rubyid_process_id'>process_id</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_pid'>pid</span> <span class='op'>%</span> <span class='int'>0xFFFF</span>
247
+
248
+ <span class='ivar'>@counter</span> <span class='op'>||=</span> <span class='int'>0</span>
249
+ <span class='ivar'>@counter</span> <span class='op'>+=</span> <span class='int'>1</span>
250
+ <span class='id identifier rubyid_count'>count</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@counter</span><span class='rparen'>)</span> <span class='op'>%</span> <span class='int'>0xFFFFFF</span>
251
+
252
+ <span class='kw'>return</span> <span class='lbracket'>[</span> <span class='id identifier rubyid_time'>time</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='comma'>,</span> <span class='id identifier rubyid_machine_id'>machine_id</span><span class='comma'>,</span> <span class='id identifier rubyid_process_id'>process_id</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;&lt;</span> <span class='int'>8</span> <span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_pack'>pack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>N NX lXX NX</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_unpack'>unpack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>H*</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_force_encoding'>force_encoding</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
253
+ <span class='kw'>end</span></pre>
254
+ </td>
255
+ </tr>
256
+ </table>
257
+ </div>
258
+
259
+ <div class="method_details ">
260
+ <h3 class="signature " id="symbolize_keys-class_method">
261
+
262
+ .<strong>symbolize_keys</strong>(hash) &#x21d2; <tt>Hash</tt>
263
+
264
+
265
+
266
+
267
+
268
+ </h3><div class="docstring">
269
+ <div class="discussion">
270
+
271
+ <p>把 hash 中的 key,都转化为 symbol 类型</p>
272
+
273
+
274
+ </div>
275
+ </div>
276
+ <div class="tags">
277
+ <p class="tag_title">Parameters:</p>
278
+ <ul class="param">
279
+
280
+ <li>
281
+
282
+ <span class='name'>hash</span>
283
+
284
+
285
+ <span class='type'>(<tt>Hash</tt>)</span>
286
+
287
+
288
+
289
+ &mdash;
290
+ <div class='inline'>
291
+ <p>需要更改的 hash</p>
292
+ </div>
293
+
294
+ </li>
295
+
296
+ </ul>
297
+
298
+ <p class="tag_title">Returns:</p>
299
+ <ul class="return">
300
+
301
+ <li>
302
+
303
+
304
+ <span class='type'>(<tt>Hash</tt>)</span>
305
+
306
+
307
+
308
+ &mdash;
309
+ <div class='inline'>
310
+ <p>更改后的 hash</p>
311
+ </div>
312
+
313
+ </li>
314
+
315
+ </ul>
316
+
317
+ </div><table class="source_code">
318
+ <tr>
319
+ <td>
320
+ <pre class="lines">
321
+
322
+
323
+ 12
324
+ 13
325
+ 14
326
+ 15
327
+ 16
328
+ 17
329
+ 18</pre>
330
+ </td>
331
+ <td>
332
+ <pre class="code"><span class="info file"># File 'lib/jyt_pay/utils.rb', line 12</span>
333
+
334
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
335
+ <span class='id identifier rubyid_new_hash'>new_hash</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
336
+ <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
337
+ <span class='id identifier rubyid_new_hash'>new_hash</span><span class='lbracket'>[</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> <span class='kw'>rescue</span> <span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
338
+ <span class='kw'>end</span>
339
+ <span class='id identifier rubyid_new_hash'>new_hash</span>
340
+ <span class='kw'>end</span></pre>
341
+ </td>
342
+ </tr>
343
+ </table>
344
+ </div>
345
+
346
+ </div>
347
+
348
+ </div>
349
+
350
+ <div id="footer">
351
+ Generated on Thu Nov 2 20:02:48 2017 by
352
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
353
+ 0.9.9 (ruby-2.3.5).
354
+ </div>
355
+
356
+ </div>
357
+ </body>
358
+ </html>