airvend 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +16 -17
- data/lib/airvend.rb +6 -3
- data/lib/airvend/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 685454409c286ada636a583004020244dda4fe64bbf64962de2d8f57dfd1b090
|
4
|
+
data.tar.gz: 69774eaceb5ff7d0bde51b977627db9a87b7ddd08f76ec6245ecff98ec6cccbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f579c110d11d79c6752f18779487d4b7e773d87b7e64bddee9d9ec246ce8506bdb52fc41ed90f860db0e1284ed3889a13cd8364f7f9863f11ee62a4ccbf4073e
|
7
|
+
data.tar.gz: 90aae6c28d5e95cb823e52c1d18cb810d8415c256a5632fd7812859684bfa5a94c8ad7677ad52d4886e144d78682d11f9d22de2d48b454f2293ecc2dd6d89010
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -13,7 +13,7 @@ To use this resource, you would need to register on the [Airvend B2B](https://bu
|
|
13
13
|
Add this line to your application's Gemfile:
|
14
14
|
|
15
15
|
```ruby
|
16
|
-
gem 'airvend'
|
16
|
+
gem 'airvend', "~> 0.1.2"
|
17
17
|
```
|
18
18
|
|
19
19
|
And then execute:
|
@@ -79,9 +79,9 @@ To purchase airtime for a phone number that is registered with any of the NCC li
|
|
79
79
|
First, we need to provide the required data in the payload
|
80
80
|
|
81
81
|
```ruby
|
82
|
-
payload = {
|
83
|
-
ref: "YOUR-OWN-REF-HERE",
|
84
|
-
phone: "08138236694",
|
82
|
+
payload = {
|
83
|
+
ref: "YOUR-OWN-REF-HERE",
|
84
|
+
phone: "08138236694",
|
85
85
|
mno: "mtn", # can also be `glo`, `airtel` or `9mobile`
|
86
86
|
amount: "200"
|
87
87
|
}
|
@@ -123,9 +123,9 @@ This return an array of hashes with each containing a data plan in the format
|
|
123
123
|
[
|
124
124
|
...
|
125
125
|
{
|
126
|
-
:description=>"350MB",
|
127
|
-
:amount=>"300",
|
128
|
-
:code=>"300",
|
126
|
+
:description=>"350MB",
|
127
|
+
:amount=>"300",
|
128
|
+
:code=>"300",
|
129
129
|
:validity=>" for 7 Days"
|
130
130
|
}
|
131
131
|
...
|
@@ -139,11 +139,11 @@ This return an array of hashes with each containing a data plan in the format
|
|
139
139
|
Next, you can proceed to purchase the selected internet data plan with the payload
|
140
140
|
|
141
141
|
```ruby
|
142
|
-
payload = {
|
143
|
-
ref: "YOUR-OWN-REF-HERE",
|
144
|
-
phone: "08138236694",
|
142
|
+
payload = {
|
143
|
+
ref: "YOUR-OWN-REF-HERE",
|
144
|
+
phone: "08138236694",
|
145
145
|
mno: "mtn", # can also be `glo`, `airtel` or `9mobile`
|
146
|
-
code: "200" # this is code from the selected internet data plan from the list of data plans
|
146
|
+
code: "200" # this is code from the selected internet data plan from the list of data plans
|
147
147
|
}
|
148
148
|
```
|
149
149
|
|
@@ -211,12 +211,12 @@ which returns:
|
|
211
211
|
|
212
212
|
|
213
213
|
|
214
|
-
Finally, to purchase power for the verified customer, you would prepare a payload using the customer number that is gotten from the `verify` method
|
214
|
+
Finally, to purchase power for the verified customer, you would prepare a payload using the customer number that is gotten from the `verify` method
|
215
215
|
|
216
216
|
``` ruby
|
217
217
|
payload = {
|
218
218
|
ref: "YOUR-OWN-REF-HERE",
|
219
|
-
account: "02188019141",
|
219
|
+
account: "02188019141",
|
220
220
|
provider: "aedc",
|
221
221
|
amount: "2000",
|
222
222
|
customernumber:"BA36F4AEF88763454678BF9D1A85E4AE6F166CECA01DE4B58C1100DA3DA87362A6CBD3410E2B7F809C1A33E1AD6756BBA853F4C0275270B398BC69E8AC050E75|eyJwcm9kdWN0IjoiUE9SVEhBUkNPVVJURUxFQ1RSSUNJVFkiLCJ0eXBlIjoiUFJFUEFJRCIsImFjY291bnQiOiIwMTI0MDAxMjQ3Njk5IiwibmFtZSI6IkVzIE9tYWNoaSIsImFkZHJlc3MiOiJOTyA2NSBXb2ppIFJkIE5PIDY1IFdvamkgUmQiLCJ0YXJyaWYiOiJSMiIsImFycmVhcnMiOiIwIiwicGhvbmUiOiIiLCJtZXRlck51bWJlciI6IjAxMjQwMDEyNDc2OTkiLCJjdXN0b21lck51bWJlciI6IjgxNDE3MDIyODMwMSIsInRvdGFsQmlsbCI6IjAiLCJpYmNOYW1lIjoiR2FyZGVuIENpdHkgSW5kdXN0cmlhbCIsImJzY05hbWUiOiJSdW11b2diYSJ9" #data contained in the response from verify customer method
|
@@ -288,7 +288,7 @@ This return an array of hashes with each containing a tv plans in the format
|
|
288
288
|
...
|
289
289
|
{
|
290
290
|
:description=>"DStv Compact",
|
291
|
-
:amount=> "7900",
|
291
|
+
:amount=> "7900",
|
292
292
|
:code=>"COMPE36"
|
293
293
|
}
|
294
294
|
...
|
@@ -297,12 +297,12 @@ This return an array of hashes with each containing a tv plans in the format
|
|
297
297
|
|
298
298
|
|
299
299
|
|
300
|
-
Finally, to subscribe to a tv plan for the verified customer, you would prepare a payload using the customer
|
300
|
+
Finally, to subscribe to a tv plan for the verified customer, you would prepare a payload using the customer
|
301
301
|
|
302
302
|
``` ruby
|
303
303
|
payload = {
|
304
304
|
ref: "YOUR-OWN-REF-HERE",
|
305
|
-
account: "02188019141",
|
305
|
+
account: "02188019141",
|
306
306
|
provider: "aedc",
|
307
307
|
account_type: "prepaid",
|
308
308
|
amount: "2000",
|
@@ -343,4 +343,3 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
343
343
|
## Code of Conduct
|
344
344
|
|
345
345
|
Everyone interacting in the Airvend project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/urchymanny/airvend-rails/blob/master/CODE_OF_CONDUCT.md).
|
346
|
-
|
data/lib/airvend.rb
CHANGED
@@ -29,18 +29,21 @@ class Airvend
|
|
29
29
|
|
30
30
|
if (ENV['RAILS_ENV'].nil?)
|
31
31
|
@production = production
|
32
|
-
@url = sandbox_url
|
33
32
|
warn "Warning: Make sure you set RAILS_ENV to production or development"
|
34
33
|
else
|
35
34
|
if ENV['RAILS_ENV'] == "production"
|
36
35
|
@production=true
|
37
|
-
@url = live_url
|
38
36
|
else
|
39
37
|
@prodcution=false
|
40
|
-
@url = sandbox_url
|
41
38
|
end
|
42
39
|
end
|
43
40
|
|
41
|
+
# set rave url to sandbox or live if we are in production or development
|
42
|
+
if ENV['RAILS_ENV'] == "development" || ENV['RAILS_ENV'].nil?
|
43
|
+
@url = sandbox_url
|
44
|
+
else
|
45
|
+
@url = live_url
|
46
|
+
end
|
44
47
|
|
45
48
|
# check if we set our public and secret keys to the environment variable
|
46
49
|
if (username.nil? && password.nil?)
|
data/lib/airvend/version.rb
CHANGED