docs/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>apiary</title>
</head>
<body>
<script src="https://api.apiary.io/seeds/embed.js"></script>
<script>
var embed = new Apiary.Embed({
apiBlueprint: "FORMAT: 1A\nHOST: http://polls.apiblueprint.org/\n\n# t2-airtime\n\nT2-Airtime is a Ruby gem providing a proxy cache and a REST API to [TransferTo](https://www.transfer-to.com/home) Airtime service.\n\n## Authorization\n\n+ Two Factor Authentication (2FA) is enabled in your [TransferTo Shop](https://shop.transferto.com) Security Center section\n+ You have your Transfer-To Shop username and Airtime secret key generated by 2FA\n+ Export the secrets as environment variables `T2_SHOP_USER`, `T2_AIRTIME_KEY`\n \n# Account\n\n```ruby\nirb(main)> account= T2Airtime::Account.get\nirb(main)> T2Airtime::Account.serialize(account.data)\n```\n\n## Account Attributes\n- `id` (string) - Transfer-To TShop login name\n- `type` (string) - `Master` (main account) or `Retailer` (subaccount)\n- `name` (string) - Transfer-To TShop account name\n- `currency` (string) - Account currency (USD, GBP, EUR, etc...)\n- `balance` (float) - For `Master` account returns the account’s remaining balance. \nFor `Retailer` returns the account’s remaining limit balance of the day \nif a daily limit is fixed. Else, returns the account remaining balance\n- `wallet` (float) - For `Master` returns the total remaining balance (sum \nof all sub-accounts and current master). For `Retailer`: \n 1. If balance is shared and daily limit is fixed: returns the fixed daily limit amount \n 2. If balance is shared but daily limit is not fixed: returns \"No Limit\"\n 3. Else if balance is not shared: returns the remaining balance \n- `fetchedAt` (string) - The date and time at which the information was fetched \n\n# Country\n\n```ruby\nirb(main)> countries= T2Airtime::Country.all\nirb(main)> T2Airtime::Country.serialize(countries.data)\n```\n\n## Country Attributes\n- `id` (integer) - Country Airtime ID\n- `name` (string) - The country name\n- `alpha3` (string) - The alpha3 code of the country\n- `callingCode` (float) - The international dialing code of the country\n- `fetchedAt` (string) - The date and time at which the information was fetched\n\n# Operator\n\n```ruby\nirb(main)> operators= T2Airtime::Operator.all(666)\nirb(main)> T2Airtime::Operator.serialize(operators.data)\n```\n\n## Operator Attributes\n- `id` (integer) - Operator Airtime ID\n- `name` (string) - The operator name\n- `logo` (string) - The URL to the operator logo\n- `countryId` (float) - The country Airtime ID of the operator\n- `countryName` (float) - The country name\n- `countryAlpha3` (float) - The country alpha3\n- `fetchedAt` (string) - The date and time at which the information was fetched\n\n## Operator Relationships\n- `country.id` (integer) - Country Airtime ID\n\n# Product\n\n```ruby\nirb(main)> products= T2Airtime::Product.all(2361)\nirb(main)> T2Airtime::Product.serialize(products.data)\n```\n\n## Product Attributes\n- `id` (integer) - Product Airtime ID\n- `name` (string) - The product name\n- `localCurrency` (string) - The currency code of the product\n- `localCurrencySymbol` (string) - The currency symbol of the product\n- `currency` (string) - The curreny of your account\n- `currencySymbol` (string) - The currency symbol of your account\n- `localPrice` (float) - The face-value of the topup\n- `retailPrice` (float) - The retail price of the product\n- `wholesalePrice` (float) - The wholesale price of the product\n- `countryId` (float) - The country Airtime ID of the product\n- `countryName` (float) - The country name\n- `countryAlpha3` (float) - The country alpha3\n- `operatorId` (string) - The operator Airtime ID of the product\n- `operatorName` (string) - The operator name\n- `operatorLogo` (string) - The URL to the operator logo\n- `fetchedAt` (string) - The date and time at which the information was fetched\n\n## Product Relationships\n- `country.id` (integer) - Country Airtime ID\n- `operator.id` (integer) - Operator Airtime ID\n\n# Transaction\n\n```ruby\nirb(main)> transactions= T2Airtime::API.api.transaction_list\nirb(main)> T2Airtime::Transaction.serialize(transactions.data)\n```\n\n```ruby\nirb(main)> transaction= T2Airtime::Transaction.get(\"584171224\")\nirb(main)> T2Airtime::Transaction.serialize_one(transaction.data)\n```\n\n## Transaction Attributes\n- `id` (integer) - Transaction Airtime ID\n- `msisdn` (string) - The international phone number or name of \nthe user (sender) requesting to credit a phone number\n- `destinationMsisdn` (string) - Destination MSISDN (usually recipient phone number)\n- `transactionAuthenticationKey` (string) - Authentication key used during the transaction\n- `transactionErrorCode` (string) - Error code for the transaction\n- `transactionErrorTxt` (string) - Description of the error code for the transaction\n- `referenceOperator` (string) - Reference of the operator (returned only if available)\n- `actualProductSent` (string) - Returns the value requested to the operator \n(equals to product_requested in case of successful transaction). It equals to 0 when Top-up \nfailed or in a simulation.\n- `sms` (string) - The custom message appended to the default notification SMS sent \nto the recipient\n- `cid1` (string) - Value of the customized field cid1 sent in the Top-up request\n- `cid2` (string) - Value of the customized field cid2 sent in the Top-up request\n- `cid3` (string) - Value of the customized field cid3 sent in the Top-up request\n- `date` (string) - Date of the transaction (GMT) \n- `currency` (string) - Currency of the account from which the transaction is requested\n- `localCurrency` (string) - Currency of the destination country\n- `pinBased` (string) - Type of product returned (\"Yes\", default \"No\" if not set)\n- `localInfoAmount` (string) - Final amount received by recipient. Indicative value only\n- `localInfoCurrency` (string) - Local currency in destination\n- `localInfoValue` (string) - Value of the transaction before tax and service fee in local currency\n- `errorCode` (string) - Error code for the transaction\n- `errorTxt` (string) - Description of the error code for the transaction\n- `productName` (string) - The product name\n- `productLocalCurrency` (string) - The currency code of the product\n- `productLocalCurrencySymbol` (string) - The currency symbol of the product\n- `productCurrency` (string) - The curreny of your account\n- `productCurrencySymbol` (string) - The currency symbol of your account\n- `productLocalPrice` (float) - The face-value of the topup\n- `productRetailPrice` (float) - The retail price of the product\n- `productWholesalePrice` (float) - The wholesale price of the product\n- `countryId` (float) - The country Airtime ID of the product\n- `countryName` (float) - The country name\n- `countryAlpha3` (float) - The country alpha3\n- `operatorId` (string) - The operator Airtime ID of the product\n- `operatorName` (string) - The operator name\n- `operatorLogo` (string) - The URL to the operator logo\n- `fetchedAt` (string) - The date and time at which the information was fetched\n\n## Transaction Relationships\n- `country.id` (integer) - Country Airtime ID\n- `operator.id` (integer) - Operator Airtime ID\n- `product.id` (integer) - Product Airtime ID\n\n# Topup\n\n```ruby\nirb(main)> topup= T2Airtime::API.api.topup params\nirb(main)> T2Airtime::Topup.serialize(topup.data)\n```\n\n## Topup Attributes\n- `balance` (string) - For main account: returns the account’s remaining\nbalance. For sub-account: returns the account’s remaining\nlimit balance of the day if a daily limit is fixed. Else,\nreturns the account remaining balance.\n- `balanceDisplay` (string) - The `balance` value formatted in the currency of your account\n- `transactionId` (integer) - Airtime ID of the transaction.\n- `msisdn` (string) - The international phone number or name of \nthe user (sender) requesting to credit a phone number\n- `destinationMsisdn` (string) - Destination MSISDN (usually recipient phone number)\n- `transactionAuthenticationKey` (string) - Authentication key used during the transaction\n- `transactionErrorCode` (string) - Error code for the transaction\n- `transactionErrorTxt` (string) - Description of the error code for the transaction\n- `referenceOperator` (string) - Reference of the operator (returned only if available)\n- `actualProductSent` (string) - Returns the value requested to the operator \n(equals to product_requested in case of successful transaction). It equals to 0 when Top-up \nfailed or in a simulation.\n- `sms` (string) - The custom message appended to the default notification SMS sent \nto the recipient\n- `smsSent` (string) - Defines the status of the notification SMS sent to the\nrecipient. Returns `yes` only if the SMS has been successfully sent.\n- `smsText` (string) - The custom message appended to the default\nnotification SMS sent to the sender.\n- `cid1` (string) - Value of the customized field cid1 sent in the Top-up request\n- `cid2` (string) - Value of the customized field cid2 sent in the Top-up request\n- `cid3` (string) - Value of the customized field cid3 sent in the Top-up request\n- `currency` (string) - Currency of the account from which the transaction is requested\n- `localCurrency` (string) - Currency of the destination country\n- `productName` (string) - The product name\n- `productLocalCurrency` (string) - The currency code of the product\n- `productLocalCurrencySymbol` (string) - The currency symbol of the product\n- `productCurrency` (string) - The curreny of your account\n- `productCurrencySymbol` (string) - The currency symbol of your account\n- `productLocalPrice` (float) - The face-value of the topup\n- `productRetailPrice` (float) - The retail price of the product\n- `productWholesalePrice` (float) - The wholesale price of the product\n- `countryId` (float) - The country Airtime ID of the product\n- `countryName` (float) - The country name\n- `countryAlpha3` (float) - The country alpha3\n- `operatorId` (string) - The operator Airtime ID of the product\n- `operatorName` (string) - The operator name\n- `operatorLogo` (string) - The URL to the operator logo\n- `executedAt` (string) - The date and time at which the information was fetched\n\n# Msisdn\n\n```ruby\nirb(main)> msisdn= T2Airtime::Msisdn.info(\"+628123456710\")\nirb(main)> T2Airtime::Msisdn.serialize(msisdn.data)\n```\n\n## Msisdn Attributes\n- `msisdn` (string) - The international mobile number\n- `country` (string) - The country of the number\n- `countryId` (string) - Country Airtime ID\n- `operator` (string) - The operator of the number\n- `operatorId` (string) - Operator Airtime ID\n- `fetchedAt` (string) - The date and time at which the information was fetched\n\n## Accounts [/accounts]\nCached for 1 hour.\n\n### Show Account [GET]\n+ Response 200 (application/json)\n\n {\n \"type\": \"accounts\", \n \"id\": \"my-t2-shop-account\", \n \"attributes\": {\n \"type\": \"Master\", \n \"name\": \"my-t2-shop-account-name\", \n \"currency\": \"USD\", \n \"balance\": 16.2, \n \"wallet\": 16.2, \n \"fetchedAt\": \"2017-09-17T13:48:34Z\"\n }\n }\n\n## Countries [/countries]\nCached for 1 hour.\n\n### List all Countries [GET]\n\n+ Response 200 (application/json)\n\n [\n {\n \"type\": \"countries\" \n \"id\": 661\n \"attributes\": {\n \"name\": \"Afghanistan\" \n \"alpha3\": \"AFG\"\n \"callingCode\": \"93\"\n \"fetchedAt\": \"2017-09-17T13:58:46Z\"\n }\n }\n ...\n ]\n\n## Operators [/operators]\n\n### List all Operators [GET]\nCached for 1 hour.\n\n+ Response 200 (application/json)\n\n [\n {\n \"type\": \"operators\"\n \"id\": 2361\n \"attributes\": {\n \"name\": \"Movicel Angola USD\" \n \"logo\": \"https://operator-logo.transferto.com/logo-2361-1.png\"\n \"countryId\": 666\n \"countryName\": \"Angola\"\n \"countryAlpha3\": \"AGO\" \n \"fetchedAt\": \"2017-09-17T16:44:08Z\"\n },\n \"relationships\": {\n \"country\": {\n \"data\":{\n \"type\": \"countries\"\n \"id\": 666\n }\n }\n }\n },\n ...\n ]\n\n## Products [/products]\nCached for 1 hour.\n\n### List all Products [GET]\n\n+ Response 200 (application/json)\n\n [\n {\n \"type\": \"products\"\n \"id\": 1\n \"attributes\": {\n \"name\": \"$1.00\"\n \"localCurrency\": \"USD\"\n \"localCurrencySymbol\": \"$\"\n \"currency\": \"USD\"\n \"currencySymbol\": \"$\"\n \"localPrice\": 1.0\n \"retailPrice\": 1.1\n \"wholesalePrice\": 1.03\n \"countryId\": 666\n \"countryName\": \"Angola\"\n \"countryAlpha3\": \"AGO\"\n \"operatorId\": 2361\n \"operatorName\": \"Movicel Angola USD\"\n \"operatorLogo\": \"https://operator-logo.transferto.com/logo-2361-1.png\"\n \"fetchedAt\": \"2017-09-17T16:48:20Z\"\n },\n \"relationships\": {\n \"country\": {\n \"data\": {\n \"type\": \"countries\"\n \"id\": 666\n }\n },\n \"operator\": {\n \"data\": {\n \"type\": \"operators\"\n \"id\": 2361\n }\n }\n },\n ...\n ]\n\n## Transactions [/transactions]\n\n### List all Transactions [GET]\n\n+ Response 200 (application/json)\n\n [\n {\n \"type\": \"transactions\"\n \"id\": 584176053\n \"attributes\": {\n \"msisdn\": \"+393800000000\"\n \"destinationMsisdn\": \"393800000001\"\n \"transactionAuthenticationKey\": \"1505553036\"\n \"transactionErrorCode\": 0\n \"transactionErrorTxt\": \"Transaction successful\"\n \"referenceOperator\": nil\n \"actualProductSent\": \"5\"\n \"sms\": nil\n \"smsText\": \"Test\"\n \"cid1\": \"Cid1\"\n \"cid2\": \"Cid2\"\n \"cid3\": \"Cid3\"\n \"date\": \"2017-09-16 09:10:39\"\n \"currency\": \"USD\"\n \"localCurrency\": \"EUR\"\n \"pinBased\": \"no\"\n \"localInfoAmount\": \"5.00\"\n \"localInfoCurrency\": \"EUR\"\n \"localInfoValue\": \"5.00\"\n \"errorCode\": 0\n \"errorTxt\": \"Transaction successful\"\n \"countryId\": 772\n \"countryName\": \"Italy\"\n \"countryAlpha3\": \"ITA\"\n \"operatorId\": 734\n \"operatorName\": \"Wind Italy\"\n \"operatorLogo\": \"https://operator-logo.transferto.com/logo-734-1.png\"\n \"productName\": \"€5.00\"\n \"productLocalCurrency\": \"EUR\"\n \"productLocalCurrencySymbol\": \"€\"\n \"productCurrency\": \"USD\"\n \"productCurrencySymbol\": \"$\"\n \"productLocalPrice\": 5.0\n \"productRetailPrice\": 7.5\n \"productWholesalePrice\": 6.9\n \"fetchedAt\": \"2017-09-17T16:56:29Z\"\n },\n \"relationships\": {\n \"country\": {\n \"data\": {\n \"type\": \"countries\"\n \"id\": 772\n }\n },\n \"operator\": {\n \"data\": {\n \"type\": \"operators\"\n \"id\": 734\n }\n },\n \"product\": {\n \"data\": {\n \"type\": \"products\"\n \"id\": 5\n }\n }\n }\n },\n ...\n ]\n\n### Show Transactions [GET]\n\n+ Response 200 (application/json)\n\n {\n \"type\": \"transactions\"\n \"id\": 584176053\n \"attributes\": {\n \"msisdn\": \"+393800000000\"\n \"destinationMsisdn\": \"393800000001\"\n \"transactionAuthenticationKey\": \"1505553036\"\n \"transactionErrorCode\": 0\n \"transactionErrorTxt\": \"Transaction successful\"\n \"referenceOperator\": nil\n \"actualProductSent\": \"5\"\n \"sms\": nil\n \"smsText\": \"Test\"\n \"cid1\": \"Cid1\"\n \"cid2\": \"Cid2\"\n \"cid3\": \"Cid3\"\n \"date\": \"2017-09-16 09:10:39\"\n \"currency\": \"USD\"\n \"localCurrency\": \"EUR\"\n \"pinBased\": \"no\"\n \"localInfoAmount\": \"5.00\"\n \"localInfoCurrency\": \"EUR\"\n \"localInfoValue\": \"5.00\"\n \"errorCode\": 0\n \"errorTxt\": \"Transaction successful\"\n \"countryId\": 772\n \"countryName\": \"Italy\"\n \"countryAlpha3\": \"ITA\"\n \"operatorId\": 734\n \"operatorName\": \"Wind Italy\"\n \"operatorLogo\": \"https://operator-logo.transferto.com/logo-734-1.png\"\n \"productName\": \"€5.00\"\n \"productLocalCurrency\": \"EUR\"\n \"productLocalCurrencySymbol\": \"€\"\n \"productCurrency\": \"USD\"\n \"productCurrencySymbol\": \"$\"\n \"productLocalPrice\": 5.0\n \"productRetailPrice\": 7.5\n \"productWholesalePrice\": 6.9\n \"fetchedAt\": \"2017-09-17T16:56:29Z\"\n },\n \"relationships\": {\n \"country\": {\n \"data\": {\n \"type\": \"countries\"\n \"id\": 772\n }\n },\n \"operator\": {\n \"data\": {\n \"type\": \"operators\"\n \"id\": 734\n }\n },\n \"product\": {\n \"data\": {\n \"type\": \"products\"\n \"id\": 5\n }\n }\n }\n }\n \n### Create (Reserve) Transaction [POST]\n\n+ Response 200 (application/json)\n\n {\n \"type\": \"transactions\"\n \"id\": 584176053\n }\n \n## Number Information [/msisdn_info]\nCached for 24 hours.\n\n### Show Number Information [GET]\n\n+ Response 200 (application/json)\n\n {\n \"type\": \"msisdn\"\n \"msisdn\": \"628123456710\"\n \"country\": \"Indonesia\"\n \"countryId\": \"767\"\n \"operator\": \"AAA-TESTING Indonesia USD\"\n \"operatorId\": \"1562\"\n \"fetchedAt\": \"2017-09-17T17:05:08Z\"\n }\n\n## Topup [/topup]\n\n### Create Topup [POST]\n\n+ Response 200 (application/json)\n\n {\n \"type\": \"msisdn\"\n \"msisdn\": \"628123456710\"\n \"country\": \"Indonesia\"\n \"countryId\": \"767\"\n \"operator\": \"AAA-TESTING Indonesia USD\"\n \"operatorId\": \"1562\"\n \"fetchedAt\": \"2017-09-17T17:05:08Z\"\n }\n"
});
if (false) {
var changed = null
var xhrChanged = new XMLHttpRequest();
var xhrData = new XMLHttpRequest();
setInterval(function() {
xhrChanged.open('GET', window.location.href + "/changed", true);
xhrChanged.send();
xhrChanged.onreadystatechange = function() {
if (xhrChanged.readyState == 4 && xhrChanged.status == 200) {
if (!changed) {
changed = xhrChanged.responseText
}
if (changed != xhrChanged.responseText) {
changed = xhrChanged.responseText
xhrData.open('GET', window.location.href + "/source", true);
xhrData.send();
xhrData.onreadystatechange = function() {
if (xhrData.readyState == 4 && xhrData.status == 200) {
embed.iframeElement.contentWindow.postMessage({"origin": embed.ORIGIN, "eventType": "anonymousPreview", "data": {"code": xhrData.responseText}}, '*');
}
}
}
}
}
}, 1000);
}
</script>
</body>
</html>