my-services 0.0.1 → 0.0.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/lib/my-services/actions/post.rb +13 -60
- data/lib/my-services/worker.rb +1 -1
- data/lib/my-services.rb +1 -2
- 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: 3a8f6df06959be827f771adea97510fa217970da294639bd710f91a66d13f067
|
4
|
+
data.tar.gz: 54aa978b21b909a1e2684e3facd4d1f854342ac8015faca40b833b9a92b0f331
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4771f9ad39cafee389261be6782a972b2c6fc3028f02f077d1a8feca85a3e2c3f1cad0ad673834658a61276a0e9baa0c445d4f56ff68a08c834763ef04d20b43
|
7
|
+
data.tar.gz: 209c5a6bf81c32d3459a82977ac8297aa6be360b5f5342bf61286dfe3d8a58c55d8fe9edf8d10a5edb85b3c67f992d24cc05a5c585b4ac4eb68cee6cdb19fcb6
|
@@ -2,70 +2,23 @@ module MyServices
|
|
2
2
|
module Actions
|
3
3
|
module Post
|
4
4
|
module ClassMethods
|
5
|
+
|
5
6
|
def load_category
|
6
|
-
|
7
|
-
|
8
|
-
# response = MyServices.request(api_url, :post)
|
9
|
-
response = JSON.parse('{
|
10
|
-
"responseCode": "00",
|
11
|
-
"message": "success",
|
12
|
-
"data": [
|
13
|
-
{
|
14
|
-
"id": 3,
|
15
|
-
"name": "State Government Collections"
|
16
|
-
},
|
17
|
-
{
|
18
|
-
"id": 1,
|
19
|
-
"name": "Utility Bills"
|
20
|
-
},
|
21
|
-
{
|
22
|
-
"id": 5,
|
23
|
-
"name": "Internet Services"
|
24
|
-
},
|
25
|
-
{
|
26
|
-
"id": 41,
|
27
|
-
"name": "Betting and Lottery"
|
28
|
-
},
|
29
|
-
{
|
30
|
-
"id": 2,
|
31
|
-
"name": "Cable TV Bills"
|
32
|
-
},
|
33
|
-
{
|
34
|
-
"id": 12,
|
35
|
-
"name": "Transport and Toll Payments"
|
36
|
-
},
|
37
|
-
{
|
38
|
-
"id": 58,
|
39
|
-
"name": "AZURI"
|
40
|
-
}
|
41
|
-
]
|
42
|
-
}')
|
7
|
+
api_url = "#{api_url}/categories"
|
8
|
+
response = MyServices.request(api_url, :post)
|
43
9
|
end
|
10
|
+
|
44
11
|
def load_billers(id)
|
45
|
-
|
46
|
-
|
47
|
-
# response = MyServices.request(api_url, :post)
|
48
|
-
response = JSON.parse('{
|
49
|
-
"responseCode": "00",
|
50
|
-
"message": "success",
|
51
|
-
"data": [
|
52
|
-
{
|
53
|
-
"id": 3444,
|
54
|
-
"billerId": "3444",
|
55
|
-
"billerName": "Abia State",
|
56
|
-
"sid": 3,
|
57
|
-
"status": "A"
|
58
|
-
},
|
59
|
-
{
|
60
|
-
"id": 913,
|
61
|
-
"billerId": "913",
|
62
|
-
"billerName": "GLO",
|
63
|
-
"sid": 3,
|
64
|
-
"status": "A"
|
65
|
-
}
|
66
|
-
]
|
67
|
-
}')
|
12
|
+
api_url = "#{api_url}/getbillers/#{id}"
|
13
|
+
response = MyServices.request(api_url, :post)
|
68
14
|
end
|
15
|
+
|
16
|
+
# params - id, customerRef, billerId, narration, accountNumber, paymentDate
|
17
|
+
def do_payment(payment_data)
|
18
|
+
api_url = "#{self.api_url}/dopayment"
|
19
|
+
response = MyServices.request(api_url, :post, payment_data)
|
20
|
+
end
|
21
|
+
|
69
22
|
end
|
70
23
|
|
71
24
|
def self.included(base)
|
data/lib/my-services/worker.rb
CHANGED
data/lib/my-services.rb
CHANGED
@@ -17,14 +17,13 @@ require_relative 'my-services/my_services_object'
|
|
17
17
|
require_relative 'my-services/worker'
|
18
18
|
|
19
19
|
module MyServices
|
20
|
-
|
20
|
+
@base_url = 'http://14.98.171.134:9090/'
|
21
21
|
|
22
22
|
class << self
|
23
23
|
# MyServicesError :api_key, :base_url
|
24
24
|
|
25
25
|
def request(api_url, method, params = {})
|
26
26
|
# raise(AuthenticationError, 'Set your API Key using MyServices.api_key = <API_KEY>') unless api_key
|
27
|
-
|
28
27
|
begin
|
29
28
|
url = URI.join(base_url, api_url).to_s
|
30
29
|
response = RestClient::Request.execute(method: method, url: url, payload: params.to_json, headers: request_headers)
|