smess 2.0.8 → 2.2.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/Gemfile.lock +28 -16
- data/lib/smess/output.rb +4 -0
- data/lib/smess/outputs/auto.rb +5 -0
- data/lib/smess/outputs/twilio.rb +20 -7
- data/lib/smess/outputs/twilio_whatsapp.rb +17 -0
- data/lib/smess/sms.rb +7 -0
- data/lib/smess/version.rb +1 -1
- data/lib/smess.rb +2 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a55b648177448474907c0d1e8a1236b602c5473709d6ff71c6e1b4f669a489c
|
4
|
+
data.tar.gz: 9e67c5b6066fb5298afe6d04296efc6f77a258c78d9d336312c129fbf25745f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17fae43d95fdee89661a81f4ac1faa2a140375fdc88c454e9c4a8fad640eece26fa67c0c5f972a47944c24a89135685cb8577cf4fa272f20162db8dee0fe65ad
|
7
|
+
data.tar.gz: 31cc82823c4fefe06f10cabca2ac0909ea84b89ca9c0f4ddfad8e432d3765c9812c08b14505e450b5426a090548ae518b7227a5c7084f715825d871fc6f280fb
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smess (2.0
|
4
|
+
smess (2.2.0)
|
5
5
|
activesupport (>= 5.2.6, < 7.0.0)
|
6
6
|
clickatell (~> 0)
|
7
7
|
httpi (~> 1.1)
|
@@ -12,7 +12,7 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (6.1.
|
15
|
+
activesupport (6.1.7)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 1.6, < 2)
|
18
18
|
minitest (>= 5.1)
|
@@ -27,29 +27,40 @@ GEM
|
|
27
27
|
diff-lcs (1.3)
|
28
28
|
docile (1.3.2)
|
29
29
|
dotenv (2.7.5)
|
30
|
-
faraday (2.
|
31
|
-
faraday-net_http (
|
30
|
+
faraday (2.7.1)
|
31
|
+
faraday-net_http (>= 2.0, < 3.1)
|
32
32
|
ruby2_keywords (>= 0.0.4)
|
33
|
-
faraday-net_http (
|
33
|
+
faraday-net_http (3.0.2)
|
34
34
|
gyoku (0.4.6)
|
35
35
|
builder (>= 2.1.2)
|
36
36
|
httpi (1.1.1)
|
37
37
|
rack
|
38
|
-
i18n (1.
|
38
|
+
i18n (1.12.0)
|
39
39
|
concurrent-ruby (~> 1.0)
|
40
40
|
json (2.3.0)
|
41
|
-
jwt (2.
|
42
|
-
mail (2.
|
41
|
+
jwt (2.5.0)
|
42
|
+
mail (2.8.0)
|
43
43
|
mini_mime (>= 0.1.1)
|
44
|
+
net-imap
|
45
|
+
net-pop
|
46
|
+
net-smtp
|
44
47
|
mini_mime (1.1.2)
|
45
48
|
mini_portile2 (2.8.0)
|
46
|
-
minitest (5.
|
47
|
-
|
49
|
+
minitest (5.16.3)
|
50
|
+
net-imap (0.3.1)
|
51
|
+
net-protocol
|
52
|
+
net-pop (0.1.2)
|
53
|
+
net-protocol
|
54
|
+
net-protocol (0.2.1)
|
55
|
+
timeout
|
56
|
+
net-smtp (0.3.3)
|
57
|
+
net-protocol
|
58
|
+
nokogiri (1.13.10)
|
48
59
|
mini_portile2 (~> 2.8.0)
|
49
60
|
racc (~> 1.4)
|
50
61
|
nori (1.1.5)
|
51
|
-
racc (1.6.
|
52
|
-
rack (
|
62
|
+
racc (1.6.1)
|
63
|
+
rack (3.0.2)
|
53
64
|
rspec (3.9.0)
|
54
65
|
rspec-core (~> 3.9.0)
|
55
66
|
rspec-expectations (~> 3.9.0)
|
@@ -77,16 +88,17 @@ GEM
|
|
77
88
|
json (>= 1.8, < 3)
|
78
89
|
simplecov-html (~> 0.10.0)
|
79
90
|
simplecov-html (0.10.2)
|
80
|
-
|
91
|
+
timeout (0.3.1)
|
92
|
+
twilio-ruby (5.73.4)
|
81
93
|
faraday (>= 0.9, < 3.0)
|
82
94
|
jwt (>= 1.5, <= 2.5)
|
83
95
|
nokogiri (>= 1.6, < 2.0)
|
84
|
-
tzinfo (2.0.
|
96
|
+
tzinfo (2.0.5)
|
85
97
|
concurrent-ruby (~> 1.0)
|
86
98
|
wasabi (2.5.1)
|
87
99
|
httpi (~> 1.0)
|
88
100
|
nokogiri (>= 1.4.0)
|
89
|
-
zeitwerk (2.
|
101
|
+
zeitwerk (2.6.6)
|
90
102
|
|
91
103
|
PLATFORMS
|
92
104
|
ruby
|
@@ -98,4 +110,4 @@ DEPENDENCIES
|
|
98
110
|
smess!
|
99
111
|
|
100
112
|
BUNDLED WITH
|
101
|
-
|
113
|
+
2.3.25
|
data/lib/smess/output.rb
CHANGED
data/lib/smess/outputs/auto.rb
CHANGED
@@ -11,6 +11,11 @@ module Smess
|
|
11
11
|
out.deliver.merge({sent_with: output_name})
|
12
12
|
end
|
13
13
|
|
14
|
+
def send_feedback(message_sid)
|
15
|
+
out = output_for sms.to
|
16
|
+
out.send_feedback(message_sid)
|
17
|
+
end
|
18
|
+
|
14
19
|
def get_output_name_for_msisdn(msisdn)
|
15
20
|
3.downto(0).each do |index|
|
16
21
|
return Smess.config.output_by_country_code[msisdn[0..index]] if Smess.config.output_by_country_code.key? msisdn[0..index]
|
data/lib/smess/outputs/twilio.rb
CHANGED
@@ -10,6 +10,7 @@ module Smess
|
|
10
10
|
end
|
11
11
|
|
12
12
|
attr_accessor :sid, :auth_token, :from, :messaging_service_sid, :callback_url
|
13
|
+
|
13
14
|
def validate_config
|
14
15
|
@sid = config.fetch(:sid)
|
15
16
|
@auth_token = config.fetch(:auth_token)
|
@@ -18,6 +19,10 @@ module Smess
|
|
18
19
|
@callback_url = config.fetch(:callback_url)
|
19
20
|
end
|
20
21
|
|
22
|
+
def send_feedback(message_sid)
|
23
|
+
client.messages(message_sid).feedback.create(outcome: "confirmed")
|
24
|
+
end
|
25
|
+
|
21
26
|
def deliver
|
22
27
|
send_one_sms sms.message
|
23
28
|
end
|
@@ -31,22 +36,30 @@ module Smess
|
|
31
36
|
end
|
32
37
|
|
33
38
|
def split_parts
|
34
|
-
Smess.separate_sms(sms.message).reject {|s| s.empty? }
|
39
|
+
Smess.separate_sms(sms.message).reject { |s| s.empty? }
|
40
|
+
end
|
41
|
+
|
42
|
+
def to
|
43
|
+
"+#{sms.to}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def sender
|
47
|
+
if messaging_service_sid.present?
|
48
|
+
{messaging_service_sid: messaging_service_sid}
|
49
|
+
else
|
50
|
+
{from: from}
|
51
|
+
end
|
35
52
|
end
|
36
53
|
|
37
54
|
def send_one_sms(message)
|
38
55
|
begin
|
39
56
|
opts = {
|
40
|
-
to:
|
57
|
+
to: to,
|
41
58
|
body: message,
|
42
59
|
status_callback: callback_url,
|
43
60
|
provide_feedback: true
|
44
61
|
}
|
45
|
-
|
46
|
-
opts[:messaging_service_sid] = messaging_service_sid
|
47
|
-
else
|
48
|
-
opts[:from] = from
|
49
|
-
end
|
62
|
+
opts.merge!(sender)
|
50
63
|
response = create_client_message(opts)
|
51
64
|
result = normal_result(response)
|
52
65
|
rescue => e
|
data/lib/smess/sms.rb
CHANGED
data/lib/smess/version.rb
CHANGED
data/lib/smess.rb
CHANGED
@@ -23,6 +23,7 @@ require 'smess/outputs/global_mouth'
|
|
23
23
|
require 'smess/outputs/link_mobility'
|
24
24
|
require 'smess/outputs/mblox'
|
25
25
|
require 'smess/outputs/twilio'
|
26
|
+
require 'smess/outputs/twilio_whatsapp'
|
26
27
|
require 'smess/outputs/iconectiv'
|
27
28
|
require 'smess/outputs/test'
|
28
29
|
|
@@ -59,7 +60,7 @@ module Smess
|
|
59
60
|
@nothing = false
|
60
61
|
@default_output = nil
|
61
62
|
@default_sender_id = "Smess"
|
62
|
-
@output_types = %i{auto card_board_fish clickatell global_mouth link_mobility iconectiv mblox smsglobal twilio}
|
63
|
+
@output_types = %i{auto card_board_fish clickatell global_mouth link_mobility iconectiv mblox smsglobal twilio twilio_whatsapp}
|
63
64
|
@configured_outputs = {}
|
64
65
|
@output_by_country_code = {}
|
65
66
|
|
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: 2.0
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Westin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -169,6 +169,7 @@ files:
|
|
169
169
|
- lib/smess/outputs/smsglobal.rb
|
170
170
|
- lib/smess/outputs/test.rb
|
171
171
|
- lib/smess/outputs/twilio.rb
|
172
|
+
- lib/smess/outputs/twilio_whatsapp.rb
|
172
173
|
- lib/smess/sms.rb
|
173
174
|
- lib/smess/utils.rb
|
174
175
|
- lib/smess/version.rb
|
@@ -193,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
194
|
- !ruby/object:Gem::Version
|
194
195
|
version: 1.3.7
|
195
196
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
197
|
+
rubygems_version: 3.1.6
|
197
198
|
signing_key:
|
198
199
|
specification_version: 4
|
199
200
|
summary: A messy SMS messenger supporting every aggregator I have gotten my hands
|