README.md in t2_airtime-0.1.9 vs README.md in t2_airtime-0.2.0

- old
+ new

@@ -1,70 +1,70 @@ # TransferTo Airtime API -TransferTo helps businesses offer airtime top-ups, goods and services, and mobile money around the world in real time. -This API enables developers to integrate TransferTo Top-up service into their system. If you are building -application that leverages international recharge services, then this is the API for you. +[TransferTo](https://www.transfer-to.com/home) helps businesses offer airtime top-ups, goods and services, and mobile money around the world in real time. +TransferTo Airtime API enables developers to integrate TransferTo Top-up service into their system. -## Installation +This gem is a convenience wrapper around the Airtime API. Requirements: + Two Factor Authentication (2FA) enabled in your [TransferTo Shop](https://shop.transferto.com) Security Center section. + + +## Usage + +rails new $APPNAME \ + --skip-active-record \ + -d postgresql \ + --skip-yarn \ + --skip-action-cable \ + --skip-sprockets \ + --skip-spring \ + --skip-coffee \ + --skip-javascript \ + --skip-turbolinks \ + --api + Add this line to your application's Gemfile: ```ruby gem 't2_airtime' -``` +``` And then execute: - $ bundle + $ bundle -Or install it yourself as: +Create a `.env` file with the required information: - $ gem install t2_airtime + T2_SHOP_USER= + T2_AIRTIME_KEY= + T2_CURRENCY= -## Usage +Start the server: `bundle exec puma -C config/puma.rb` -### Retrieve your API Token -Once you have received your account credentials (login, password) to access the TransferTo web -interface, you must log in and retrieve your API token to be used with the TransferTo API. -To activate access to your API account, enable Two Factor Authentication (2FA). +### Routes - TSHOP_USER= - TSHOP_SECRET= +The following routes are mada available to your application when you mount the API engine in `config/routes.rb`: -## Test +```ruby +mount T2Airtime::Engine => '/airtime' +``` -Execute: + http://localhost:3000/airtime/transactions + http://localhost:3000/airtime/transactions/<id> + http://localhost:3000/airtime/countries + http://localhost:3000/airtime/<country_id>/operators + http://localhost:3000/airtime/<operator_id>/products + +### Helpers - $ rspec +Main API helper: - T2Airtime - has a version number - has the correct API URL - has 7 test numbers - responds to ping - checks wallet - checks number information - reserves a transaction id - returns a countries list - returns a country operators - returns an operator products - returns error code 0 for PIN based Top-up (successful transaction) - returns error code 0 for PIN less Top-up (successful transaction) - returns error code 204 (destination number is not a valid prepaid phone number) (FAILED - 1) - returns error code 301 (input value out of range or invalid product) (FAILED - 2) - returns error code 214 (transaction refused by the operator) (FAILED - 3) - returns error code 998 (system not available, please retry later) (FAILED - 4) - returns error code 999 (unknown error, please contact support) (FAILED - 5) - returns a transaction list +```ruby +api = T2Airtime::API.api +``` - Failed examples: +[TBC] - rspec ./spec/t2_airtime_spec.rb:99 # T2Airtime returns error code 204 (destination number is not a valid prepaid phone number) - rspec ./spec/t2_airtime_spec.rb:108 # T2Airtime returns error code 301 (input value out of range or invalid product) - rspec ./spec/t2_airtime_spec.rb:117 # T2Airtime returns error code 214 (transaction refused by the operator) - rspec ./spec/t2_airtime_spec.rb:126 # T2Airtime returns error code 998 (system not available, please retry later) - rspec ./spec/t2_airtime_spec.rb:135 # T2Airtime returns error code 999 (unknown error, please contact support) - ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).