outbox-twilio 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +16 -0
- data/lib/outbox-twilio.rb +1 -0
- data/lib/outbox/twilio/client.rb +4 -4
- data/lib/outbox/twilio/version.rb +1 -1
- data/outbox-twilio.gemspec +12 -12
- data/spec/outbox/twilio/client_spec.rb +24 -6
- metadata +20 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14dc66d7833ccfa8b95e0b0f8f3e3dbf12e84dcc
|
4
|
+
data.tar.gz: 362d71f7b1d22a30b60153bc5a4dc5017935a7f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73f2a43fff7c9eff6ef7b82b2ed7a0b9dade02725ece0e38d84e023edb564ba4d053296553f316263a952a4e5128ad3a141f411039a217783a6c225858e4b793
|
7
|
+
data.tar.gz: eb5fa6efe3150e50b5c18d35ed20cf57879c1ea0931c577ae0dc70bb9d0b83e3064d998fd06c69e8a274d27fbc0ae5a9b32f2b4479c9d935359aebfc9d5a2947
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- "vendor/**/*"
|
4
|
+
DisplayCopNames: true
|
5
|
+
DisplayStyleGuide: true
|
6
|
+
|
7
|
+
Style/Documentation:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Metrics/BlockLength:
|
11
|
+
Exclude:
|
12
|
+
- "spec/**/*"
|
13
|
+
|
14
|
+
Metrics/LineLength:
|
15
|
+
IgnoreCopDirectives: true
|
16
|
+
Max: 100
|
data/lib/outbox-twilio.rb
CHANGED
data/lib/outbox/twilio/client.rb
CHANGED
@@ -23,9 +23,9 @@ module Outbox
|
|
23
23
|
|
24
24
|
options = @settings.dup
|
25
25
|
@api_client = ::Twilio::REST::Client.new(
|
26
|
-
options
|
27
|
-
options
|
28
|
-
options
|
26
|
+
options[:username] || options[:account_sid],
|
27
|
+
options[:password] || options[:auth_token],
|
28
|
+
options[:account_sid],
|
29
29
|
)
|
30
30
|
end
|
31
31
|
|
@@ -39,7 +39,7 @@ module Outbox
|
|
39
39
|
application_sid: sms[:application_sid]
|
40
40
|
}
|
41
41
|
params.delete_if { |_, value| value.nil? }
|
42
|
-
@api_client.account.messages.create(params)
|
42
|
+
@api_client.account.messages.create(params).fetch
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/outbox-twilio.gemspec
CHANGED
@@ -4,22 +4,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'outbox/twilio/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
13
|
-
spec.homepage
|
14
|
-
spec.license
|
7
|
+
spec.name = 'outbox-twilio'
|
8
|
+
spec.version = Outbox::Twilio::VERSION
|
9
|
+
spec.authors = ['Pete Browne']
|
10
|
+
spec.email = ['pete.browne@localmed.com']
|
11
|
+
spec.summary = 'Outbox SMS client for Twilio.'
|
12
|
+
spec.description = 'Twilio API wrapper for Outbox, a generic interface for sending notificatons.'
|
13
|
+
spec.homepage = 'https://github.com/localmed/outbox-twilio'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.files
|
17
|
-
spec.executables
|
18
|
-
spec.test_files
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'outbox', '~> 0.2'
|
22
|
-
spec.add_runtime_dependency 'twilio-ruby', '~>
|
22
|
+
spec.add_runtime_dependency 'twilio-ruby', '~> 5.0.0.rc17'
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
24
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
25
|
spec.add_development_dependency 'rspec'
|
@@ -7,17 +7,33 @@ describe Outbox::Twilio::Client do
|
|
7
7
|
expect(::Twilio::REST::Client).to receive(:new).with(
|
8
8
|
'AC1',
|
9
9
|
'abcdef',
|
10
|
-
|
11
|
-
|
10
|
+
'AC1',
|
11
|
+
nil
|
12
12
|
).and_return(api_client)
|
13
13
|
client = Outbox::Twilio::Client.new(
|
14
14
|
account_sid: 'AC1',
|
15
|
-
auth_token: 'abcdef'
|
16
|
-
timeout: 5,
|
17
|
-
retry_limit: 2
|
15
|
+
auth_token: 'abcdef'
|
18
16
|
)
|
19
17
|
expect(client.api_client).to be(api_client)
|
20
18
|
end
|
19
|
+
|
20
|
+
context 'with username and password' do
|
21
|
+
it 'configures the Twilio API client' do
|
22
|
+
api_client = double(:api_client)
|
23
|
+
expect(::Twilio::REST::Client).to receive(:new).with(
|
24
|
+
'username',
|
25
|
+
'abcdef',
|
26
|
+
'AC1',
|
27
|
+
nil
|
28
|
+
).and_return(api_client)
|
29
|
+
client = Outbox::Twilio::Client.new(
|
30
|
+
username: 'username',
|
31
|
+
password: 'abcdef',
|
32
|
+
account_sid: 'AC1'
|
33
|
+
)
|
34
|
+
expect(client.api_client).to be(api_client)
|
35
|
+
end
|
36
|
+
end
|
21
37
|
end
|
22
38
|
|
23
39
|
describe '#deliver' do
|
@@ -37,6 +53,8 @@ describe Outbox::Twilio::Client do
|
|
37
53
|
end
|
38
54
|
|
39
55
|
it 'delivers the SMS' do
|
56
|
+
message_context = double(:message_context)
|
57
|
+
expect(message_context).to receive(:fetch)
|
40
58
|
expect(@client.api_client.account.messages).to receive(:create).with(
|
41
59
|
to: '+14155551212',
|
42
60
|
from: 'Company Name',
|
@@ -44,7 +62,7 @@ describe Outbox::Twilio::Client do
|
|
44
62
|
media_url: 'http://www.example.com/hearts.png',
|
45
63
|
status_callback: 'http://www.example.com/callback',
|
46
64
|
application_sid: '1234'
|
47
|
-
)
|
65
|
+
).and_return(message_context)
|
48
66
|
@client.deliver(@sms)
|
49
67
|
end
|
50
68
|
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: outbox-twilio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Browne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: outbox
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: twilio-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 5.0.0.rc17
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 5.0.0.rc17
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.6'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '10.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: Twilio API wrapper for Outbox, a generic interface for sending notificatons.
|
@@ -87,8 +87,9 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .rspec
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".rubocop.yml"
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE.txt
|
94
95
|
- README.md
|
@@ -111,17 +112,17 @@ require_paths:
|
|
111
112
|
- lib
|
112
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
114
|
requirements:
|
114
|
-
- -
|
115
|
+
- - ">="
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: '0'
|
117
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
119
|
requirements:
|
119
|
-
- -
|
120
|
+
- - ">="
|
120
121
|
- !ruby/object:Gem::Version
|
121
122
|
version: '0'
|
122
123
|
requirements: []
|
123
124
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.6.8
|
125
126
|
signing_key:
|
126
127
|
specification_version: 4
|
127
128
|
summary: Outbox SMS client for Twilio.
|