t2_airtime 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,664 @@
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: T2Airtime::Request
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 = "T2Airtime::Request";
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="../T2Airtime.html" title="T2Airtime (module)">T2Airtime</a></span></span>
41
+ &raquo;
42
+ <span class="title">Request</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: T2Airtime::Request
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">T2Airtime::Request</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/t2_airtime/request.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+ <h2>
111
+ Instance Method Summary
112
+ <small><a href="#" class="summary_toggle">collapse</a></small>
113
+ </h2>
114
+
115
+ <ul class="summary">
116
+
117
+ <li class="public ">
118
+ <span class="summary_signature">
119
+
120
+ <a href="#add_param-instance_method" title="#add_param (instance method)">#<strong>add_param</strong>(key, value) &#x21d2; Object </a>
121
+
122
+
123
+
124
+ </span>
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+ <span class="summary_desc"><div class='inline'></div></span>
135
+
136
+ </li>
137
+
138
+
139
+ <li class="public ">
140
+ <span class="summary_signature">
141
+
142
+ <a href="#authenticate-instance_method" title="#authenticate (instance method)">#<strong>authenticate</strong> &#x21d2; Object </a>
143
+
144
+
145
+
146
+ </span>
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+ <span class="summary_desc"><div class='inline'></div></span>
157
+
158
+ </li>
159
+
160
+
161
+ <li class="public ">
162
+ <span class="summary_signature">
163
+
164
+ <a href="#get%3F-instance_method" title="#get? (instance method)">#<strong>get?</strong> &#x21d2; Boolean </a>
165
+
166
+
167
+
168
+ </span>
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+ <span class="summary_desc"><div class='inline'></div></span>
179
+
180
+ </li>
181
+
182
+
183
+ <li class="public ">
184
+ <span class="summary_signature">
185
+
186
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(user, password, url, name, params) &#x21d2; Request </a>
187
+
188
+
189
+
190
+ </span>
191
+
192
+
193
+ <span class="note title constructor">constructor</span>
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <span class="summary_desc"><div class='inline'>
203
+ <p>A new instance of Request.</p>
204
+ </div></span>
205
+
206
+ </li>
207
+
208
+
209
+ <li class="public ">
210
+ <span class="summary_signature">
211
+
212
+ <a href="#key-instance_method" title="#key (instance method)">#<strong>key</strong> &#x21d2; Object </a>
213
+
214
+
215
+
216
+ </span>
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+ <span class="summary_desc"><div class='inline'></div></span>
227
+
228
+ </li>
229
+
230
+
231
+ <li class="public ">
232
+ <span class="summary_signature">
233
+
234
+ <a href="#post%3F-instance_method" title="#post? (instance method)">#<strong>post?</strong> &#x21d2; Boolean </a>
235
+
236
+
237
+
238
+ </span>
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+ <span class="summary_desc"><div class='inline'></div></span>
249
+
250
+ </li>
251
+
252
+
253
+ <li class="public ">
254
+ <span class="summary_signature">
255
+
256
+ <a href="#reset-instance_method" title="#reset (instance method)">#<strong>reset</strong> &#x21d2; Object </a>
257
+
258
+
259
+
260
+ </span>
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+ <span class="summary_desc"><div class='inline'></div></span>
271
+
272
+ </li>
273
+
274
+
275
+ <li class="public ">
276
+ <span class="summary_signature">
277
+
278
+ <a href="#run-instance_method" title="#run (instance method)">#<strong>run</strong>(method = :get) &#x21d2; Object </a>
279
+
280
+
281
+
282
+ </span>
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+ <span class="summary_desc"><div class='inline'>
293
+ <p>More than 99.5% of the transactions are currently processed within a few
294
+ seconds.</p>
295
+ </div></span>
296
+
297
+ </li>
298
+
299
+
300
+ </ul>
301
+
302
+
303
+ <div id="constructor_details" class="method_details_list">
304
+ <h2>Constructor Details</h2>
305
+
306
+ <div class="method_details first">
307
+ <h3 class="signature first" id="initialize-instance_method">
308
+
309
+ #<strong>initialize</strong>(user, password, url, name, params) &#x21d2; <tt><span class='object_link'><a href="" title="T2Airtime::Request (class)">Request</a></span></tt>
310
+
311
+
312
+
313
+
314
+
315
+ </h3><div class="docstring">
316
+ <div class="discussion">
317
+
318
+ <p>Returns a new instance of Request</p>
319
+
320
+
321
+ </div>
322
+ </div>
323
+ <div class="tags">
324
+
325
+
326
+ </div><table class="source_code">
327
+ <tr>
328
+ <td>
329
+ <pre class="lines">
330
+
331
+
332
+ 4
333
+ 5
334
+ 6
335
+ 7
336
+ 8
337
+ 9
338
+ 10
339
+ 11
340
+ 12
341
+ 13
342
+ 14
343
+ 15</pre>
344
+ </td>
345
+ <td>
346
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/request.rb', line 4</span>
347
+
348
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_user'>user</span><span class='comma'>,</span> <span class='id identifier rubyid_password'>password</span><span class='comma'>,</span> <span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
349
+ <span class='ivar'>@user</span> <span class='op'>=</span> <span class='id identifier rubyid_user'>user</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
350
+ <span class='ivar'>@pass</span> <span class='op'>=</span> <span class='id identifier rubyid_password'>password</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
351
+ <span class='ivar'>@conn</span> <span class='op'>=</span> <span class='const'>Faraday</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>url:</span> <span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_faraday'>faraday</span><span class='op'>|</span>
352
+ <span class='id identifier rubyid_faraday'>faraday</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span> <span class='symbol'>:url_encoded</span>
353
+ <span class='id identifier rubyid_faraday'>faraday</span><span class='period'>.</span><span class='id identifier rubyid_adapter'>adapter</span> <span class='symbol'>:net_http</span>
354
+ <span class='kw'>end</span>
355
+ <span class='id identifier rubyid_reset'>reset</span>
356
+ <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
357
+ <span class='id identifier rubyid_add_param'>add_param</span> <span class='symbol'>:action</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span>
358
+ <span class='ivar'>@params</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
359
+ <span class='kw'>end</span></pre>
360
+ </td>
361
+ </tr>
362
+ </table>
363
+ </div>
364
+
365
+ </div>
366
+
367
+
368
+ <div id="instance_method_details" class="method_details_list">
369
+ <h2>Instance Method Details</h2>
370
+
371
+
372
+ <div class="method_details first">
373
+ <h3 class="signature first" id="add_param-instance_method">
374
+
375
+ #<strong>add_param</strong>(key, value) &#x21d2; <tt>Object</tt>
376
+
377
+
378
+
379
+
380
+
381
+ </h3><table class="source_code">
382
+ <tr>
383
+ <td>
384
+ <pre class="lines">
385
+
386
+
387
+ 29</pre>
388
+ </td>
389
+ <td>
390
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/request.rb', line 29</span>
391
+
392
+ <span class='kw'>def</span> <span class='id identifier rubyid_add_param'>add_param</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='ivar'>@params</span><span class='lbracket'>[</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='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>end</span></pre>
393
+ </td>
394
+ </tr>
395
+ </table>
396
+ </div>
397
+
398
+ <div class="method_details ">
399
+ <h3 class="signature " id="authenticate-instance_method">
400
+
401
+ #<strong>authenticate</strong> &#x21d2; <tt>Object</tt>
402
+
403
+
404
+
405
+
406
+
407
+ </h3><table class="source_code">
408
+ <tr>
409
+ <td>
410
+ <pre class="lines">
411
+
412
+
413
+ 22
414
+ 23
415
+ 24
416
+ 25
417
+ 26
418
+ 27</pre>
419
+ </td>
420
+ <td>
421
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/request.rb', line 22</span>
422
+
423
+ <span class='kw'>def</span> <span class='id identifier rubyid_authenticate'>authenticate</span>
424
+ <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='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
425
+ <span class='id identifier rubyid_add_param'>add_param</span> <span class='symbol'>:key</span><span class='comma'>,</span> <span class='id identifier rubyid_time'>time</span>
426
+ <span class='id identifier rubyid_add_param'>add_param</span> <span class='symbol'>:md5</span><span class='comma'>,</span> <span class='id identifier rubyid_md5_hash'>md5_hash</span><span class='lparen'>(</span><span class='ivar'>@user</span> <span class='op'>+</span> <span class='ivar'>@pass</span> <span class='op'>+</span> <span class='id identifier rubyid_time'>time</span><span class='rparen'>)</span>
427
+ <span class='id identifier rubyid_add_param'>add_param</span> <span class='symbol'>:login</span><span class='comma'>,</span> <span class='ivar'>@user</span>
428
+ <span class='kw'>end</span></pre>
429
+ </td>
430
+ </tr>
431
+ </table>
432
+ </div>
433
+
434
+ <div class="method_details ">
435
+ <h3 class="signature " id="get?-instance_method">
436
+
437
+ #<strong>get?</strong> &#x21d2; <tt>Boolean</tt>
438
+
439
+
440
+
441
+
442
+
443
+ </h3><div class="docstring">
444
+ <div class="discussion">
445
+
446
+
447
+ </div>
448
+ </div>
449
+ <div class="tags">
450
+
451
+ <p class="tag_title">Returns:</p>
452
+ <ul class="return">
453
+
454
+ <li>
455
+
456
+
457
+ <span class='type'>(<tt>Boolean</tt>)</span>
458
+
459
+
460
+
461
+ </li>
462
+
463
+ </ul>
464
+
465
+ </div><table class="source_code">
466
+ <tr>
467
+ <td>
468
+ <pre class="lines">
469
+
470
+
471
+ 33</pre>
472
+ </td>
473
+ <td>
474
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/request.rb', line 33</span>
475
+
476
+ <span class='kw'>def</span> <span class='id identifier rubyid_get?'>get?</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='ivar'>@params</span><span class='lbracket'>[</span><span class='symbol'>:method</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:get</span> <span class='kw'>end</span></pre>
477
+ </td>
478
+ </tr>
479
+ </table>
480
+ </div>
481
+
482
+ <div class="method_details ">
483
+ <h3 class="signature " id="key-instance_method">
484
+
485
+ #<strong>key</strong> &#x21d2; <tt>Object</tt>
486
+
487
+
488
+
489
+
490
+
491
+ </h3><table class="source_code">
492
+ <tr>
493
+ <td>
494
+ <pre class="lines">
495
+
496
+
497
+ 31</pre>
498
+ </td>
499
+ <td>
500
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/request.rb', line 31</span>
501
+
502
+ <span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='ivar'>@params</span><span class='lbracket'>[</span><span class='symbol'>:key</span><span class='rbracket'>]</span> <span class='kw'>end</span></pre>
503
+ </td>
504
+ </tr>
505
+ </table>
506
+ </div>
507
+
508
+ <div class="method_details ">
509
+ <h3 class="signature " id="post?-instance_method">
510
+
511
+ #<strong>post?</strong> &#x21d2; <tt>Boolean</tt>
512
+
513
+
514
+
515
+
516
+
517
+ </h3><div class="docstring">
518
+ <div class="discussion">
519
+
520
+
521
+ </div>
522
+ </div>
523
+ <div class="tags">
524
+
525
+ <p class="tag_title">Returns:</p>
526
+ <ul class="return">
527
+
528
+ <li>
529
+
530
+
531
+ <span class='type'>(<tt>Boolean</tt>)</span>
532
+
533
+
534
+
535
+ </li>
536
+
537
+ </ul>
538
+
539
+ </div><table class="source_code">
540
+ <tr>
541
+ <td>
542
+ <pre class="lines">
543
+
544
+
545
+ 35</pre>
546
+ </td>
547
+ <td>
548
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/request.rb', line 35</span>
549
+
550
+ <span class='kw'>def</span> <span class='id identifier rubyid_post?'>post?</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='ivar'>@params</span><span class='lbracket'>[</span><span class='symbol'>:method</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:post</span> <span class='kw'>end</span></pre>
551
+ </td>
552
+ </tr>
553
+ </table>
554
+ </div>
555
+
556
+ <div class="method_details ">
557
+ <h3 class="signature " id="reset-instance_method">
558
+
559
+ #<strong>reset</strong> &#x21d2; <tt>Object</tt>
560
+
561
+
562
+
563
+
564
+
565
+ </h3><table class="source_code">
566
+ <tr>
567
+ <td>
568
+ <pre class="lines">
569
+
570
+
571
+ 17
572
+ 18
573
+ 19
574
+ 20</pre>
575
+ </td>
576
+ <td>
577
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/request.rb', line 17</span>
578
+
579
+ <span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span>
580
+ <span class='ivar'>@params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
581
+ <span class='id identifier rubyid_authenticate'>authenticate</span>
582
+ <span class='kw'>end</span></pre>
583
+ </td>
584
+ </tr>
585
+ </table>
586
+ </div>
587
+
588
+ <div class="method_details ">
589
+ <h3 class="signature " id="run-instance_method">
590
+
591
+ #<strong>run</strong>(method = :get) &#x21d2; <tt>Object</tt>
592
+
593
+
594
+
595
+
596
+
597
+ </h3><div class="docstring">
598
+ <div class="discussion">
599
+
600
+ <p>More than 99.5% of the transactions are currently processed within a few
601
+ seconds. However, it may happen in some rare cases that a transaction
602
+ takes longer to be processed by the receiving operator due to congested
603
+ system on their end for instance. TransferTo guarantees that transactions
604
+ not processed within 600 seconds will not be charged, whatever the final
605
+ status of the transaction (successful or not). In addition, TransferTo is
606
+ operating a real time system; therefore, the status returned in the Top-up
607
+ response is final and will not change. To ensure that your system
608
+ captures successfully the status of all transactions especially the
609
+ longest ones, it is advised to either set up a high timeout value of
610
+ 600seconds to be on the safe side (TCP connection could potentially be
611
+ opened for a long time in this case) or to set up a mechanism to check on
612
+ the status (to do so, you can call the trans_info method to retrieve the
613
+ final status of a transaction). In case of timeout, both methods reserve_id
614
+ and get_id_from_key of the API could be useful to identify the ID of the
615
+ transaction (we recommend to either send a reserve_id request and to use
616
+ the ID returned in the response in the subsequent top-up request so that
617
+ you know in advance the ID of the transaction).</p>
618
+
619
+
620
+ </div>
621
+ </div>
622
+ <div class="tags">
623
+
624
+
625
+ </div><table class="source_code">
626
+ <tr>
627
+ <td>
628
+ <pre class="lines">
629
+
630
+
631
+ 50
632
+ 51
633
+ 52
634
+ 53
635
+ 54
636
+ 55</pre>
637
+ </td>
638
+ <td>
639
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/request.rb', line 50</span>
640
+
641
+ <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='symbol'>:get</span><span class='rparen'>)</span>
642
+ <span class='id identifier rubyid_add_param'>add_param</span> <span class='symbol'>:method</span><span class='comma'>,</span> <span class='id identifier rubyid_method'>method</span>
643
+ <span class='ivar'>@conn</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="../T2Airtime.html" title="T2Airtime (module)">T2Airtime</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../T2Airtime.html#ENDPOINT-constant" title="T2Airtime::ENDPOINT (constant)">ENDPOINT</a></span></span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='ivar'>@params</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_req'>req</span><span class='op'>|</span>
644
+ <span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>timeout:</span> <span class='int'>600</span><span class='comma'>,</span> <span class='label'>open_timeout:</span> <span class='int'>600</span> <span class='rbrace'>}</span>
645
+ <span class='kw'>end</span>
646
+ <span class='kw'>end</span></pre>
647
+ </td>
648
+ </tr>
649
+ </table>
650
+ </div>
651
+
652
+ </div>
653
+
654
+ </div>
655
+
656
+ <div id="footer">
657
+ Generated on Sun Aug 27 17:54:43 2017 by
658
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
659
+ 0.9.9 (ruby-2.3.3).
660
+ </div>
661
+
662
+ </div>
663
+ </body>
664
+ </html>