t2_airtime 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d31b97a41f77c8dc0699a4f2f53f5ab3e8089ba
4
- data.tar.gz: b72a93f7d90b3a0aa703409e574e587473856983
3
+ metadata.gz: ae197e105fc7596c31630070d8030e85757b0701
4
+ data.tar.gz: f73403091b4c8cd4b0d6977edf60e27f5cdbdc75
5
5
  SHA512:
6
- metadata.gz: 97d448a27a38c76b1f822f412156f2e553b03f6f02b336285d998d5d1960384e8163e0dff494d208ff9848183a618493c5c7143ea355784159e3e251c476f78a
7
- data.tar.gz: bc760cdd4c03e34f22e77a9821d2622f75a9ef7b10468c46c7a4a8f807813d713107c70d20fe92013aca84c5fb07f2389d7698e0dee801d83a7512bb647bb71c
6
+ metadata.gz: c280efca6a355e39cf15fac08767ebdc9d371d15d5baa59d04d56031e0a765d82284d017a712227d22e2b0e41dc0610477f88834ab079e81f85967f0d1e16b6a
7
+ data.tar.gz: 0bcffd703b9791a30ecb138ff819ae5b4250c20f49dd867ecfc3b57457a78e686623030abaeda4146ea010dd071c729fb95c2727f3a4549c08edc13e7a99658e
data/README.md CHANGED
@@ -1,69 +1,69 @@
1
1
  # TransferTo Airtime API
2
2
 
3
- TransferTo helps businesses offer airtime top-ups, goods and services, and mobile money around the world in real time.
4
- This API enables developers to integrate TransferTo Top-up service into their system. If you are building
5
- application that leverages international recharge services, then this is the API for you.
3
+ [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.
4
+ TransferTo Airtime API enables developers to integrate TransferTo Top-up service into their system.
6
5
 
7
- ## Installation
6
+ This gem is a convenience wrapper around the Airtime API. Requirements:
7
+
8
+ Two Factor Authentication (2FA) enabled in your [TransferTo Shop](https://shop.transferto.com) Security Center section.
9
+
10
+
11
+ ## Usage
12
+
13
+ rails new $APPNAME \
14
+ --skip-active-record \
15
+ -d postgresql \
16
+ --skip-yarn \
17
+ --skip-action-cable \
18
+ --skip-sprockets \
19
+ --skip-spring \
20
+ --skip-coffee \
21
+ --skip-javascript \
22
+ --skip-turbolinks \
23
+ --api
8
24
 
9
25
  Add this line to your application's Gemfile:
10
26
 
11
27
  ```ruby
12
28
  gem 't2_airtime'
13
- ```
29
+ ```
14
30
 
15
31
  And then execute:
16
32
 
17
- $ bundle
33
+ $ bundle
18
34
 
19
- Or install it yourself as:
35
+ Create a `.env` file with the required information:
20
36
 
21
- $ gem install t2_airtime
37
+ T2_SHOP_USER=
38
+ T2_AIRTIME_KEY=
39
+ T2_CURRENCY=
22
40
 
23
- ## Usage
41
+ Start the server: `bundle exec puma -C config/puma.rb`
42
+
43
+ ### Routes
44
+
45
+ The following routes are mada available to your application when you mount the API engine in `config/routes.rb`:
24
46
 
25
- ### Retrieve your API Token
26
- Once you have received your account credentials (login, password) to access the TransferTo web
27
- interface, you must log in and retrieve your API token to be used with the TransferTo API.
28
- To activate access to your API account, enable Two Factor Authentication (2FA).
29
-
30
- TSHOP_USER=
31
- TSHOP_SECRET=
32
-
33
- ## Test
34
-
35
- Execute:
36
-
37
- $ rspec
38
-
39
- T2Airtime
40
- has a version number
41
- has the correct API URL
42
- has 7 test numbers
43
- responds to ping
44
- checks wallet
45
- checks number information
46
- reserves a transaction id
47
- returns a countries list
48
- returns a country operators
49
- returns an operator products
50
- returns error code 0 for PIN based Top-up (successful transaction)
51
- returns error code 0 for PIN less Top-up (successful transaction)
52
- returns error code 204 (destination number is not a valid prepaid phone number) (FAILED - 1)
53
- returns error code 301 (input value out of range or invalid product) (FAILED - 2)
54
- returns error code 214 (transaction refused by the operator) (FAILED - 3)
55
- returns error code 998 (system not available, please retry later) (FAILED - 4)
56
- returns error code 999 (unknown error, please contact support) (FAILED - 5)
57
- returns a transaction list
58
-
59
- Failed examples:
60
-
61
- rspec ./spec/t2_airtime_spec.rb:99 # T2Airtime returns error code 204 (destination number is not a valid prepaid phone number)
62
- rspec ./spec/t2_airtime_spec.rb:108 # T2Airtime returns error code 301 (input value out of range or invalid product)
63
- rspec ./spec/t2_airtime_spec.rb:117 # T2Airtime returns error code 214 (transaction refused by the operator)
64
- rspec ./spec/t2_airtime_spec.rb:126 # T2Airtime returns error code 998 (system not available, please retry later)
65
- rspec ./spec/t2_airtime_spec.rb:135 # T2Airtime returns error code 999 (unknown error, please contact support)
47
+ ```ruby
48
+ mount T2Airtime::Engine => '/airtime'
49
+ ```
50
+
51
+ http://localhost:3000/airtime/transactions
52
+ http://localhost:3000/airtime/transactions/<id>
53
+ http://localhost:3000/airtime/countries
54
+ http://localhost:3000/airtime/<country_id>/operators
55
+ http://localhost:3000/airtime/<operator_id>/products
66
56
 
57
+ ### Helpers
58
+
59
+ Main API helper:
60
+
61
+ ```ruby
62
+ api = T2Airtime::API.api
63
+ ```
64
+
65
+ [TBC]
66
+
67
67
  ## Development
68
68
 
69
69
  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.
@@ -17,7 +17,7 @@ module T2Airtime
17
17
  num > 0 && num < 8 ? numbers[num-1] : numbers
18
18
  end
19
19
 
20
- def self.format_price(price, currency=ENV['T2_CURRENCY'])
20
+ def self.format_price(price, currency=(ENV['T2_CURRENCY'] || "USD"))
21
21
  Money.new(Float(price)*100, currency).format
22
22
  end
23
23
 
@@ -1,3 +1,3 @@
1
1
  module T2Airtime
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t2_airtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - matteolc