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,1152 @@
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::API
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::API";
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)</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">API</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::API
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="Base.html" title="T2Airtime::Base (class)">Base</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="Base.html" title="T2Airtime::Base (class)">Base</a></span></li>
78
+
79
+ <li class="next">T2Airtime::API</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/t2_airtime/api.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+ <h2>
113
+ Instance Method Summary
114
+ <small><a href="#" class="summary_toggle">collapse</a></small>
115
+ </h2>
116
+
117
+ <ul class="summary">
118
+
119
+ <li class="public ">
120
+ <span class="summary_signature">
121
+
122
+ <a href="#check_wallet-instance_method" title="#check_wallet (instance method)">#<strong>check_wallet</strong> &#x21d2; Object </a>
123
+
124
+
125
+
126
+ </span>
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+ <span class="summary_desc"><div class='inline'>
137
+ <p>Returns the balance in your TransferTo account.</p>
138
+ </div></span>
139
+
140
+ </li>
141
+
142
+
143
+ <li class="public ">
144
+ <span class="summary_signature">
145
+
146
+ <a href="#country_list-instance_method" title="#country_list (instance method)">#<strong>country_list</strong> &#x21d2; Object </a>
147
+
148
+
149
+
150
+ </span>
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+ <span class="summary_desc"><div class='inline'>
161
+ <p>Convenience method to get the country list.</p>
162
+ </div></span>
163
+
164
+ </li>
165
+
166
+
167
+ <li class="public ">
168
+ <span class="summary_signature">
169
+
170
+ <a href="#get_id_from_key-instance_method" title="#get_id_from_key (instance method)">#<strong>get_id_from_key</strong>(key) &#x21d2; Object </a>
171
+
172
+
173
+
174
+ </span>
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+ <span class="summary_desc"><div class='inline'>
185
+ <p>This method is used to retrieve the ID of a transaction previously
186
+ performed based on the key used in the request at that time.</p>
187
+ </div></span>
188
+
189
+ </li>
190
+
191
+
192
+ <li class="public ">
193
+ <span class="summary_signature">
194
+
195
+ <a href="#msisdn_info-instance_method" title="#msisdn_info (instance method)">#<strong>msisdn_info</strong>(destination_msisdn, operator_id = nil, delivered_amount_info = 1, return_service_fee = 1, return_promo = 1) &#x21d2; Object </a>
196
+
197
+
198
+
199
+ </span>
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ <span class="summary_desc"><div class='inline'>
210
+ <p>This method is used to retrieve various information of a specific MSISDN
211
+ (operator, country…) as well as the list of all products configured for
212
+ your specific account and the destination operator of the MSISDN.</p>
213
+ </div></span>
214
+
215
+ </li>
216
+
217
+
218
+ <li class="public ">
219
+ <span class="summary_signature">
220
+
221
+ <a href="#operator_list-instance_method" title="#operator_list (instance method)">#<strong>operator_list</strong>(country_aid) &#x21d2; Object </a>
222
+
223
+
224
+
225
+ </span>
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+ <span class="summary_desc"><div class='inline'>
236
+ <p>Convenience method to get the operators list for a given country.</p>
237
+ </div></span>
238
+
239
+ </li>
240
+
241
+
242
+ <li class="public ">
243
+ <span class="summary_signature">
244
+
245
+ <a href="#ping-instance_method" title="#ping (instance method)">#<strong>ping</strong> &#x21d2; Object </a>
246
+
247
+
248
+
249
+ </span>
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+ <span class="summary_desc"><div class='inline'>
260
+ <p>Test the connection to the Airtime API.</p>
261
+ </div></span>
262
+
263
+ </li>
264
+
265
+
266
+ <li class="public ">
267
+ <span class="summary_signature">
268
+
269
+ <a href="#price_list-instance_method" title="#price_list (instance method)">#<strong>price_list</strong>(info_type, content = nil) &#x21d2; Object </a>
270
+
271
+
272
+
273
+ </span>
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+ <span class="summary_desc"><div class='inline'>
284
+ <p>These methods are used to retrieve coverage and pricelist offered to you.</p>
285
+ </div></span>
286
+
287
+ </li>
288
+
289
+
290
+ <li class="public ">
291
+ <span class="summary_signature">
292
+
293
+ <a href="#product_list-instance_method" title="#product_list (instance method)">#<strong>product_list</strong>(operator_aid) &#x21d2; Object </a>
294
+
295
+
296
+
297
+ </span>
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+ <span class="summary_desc"><div class='inline'>
308
+ <p>Convenience method to get the product list for a given operator.</p>
309
+ </div></span>
310
+
311
+ </li>
312
+
313
+
314
+ <li class="public ">
315
+ <span class="summary_signature">
316
+
317
+ <a href="#reserve_id-instance_method" title="#reserve_id (instance method)">#<strong>reserve_id</strong> &#x21d2; Object </a>
318
+
319
+
320
+
321
+ </span>
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+ <span class="summary_desc"><div class='inline'>
332
+ <p>This method is used to reserve an ID in the system.</p>
333
+ </div></span>
334
+
335
+ </li>
336
+
337
+
338
+ <li class="public ">
339
+ <span class="summary_signature">
340
+
341
+ <a href="#topup-instance_method" title="#topup (instance method)">#<strong>topup</strong>(msisdn, destination_msisdn, product, method = &#39;topup&#39;, reserved_id = nil, send_sms = true, sms = nil, sender_text = nil, operator_id = nil, return_service_fee = 1, delivered_amount_info = 1, return_timestamp = 1, return_version = 1, return_promo = 0) &#x21d2; Object </a>
342
+
343
+
344
+
345
+ </span>
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+ <span class="summary_desc"><div class='inline'>
356
+ <p>By default, an SMS notification is sent to the recipient after every
357
+ successful Top-up.</p>
358
+ </div></span>
359
+
360
+ </li>
361
+
362
+
363
+ <li class="public ">
364
+ <span class="summary_signature">
365
+
366
+ <a href="#trans_info-instance_method" title="#trans_info (instance method)">#<strong>trans_info</strong>(id) &#x21d2; Object </a>
367
+
368
+
369
+
370
+ </span>
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+ <span class="summary_desc"><div class='inline'>
381
+ <p>Retrieve available information on a specific transaction.</p>
382
+ </div></span>
383
+
384
+ </li>
385
+
386
+
387
+ <li class="public ">
388
+ <span class="summary_signature">
389
+
390
+ <a href="#trans_list-instance_method" title="#trans_list (instance method)">#<strong>trans_list</strong>(start = (Time.now-24.hours), stop = Time.now, msisdn = nil, destination = nil, code = nil) &#x21d2; Object </a>
391
+
392
+
393
+
394
+ </span>
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+ <span class="summary_desc"><div class='inline'>
405
+ <p>This method is used to retrieve the list of transactions performed within
406
+ the date range by the MSISDN if set.</p>
407
+ </div></span>
408
+
409
+ </li>
410
+
411
+
412
+ </ul>
413
+
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Base.html" title="T2Airtime::Base (class)">Base</a></span></h3>
425
+ <p class="inherited"><span class='object_link'><a href="Base.html#api-class_method" title="T2Airtime::Base.api (method)">api</a></span>, <span class='object_link'><a href="Base.html#initialize-instance_method" title="T2Airtime::Base#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Base.html#run_action-instance_method" title="T2Airtime::Base#run_action (method)">#run_action</a></span></p>
426
+ <div id="constructor_details" class="method_details_list">
427
+ <h2>Constructor Details</h2>
428
+
429
+ <p class="notice">This class inherits a constructor from <span class='object_link'><a href="Base.html#initialize-instance_method" title="T2Airtime::Base#initialize (method)">T2Airtime::Base</a></span></p>
430
+
431
+ </div>
432
+
433
+
434
+ <div id="instance_method_details" class="method_details_list">
435
+ <h2>Instance Method Details</h2>
436
+
437
+
438
+ <div class="method_details first">
439
+ <h3 class="signature first" id="check_wallet-instance_method">
440
+
441
+ #<strong>check_wallet</strong> &#x21d2; <tt>Object</tt>
442
+
443
+
444
+
445
+
446
+
447
+ </h3><div class="docstring">
448
+ <div class="discussion">
449
+
450
+ <p>Returns the balance in your TransferTo account. This method shall not be
451
+ used more than 24 times per day.</p>
452
+
453
+
454
+ </div>
455
+ </div>
456
+ <div class="tags">
457
+
458
+
459
+ </div><table class="source_code">
460
+ <tr>
461
+ <td>
462
+ <pre class="lines">
463
+
464
+
465
+ 11
466
+ 12
467
+ 13</pre>
468
+ </td>
469
+ <td>
470
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 11</span>
471
+
472
+ <span class='kw'>def</span> <span class='id identifier rubyid_check_wallet'>check_wallet</span>
473
+ <span class='id identifier rubyid_run_action'>run_action</span> <span class='symbol'>:check_wallet</span>
474
+ <span class='kw'>end</span></pre>
475
+ </td>
476
+ </tr>
477
+ </table>
478
+ </div>
479
+
480
+ <div class="method_details ">
481
+ <h3 class="signature " id="country_list-instance_method">
482
+
483
+ #<strong>country_list</strong> &#x21d2; <tt>Object</tt>
484
+
485
+
486
+
487
+
488
+
489
+ </h3><div class="docstring">
490
+ <div class="discussion">
491
+
492
+ <p>Convenience method to get the country list</p>
493
+
494
+
495
+ </div>
496
+ </div>
497
+ <div class="tags">
498
+
499
+
500
+ </div><table class="source_code">
501
+ <tr>
502
+ <td>
503
+ <pre class="lines">
504
+
505
+
506
+ 245</pre>
507
+ </td>
508
+ <td>
509
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 245</span>
510
+
511
+ <span class='kw'>def</span> <span class='id identifier rubyid_country_list'>country_list</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='id identifier rubyid_price_list'>price_list</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>countries</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
512
+ </td>
513
+ </tr>
514
+ </table>
515
+ </div>
516
+
517
+ <div class="method_details ">
518
+ <h3 class="signature " id="get_id_from_key-instance_method">
519
+
520
+ #<strong>get_id_from_key</strong>(key) &#x21d2; <tt>Object</tt>
521
+
522
+
523
+
524
+
525
+
526
+ </h3><div class="docstring">
527
+ <div class="discussion">
528
+
529
+ <p>This method is used to retrieve the ID of a transaction previously
530
+ performed based on the key used in the request at that time.</p>
531
+
532
+
533
+ </div>
534
+ </div>
535
+ <div class="tags">
536
+
537
+
538
+ </div><table class="source_code">
539
+ <tr>
540
+ <td>
541
+ <pre class="lines">
542
+
543
+
544
+ 219
545
+ 220
546
+ 221
547
+ 222</pre>
548
+ </td>
549
+ <td>
550
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 219</span>
551
+
552
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_id_from_key'>get_id_from_key</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
553
+ <span class='ivar'>@params</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>from_key:</span> <span class='id identifier rubyid_key'>key</span> <span class='rbrace'>}</span>
554
+ <span class='id identifier rubyid_run_action'>run_action</span> <span class='symbol'>:get_id_from_key</span>
555
+ <span class='kw'>end</span></pre>
556
+ </td>
557
+ </tr>
558
+ </table>
559
+ </div>
560
+
561
+ <div class="method_details ">
562
+ <h3 class="signature " id="msisdn_info-instance_method">
563
+
564
+ #<strong>msisdn_info</strong>(destination_msisdn, operator_id = nil, delivered_amount_info = 1, return_service_fee = 1, return_promo = 1) &#x21d2; <tt>Object</tt>
565
+
566
+
567
+
568
+
569
+
570
+ </h3><div class="docstring">
571
+ <div class="discussion">
572
+
573
+ <p>This method is used to retrieve various information of a specific MSISDN
574
+ (operator, country…) as well as the list of all products configured for
575
+ your specific account and the destination operator of the MSISDN. Returns
576
+ relevant information on a MSISDN (operator, country…) as well as the list
577
+ of products configured for your account and the destination operator
578
+ linked to that MSISDN. Allows to check if a MSISDN is subjected to a
579
+ promotion</p>
580
+
581
+ <p>destination_msisdn Destination MSISDN (usually recipient phone number).
582
+ This is the destination phone number that will be credited with the amount
583
+ transferred. Format is similar to “msisdn” and restricted to international
584
+ phone number only.</p>
585
+
586
+ <p>delivered_amount_info Setting this to “1” will return the fields
587
+ local_info_amount_list,local_info_currency and local_info_value_list in the
588
+ API response. Blank or “no” if you do not want this returned.
589
+ return_service_fee Setting this to “1” will return the field
590
+ service_fee_list in the API response. Blank or “0” if you do not want it
591
+ returned. operatorid Operator ID of the receiving operator that must be
592
+ used when treating the request. If set, the platform will be forced to use
593
+ this operator ID and will not identify the operator of the destination
594
+ MSISDN based on the numbering plan. It is very useful in case of countries
595
+ with number portability if you are able to know the destination operator.</p>
596
+
597
+ <p>return_promo Setting this to “1” will return the current promotion related
598
+ to the transaction’s operator.</p>
599
+
600
+
601
+ </div>
602
+ </div>
603
+ <div class="tags">
604
+
605
+
606
+ </div><table class="source_code">
607
+ <tr>
608
+ <td>
609
+ <pre class="lines">
610
+
611
+
612
+ 149
613
+ 150
614
+ 151
615
+ 152
616
+ 153
617
+ 154
618
+ 155
619
+ 156
620
+ 157
621
+ 158
622
+ 159
623
+ 160</pre>
624
+ </td>
625
+ <td>
626
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 149</span>
627
+
628
+ <span class='kw'>def</span> <span class='id identifier rubyid_msisdn_info'>msisdn_info</span><span class='lparen'>(</span><span class='id identifier rubyid_destination_msisdn'>destination_msisdn</span><span class='comma'>,</span>
629
+ <span class='id identifier rubyid_operator_id'>operator_id</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span>
630
+ <span class='id identifier rubyid_delivered_amount_info'>delivered_amount_info</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_return_service_fee'>return_service_fee</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_return_promo'>return_promo</span><span class='op'>=</span><span class='int'>1</span><span class='rparen'>)</span>
631
+ <span class='ivar'>@params</span> <span class='op'>=</span> <span class='lbrace'>{</span>
632
+ <span class='label'>destination_msisdn:</span> <span class='id identifier rubyid_destination_msisdn'>destination_msisdn</span><span class='comma'>,</span>
633
+ <span class='label'>delivered_amount_info:</span> <span class='id identifier rubyid_delivered_amount_info'>delivered_amount_info</span><span class='comma'>,</span>
634
+ <span class='label'>return_service_fee:</span> <span class='id identifier rubyid_return_service_fee'>return_service_fee</span><span class='comma'>,</span>
635
+ <span class='label'>return_promo:</span> <span class='id identifier rubyid_return_promo'>return_promo</span>
636
+ <span class='rbrace'>}</span>
637
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_oid'>oid</span> <span class='op'>=</span> <span class='id identifier rubyid_operator_id'>operator_id</span>
638
+ <span class='id identifier rubyid_run_action'>run_action</span> <span class='symbol'>:msisdn_info</span>
639
+ <span class='kw'>end</span></pre>
640
+ </td>
641
+ </tr>
642
+ </table>
643
+ </div>
644
+
645
+ <div class="method_details ">
646
+ <h3 class="signature " id="operator_list-instance_method">
647
+
648
+ #<strong>operator_list</strong>(country_aid) &#x21d2; <tt>Object</tt>
649
+
650
+
651
+
652
+
653
+
654
+ </h3><div class="docstring">
655
+ <div class="discussion">
656
+
657
+ <p>Convenience method to get the operators list for a given country</p>
658
+
659
+
660
+ </div>
661
+ </div>
662
+ <div class="tags">
663
+
664
+
665
+ </div><table class="source_code">
666
+ <tr>
667
+ <td>
668
+ <pre class="lines">
669
+
670
+
671
+ 249</pre>
672
+ </td>
673
+ <td>
674
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 249</span>
675
+
676
+ <span class='kw'>def</span> <span class='id identifier rubyid_operator_list'>operator_list</span><span class='lparen'>(</span><span class='id identifier rubyid_country_aid'>country_aid</span><span class='rparen'>)</span> <span class='id identifier rubyid_price_list'>price_list</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>country</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_country_aid'>country_aid</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
677
+ </td>
678
+ </tr>
679
+ </table>
680
+ </div>
681
+
682
+ <div class="method_details ">
683
+ <h3 class="signature " id="ping-instance_method">
684
+
685
+ #<strong>ping</strong> &#x21d2; <tt>Object</tt>
686
+
687
+
688
+
689
+
690
+
691
+ </h3><div class="docstring">
692
+ <div class="discussion">
693
+
694
+ <p>Test the connection to the Airtime API. Can be used for keep-alive.</p>
695
+
696
+
697
+ </div>
698
+ </div>
699
+ <div class="tags">
700
+
701
+
702
+ </div><table class="source_code">
703
+ <tr>
704
+ <td>
705
+ <pre class="lines">
706
+
707
+
708
+ 5
709
+ 6
710
+ 7</pre>
711
+ </td>
712
+ <td>
713
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 5</span>
714
+
715
+ <span class='kw'>def</span> <span class='id identifier rubyid_ping'>ping</span>
716
+ <span class='id identifier rubyid_run_action'>run_action</span> <span class='symbol'>:ping</span>
717
+ <span class='kw'>end</span></pre>
718
+ </td>
719
+ </tr>
720
+ </table>
721
+ </div>
722
+
723
+ <div class="method_details ">
724
+ <h3 class="signature " id="price_list-instance_method">
725
+
726
+ #<strong>price_list</strong>(info_type, content = nil) &#x21d2; <tt>Object</tt>
727
+
728
+
729
+
730
+
731
+
732
+ </h3><div class="docstring">
733
+ <div class="discussion">
734
+
735
+ <p>These methods are used to retrieve coverage and pricelist offered to you.
736
+ parameters</p>
737
+
738
+ <h6 id="label-"></h6>
739
+
740
+ <p>info_type</p>
741
+ <hr>
742
+
743
+ <pre class="code ruby"><code class="ruby"> i) “countries”: Returns a list of all countries offered to you
744
+ ii) “country” : Returns a list of operators in the country</code></pre>
745
+
746
+ <p>iii) “operator” : Returns a list of wholesale and retail price for the
747
+ operator</p>
748
+
749
+ <p>content</p>
750
+ <hr>
751
+
752
+ <pre class="code ruby"><code class="ruby"> i) Not used if info_type = “countries”
753
+ ii) countryid of the requested country if info_type = “country”</code></pre>
754
+
755
+ <p>iii) operatorid of the requested operator if info_type = “operator”</p>
756
+
757
+
758
+ </div>
759
+ </div>
760
+ <div class="tags">
761
+
762
+
763
+ </div><table class="source_code">
764
+ <tr>
765
+ <td>
766
+ <pre class="lines">
767
+
768
+
769
+ 238
770
+ 239
771
+ 240
772
+ 241
773
+ 242</pre>
774
+ </td>
775
+ <td>
776
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 238</span>
777
+
778
+ <span class='kw'>def</span> <span class='id identifier rubyid_price_list'>price_list</span><span class='lparen'>(</span><span class='id identifier rubyid_info_type'>info_type</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
779
+ <span class='ivar'>@params</span><span class='lbracket'>[</span><span class='symbol'>:info_type</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_info_type'>info_type</span>
780
+ <span class='id identifier rubyid_content'>content</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@params</span><span class='lbracket'>[</span><span class='symbol'>:content</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_content'>content</span>
781
+ <span class='id identifier rubyid_run_action'>run_action</span> <span class='symbol'>:pricelist</span>
782
+ <span class='kw'>end</span></pre>
783
+ </td>
784
+ </tr>
785
+ </table>
786
+ </div>
787
+
788
+ <div class="method_details ">
789
+ <h3 class="signature " id="product_list-instance_method">
790
+
791
+ #<strong>product_list</strong>(operator_aid) &#x21d2; <tt>Object</tt>
792
+
793
+
794
+
795
+
796
+
797
+ </h3><div class="docstring">
798
+ <div class="discussion">
799
+
800
+ <p>Convenience method to get the product list for a given operator</p>
801
+
802
+
803
+ </div>
804
+ </div>
805
+ <div class="tags">
806
+
807
+
808
+ </div><table class="source_code">
809
+ <tr>
810
+ <td>
811
+ <pre class="lines">
812
+
813
+
814
+ 253</pre>
815
+ </td>
816
+ <td>
817
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 253</span>
818
+
819
+ <span class='kw'>def</span> <span class='id identifier rubyid_product_list'>product_list</span><span class='lparen'>(</span><span class='id identifier rubyid_operator_aid'>operator_aid</span><span class='rparen'>)</span> <span class='id identifier rubyid_price_list'>price_list</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>operator</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_operator_aid'>operator_aid</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
820
+ </td>
821
+ </tr>
822
+ </table>
823
+ </div>
824
+
825
+ <div class="method_details ">
826
+ <h3 class="signature " id="reserve_id-instance_method">
827
+
828
+ #<strong>reserve_id</strong> &#x21d2; <tt>Object</tt>
829
+
830
+
831
+
832
+
833
+
834
+ </h3><div class="docstring">
835
+ <div class="discussion">
836
+
837
+ <p>This method is used to reserve an ID in the system. This ID can then be
838
+ used in the “topup” or “simulation” requests. This way, your system knows
839
+ the ID of the transaction before sending the request to TransferTo (else it
840
+ will only be displayed in the response).</p>
841
+
842
+
843
+ </div>
844
+ </div>
845
+ <div class="tags">
846
+
847
+
848
+ </div><table class="source_code">
849
+ <tr>
850
+ <td>
851
+ <pre class="lines">
852
+
853
+
854
+ 166
855
+ 167
856
+ 168</pre>
857
+ </td>
858
+ <td>
859
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 166</span>
860
+
861
+ <span class='kw'>def</span> <span class='id identifier rubyid_reserve_id'>reserve_id</span>
862
+ <span class='id identifier rubyid_run_action'>run_action</span> <span class='symbol'>:reserve_id</span>
863
+ <span class='kw'>end</span></pre>
864
+ </td>
865
+ </tr>
866
+ </table>
867
+ </div>
868
+
869
+ <div class="method_details ">
870
+ <h3 class="signature " id="topup-instance_method">
871
+
872
+ #<strong>topup</strong>(msisdn, destination_msisdn, product, method = &#39;topup&#39;, reserved_id = nil, send_sms = true, sms = nil, sender_text = nil, operator_id = nil, return_service_fee = 1, delivered_amount_info = 1, return_timestamp = 1, return_version = 1, return_promo = 0) &#x21d2; <tt>Object</tt>
873
+
874
+
875
+
876
+
877
+
878
+ </h3><div class="docstring">
879
+ <div class="discussion">
880
+
881
+ <p>By default, an SMS notification is sent to the recipient after every
882
+ successful Top-up. The default originating address for the SMS is “8888”.
883
+ The following is the default SMS which is translated into local languages
884
+ for most of recipient countries: Congratulations! You&#39;ve received
885
+ AMOUNT_CURRENCY from SENDER. Thank you for using TransferTo. FREE_TEXT. •
886
+ AMOUNT CURRENCY is the amount that has been sent with the currency.
887
+ • SENDER can be a name or a phone number. • FREE_TEXT is the content of
888
+ the field named “sms” of the topup method.</p>
889
+
890
+
891
+ </div>
892
+ </div>
893
+ <div class="tags">
894
+
895
+
896
+ </div><table class="source_code">
897
+ <tr>
898
+ <td>
899
+ <pre class="lines">
900
+
901
+
902
+ 78
903
+ 79
904
+ 80
905
+ 81
906
+ 82
907
+ 83
908
+ 84
909
+ 85
910
+ 86
911
+ 87
912
+ 88
913
+ 89
914
+ 90
915
+ 91
916
+ 92
917
+ 93
918
+ 94
919
+ 95
920
+ 96
921
+ 97
922
+ 98
923
+ 99
924
+ 100
925
+ 101
926
+ 102
927
+ 103
928
+ 104
929
+ 105
930
+ 106
931
+ 107
932
+ 108
933
+ 109
934
+ 110
935
+ 111
936
+ 112
937
+ 113
938
+ 114
939
+ 115
940
+ 116
941
+ 117
942
+ 118
943
+ 119
944
+ 120
945
+ 121
946
+ 122
947
+ 123
948
+ 124
949
+ 125</pre>
950
+ </td>
951
+ <td>
952
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 78</span>
953
+
954
+ <span class='kw'>def</span> <span class='id identifier rubyid_topup'>topup</span><span class='lparen'>(</span><span class='id identifier rubyid_msisdn'>msisdn</span><span class='comma'>,</span> <span class='id identifier rubyid_destination_msisdn'>destination_msisdn</span><span class='comma'>,</span> <span class='id identifier rubyid_product'>product</span><span class='comma'>,</span> <span class='id identifier rubyid_method'>method</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>topup</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
955
+ <span class='id identifier rubyid_reserved_id'>reserved_id</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_send_sms'>send_sms</span><span class='op'>=</span><span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_sms'>sms</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_sender_text'>sender_text</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_operator_id'>operator_id</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span>
956
+ <span class='id identifier rubyid_return_service_fee'>return_service_fee</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_delivered_amount_info'>delivered_amount_info</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_return_timestamp'>return_timestamp</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_return_version'>return_version</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span>
957
+ <span class='id identifier rubyid_return_promo'>return_promo</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span>
958
+
959
+ <span class='ivar'>@params</span> <span class='op'>=</span> <span class='lbrace'>{</span>
960
+ <span class='label'>msisdn:</span> <span class='id identifier rubyid_msisdn'>msisdn</span><span class='comma'>,</span>
961
+ <span class='label'>destination_msisdn:</span> <span class='id identifier rubyid_destination_msisdn'>destination_msisdn</span><span class='comma'>,</span>
962
+ <span class='label'>product:</span> <span class='id identifier rubyid_product'>product</span>
963
+ <span class='rbrace'>}</span>
964
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_oid'>oid</span> <span class='op'>=</span> <span class='id identifier rubyid_operator_id'>operator_id</span>
965
+
966
+ <span class='ivar'>@params</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='lbrace'>{</span>
967
+ <span class='label'>cid1:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>cid2:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>cid3:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
968
+ <span class='label'>reserved_id:</span> <span class='id identifier rubyid_reserved_id'>reserved_id</span><span class='comma'>,</span>
969
+ <span class='label'>sender_sms:</span> <span class='lparen'>(</span><span class='id identifier rubyid_sender_text'>sender_text</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>yes</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>no</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='comma'>,</span>
970
+ <span class='label'>send_sms:</span> <span class='lparen'>(</span><span class='id identifier rubyid_send_sms'>send_sms</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>yes</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>no</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='comma'>,</span>
971
+ <span class='label'>sms:</span> <span class='id identifier rubyid_sms'>sms</span><span class='comma'>,</span>
972
+ <span class='label'>sender_text:</span> <span class='id identifier rubyid_sender_text'>sender_text</span><span class='comma'>,</span>
973
+ <span class='label'>delivered_amount_info:</span> <span class='id identifier rubyid_delivered_amount_info'>delivered_amount_info</span><span class='comma'>,</span>
974
+ <span class='label'>return_service_fee:</span> <span class='id identifier rubyid_return_service_fee'>return_service_fee</span><span class='comma'>,</span>
975
+ <span class='label'>return_timestamp:</span> <span class='id identifier rubyid_return_timestamp'>return_timestamp</span><span class='comma'>,</span>
976
+ <span class='label'>return_version:</span> <span class='id identifier rubyid_return_version'>return_version</span><span class='comma'>,</span>
977
+ <span class='label'>return_promo:</span> <span class='id identifier rubyid_return_promo'>return_promo</span>
978
+ <span class='rbrace'>}</span><span class='rparen'>)</span>
979
+
980
+ <span class='id identifier rubyid_run_action'>run_action</span> <span class='id identifier rubyid_method'>method</span>
981
+ <span class='comment'>#{
982
+ </span> <span class='comment'># requesting_msisdn: response[:msisdn],
983
+ </span> <span class='comment'># destination_msisdn: response[:destination_msisdn],
984
+ </span> <span class='comment'># product_sent: response[:actual_product_sent].to_i,
985
+ </span> <span class='comment'># local_amount: response[:local_info_amount],
986
+ </span> <span class='comment'># local_value: response[:local_info_value],
987
+ </span> <span class='comment'># local_currency_code: response[:local_info_currency],
988
+ </span> <span class='comment'># transaction_status: response[:error_txt],
989
+ </span> <span class='comment'># operation_result: response[:error_code],
990
+ </span> <span class='comment'># operation_info: response[:info_txt],
991
+ </span> <span class='comment'># transaction_api_id: response[:transactionid].to_i,
992
+ </span> <span class='comment'># country_api_id: response[:countryid].to_i,
993
+ </span> <span class='comment'># operator_api_id: response[:operatorid].to_i,
994
+ </span> <span class='comment'># product_api_id: response[:product_requested].to_i,
995
+ </span> <span class='comment'># originator_currency_code: response[:originating_currency],
996
+ </span> <span class='comment'># destination_currency_code: response[:destination_currency],
997
+ </span> <span class='comment'># wholesale_price: response[:wholesale_price],
998
+ </span> <span class='comment'># retail_price: response[:retail_price],
999
+ </span> <span class='comment'># service_fee: response[:service_fee]
1000
+ </span> <span class='comment'>#}
1001
+ </span><span class='kw'>end</span></pre>
1002
+ </td>
1003
+ </tr>
1004
+ </table>
1005
+ </div>
1006
+
1007
+ <div class="method_details ">
1008
+ <h3 class="signature " id="trans_info-instance_method">
1009
+
1010
+ #<strong>trans_info</strong>(id) &#x21d2; <tt>Object</tt>
1011
+
1012
+
1013
+
1014
+
1015
+
1016
+ </h3><div class="docstring">
1017
+ <div class="discussion">
1018
+
1019
+ <p>Retrieve available information on a specific transaction. Please note that
1020
+ values of “input_value” and “debit_amount_validated” are rounded to 2
1021
+ digits after the comma but are the same as the values returned in the
1022
+ fields “input_value” and “validated_input_value” of the “topup” method
1023
+ response.</p>
1024
+
1025
+
1026
+ </div>
1027
+ </div>
1028
+ <div class="tags">
1029
+
1030
+
1031
+ </div><table class="source_code">
1032
+ <tr>
1033
+ <td>
1034
+ <pre class="lines">
1035
+
1036
+
1037
+ 212
1038
+ 213
1039
+ 214
1040
+ 215</pre>
1041
+ </td>
1042
+ <td>
1043
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 212</span>
1044
+
1045
+ <span class='kw'>def</span> <span class='id identifier rubyid_trans_info'>trans_info</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
1046
+ <span class='ivar'>@params</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>transactionid:</span> <span class='id identifier rubyid_id'>id</span> <span class='rbrace'>}</span>
1047
+ <span class='id identifier rubyid_run_action'>run_action</span> <span class='symbol'>:trans_info</span>
1048
+ <span class='kw'>end</span></pre>
1049
+ </td>
1050
+ </tr>
1051
+ </table>
1052
+ </div>
1053
+
1054
+ <div class="method_details ">
1055
+ <h3 class="signature " id="trans_list-instance_method">
1056
+
1057
+ #<strong>trans_list</strong>(start = (Time.now-24.hours), stop = Time.now, msisdn = nil, destination = nil, code = nil) &#x21d2; <tt>Object</tt>
1058
+
1059
+
1060
+
1061
+
1062
+
1063
+ </h3><div class="docstring">
1064
+ <div class="discussion">
1065
+
1066
+ <p>This method is used to retrieve the list of transactions performed within
1067
+ the date range by the MSISDN if set. Note that both dates are included
1068
+ during the search.</p>
1069
+
1070
+ <p>parameters</p>
1071
+
1072
+ <h6 id="label-"></h6>
1073
+
1074
+ <p>msisdn</p>
1075
+ <hr>
1076
+
1077
+ <p>The format must be international with or without the ‘+’ or ‘00’:
1078
+ “6012345678” or “+6012345678” or “006012345678” (Malaysia)</p>
1079
+
1080
+ <p>destination_msisdn</p>
1081
+ <hr>
1082
+
1083
+ <p>The format must be international with or without the ‘+’ or ‘00’:
1084
+ “6012345678” or “+6012345678” or “006012345678” (Malaysia)</p>
1085
+
1086
+ <p>code</p>
1087
+ <hr>
1088
+
1089
+ <p>The error_code of the transactions to search for. E.g “0” to search for
1090
+ only all successful transactions. If left empty, all transactions will be
1091
+ returned(Failed and successful).</p>
1092
+
1093
+ <p>start_date</p>
1094
+ <hr>
1095
+
1096
+ <p>Defines the start date of the search. Format must be YYYY-MM-DD.</p>
1097
+
1098
+ <p>stop_date</p>
1099
+ <hr>
1100
+
1101
+ <p>Defines the end date of the search (included). Format must be YYYY-MM-DD.</p>
1102
+
1103
+
1104
+ </div>
1105
+ </div>
1106
+ <div class="tags">
1107
+
1108
+
1109
+ </div><table class="source_code">
1110
+ <tr>
1111
+ <td>
1112
+ <pre class="lines">
1113
+
1114
+
1115
+ 199
1116
+ 200
1117
+ 201
1118
+ 202
1119
+ 203
1120
+ 204
1121
+ 205
1122
+ 206</pre>
1123
+ </td>
1124
+ <td>
1125
+ <pre class="code"><span class="info file"># File 'lib/t2_airtime/api.rb', line 199</span>
1126
+
1127
+ <span class='kw'>def</span> <span class='id identifier rubyid_trans_list'>trans_list</span><span class='lparen'>(</span><span class='id identifier rubyid_start'>start</span><span class='op'>=</span><span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='op'>-</span><span class='int'>24</span><span class='period'>.</span><span class='id identifier rubyid_hours'>hours</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_stop'>stop</span><span class='op'>=</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='comma'>,</span> <span class='id identifier rubyid_msisdn'>msisdn</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_destination'>destination</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_code'>code</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
1128
+ <span class='ivar'>@params</span><span class='lbracket'>[</span><span class='symbol'>:code</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_code'>code</span> <span class='kw'>unless</span> <span class='id identifier rubyid_code'>code</span>
1129
+ <span class='ivar'>@params</span><span class='lbracket'>[</span><span class='symbol'>:msisdn</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_msisdn'>msisdn</span> <span class='kw'>unless</span> <span class='id identifier rubyid_msisdn'>msisdn</span>
1130
+ <span class='ivar'>@params</span><span class='lbracket'>[</span><span class='symbol'>:stop_date</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_to_yyyymmdd'>to_yyyymmdd</span><span class='lparen'>(</span><span class='id identifier rubyid_stop'>stop</span><span class='rparen'>)</span>
1131
+ <span class='ivar'>@params</span><span class='lbracket'>[</span><span class='symbol'>:start_date</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_to_yyyymmdd'>to_yyyymmdd</span><span class='lparen'>(</span><span class='id identifier rubyid_start'>start</span><span class='rparen'>)</span>
1132
+ <span class='ivar'>@params</span><span class='lbracket'>[</span><span class='symbol'>:destination_msisdn</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_destination'>destination</span> <span class='kw'>unless</span> <span class='id identifier rubyid_destination'>destination</span>
1133
+ <span class='id identifier rubyid_run_action'>run_action</span> <span class='symbol'>:trans_list</span>
1134
+ <span class='kw'>end</span></pre>
1135
+ </td>
1136
+ </tr>
1137
+ </table>
1138
+ </div>
1139
+
1140
+ </div>
1141
+
1142
+ </div>
1143
+
1144
+ <div id="footer">
1145
+ Generated on Sun Aug 27 17:54:43 2017 by
1146
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1147
+ 0.9.9 (ruby-2.3.3).
1148
+ </div>
1149
+
1150
+ </div>
1151
+ </body>
1152
+ </html>