smess 3.0.0 → 3.1.1
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 +4 -4
- data/example_config.rb +6 -4
- data/lib/smess/outputs/twilio.rb +7 -4
- data/lib/smess/version.rb +1 -1
- data/smess.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc6f705611dc73a9a62fed01b38a3f3e6217045d02746686a2604bfa7f2a59e0
|
4
|
+
data.tar.gz: '0169994aa67408e04f3a9f63bfa33177effcaa0f1100e22cf0c96a632442f0dc'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a8104e36f45f29d7fb1297e0307f50ecb1f12522fb04d209c8950e2b84e04c4a63bced461b8baff6fe1e8d9d236403b59ef30937f087fe7df1a72075fc080e5
|
7
|
+
data.tar.gz: a3e0ebdb13fdbc2b7818eb2f9e03c65d09b57642fd9877f3718d9ca13ff75800da2f954eeb02d5c525273419985c87884f955dc3d71bea8850cb5cf27fb8e91d
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smess (
|
4
|
+
smess (3.1.0)
|
5
5
|
activesupport (>= 5.2.6, < 7.0.0)
|
6
6
|
clickatell (~> 0)
|
7
7
|
httpi (~> 3.0)
|
8
|
-
twilio-ruby (~>
|
8
|
+
twilio-ruby (~> 6.2)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
@@ -57,9 +57,9 @@ GEM
|
|
57
57
|
json (>= 1.8, < 3)
|
58
58
|
simplecov-html (~> 0.10.0)
|
59
59
|
simplecov-html (0.10.2)
|
60
|
-
twilio-ruby (
|
60
|
+
twilio-ruby (6.2.0)
|
61
61
|
faraday (>= 0.9, < 3.0)
|
62
|
-
jwt (>= 1.5,
|
62
|
+
jwt (>= 1.5, < 3.0)
|
63
63
|
nokogiri (>= 1.6, < 2.0)
|
64
64
|
tzinfo (2.0.5)
|
65
65
|
concurrent-ruby (~> 1.0)
|
data/example_config.rb
CHANGED
@@ -41,10 +41,12 @@ Smess.configure do |config|
|
|
41
41
|
country_codes: ["1", "971"],
|
42
42
|
type: :twilio,
|
43
43
|
config: {
|
44
|
-
sid:
|
45
|
-
auth_token:
|
46
|
-
|
47
|
-
|
44
|
+
sid: ENV["SMESS_TWILIO_SID"],
|
45
|
+
# auth_token: ENV["SMESS_TWILIO_AUTH_TOKEN"],
|
46
|
+
api_key: ENV["SMESS_TWILIO_API_KEY_SID"],
|
47
|
+
api_secret: ENV["SMESS_TWILIO_API_KEY_SECRET"],
|
48
|
+
from: ENV["SMESS_TWILIO_FROM"],
|
49
|
+
callback_url: ENV["SMESS_TWILIO_CALLBACK_URL"]
|
48
50
|
}
|
49
51
|
})
|
50
52
|
|
data/lib/smess/outputs/twilio.rb
CHANGED
@@ -9,11 +9,14 @@ module Smess
|
|
9
9
|
@results = []
|
10
10
|
end
|
11
11
|
|
12
|
-
attr_accessor :sid, :auth_token, :from, :messaging_service_sid, :callback_url, :verify_service_sid
|
12
|
+
attr_accessor :sid, :auth_token, :api_key, :api_secret, :from, :messaging_service_sid, :callback_url, :verify_service_sid
|
13
13
|
|
14
14
|
def validate_config
|
15
15
|
@sid = config.fetch(:sid)
|
16
|
-
@auth_token = config.fetch(:auth_token)
|
16
|
+
@auth_token = config.fetch(:auth_token, nil)
|
17
|
+
@api_key = config.fetch(:api_key, nil)
|
18
|
+
@api_secret = config.fetch(:api_secret, nil)
|
19
|
+
raise "missing API credentials" unless auth_token.present? || (api_key.present? && api_secret.present?)
|
17
20
|
@from = config.fetch(:from, nil)
|
18
21
|
@messaging_service_sid = config.fetch(:messaging_service_sid, nil)
|
19
22
|
@callback_url = config.fetch(:callback_url)
|
@@ -108,7 +111,7 @@ module Smess
|
|
108
111
|
opts.merge!(sender)
|
109
112
|
response = create_client_message(opts)
|
110
113
|
result = normal_result(response)
|
111
|
-
rescue Twilio::REST::RestError => e
|
114
|
+
rescue ::Twilio::REST::RestError => e
|
112
115
|
puts "got exception #{e.inspect}"
|
113
116
|
result = result_for_error(e)
|
114
117
|
end
|
@@ -120,7 +123,7 @@ module Smess
|
|
120
123
|
end
|
121
124
|
|
122
125
|
def client
|
123
|
-
@client ||= ::Twilio::REST::Client.new(sid, auth_token)
|
126
|
+
@client ||= auth_token.present? ? ::Twilio::REST::Client.new(sid, auth_token) : ::Twilio::REST::Client.new(api_key, api_secret, sid)
|
124
127
|
end
|
125
128
|
|
126
129
|
def normal_result(response)
|
data/lib/smess/version.rb
CHANGED
data/smess.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_development_dependency 'dotenv'
|
20
20
|
s.add_dependency 'httpi', '~> 3.0'
|
21
21
|
s.add_dependency 'clickatell', '~> 0'
|
22
|
-
s.add_dependency 'twilio-ruby', '~>
|
22
|
+
s.add_dependency 'twilio-ruby', '~> 6.2'
|
23
23
|
s.add_dependency 'activesupport', '>= 5.2.6', '< 7.0.0'
|
24
24
|
|
25
25
|
s.files = Dir["{lib}/**/*", "[A-Z]*", "init.rb"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Westin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '6.2'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '6.2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: activesupport
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|