africastalking-ruby 2.1.3 → 2.1.7
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 +40 -38
- data/README.md +2 -8
- data/africastalking-ruby.gemspec +1 -1
- data/lib/AfricasTalking/Payments.rb +4 -1
- data/lib/AfricasTalking/Sms.rb +0 -3
- data/lib/AfricasTalking/Token.rb +0 -22
- data/lib/AfricasTalking/Voice.rb +4 -3
- data/lib/AfricasTalking/version.rb +1 -1
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d722d05cc6899aee30f158a0f27ccb5f0b76622967212a8bde12d0c81954501
|
4
|
+
data.tar.gz: b16602ad3063feac0786308f60e7f94a3066e4ad0e5052c5c7972e7ab6c46078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39219fd71b9e35e731d38899131430596e950eb9c962af9c01f4c6af4cd388580f711d27ffcd42983083f5df9986878e5ef6f688af0ff060a2b60d4d0b551c3d
|
7
|
+
data.tar.gz: e8580c4b2fb9dd1579f57dd7a97ac075a1b83f57c20563ca76cd8bcaad17d8fdf444286d7951aed5959d0bfe078b49251cebb246b178273a64c5f40e1e5ec708
|
data/Gemfile.lock
CHANGED
@@ -1,71 +1,72 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
africastalking-ruby (2.1.
|
4
|
+
africastalking-ruby (2.1.5.beta.1)
|
5
5
|
httparty (= 0.16.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionpack (
|
11
|
-
actionview (=
|
12
|
-
activesupport (=
|
13
|
-
rack (~> 2.0)
|
10
|
+
actionpack (6.0.2.1)
|
11
|
+
actionview (= 6.0.2.1)
|
12
|
+
activesupport (= 6.0.2.1)
|
13
|
+
rack (~> 2.0, >= 2.0.8)
|
14
14
|
rack-test (>= 0.6.3)
|
15
15
|
rails-dom-testing (~> 2.0)
|
16
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
17
|
-
actionview (
|
18
|
-
activesupport (=
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
+
actionview (6.0.2.1)
|
18
|
+
activesupport (= 6.0.2.1)
|
19
19
|
builder (~> 3.1)
|
20
20
|
erubi (~> 1.4)
|
21
21
|
rails-dom-testing (~> 2.0)
|
22
|
-
rails-html-sanitizer (~> 1.
|
23
|
-
activesupport (
|
22
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
+
activesupport (6.0.2.1)
|
24
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
25
|
i18n (>= 0.7, < 2)
|
26
26
|
minitest (~> 5.1)
|
27
27
|
tzinfo (~> 1.1)
|
28
|
+
zeitwerk (~> 2.2)
|
28
29
|
ast (2.4.0)
|
29
|
-
builder (3.2.
|
30
|
+
builder (3.2.4)
|
30
31
|
coderay (1.1.2)
|
31
|
-
concurrent-ruby (1.
|
32
|
-
crass (1.0.
|
32
|
+
concurrent-ruby (1.1.5)
|
33
|
+
crass (1.0.5)
|
33
34
|
diff-lcs (1.3)
|
34
|
-
erubi (1.
|
35
|
+
erubi (1.9.0)
|
35
36
|
httparty (0.16.1)
|
36
37
|
multi_xml (>= 0.5.2)
|
37
|
-
i18n (1.
|
38
|
+
i18n (1.8.1)
|
38
39
|
concurrent-ruby (~> 1.0)
|
39
|
-
loofah (2.
|
40
|
+
loofah (2.4.0)
|
40
41
|
crass (~> 1.0.2)
|
41
42
|
nokogiri (>= 1.5.9)
|
42
|
-
method_source (0.9.
|
43
|
-
mini_portile2 (2.
|
44
|
-
minitest (5.
|
43
|
+
method_source (0.9.2)
|
44
|
+
mini_portile2 (2.4.0)
|
45
|
+
minitest (5.13.0)
|
45
46
|
multi_xml (0.6.0)
|
46
|
-
nokogiri (1.
|
47
|
-
mini_portile2 (~> 2.
|
48
|
-
parallel (1.
|
49
|
-
parser (2.
|
47
|
+
nokogiri (1.10.7)
|
48
|
+
mini_portile2 (~> 2.4.0)
|
49
|
+
parallel (1.19.1)
|
50
|
+
parser (2.7.0.2)
|
50
51
|
ast (~> 2.4.0)
|
51
|
-
powerpack (0.1.
|
52
|
-
pry (0.
|
52
|
+
powerpack (0.1.2)
|
53
|
+
pry (0.12.2)
|
53
54
|
coderay (~> 1.1.0)
|
54
55
|
method_source (~> 0.9.0)
|
55
|
-
rack (2.0.
|
56
|
-
rack-test (1.
|
56
|
+
rack (2.0.8)
|
57
|
+
rack-test (1.1.0)
|
57
58
|
rack (>= 1.0, < 3)
|
58
59
|
rails-dom-testing (2.0.3)
|
59
60
|
activesupport (>= 4.2.0)
|
60
61
|
nokogiri (>= 1.6)
|
61
|
-
rails-html-sanitizer (1.0
|
62
|
-
loofah (~> 2.
|
63
|
-
railties (
|
64
|
-
actionpack (=
|
65
|
-
activesupport (=
|
62
|
+
rails-html-sanitizer (1.3.0)
|
63
|
+
loofah (~> 2.3)
|
64
|
+
railties (6.0.2.1)
|
65
|
+
actionpack (= 6.0.2.1)
|
66
|
+
activesupport (= 6.0.2.1)
|
66
67
|
method_source
|
67
68
|
rake (>= 0.8.7)
|
68
|
-
thor (>= 0.
|
69
|
+
thor (>= 0.20.3, < 2.0)
|
69
70
|
rainbow (3.0.0)
|
70
71
|
rake (10.5.0)
|
71
72
|
rspec (3.7.0)
|
@@ -96,12 +97,13 @@ GEM
|
|
96
97
|
rainbow (>= 2.2.2, < 4.0)
|
97
98
|
ruby-progressbar (~> 1.7)
|
98
99
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
99
|
-
ruby-progressbar (1.
|
100
|
-
thor (0.
|
100
|
+
ruby-progressbar (1.10.1)
|
101
|
+
thor (1.0.1)
|
101
102
|
thread_safe (0.3.6)
|
102
|
-
tzinfo (1.2.
|
103
|
+
tzinfo (1.2.6)
|
103
104
|
thread_safe (~> 0.1)
|
104
|
-
unicode-display_width (1.
|
105
|
+
unicode-display_width (1.6.0)
|
106
|
+
zeitwerk (2.2.2)
|
105
107
|
|
106
108
|
PLATFORMS
|
107
109
|
ruby
|
@@ -116,4 +118,4 @@ DEPENDENCIES
|
|
116
118
|
rubocop (~> 0.54.0)
|
117
119
|
|
118
120
|
BUNDLED WITH
|
119
|
-
1.
|
121
|
+
1.17.2
|
data/README.md
CHANGED
@@ -48,14 +48,6 @@ token = @AT.token
|
|
48
48
|
|
49
49
|
#### Create authentication Token
|
50
50
|
|
51
|
-
```ruby
|
52
|
-
token.createCheckoutToken options
|
53
|
-
```
|
54
|
-
- `options`
|
55
|
-
- `phoneNumber`: The phone number you want to create a subscription for
|
56
|
-
|
57
|
-
#### Create Checkout Token
|
58
|
-
|
59
51
|
```ruby
|
60
52
|
token.generateAuthToken phoneNumber
|
61
53
|
```
|
@@ -158,6 +150,7 @@ voice.call options
|
|
158
150
|
- `to`: A single recipient or an array of recipients. `REQUIRED`
|
159
151
|
- array of recipients contains ['2XXXXXXXX', '2XXXXXXXX']
|
160
152
|
- `from`: Shortcode or alphanumeric ID that is registered with Africa's Talking account.`REQUIRED`
|
153
|
+
- `clientRequestId`: String sent to your Events Callback URL that can be used to tag the call. `OPTIONAL`
|
161
154
|
|
162
155
|
|
163
156
|
#### Fetch queued calls
|
@@ -331,6 +324,7 @@ payments.mobileB2B options
|
|
331
324
|
- `destinationAccount`: This value contains the account name used by the business to receive money on the provided destinationChannel. `REQUIRED`
|
332
325
|
- `currencyCode`: 3-digit ISO format currency code (e.g `KES`, `USD`, `UGX` etc.) `REQUIRED`
|
333
326
|
- `amount`: Payment amount. `REQUIRED`
|
327
|
+
- `requester`: PhoneNumber through which KPLC will send tokens when using B2B to buy electricity tokens.
|
334
328
|
- `metadata`: Some optional data to associate with transaction.`REQUIRED`
|
335
329
|
|
336
330
|
#### Mobile Data
|
data/africastalking-ruby.gemspec
CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency "bundler", "~> 1.16"
|
34
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
-
spec.add_development_dependency
|
36
|
+
spec.add_development_dependency 'rspec-rails', '~> 3.7', '>= 3.7.2'
|
37
37
|
spec.add_development_dependency "rubocop", "~> 0.54.0"
|
38
38
|
spec.add_development_dependency "pry" , "~> 0"
|
39
39
|
spec.add_dependency "httparty", "0.16.1"
|
@@ -76,7 +76,10 @@ class Payments
|
|
76
76
|
'amount' => options['amount'],
|
77
77
|
'metadata' => options['metadata']
|
78
78
|
}
|
79
|
-
url
|
79
|
+
url = getMobilePaymentB2BUrl()
|
80
|
+
if options.key?('requester')
|
81
|
+
parameters['requester'] = options['requester']
|
82
|
+
end
|
80
83
|
response = sendJSONRequest(url, parameters)
|
81
84
|
if (@response_code == HTTP_CREATED)
|
82
85
|
resultObj = JSON.parse(response, :quirky_mode =>true)
|
data/lib/AfricasTalking/Sms.rb
CHANGED
@@ -145,9 +145,6 @@ class Sms
|
|
145
145
|
'shortCode' => options['shortCode'],
|
146
146
|
'keyword' => options['keyword']
|
147
147
|
}
|
148
|
-
if options['checkoutToken'] != nil
|
149
|
-
post_body['checkoutToken'] = options['checkoutToken']
|
150
|
-
end
|
151
148
|
url = getSmsSubscriptionUrl() + "/create"
|
152
149
|
if validateParamsPresence?(options, ['shortCode', 'keyword', 'phoneNumber'])
|
153
150
|
response = sendNormalRequest(url, post_body)
|
data/lib/AfricasTalking/Token.rb
CHANGED
@@ -24,21 +24,6 @@ class Token
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def createCheckoutToken options
|
28
|
-
post_body = {
|
29
|
-
'phoneNumber' => options['phoneNumber']
|
30
|
-
}
|
31
|
-
url = getApiHost() + "/checkout/token/create"
|
32
|
-
response = sendNormalRequest(url, post_body)
|
33
|
-
#
|
34
|
-
if(@response_code == HTTP_CREATED)
|
35
|
-
r= JSON.parse(response, :quirky_mode => true)
|
36
|
-
return CheckoutTokenResponse.new r['token'], r['description']
|
37
|
-
else
|
38
|
-
raise AfricasTalkingException, response
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
27
|
private
|
43
28
|
|
44
29
|
def getApiHost()
|
@@ -57,10 +42,3 @@ class AuthTokenResponse
|
|
57
42
|
@lifetimeInSeconds = lifetimeInSeconds_
|
58
43
|
end
|
59
44
|
end
|
60
|
-
class CheckoutTokenResponse
|
61
|
-
attr_accessor :token, :description
|
62
|
-
def initialize token_, description_
|
63
|
-
@token = token_
|
64
|
-
@description = description_
|
65
|
-
end
|
66
|
-
end
|
data/lib/AfricasTalking/Voice.rb
CHANGED
@@ -13,9 +13,10 @@ class Voice
|
|
13
13
|
def call options
|
14
14
|
if validateParamsPresence?(options, ['from', 'to'])
|
15
15
|
post_body = {
|
16
|
-
'username'
|
17
|
-
'from'
|
18
|
-
'to'
|
16
|
+
'username' => @username,
|
17
|
+
'from' => options['from'],
|
18
|
+
'to' => options['to'],
|
19
|
+
'clientRequestId' => options['clientRequestId']
|
19
20
|
}
|
20
21
|
#
|
21
22
|
response = sendNormalRequest(getVoiceHost() + "/call", post_body)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: africastalking-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Mwirigi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,6 +57,9 @@ dependencies:
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.7'
|
62
|
+
- - ">="
|
60
63
|
- !ruby/object:Gem::Version
|
61
64
|
version: 3.7.2
|
62
65
|
type: :development
|
@@ -64,6 +67,9 @@ dependencies:
|
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
69
|
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '3.7'
|
72
|
+
- - ">="
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: 3.7.2
|
69
75
|
- !ruby/object:Gem::Dependency
|
@@ -153,8 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
159
|
- !ruby/object:Gem::Version
|
154
160
|
version: '0'
|
155
161
|
requirements: []
|
156
|
-
|
157
|
-
rubygems_version: 2.7.7
|
162
|
+
rubygems_version: 3.0.3
|
158
163
|
signing_key:
|
159
164
|
specification_version: 4
|
160
165
|
summary: Simple gem that helps you build integrations with AfricasTalking
|