cpaas-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +4 -0
- data/LICENSE.md +1 -0
- data/README.md +25 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/cpaas-sdk.gemspec +32 -0
- data/docs/Cpaas.html +446 -0
- data/docs/Cpaas/Conversation.html +1742 -0
- data/docs/Cpaas/Notification.html +301 -0
- data/docs/Cpaas/TwoFactor.html +908 -0
- data/docs/_index.html +146 -0
- data/docs/_index.md +21 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +496 -0
- data/docs/file.README.html +102 -0
- data/docs/file._index.html +94 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +94 -0
- data/docs/js/app.js +303 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +251 -0
- data/docs/mv_index.html +102 -0
- data/docs/top-level-namespace.html +663 -0
- data/examples/2fa/.env.example +6 -0
- data/examples/2fa/.gitignore +159 -0
- data/examples/2fa/.ruby-gemset +1 -0
- data/examples/2fa/.ruby-version +1 -0
- data/examples/2fa/Gemfile +8 -0
- data/examples/2fa/README.md +34 -0
- data/examples/2fa/app.rb +134 -0
- data/examples/2fa/config.ru +10 -0
- data/examples/2fa/helper.rb +37 -0
- data/examples/2fa/public/stylesheets/forms.css +28 -0
- data/examples/2fa/public/stylesheets/global.css +7 -0
- data/examples/2fa/public/stylesheets/layout.css +45 -0
- data/examples/2fa/public/stylesheets/main.css +3 -0
- data/examples/2fa/views/alert.erb +5 -0
- data/examples/2fa/views/dashboard.erb +4 -0
- data/examples/2fa/views/index.erb +17 -0
- data/examples/2fa/views/login.erb +13 -0
- data/examples/2fa/views/verify.erb +8 -0
- data/examples/sms/.env.example +4 -0
- data/examples/sms/.gitignore +159 -0
- data/examples/sms/.ruby-gemset +1 -0
- data/examples/sms/.ruby-version +1 -0
- data/examples/sms/Gemfile +8 -0
- data/examples/sms/README.md +80 -0
- data/examples/sms/app.rb +87 -0
- data/examples/sms/config.ru +10 -0
- data/examples/sms/helper.rb +33 -0
- data/examples/sms/public/scripts/notification.js +46 -0
- data/examples/sms/public/stylesheets/forms.css +28 -0
- data/examples/sms/public/stylesheets/global.css +7 -0
- data/examples/sms/public/stylesheets/layout.css +74 -0
- data/examples/sms/public/stylesheets/main.css +3 -0
- data/examples/sms/views/alert.erb +5 -0
- data/examples/sms/views/index.erb +48 -0
- data/lib/cpaas-sdk.rb +30 -0
- data/lib/cpaas-sdk/api.rb +139 -0
- data/lib/cpaas-sdk/config.rb +9 -0
- data/lib/cpaas-sdk/resources.rb +4 -0
- data/lib/cpaas-sdk/resources/conversation.rb +268 -0
- data/lib/cpaas-sdk/resources/notification.rb +62 -0
- data/lib/cpaas-sdk/resources/notification_channel.rb +39 -0
- data/lib/cpaas-sdk/resources/twofactor.rb +136 -0
- data/lib/cpaas-sdk/util.rb +93 -0
- data/lib/cpaas-sdk/version.rb +3 -0
- data/tutorials/2FA.md +109 -0
- data/tutorials/2fa-flow.png +0 -0
- data/tutorials/GetStarted.md +86 -0
- data/tutorials/SMSMessaging.md +132 -0
- data/tutorials/index.html +86 -0
- data/tutorials/quickstarts.yml +15 -0
- metadata +238 -0
data/docs/mv_index.html
ADDED
@@ -0,0 +1,102 @@
|
|
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
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.20
|
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 = "README";
|
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</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'>
|
61
|
+
<h1 id="label-cpaas-ruby">cpaas-ruby</h1>
|
62
|
+
|
63
|
+
<h2 id="label-Installation">Installation</h2>
|
64
|
+
|
65
|
+
<p>Add this line to your application's Gemfile:</p>
|
66
|
+
|
67
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cpaas-ruby</span><span class='tstring_end'>'</span></span>
|
68
|
+
</code></pre>
|
69
|
+
|
70
|
+
<p>And then execute:</p>
|
71
|
+
|
72
|
+
<pre class="code ruby"><code class="ruby">$ bundle
|
73
|
+
</code></pre>
|
74
|
+
|
75
|
+
<p>Or install it yourself as:</p>
|
76
|
+
|
77
|
+
<pre class="code ruby"><code class="ruby">$ gem install cpaas-ruby
|
78
|
+
</code></pre>
|
79
|
+
|
80
|
+
<h2 id="label-Reference">Reference</h2>
|
81
|
+
|
82
|
+
<p>The information about tutorials and documents can be found in the links
|
83
|
+
below</p>
|
84
|
+
<ul><li>
|
85
|
+
<p><code>Documents</code>: <a
|
86
|
+
href="https://kandy-io.github.io/kandy-cpaas-ruby-sdk/docs">docs</a></p>
|
87
|
+
</li><li>
|
88
|
+
<p><code>Tutorials</code>: <a
|
89
|
+
href="https://Kandy-IO.github.io/kandy-cpaas-ruby-sdk/tutorials/?KANDY=Kandy&KANDYFQDN=https://oauth-cpaas.att.com#/GetStarted">Get
|
90
|
+
Started</a></p>
|
91
|
+
</li></ul>
|
92
|
+
</div></div>
|
93
|
+
|
94
|
+
<div id="footer">
|
95
|
+
Generated on Wed Oct 16 11:36:35 2019 by
|
96
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
97
|
+
0.9.20 (ruby-2.5.0).
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
</body>
|
102
|
+
</html>
|
@@ -0,0 +1,663 @@
|
|
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
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.20
|
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 = "";
|
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</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Top Level Namespace</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>Top Level Namespace
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<h2>Defined Under Namespace</h2>
|
82
|
+
<p class="children">
|
83
|
+
|
84
|
+
|
85
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Cpaas.html" title="Cpaas (module)">Cpaas</a></span>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
</p>
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<h2>
|
100
|
+
Instance Method Summary
|
101
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
102
|
+
</h2>
|
103
|
+
|
104
|
+
<ul class="summary">
|
105
|
+
|
106
|
+
<li class="public ">
|
107
|
+
<span class="summary_signature">
|
108
|
+
|
109
|
+
<a href="top-level-namespace.html#compose_error_from-instance_method" title="#compose_error_from (instance method)">#<strong>compose_error_from</strong>(err_response) ⇒ Object </a>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
</span>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
124
|
+
|
125
|
+
</li>
|
126
|
+
|
127
|
+
|
128
|
+
<li class="public ">
|
129
|
+
<span class="summary_signature">
|
130
|
+
|
131
|
+
<a href="top-level-namespace.html#convert_hash_keys-instance_method" title="#convert_hash_keys (instance method)">#<strong>convert_hash_keys</strong>(value) ⇒ Object </a>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
</span>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
146
|
+
|
147
|
+
</li>
|
148
|
+
|
149
|
+
|
150
|
+
<li class="public ">
|
151
|
+
<span class="summary_signature">
|
152
|
+
|
153
|
+
<a href="top-level-namespace.html#deep_find-instance_method" title="#deep_find (instance method)">#<strong>deep_find</strong>(object, key, parentKey = '') ⇒ Object </a>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
</span>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
168
|
+
|
169
|
+
</li>
|
170
|
+
|
171
|
+
|
172
|
+
<li class="public ">
|
173
|
+
<span class="summary_signature">
|
174
|
+
|
175
|
+
<a href="top-level-namespace.html#id_from-instance_method" title="#id_from (instance method)">#<strong>id_from</strong>(url) ⇒ Object </a>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</span>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
190
|
+
|
191
|
+
</li>
|
192
|
+
|
193
|
+
|
194
|
+
<li class="public ">
|
195
|
+
<span class="summary_signature">
|
196
|
+
|
197
|
+
<a href="top-level-namespace.html#process_response-instance_method" title="#process_response (instance method)">#<strong>process_response</strong>(res) ⇒ Object </a>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
</span>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
212
|
+
|
213
|
+
</li>
|
214
|
+
|
215
|
+
|
216
|
+
<li class="public ">
|
217
|
+
<span class="summary_signature">
|
218
|
+
|
219
|
+
<a href="top-level-namespace.html#reject-instance_method" title="#reject (instance method)">#<strong>reject</strong>(obj, key) ⇒ Object </a>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
</span>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
234
|
+
|
235
|
+
</li>
|
236
|
+
|
237
|
+
|
238
|
+
<li class="public ">
|
239
|
+
<span class="summary_signature">
|
240
|
+
|
241
|
+
<a href="top-level-namespace.html#underscore-instance_method" title="#underscore (instance method)">#<strong>underscore</strong>(str) ⇒ Object </a>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
</span>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
256
|
+
|
257
|
+
</li>
|
258
|
+
|
259
|
+
|
260
|
+
<li class="public ">
|
261
|
+
<span class="summary_signature">
|
262
|
+
|
263
|
+
<a href="top-level-namespace.html#underscore_key-instance_method" title="#underscore_key (instance method)">#<strong>underscore_key</strong>(k) ⇒ Object </a>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
</span>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
278
|
+
|
279
|
+
</li>
|
280
|
+
|
281
|
+
|
282
|
+
</ul>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
<div id="instance_method_details" class="method_details_list">
|
288
|
+
<h2>Instance Method Details</h2>
|
289
|
+
|
290
|
+
|
291
|
+
<div class="method_details first">
|
292
|
+
<h3 class="signature first" id="compose_error_from-instance_method">
|
293
|
+
|
294
|
+
#<strong>compose_error_from</strong>(err_response) ⇒ <tt>Object</tt>
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
</h3><table class="source_code">
|
301
|
+
<tr>
|
302
|
+
<td>
|
303
|
+
<pre class="lines">
|
304
|
+
|
305
|
+
|
306
|
+
23
|
307
|
+
24
|
308
|
+
25
|
309
|
+
26
|
310
|
+
27
|
311
|
+
28
|
312
|
+
29
|
313
|
+
30
|
314
|
+
31
|
315
|
+
32
|
316
|
+
33
|
317
|
+
34
|
318
|
+
35
|
319
|
+
36
|
320
|
+
37
|
321
|
+
38
|
322
|
+
39
|
323
|
+
40
|
324
|
+
41
|
325
|
+
42
|
326
|
+
43</pre>
|
327
|
+
</td>
|
328
|
+
<td>
|
329
|
+
<pre class="code"><span class="info file"># File 'lib/cpaas/util.rb', line 23</span>
|
330
|
+
|
331
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_compose_error_from'>compose_error_from</span><span class='lparen'>(</span><span class='id identifier rubyid_err_response'>err_response</span><span class='rparen'>)</span>
|
332
|
+
<span class='id identifier rubyid_error_obj'>error_obj</span> <span class='op'>=</span> <span class='id identifier rubyid_deep_find'><span class='object_link'><a href="#deep_find-instance_method" title="#deep_find (method)">deep_find</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_err_response'>err_response</span><span class='comma'>,</span> <span class='symbol'>:message_id</span><span class='rparen'>)</span>
|
333
|
+
|
334
|
+
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_error_obj'>error_obj</span><span class='rparen'>)</span>
|
335
|
+
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_error_obj'>error_obj</span><span class='lbracket'>[</span><span class='symbol'>:text</span><span class='rbracket'>]</span>
|
336
|
+
|
337
|
+
<span class='id identifier rubyid_error_obj'>error_obj</span><span class='lbracket'>[</span><span class='symbol'>:variables</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_variable'>variable</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='op'>|</span> <span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_gsub!'>gsub!</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_index'>index</span> <span class='op'>+</span> <span class='int'>1</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_variable'>variable</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
338
|
+
|
339
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
340
|
+
<span class='label'>name:</span> <span class='id identifier rubyid_error_obj'>error_obj</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
341
|
+
<span class='label'>exception_id:</span> <span class='id identifier rubyid_error_obj'>error_obj</span><span class='lbracket'>[</span><span class='symbol'>:message_id</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
342
|
+
<span class='label'>message:</span> <span class='id identifier rubyid_message'>message</span>
|
343
|
+
<span class='rbrace'>}</span>
|
344
|
+
<span class='kw'>else</span>
|
345
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
346
|
+
<span class='label'>name:</span> <span class='id identifier rubyid_err_response'>err_response</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span>
|
347
|
+
<span class='label'>exception_id:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Unknown</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
348
|
+
<span class='label'>message:</span> <span class='id identifier rubyid_err_response'>err_response</span><span class='lbracket'>[</span><span class='symbol'>:message</span><span class='rbracket'>]</span>
|
349
|
+
<span class='rbrace'>}</span>
|
350
|
+
<span class='kw'>end</span>
|
351
|
+
<span class='kw'>end</span></pre>
|
352
|
+
</td>
|
353
|
+
</tr>
|
354
|
+
</table>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
<div class="method_details ">
|
358
|
+
<h3 class="signature " id="convert_hash_keys-instance_method">
|
359
|
+
|
360
|
+
#<strong>convert_hash_keys</strong>(value) ⇒ <tt>Object</tt>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
</h3><table class="source_code">
|
367
|
+
<tr>
|
368
|
+
<td>
|
369
|
+
<pre class="lines">
|
370
|
+
|
371
|
+
|
372
|
+
66
|
373
|
+
67
|
374
|
+
68
|
375
|
+
69
|
376
|
+
70
|
377
|
+
71
|
378
|
+
72
|
379
|
+
73
|
380
|
+
74
|
381
|
+
75</pre>
|
382
|
+
</td>
|
383
|
+
<td>
|
384
|
+
<pre class="code"><span class="info file"># File 'lib/cpaas/util.rb', line 66</span>
|
385
|
+
|
386
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_convert_hash_keys'>convert_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
387
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_value'>value</span>
|
388
|
+
<span class='kw'>when</span> <span class='const'>Array</span>
|
389
|
+
<span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_convert_hash_keys'>convert_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
390
|
+
<span class='kw'>when</span> <span class='const'>Hash</span>
|
391
|
+
<span class='const'>Hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_underscore_key'><span class='object_link'><a href="#underscore_key-instance_method" title="#underscore_key (method)">underscore_key</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_convert_hash_keys'>convert_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='rbracket'>]</span>
|
392
|
+
<span class='kw'>else</span>
|
393
|
+
<span class='id identifier rubyid_value'>value</span>
|
394
|
+
<span class='kw'>end</span>
|
395
|
+
<span class='kw'>end</span></pre>
|
396
|
+
</td>
|
397
|
+
</tr>
|
398
|
+
</table>
|
399
|
+
</div>
|
400
|
+
|
401
|
+
<div class="method_details ">
|
402
|
+
<h3 class="signature " id="deep_find-instance_method">
|
403
|
+
|
404
|
+
#<strong>deep_find</strong>(object, key, parentKey = '') ⇒ <tt>Object</tt>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
</h3><table class="source_code">
|
411
|
+
<tr>
|
412
|
+
<td>
|
413
|
+
<pre class="lines">
|
414
|
+
|
415
|
+
|
416
|
+
49
|
417
|
+
50
|
418
|
+
51
|
419
|
+
52
|
420
|
+
53
|
421
|
+
54
|
422
|
+
55
|
423
|
+
56
|
424
|
+
57
|
425
|
+
58
|
426
|
+
59
|
427
|
+
60
|
428
|
+
61
|
429
|
+
62
|
430
|
+
63
|
431
|
+
64</pre>
|
432
|
+
</td>
|
433
|
+
<td>
|
434
|
+
<pre class="code"><span class="info file"># File 'lib/cpaas/util.rb', line 49</span>
|
435
|
+
|
436
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_deep_find'>deep_find</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_parentKey'>parentKey</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
437
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
438
|
+
|
439
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:key?</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
440
|
+
<span class='id identifier rubyid_object'>object</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_parentKey'>parentKey</span>
|
441
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_object'>object</span>
|
442
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Enumerable</span>
|
443
|
+
<span class='id identifier rubyid_object'>object</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_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
444
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_deep_find'>deep_find</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span>
|
445
|
+
|
446
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_result'>result</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
447
|
+
<span class='kw'>end</span>
|
448
|
+
<span class='kw'>end</span>
|
449
|
+
|
450
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_result'>result</span>
|
451
|
+
<span class='kw'>end</span></pre>
|
452
|
+
</td>
|
453
|
+
</tr>
|
454
|
+
</table>
|
455
|
+
</div>
|
456
|
+
|
457
|
+
<div class="method_details ">
|
458
|
+
<h3 class="signature " id="id_from-instance_method">
|
459
|
+
|
460
|
+
#<strong>id_from</strong>(url) ⇒ <tt>Object</tt>
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
</h3><table class="source_code">
|
467
|
+
<tr>
|
468
|
+
<td>
|
469
|
+
<pre class="lines">
|
470
|
+
|
471
|
+
|
472
|
+
45
|
473
|
+
46
|
474
|
+
47</pre>
|
475
|
+
</td>
|
476
|
+
<td>
|
477
|
+
<pre class="code"><span class="info file"># File 'lib/cpaas/util.rb', line 45</span>
|
478
|
+
|
479
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_id_from'>id_from</span> <span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
|
480
|
+
<span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span>
|
481
|
+
<span class='kw'>end</span></pre>
|
482
|
+
</td>
|
483
|
+
</tr>
|
484
|
+
</table>
|
485
|
+
</div>
|
486
|
+
|
487
|
+
<div class="method_details ">
|
488
|
+
<h3 class="signature " id="process_response-instance_method">
|
489
|
+
|
490
|
+
#<strong>process_response</strong>(res) ⇒ <tt>Object</tt>
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
</h3><table class="source_code">
|
497
|
+
<tr>
|
498
|
+
<td>
|
499
|
+
<pre class="lines">
|
500
|
+
|
501
|
+
|
502
|
+
1
|
503
|
+
2
|
504
|
+
3
|
505
|
+
4
|
506
|
+
5
|
507
|
+
6
|
508
|
+
7
|
509
|
+
8
|
510
|
+
9
|
511
|
+
10
|
512
|
+
11
|
513
|
+
12
|
514
|
+
13
|
515
|
+
14
|
516
|
+
15
|
517
|
+
16
|
518
|
+
17
|
519
|
+
18
|
520
|
+
19
|
521
|
+
20
|
522
|
+
21</pre>
|
523
|
+
</td>
|
524
|
+
<td>
|
525
|
+
<pre class="code"><span class="info file"># File 'lib/cpaas/util.rb', line 1</span>
|
526
|
+
|
527
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_process_response'>process_response</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='rparen'>)</span>
|
528
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span> <span class='symbol'>:exception_id</span>
|
529
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_res'>res</span>
|
530
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_res'>res</span> <span class='op'>&&</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_dig'>dig</span><span class='lparen'>(</span><span class='symbol'>:__for_test__</span><span class='rparen'>)</span>
|
531
|
+
<span class='id identifier rubyid_custom_body'>custom_body</span> <span class='op'>=</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_dig'>dig</span><span class='lparen'>(</span><span class='symbol'>:custom_body</span><span class='rparen'>)</span>
|
532
|
+
<span class='id identifier rubyid_reject'><span class='object_link'><a href="#reject-instance_method" title="#reject (method)">reject</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='comma'>,</span> <span class='symbol'>:custom_body</span><span class='rparen'>)</span>
|
533
|
+
|
534
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_dig'>dig</span><span class='lparen'>(</span><span class='symbol'>:custom_body</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
535
|
+
<span class='id identifier rubyid_custom_body'>custom_body</span> <span class='op'>=</span> <span class='kw'>yield</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='symbol'>:custom_body</span><span class='rbracket'>]</span>
|
536
|
+
<span class='kw'>end</span>
|
537
|
+
|
538
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_custom_body'>custom_body</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_res'>res</span> <span class='op'>:</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_custom_body'>custom_body</span><span class='rparen'>)</span>
|
539
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
540
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='kw'>yield</span> <span class='id identifier rubyid_res'>res</span>
|
541
|
+
<span class='kw'>else</span>
|
542
|
+
<span class='id identifier rubyid_topLevelKey'>topLevelKey</span> <span class='op'>=</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
543
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='id identifier rubyid_topLevelKey'>topLevelKey</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_as_json'>as_json</span>
|
544
|
+
<span class='kw'>end</span>
|
545
|
+
|
546
|
+
<span class='id identifier rubyid_response'>response</span>
|
547
|
+
<span class='kw'>end</span></pre>
|
548
|
+
</td>
|
549
|
+
</tr>
|
550
|
+
</table>
|
551
|
+
</div>
|
552
|
+
|
553
|
+
<div class="method_details ">
|
554
|
+
<h3 class="signature " id="reject-instance_method">
|
555
|
+
|
556
|
+
#<strong>reject</strong>(obj, key) ⇒ <tt>Object</tt>
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
</h3><table class="source_code">
|
563
|
+
<tr>
|
564
|
+
<td>
|
565
|
+
<pre class="lines">
|
566
|
+
|
567
|
+
|
568
|
+
89
|
569
|
+
90
|
570
|
+
91</pre>
|
571
|
+
</td>
|
572
|
+
<td>
|
573
|
+
<pre class="code"><span class="info file"># File 'lib/cpaas/util.rb', line 89</span>
|
574
|
+
|
575
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reject'>reject</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
576
|
+
<span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_k'>k</span> <span class='op'>==</span> <span class='id identifier rubyid_key'>key</span> <span class='rbrace'>}</span>
|
577
|
+
<span class='kw'>end</span></pre>
|
578
|
+
</td>
|
579
|
+
</tr>
|
580
|
+
</table>
|
581
|
+
</div>
|
582
|
+
|
583
|
+
<div class="method_details ">
|
584
|
+
<h3 class="signature " id="underscore-instance_method">
|
585
|
+
|
586
|
+
#<strong>underscore</strong>(str) ⇒ <tt>Object</tt>
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
</h3><table class="source_code">
|
593
|
+
<tr>
|
594
|
+
<td>
|
595
|
+
<pre class="lines">
|
596
|
+
|
597
|
+
|
598
|
+
81
|
599
|
+
82
|
600
|
+
83
|
601
|
+
84
|
602
|
+
85
|
603
|
+
86
|
604
|
+
87</pre>
|
605
|
+
</td>
|
606
|
+
<td>
|
607
|
+
<pre class="code"><span class="info file"># File 'lib/cpaas/util.rb', line 81</span>
|
608
|
+
|
609
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_underscore'>underscore</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
|
610
|
+
<span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>::</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span>
|
611
|
+
<span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>([A-Z]+)([A-Z][a-z])</span><span class='regexp_end'>/</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>\1_\2</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span>
|
612
|
+
<span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>([a-z\d])([A-Z])</span><span class='regexp_end'>/</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>\1_\2</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span>
|
613
|
+
<span class='id identifier rubyid_tr'>tr</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>_</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span>
|
614
|
+
<span class='id identifier rubyid_downcase'>downcase</span>
|
615
|
+
<span class='kw'>end</span></pre>
|
616
|
+
</td>
|
617
|
+
</tr>
|
618
|
+
</table>
|
619
|
+
</div>
|
620
|
+
|
621
|
+
<div class="method_details ">
|
622
|
+
<h3 class="signature " id="underscore_key-instance_method">
|
623
|
+
|
624
|
+
#<strong>underscore_key</strong>(k) ⇒ <tt>Object</tt>
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
</h3><table class="source_code">
|
631
|
+
<tr>
|
632
|
+
<td>
|
633
|
+
<pre class="lines">
|
634
|
+
|
635
|
+
|
636
|
+
77
|
637
|
+
78
|
638
|
+
79</pre>
|
639
|
+
</td>
|
640
|
+
<td>
|
641
|
+
<pre class="code"><span class="info file"># File 'lib/cpaas/util.rb', line 77</span>
|
642
|
+
|
643
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_underscore_key'>underscore_key</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span>
|
644
|
+
<span class='id identifier rubyid_underscore'><span class='object_link'><a href="#underscore-instance_method" title="#underscore (method)">underscore</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
645
|
+
<span class='kw'>end</span></pre>
|
646
|
+
</td>
|
647
|
+
</tr>
|
648
|
+
</table>
|
649
|
+
</div>
|
650
|
+
|
651
|
+
</div>
|
652
|
+
|
653
|
+
</div>
|
654
|
+
|
655
|
+
<div id="footer">
|
656
|
+
Generated on Thu Oct 17 17:28:29 2019 by
|
657
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
658
|
+
0.9.20 (ruby-2.5.0).
|
659
|
+
</div>
|
660
|
+
|
661
|
+
</div>
|
662
|
+
</body>
|
663
|
+
</html>
|