direct7 0.0.1 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/Direct7/AuthenticationError.html +206 -0
- data/doc/Direct7/BadRequest.html +124 -0
- data/doc/Direct7/Client.html +1125 -0
- data/doc/Direct7/ClientError.html +124 -0
- data/doc/Direct7/InsufficientCreditError.html +124 -0
- data/doc/Direct7/NUMBER_LOOKUP.html +283 -0
- data/doc/Direct7/NotFoundError.html +124 -0
- data/doc/Direct7/SLACK.html +349 -0
- data/doc/Direct7/SMS.html +349 -0
- data/doc/Direct7/ServerError.html +124 -0
- data/doc/Direct7/VERIFY.html +493 -0
- data/doc/Direct7/VIBER.html +351 -0
- data/doc/Direct7/ValidationError.html +124 -0
- data/doc/Direct7/WHATSAPP.html +527 -0
- data/doc/Direct7.html +133 -0
- data/doc/_index.html +272 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +497 -0
- data/doc/file.README.html +253 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +253 -0
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +331 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/direct7/version.rb +2 -2
- data/lib/direct7.rb +9 -0
- metadata +47 -3
@@ -0,0 +1,1125 @@
|
|
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
|
+
Class: Direct7::Client
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.34
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "Direct7::Client";
|
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 (C)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Direct7.html" title="Direct7 (module)">Direct7</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Client</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>Class: Direct7::Client
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Direct7::Client</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/direct7/client.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
107
|
+
<ul class="summary">
|
108
|
+
|
109
|
+
<li class="public ">
|
110
|
+
<span class="summary_signature">
|
111
|
+
|
112
|
+
<a href="#adapter-instance_method" title="#adapter (instance method)">#<strong>adapter</strong> ⇒ Object </a>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
</span>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<span class="summary_desc"><div class='inline'>
|
130
|
+
<p>Returns the value of attribute adapter.</p>
|
131
|
+
</div></span>
|
132
|
+
|
133
|
+
</li>
|
134
|
+
|
135
|
+
|
136
|
+
<li class="public ">
|
137
|
+
<span class="summary_signature">
|
138
|
+
|
139
|
+
<a href="#session-instance_method" title="#session (instance method)">#<strong>session</strong> ⇒ Object </a>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</span>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'>
|
157
|
+
<p>Returns the value of attribute session.</p>
|
158
|
+
</div></span>
|
159
|
+
|
160
|
+
</li>
|
161
|
+
|
162
|
+
|
163
|
+
<li class="public ">
|
164
|
+
<span class="summary_signature">
|
165
|
+
|
166
|
+
<a href="#timeout-instance_method" title="#timeout (instance method)">#<strong>timeout</strong> ⇒ Object </a>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
</span>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<span class="summary_desc"><div class='inline'>
|
184
|
+
<p>Returns the value of attribute timeout.</p>
|
185
|
+
</div></span>
|
186
|
+
|
187
|
+
</li>
|
188
|
+
|
189
|
+
|
190
|
+
</ul>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<h2>
|
197
|
+
Instance Method Summary
|
198
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
199
|
+
</h2>
|
200
|
+
|
201
|
+
<ul class="summary">
|
202
|
+
|
203
|
+
<li class="public ">
|
204
|
+
<span class="summary_signature">
|
205
|
+
|
206
|
+
<a href="#get-instance_method" title="#get (instance method)">#<strong>get</strong>(host, path, params = nil) ⇒ Object </a>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
</span>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
221
|
+
|
222
|
+
</li>
|
223
|
+
|
224
|
+
|
225
|
+
<li class="public ">
|
226
|
+
<span class="summary_signature">
|
227
|
+
|
228
|
+
<a href="#host-instance_method" title="#host (instance method)">#<strong>host</strong>(value = nil) ⇒ Object </a>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
</span>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
243
|
+
|
244
|
+
</li>
|
245
|
+
|
246
|
+
|
247
|
+
<li class="public ">
|
248
|
+
<span class="summary_signature">
|
249
|
+
|
250
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(api_token = nil, timeout = 30, pool_connections = 10, pool_maxsize = 10, max_retries = 3) ⇒ Client </a>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
</span>
|
255
|
+
|
256
|
+
|
257
|
+
<span class="note title constructor">constructor</span>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<span class="summary_desc"><div class='inline'>
|
267
|
+
<p>A new instance of Client.</p>
|
268
|
+
</div></span>
|
269
|
+
|
270
|
+
</li>
|
271
|
+
|
272
|
+
|
273
|
+
<li class="public ">
|
274
|
+
<span class="summary_signature">
|
275
|
+
|
276
|
+
<a href="#number_lookup-instance_method" title="#number_lookup (instance method)">#<strong>number_lookup</strong> ⇒ Object </a>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
</span>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
291
|
+
|
292
|
+
</li>
|
293
|
+
|
294
|
+
|
295
|
+
<li class="public ">
|
296
|
+
<span class="summary_signature">
|
297
|
+
|
298
|
+
<a href="#post-instance_method" title="#post (instance method)">#<strong>post</strong>(host, path, body_is_json, params) ⇒ Object </a>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
</span>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
313
|
+
|
314
|
+
</li>
|
315
|
+
|
316
|
+
|
317
|
+
<li class="public ">
|
318
|
+
<span class="summary_signature">
|
319
|
+
|
320
|
+
<a href="#process_response-instance_method" title="#process_response (instance method)">#<strong>process_response</strong>(host, response) ⇒ Object </a>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
</span>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
335
|
+
|
336
|
+
</li>
|
337
|
+
|
338
|
+
|
339
|
+
<li class="public ">
|
340
|
+
<span class="summary_signature">
|
341
|
+
|
342
|
+
<a href="#slack-instance_method" title="#slack (instance method)">#<strong>slack</strong> ⇒ Object </a>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
</span>
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
357
|
+
|
358
|
+
</li>
|
359
|
+
|
360
|
+
|
361
|
+
<li class="public ">
|
362
|
+
<span class="summary_signature">
|
363
|
+
|
364
|
+
<a href="#sms-instance_method" title="#sms (instance method)">#<strong>sms</strong> ⇒ Object </a>
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
</span>
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
379
|
+
|
380
|
+
</li>
|
381
|
+
|
382
|
+
|
383
|
+
<li class="public ">
|
384
|
+
<span class="summary_signature">
|
385
|
+
|
386
|
+
<a href="#verify-instance_method" title="#verify (instance method)">#<strong>verify</strong> ⇒ Object </a>
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
</span>
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
401
|
+
|
402
|
+
</li>
|
403
|
+
|
404
|
+
|
405
|
+
<li class="public ">
|
406
|
+
<span class="summary_signature">
|
407
|
+
|
408
|
+
<a href="#viber-instance_method" title="#viber (instance method)">#<strong>viber</strong> ⇒ Object </a>
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
</span>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
423
|
+
|
424
|
+
</li>
|
425
|
+
|
426
|
+
|
427
|
+
<li class="public ">
|
428
|
+
<span class="summary_signature">
|
429
|
+
|
430
|
+
<a href="#whatsapp-instance_method" title="#whatsapp (instance method)">#<strong>whatsapp</strong> ⇒ Object </a>
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
</span>
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
445
|
+
|
446
|
+
</li>
|
447
|
+
|
448
|
+
|
449
|
+
</ul>
|
450
|
+
|
451
|
+
|
452
|
+
<div id="constructor_details" class="method_details_list">
|
453
|
+
<h2>Constructor Details</h2>
|
454
|
+
|
455
|
+
<div class="method_details first">
|
456
|
+
<h3 class="signature first" id="initialize-instance_method">
|
457
|
+
|
458
|
+
#<strong>initialize</strong>(api_token = nil, timeout = 30, pool_connections = 10, pool_maxsize = 10, max_retries = 3) ⇒ <tt><span class='object_link'><a href="" title="Direct7::Client (class)">Client</a></span></tt>
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
</h3><div class="docstring">
|
465
|
+
<div class="discussion">
|
466
|
+
|
467
|
+
<p>Returns a new instance of Client.</p>
|
468
|
+
|
469
|
+
|
470
|
+
</div>
|
471
|
+
</div>
|
472
|
+
<div class="tags">
|
473
|
+
|
474
|
+
|
475
|
+
</div><table class="source_code">
|
476
|
+
<tr>
|
477
|
+
<td>
|
478
|
+
<pre class="lines">
|
479
|
+
|
480
|
+
|
481
|
+
18
|
482
|
+
19
|
483
|
+
20
|
484
|
+
21
|
485
|
+
22
|
486
|
+
23
|
487
|
+
24
|
488
|
+
25
|
489
|
+
26
|
490
|
+
27
|
491
|
+
28
|
492
|
+
29
|
493
|
+
30
|
494
|
+
31
|
495
|
+
32
|
496
|
+
33
|
497
|
+
34
|
498
|
+
35
|
499
|
+
36
|
500
|
+
37
|
501
|
+
38
|
502
|
+
39
|
503
|
+
40
|
504
|
+
41
|
505
|
+
42
|
506
|
+
43
|
507
|
+
44
|
508
|
+
45
|
509
|
+
46
|
510
|
+
47
|
511
|
+
48
|
512
|
+
49
|
513
|
+
50
|
514
|
+
51
|
515
|
+
52
|
516
|
+
53
|
517
|
+
54
|
518
|
+
55
|
519
|
+
56
|
520
|
+
57
|
521
|
+
58</pre>
|
522
|
+
</td>
|
523
|
+
<td>
|
524
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 18</span>
|
525
|
+
|
526
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_api_token'>api_token</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_timeout'>timeout</span> <span class='op'>=</span> <span class='int'>30</span><span class='comma'>,</span> <span class='id identifier rubyid_pool_connections'>pool_connections</span> <span class='op'>=</span> <span class='int'>10</span><span class='comma'>,</span> <span class='id identifier rubyid_pool_maxsize'>pool_maxsize</span> <span class='op'>=</span> <span class='int'>10</span><span class='comma'>,</span> <span class='id identifier rubyid_max_retries'>max_retries</span> <span class='op'>=</span> <span class='int'>3</span><span class='rparen'>)</span>
|
527
|
+
<span class='ivar'>@api_token</span> <span class='op'>=</span> <span class='id identifier rubyid_api_token'>api_token</span>
|
528
|
+
<span class='ivar'>@host</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>https://api.d7networks.com</span><span class='tstring_end'>'</span></span>
|
529
|
+
<span class='id identifier rubyid_user_agent'>user_agent</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>direct7-ruby-sdk/</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="../Direct7.html" title="Direct7 (module)">Direct7</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Direct7.html#VERSION-constant" title="Direct7::VERSION (constant)">VERSION</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'> ruby/</span><span class='embexpr_beg'>#{</span><span class='const'>RUBY_VERSION</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
530
|
+
<span class='ivar'>@headers</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
531
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>User-Agent</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_user_agent'>user_agent</span><span class='comma'>,</span>
|
532
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Accept</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>application/json</span><span class='tstring_end'>'</span></span>
|
533
|
+
<span class='rbrace'>}</span>
|
534
|
+
|
535
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_sms'>sms</span>
|
536
|
+
<span class='ivar'>@sms</span>
|
537
|
+
<span class='kw'>end</span>
|
538
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_verify'>verify</span>
|
539
|
+
<span class='ivar'>@verify</span>
|
540
|
+
<span class='kw'>end</span>
|
541
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_slack'>slack</span>
|
542
|
+
<span class='ivar'>@slack</span>
|
543
|
+
<span class='kw'>end</span>
|
544
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_viber'>viber</span>
|
545
|
+
<span class='ivar'>@viber</span>
|
546
|
+
<span class='kw'>end</span>
|
547
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_number_lookup'>number_lookup</span>
|
548
|
+
<span class='ivar'>@number_lookup</span>
|
549
|
+
<span class='kw'>end</span>
|
550
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_whatsapp'>whatsapp</span>
|
551
|
+
<span class='ivar'>@whatsapp</span>
|
552
|
+
<span class='kw'>end</span>
|
553
|
+
<span class='ivar'>@sms</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Direct7.html" title="Direct7 (module)">Direct7</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="SMS.html" title="Direct7::SMS (class)">SMS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="SMS.html#initialize-instance_method" title="Direct7::SMS#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
554
|
+
<span class='ivar'>@verify</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Direct7.html" title="Direct7 (module)">Direct7</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="VERIFY.html" title="Direct7::VERIFY (class)">VERIFY</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="VERIFY.html#initialize-instance_method" title="Direct7::VERIFY#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
555
|
+
<span class='ivar'>@slack</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Direct7.html" title="Direct7 (module)">Direct7</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="SLACK.html" title="Direct7::SLACK (class)">SLACK</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="SLACK.html#initialize-instance_method" title="Direct7::SLACK#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
556
|
+
<span class='ivar'>@viber</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Direct7.html" title="Direct7 (module)">Direct7</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="VIBER.html" title="Direct7::VIBER (class)">VIBER</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="VIBER.html#initialize-instance_method" title="Direct7::VIBER#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
557
|
+
<span class='ivar'>@number_lookup</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Direct7.html" title="Direct7 (module)">Direct7</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NUMBER_LOOKUP.html" title="Direct7::NUMBER_LOOKUP (class)">NUMBER_LOOKUP</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="NUMBER_LOOKUP.html#initialize-instance_method" title="Direct7::NUMBER_LOOKUP#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
558
|
+
<span class='ivar'>@whatsapp</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Direct7.html" title="Direct7 (module)">Direct7</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="WHATSAPP.html" title="Direct7::WHATSAPP (class)">WHATSAPP</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="WHATSAPP.html#initialize-instance_method" title="Direct7::WHATSAPP#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
559
|
+
<span class='comment'># ... initialize other services ...
|
560
|
+
</span>
|
561
|
+
<span class='ivar'>@session</span> <span class='op'>=</span> <span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_persistent'>persistent</span><span class='lparen'>(</span><span class='ivar'>@host</span><span class='rparen'>)</span>
|
562
|
+
<span class='ivar'>@session</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>User-Agent</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_user_agent'>user_agent</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Accept</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>application/json</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
563
|
+
<span class='ivar'>@session</span><span class='period'>.</span><span class='id identifier rubyid_timeout'>timeout</span><span class='lparen'>(</span><span class='label'>write:</span> <span class='id identifier rubyid_timeout'>timeout</span><span class='comma'>,</span> <span class='label'>connect:</span> <span class='id identifier rubyid_timeout'>timeout</span><span class='rparen'>)</span>
|
564
|
+
<span class='comment'># @session.connect('pool_size'=> pool_connections, 'pool_max' => pool_maxsize)
|
565
|
+
</span>
|
566
|
+
<span class='kw'>end</span></pre>
|
567
|
+
</td>
|
568
|
+
</tr>
|
569
|
+
</table>
|
570
|
+
</div>
|
571
|
+
|
572
|
+
</div>
|
573
|
+
|
574
|
+
<div id="instance_attr_details" class="attr_details">
|
575
|
+
<h2>Instance Attribute Details</h2>
|
576
|
+
|
577
|
+
|
578
|
+
<span id="adapter=-instance_method"></span>
|
579
|
+
<div class="method_details first">
|
580
|
+
<h3 class="signature first" id="adapter-instance_method">
|
581
|
+
|
582
|
+
#<strong>adapter</strong> ⇒ <tt>Object</tt>
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
|
588
|
+
</h3><div class="docstring">
|
589
|
+
<div class="discussion">
|
590
|
+
|
591
|
+
<p>Returns the value of attribute adapter.</p>
|
592
|
+
|
593
|
+
|
594
|
+
</div>
|
595
|
+
</div>
|
596
|
+
<div class="tags">
|
597
|
+
|
598
|
+
|
599
|
+
</div><table class="source_code">
|
600
|
+
<tr>
|
601
|
+
<td>
|
602
|
+
<pre class="lines">
|
603
|
+
|
604
|
+
|
605
|
+
16
|
606
|
+
17
|
607
|
+
18</pre>
|
608
|
+
</td>
|
609
|
+
<td>
|
610
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 16</span>
|
611
|
+
|
612
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_adapter'>adapter</span>
|
613
|
+
<span class='ivar'>@adapter</span>
|
614
|
+
<span class='kw'>end</span></pre>
|
615
|
+
</td>
|
616
|
+
</tr>
|
617
|
+
</table>
|
618
|
+
</div>
|
619
|
+
|
620
|
+
|
621
|
+
<span id="session=-instance_method"></span>
|
622
|
+
<div class="method_details ">
|
623
|
+
<h3 class="signature " id="session-instance_method">
|
624
|
+
|
625
|
+
#<strong>session</strong> ⇒ <tt>Object</tt>
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
|
631
|
+
</h3><div class="docstring">
|
632
|
+
<div class="discussion">
|
633
|
+
|
634
|
+
<p>Returns the value of attribute session.</p>
|
635
|
+
|
636
|
+
|
637
|
+
</div>
|
638
|
+
</div>
|
639
|
+
<div class="tags">
|
640
|
+
|
641
|
+
|
642
|
+
</div><table class="source_code">
|
643
|
+
<tr>
|
644
|
+
<td>
|
645
|
+
<pre class="lines">
|
646
|
+
|
647
|
+
|
648
|
+
16
|
649
|
+
17
|
650
|
+
18</pre>
|
651
|
+
</td>
|
652
|
+
<td>
|
653
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 16</span>
|
654
|
+
|
655
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_session'>session</span>
|
656
|
+
<span class='ivar'>@session</span>
|
657
|
+
<span class='kw'>end</span></pre>
|
658
|
+
</td>
|
659
|
+
</tr>
|
660
|
+
</table>
|
661
|
+
</div>
|
662
|
+
|
663
|
+
|
664
|
+
<span id="timeout=-instance_method"></span>
|
665
|
+
<div class="method_details ">
|
666
|
+
<h3 class="signature " id="timeout-instance_method">
|
667
|
+
|
668
|
+
#<strong>timeout</strong> ⇒ <tt>Object</tt>
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
|
673
|
+
|
674
|
+
</h3><div class="docstring">
|
675
|
+
<div class="discussion">
|
676
|
+
|
677
|
+
<p>Returns the value of attribute timeout.</p>
|
678
|
+
|
679
|
+
|
680
|
+
</div>
|
681
|
+
</div>
|
682
|
+
<div class="tags">
|
683
|
+
|
684
|
+
|
685
|
+
</div><table class="source_code">
|
686
|
+
<tr>
|
687
|
+
<td>
|
688
|
+
<pre class="lines">
|
689
|
+
|
690
|
+
|
691
|
+
16
|
692
|
+
17
|
693
|
+
18</pre>
|
694
|
+
</td>
|
695
|
+
<td>
|
696
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 16</span>
|
697
|
+
|
698
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_timeout'>timeout</span>
|
699
|
+
<span class='ivar'>@timeout</span>
|
700
|
+
<span class='kw'>end</span></pre>
|
701
|
+
</td>
|
702
|
+
</tr>
|
703
|
+
</table>
|
704
|
+
</div>
|
705
|
+
|
706
|
+
</div>
|
707
|
+
|
708
|
+
|
709
|
+
<div id="instance_method_details" class="method_details_list">
|
710
|
+
<h2>Instance Method Details</h2>
|
711
|
+
|
712
|
+
|
713
|
+
<div class="method_details first">
|
714
|
+
<h3 class="signature first" id="get-instance_method">
|
715
|
+
|
716
|
+
#<strong>get</strong>(host, path, params = nil) ⇒ <tt>Object</tt>
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
|
721
|
+
|
722
|
+
</h3><table class="source_code">
|
723
|
+
<tr>
|
724
|
+
<td>
|
725
|
+
<pre class="lines">
|
726
|
+
|
727
|
+
|
728
|
+
103
|
729
|
+
104
|
730
|
+
105
|
731
|
+
106
|
732
|
+
107
|
733
|
+
108
|
734
|
+
109</pre>
|
735
|
+
</td>
|
736
|
+
<td>
|
737
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 103</span>
|
738
|
+
|
739
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
740
|
+
<span class='id identifier rubyid_request_url'>request_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_host'>host</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
741
|
+
<span class='id identifier rubyid_request_headers'>request_headers</span> <span class='op'>=</span> <span class='ivar'>@headers</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Authorization</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_create_bearer_token_string'>create_bearer_token_string</span><span class='rparen'>)</span>
|
742
|
+
<span class='comment'># puts "GET request sent to #{request_url} with headers #{request_headers} and params #{params}"
|
743
|
+
</span> <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='ivar'>@session</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='const'>URI</span><span class='lparen'>(</span><span class='id identifier rubyid_request_url'>request_url</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='id identifier rubyid_request_headers'>request_headers</span><span class='rparen'>)</span>
|
744
|
+
<span class='id identifier rubyid_process_response'>process_response</span><span class='lparen'>(</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span>
|
745
|
+
<span class='kw'>end</span></pre>
|
746
|
+
</td>
|
747
|
+
</tr>
|
748
|
+
</table>
|
749
|
+
</div>
|
750
|
+
|
751
|
+
<div class="method_details ">
|
752
|
+
<h3 class="signature " id="host-instance_method">
|
753
|
+
|
754
|
+
#<strong>host</strong>(value = nil) ⇒ <tt>Object</tt>
|
755
|
+
|
756
|
+
|
757
|
+
|
758
|
+
|
759
|
+
|
760
|
+
</h3><table class="source_code">
|
761
|
+
<tr>
|
762
|
+
<td>
|
763
|
+
<pre class="lines">
|
764
|
+
|
765
|
+
|
766
|
+
60
|
767
|
+
61
|
768
|
+
62
|
769
|
+
63
|
770
|
+
64
|
771
|
+
65
|
772
|
+
66</pre>
|
773
|
+
</td>
|
774
|
+
<td>
|
775
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 60</span>
|
776
|
+
|
777
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_host'>host</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
778
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
779
|
+
<span class='ivar'>@host</span>
|
780
|
+
<span class='kw'>else</span>
|
781
|
+
<span class='ivar'>@host</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
782
|
+
<span class='kw'>end</span>
|
783
|
+
<span class='kw'>end</span></pre>
|
784
|
+
</td>
|
785
|
+
</tr>
|
786
|
+
</table>
|
787
|
+
</div>
|
788
|
+
|
789
|
+
<div class="method_details ">
|
790
|
+
<h3 class="signature " id="number_lookup-instance_method">
|
791
|
+
|
792
|
+
#<strong>number_lookup</strong> ⇒ <tt>Object</tt>
|
793
|
+
|
794
|
+
|
795
|
+
|
796
|
+
|
797
|
+
|
798
|
+
</h3><table class="source_code">
|
799
|
+
<tr>
|
800
|
+
<td>
|
801
|
+
<pre class="lines">
|
802
|
+
|
803
|
+
|
804
|
+
39
|
805
|
+
40
|
806
|
+
41</pre>
|
807
|
+
</td>
|
808
|
+
<td>
|
809
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 39</span>
|
810
|
+
|
811
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_number_lookup'>number_lookup</span>
|
812
|
+
<span class='ivar'>@number_lookup</span>
|
813
|
+
<span class='kw'>end</span></pre>
|
814
|
+
</td>
|
815
|
+
</tr>
|
816
|
+
</table>
|
817
|
+
</div>
|
818
|
+
|
819
|
+
<div class="method_details ">
|
820
|
+
<h3 class="signature " id="post-instance_method">
|
821
|
+
|
822
|
+
#<strong>post</strong>(host, path, body_is_json, params) ⇒ <tt>Object</tt>
|
823
|
+
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
|
828
|
+
</h3><table class="source_code">
|
829
|
+
<tr>
|
830
|
+
<td>
|
831
|
+
<pre class="lines">
|
832
|
+
|
833
|
+
|
834
|
+
111
|
835
|
+
112
|
836
|
+
113
|
837
|
+
114
|
838
|
+
115
|
839
|
+
116
|
840
|
+
117
|
841
|
+
118
|
842
|
+
119
|
843
|
+
120
|
844
|
+
121
|
845
|
+
122
|
846
|
+
123
|
847
|
+
124</pre>
|
848
|
+
</td>
|
849
|
+
<td>
|
850
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 111</span>
|
851
|
+
|
852
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_body_is_json'>body_is_json</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
853
|
+
<span class='id identifier rubyid_request_url'>request_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_host'>host</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
854
|
+
<span class='id identifier rubyid_request_headers'>request_headers</span> <span class='op'>=</span> <span class='ivar'>@headers</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Authorization</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_create_bearer_token_string'>create_bearer_token_string</span><span class='rparen'>)</span>
|
855
|
+
<span class='id identifier rubyid_request_headers'>request_headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_body_is_json'>body_is_json</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>application/json</span><span class='tstring_end'>'</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>application/x-www-form-urlencoded</span><span class='tstring_end'>'</span></span>
|
856
|
+
<span class='comment'># puts "POST request sent to #{request_url} with headers #{request_headers} and params #{params}"
|
857
|
+
</span> <span class='id identifier rubyid_params_json'>params_json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_generate'>generate</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
858
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_body_is_json'>body_is_json</span>
|
859
|
+
<span class='ivar'>@session</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='const'>URI</span><span class='lparen'>(</span><span class='id identifier rubyid_request_url'>request_url</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='id identifier rubyid_request_headers'>request_headers</span><span class='comma'>,</span> <span class='label'>json:</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
860
|
+
<span class='kw'>else</span>
|
861
|
+
<span class='ivar'>@session</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='const'>URI</span><span class='lparen'>(</span><span class='id identifier rubyid_request_url'>request_url</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>data:</span> <span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='id identifier rubyid_request_headers'>request_headers</span><span class='rparen'>)</span>
|
862
|
+
<span class='kw'>end</span>
|
863
|
+
<span class='comment'># puts response
|
864
|
+
</span> <span class='id identifier rubyid_process_response'>process_response</span><span class='lparen'>(</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span>
|
865
|
+
<span class='kw'>end</span></pre>
|
866
|
+
</td>
|
867
|
+
</tr>
|
868
|
+
</table>
|
869
|
+
</div>
|
870
|
+
|
871
|
+
<div class="method_details ">
|
872
|
+
<h3 class="signature " id="process_response-instance_method">
|
873
|
+
|
874
|
+
#<strong>process_response</strong>(host, response) ⇒ <tt>Object</tt>
|
875
|
+
|
876
|
+
|
877
|
+
|
878
|
+
|
879
|
+
|
880
|
+
</h3><table class="source_code">
|
881
|
+
<tr>
|
882
|
+
<td>
|
883
|
+
<pre class="lines">
|
884
|
+
|
885
|
+
|
886
|
+
68
|
887
|
+
69
|
888
|
+
70
|
889
|
+
71
|
890
|
+
72
|
891
|
+
73
|
892
|
+
74
|
893
|
+
75
|
894
|
+
76
|
895
|
+
77
|
896
|
+
78
|
897
|
+
79
|
898
|
+
80
|
899
|
+
81
|
900
|
+
82
|
901
|
+
83
|
902
|
+
84
|
903
|
+
85
|
904
|
+
86
|
905
|
+
87
|
906
|
+
88
|
907
|
+
89
|
908
|
+
90
|
909
|
+
91
|
910
|
+
92
|
911
|
+
93
|
912
|
+
94
|
913
|
+
95
|
914
|
+
96
|
915
|
+
97
|
916
|
+
98
|
917
|
+
99
|
918
|
+
100
|
919
|
+
101</pre>
|
920
|
+
</td>
|
921
|
+
<td>
|
922
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 68</span>
|
923
|
+
|
924
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_process_response'>process_response</span><span class='lparen'>(</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span>
|
925
|
+
<span class='comment'># puts "Response headers #{response}"
|
926
|
+
</span> <span class='kw'>case</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
927
|
+
<span class='kw'>when</span> <span class='int'>401</span>
|
928
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="AuthenticationError.html" title="Direct7::AuthenticationError (class)">AuthenticationError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Invalid API token</span><span class='tstring_end'>'</span></span>
|
929
|
+
<span class='kw'>when</span> <span class='int'>200</span><span class='op'>..</span><span class='int'>299</span>
|
930
|
+
<span class='kw'>begin</span>
|
931
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
932
|
+
<span class='comment'># puts "Successful process response: #{result}"
|
933
|
+
</span> <span class='id identifier rubyid_result'>result</span>
|
934
|
+
<span class='kw'>rescue</span> <span class='const'>JSON</span><span class='op'>::</span><span class='const'>ParserError</span>
|
935
|
+
<span class='kw'>nil</span>
|
936
|
+
<span class='kw'>end</span>
|
937
|
+
<span class='kw'>when</span> <span class='int'>400</span><span class='op'>..</span><span class='int'>499</span>
|
938
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Client error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
939
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
940
|
+
<span class='kw'>when</span> <span class='int'>400</span>
|
941
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="BadRequest.html" title="Direct7::BadRequest (class)">BadRequest</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span>
|
942
|
+
<span class='kw'>when</span> <span class='int'>404</span>
|
943
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="NotFoundError.html" title="Direct7::NotFoundError (class)">NotFoundError</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span>
|
944
|
+
<span class='kw'>when</span> <span class='int'>402</span>
|
945
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="InsufficientCreditError.html" title="Direct7::InsufficientCreditError (class)">InsufficientCreditError</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span>
|
946
|
+
<span class='kw'>when</span> <span class='int'>422</span>
|
947
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ValidationError.html" title="Direct7::ValidationError (class)">ValidationError</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span>
|
948
|
+
<span class='kw'>else</span>
|
949
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ClientError.html" title="Direct7::ClientError (class)">ClientError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='embexpr_end'>}</span><span class='tstring_content'> response from </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_host'>host</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
950
|
+
<span class='kw'>end</span>
|
951
|
+
<span class='kw'>when</span> <span class='int'>500</span><span class='op'>..</span><span class='int'>599</span>
|
952
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Server error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
953
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="ServerError.html" title="Direct7::ServerError (class)">ServerError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='embexpr_end'>}</span><span class='tstring_content'> response from </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_host'>host</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
954
|
+
<span class='kw'>else</span>
|
955
|
+
<span class='kw'>nil</span>
|
956
|
+
<span class='kw'>end</span>
|
957
|
+
<span class='kw'>end</span></pre>
|
958
|
+
</td>
|
959
|
+
</tr>
|
960
|
+
</table>
|
961
|
+
</div>
|
962
|
+
|
963
|
+
<div class="method_details ">
|
964
|
+
<h3 class="signature " id="slack-instance_method">
|
965
|
+
|
966
|
+
#<strong>slack</strong> ⇒ <tt>Object</tt>
|
967
|
+
|
968
|
+
|
969
|
+
|
970
|
+
|
971
|
+
|
972
|
+
</h3><table class="source_code">
|
973
|
+
<tr>
|
974
|
+
<td>
|
975
|
+
<pre class="lines">
|
976
|
+
|
977
|
+
|
978
|
+
33
|
979
|
+
34
|
980
|
+
35</pre>
|
981
|
+
</td>
|
982
|
+
<td>
|
983
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 33</span>
|
984
|
+
|
985
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_slack'>slack</span>
|
986
|
+
<span class='ivar'>@slack</span>
|
987
|
+
<span class='kw'>end</span></pre>
|
988
|
+
</td>
|
989
|
+
</tr>
|
990
|
+
</table>
|
991
|
+
</div>
|
992
|
+
|
993
|
+
<div class="method_details ">
|
994
|
+
<h3 class="signature " id="sms-instance_method">
|
995
|
+
|
996
|
+
#<strong>sms</strong> ⇒ <tt>Object</tt>
|
997
|
+
|
998
|
+
|
999
|
+
|
1000
|
+
|
1001
|
+
|
1002
|
+
</h3><table class="source_code">
|
1003
|
+
<tr>
|
1004
|
+
<td>
|
1005
|
+
<pre class="lines">
|
1006
|
+
|
1007
|
+
|
1008
|
+
27
|
1009
|
+
28
|
1010
|
+
29</pre>
|
1011
|
+
</td>
|
1012
|
+
<td>
|
1013
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 27</span>
|
1014
|
+
|
1015
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_sms'>sms</span>
|
1016
|
+
<span class='ivar'>@sms</span>
|
1017
|
+
<span class='kw'>end</span></pre>
|
1018
|
+
</td>
|
1019
|
+
</tr>
|
1020
|
+
</table>
|
1021
|
+
</div>
|
1022
|
+
|
1023
|
+
<div class="method_details ">
|
1024
|
+
<h3 class="signature " id="verify-instance_method">
|
1025
|
+
|
1026
|
+
#<strong>verify</strong> ⇒ <tt>Object</tt>
|
1027
|
+
|
1028
|
+
|
1029
|
+
|
1030
|
+
|
1031
|
+
|
1032
|
+
</h3><table class="source_code">
|
1033
|
+
<tr>
|
1034
|
+
<td>
|
1035
|
+
<pre class="lines">
|
1036
|
+
|
1037
|
+
|
1038
|
+
30
|
1039
|
+
31
|
1040
|
+
32</pre>
|
1041
|
+
</td>
|
1042
|
+
<td>
|
1043
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 30</span>
|
1044
|
+
|
1045
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_verify'>verify</span>
|
1046
|
+
<span class='ivar'>@verify</span>
|
1047
|
+
<span class='kw'>end</span></pre>
|
1048
|
+
</td>
|
1049
|
+
</tr>
|
1050
|
+
</table>
|
1051
|
+
</div>
|
1052
|
+
|
1053
|
+
<div class="method_details ">
|
1054
|
+
<h3 class="signature " id="viber-instance_method">
|
1055
|
+
|
1056
|
+
#<strong>viber</strong> ⇒ <tt>Object</tt>
|
1057
|
+
|
1058
|
+
|
1059
|
+
|
1060
|
+
|
1061
|
+
|
1062
|
+
</h3><table class="source_code">
|
1063
|
+
<tr>
|
1064
|
+
<td>
|
1065
|
+
<pre class="lines">
|
1066
|
+
|
1067
|
+
|
1068
|
+
36
|
1069
|
+
37
|
1070
|
+
38</pre>
|
1071
|
+
</td>
|
1072
|
+
<td>
|
1073
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 36</span>
|
1074
|
+
|
1075
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_viber'>viber</span>
|
1076
|
+
<span class='ivar'>@viber</span>
|
1077
|
+
<span class='kw'>end</span></pre>
|
1078
|
+
</td>
|
1079
|
+
</tr>
|
1080
|
+
</table>
|
1081
|
+
</div>
|
1082
|
+
|
1083
|
+
<div class="method_details ">
|
1084
|
+
<h3 class="signature " id="whatsapp-instance_method">
|
1085
|
+
|
1086
|
+
#<strong>whatsapp</strong> ⇒ <tt>Object</tt>
|
1087
|
+
|
1088
|
+
|
1089
|
+
|
1090
|
+
|
1091
|
+
|
1092
|
+
</h3><table class="source_code">
|
1093
|
+
<tr>
|
1094
|
+
<td>
|
1095
|
+
<pre class="lines">
|
1096
|
+
|
1097
|
+
|
1098
|
+
42
|
1099
|
+
43
|
1100
|
+
44</pre>
|
1101
|
+
</td>
|
1102
|
+
<td>
|
1103
|
+
<pre class="code"><span class="info file"># File 'lib/direct7/client.rb', line 42</span>
|
1104
|
+
|
1105
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_whatsapp'>whatsapp</span>
|
1106
|
+
<span class='ivar'>@whatsapp</span>
|
1107
|
+
<span class='kw'>end</span></pre>
|
1108
|
+
</td>
|
1109
|
+
</tr>
|
1110
|
+
</table>
|
1111
|
+
</div>
|
1112
|
+
|
1113
|
+
</div>
|
1114
|
+
|
1115
|
+
</div>
|
1116
|
+
|
1117
|
+
<div id="footer">
|
1118
|
+
Generated on Fri Nov 3 09:22:45 2023 by
|
1119
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1120
|
+
0.9.34 (ruby-2.7.4).
|
1121
|
+
</div>
|
1122
|
+
|
1123
|
+
</div>
|
1124
|
+
</body>
|
1125
|
+
</html>
|