outbox-bandwidth 0.3.0 → 0.4.0
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/outbox/bandwidth/client.rb +14 -10
- data/lib/outbox/bandwidth/version.rb +1 -1
- data/spec/outbox/bandwidth/client_spec.rb +33 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60b94af8abf93c73a1d8b43a086cd6ff394470230c7e7da25c0d0934fe6f2463
|
4
|
+
data.tar.gz: d093735ad46d6758aa39eb9ab79283672cad1a20d7aeaf62f3476c3c9a401a43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb1d5bc634ac50b29c9347e366c4286b503fa74999765cc6974532f2d9e04054539a4bf10f78ccabd662434f599249fce88b843e90b94312dd6aa8cf8f8e8946
|
7
|
+
data.tar.gz: 1eaef2caa45b6f8044bf73c786204dec73bcb2e32e5e89957c6b94837c747296c0c3e2d06e5e18d501b440076d01d2fdb9041bc7754be96bd9e0962b6be9541a
|
@@ -7,12 +7,8 @@ module Outbox
|
|
7
7
|
# Uses Bandwidth's official Ruby API client (bandwidth) to deliver
|
8
8
|
# SMS messages.
|
9
9
|
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
# account_sid: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
13
|
-
# token: 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
|
14
|
-
# secret: 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
|
15
|
-
# )
|
10
|
+
# https://dev.bandwidth.com/sdks/ruby.html
|
11
|
+
#
|
16
12
|
# sms = Outbox::Messages::SMS.new(
|
17
13
|
# to: '+15552224444',
|
18
14
|
# from: '+15551115555',
|
@@ -25,14 +21,22 @@ module Outbox
|
|
25
21
|
|
26
22
|
def initialize(settings = nil)
|
27
23
|
super
|
28
|
-
|
29
24
|
options = @settings.dup
|
30
|
-
|
31
|
-
messaging_basic_auth_user_name
|
32
|
-
messaging_basic_auth_password
|
25
|
+
bandwidth_client_settings = options.slice(
|
26
|
+
:messaging_basic_auth_user_name,
|
27
|
+
:messaging_basic_auth_password,
|
28
|
+
:voice_basic_auth_user_name,
|
29
|
+
:voice_basic_auth_password,
|
30
|
+
:two_factor_auth_basic_auth_user_name,
|
31
|
+
:two_factor_auth_basic_auth_password,
|
32
|
+
:environment,
|
33
|
+
:base_url
|
33
34
|
)
|
34
35
|
@account_id = options[:subaccount_id] || options[:account_id]
|
35
36
|
@application_id = options[:application_id]
|
37
|
+
@api_client = ::Bandwidth::Client.new(
|
38
|
+
bandwidth_client_settings
|
39
|
+
)
|
36
40
|
end
|
37
41
|
|
38
42
|
def deliver(sms)
|
@@ -5,17 +5,37 @@ require 'ostruct'
|
|
5
5
|
|
6
6
|
describe Outbox::Bandwidth::Client do
|
7
7
|
describe '.new' do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
8
|
+
context 'with a messaging_basic_auth' do
|
9
|
+
it 'configures the Bandwidth API client' do
|
10
|
+
api_client = double(:api_client)
|
11
|
+
expect(::Bandwidth::Client).to receive(:new).with(
|
12
|
+
messaging_basic_auth_user_name: 'AC1',
|
13
|
+
messaging_basic_auth_password: 'abcdef'
|
14
|
+
).and_return(api_client)
|
15
|
+
client = Outbox::Bandwidth::Client.new(
|
16
|
+
messaging_basic_auth_user_name: 'AC1',
|
17
|
+
messaging_basic_auth_password: 'abcdef'
|
18
|
+
)
|
19
|
+
expect(client.api_client).to be(api_client)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
context 'with a custom environment and base url' do
|
23
|
+
it 'configures the Bandwidth API client' do
|
24
|
+
api_client = double(:api_client)
|
25
|
+
expect(::Bandwidth::Client).to receive(:new).with(
|
26
|
+
messaging_basic_auth_user_name: 'AC1',
|
27
|
+
messaging_basic_auth_password: 'abcdef',
|
28
|
+
environment: 'custom_env',
|
29
|
+
base_url: 'custom.test.com'
|
30
|
+
).and_return(api_client)
|
31
|
+
client = Outbox::Bandwidth::Client.new(
|
32
|
+
messaging_basic_auth_user_name: 'AC1',
|
33
|
+
messaging_basic_auth_password: 'abcdef',
|
34
|
+
environment: 'custom_env',
|
35
|
+
base_url: 'custom.test.com'
|
36
|
+
)
|
37
|
+
expect(client.api_client).to be(api_client)
|
38
|
+
end
|
19
39
|
end
|
20
40
|
end
|
21
41
|
|
@@ -30,8 +50,8 @@ describe Outbox::Bandwidth::Client do
|
|
30
50
|
messaging_basic_auth_password: 'abcdef'
|
31
51
|
).and_return(@api_client)
|
32
52
|
@client = Outbox::Bandwidth::Client.new(
|
33
|
-
|
34
|
-
|
53
|
+
messaging_basic_auth_user_name: 'AC1',
|
54
|
+
messaging_basic_auth_password: 'abcdef',
|
35
55
|
account_id: 'account_1'
|
36
56
|
)
|
37
57
|
@sms = Outbox::Messages::SMS.new do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: outbox-bandwidth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Browne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bandwidth-sdk
|