smess 2.1.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9264dd553b1402dab8be17b373c67334564d4b1e960636d4df42c8b40c190421
4
- data.tar.gz: d125c970b1ae0591f092cdca5036f85f892bd4d5aa50bdb1cfff02f330381946
3
+ metadata.gz: 6de9e998d4913d8ef125c208a99dc940dc3aa38174c9fdd1ee21762b3fe03d8c
4
+ data.tar.gz: 68453c5001c407ace77ce172d65f102c219425f4b86ac9e4689488f3c43058c3
5
5
  SHA512:
6
- metadata.gz: 77e61cf66715eb0a64f28c91e1b7d0cee22bc27af517c9f545680443225f465abab65fb42c7cf7c5321d9d0527bff0d2871897ae58bf47965a76dda6df3364a7
7
- data.tar.gz: 1ece289153de4a40343f1bce349ce5ee9adf9c1dbdc4596910910d57f4e48a37fabd44a055eaaf6384927a98f5ad55362b40e748ac86a6ba760efe2ccf4651e0
6
+ metadata.gz: 5f95dce3a4708f0b824599963a828fce5ca468c2c07ab154ab8b191bc1d62b8f1a4546337ef7ad69b3ad1caa9fa94c950d92642ffa4b1fccad243cc9ef8492eb
7
+ data.tar.gz: 9c8b2386217ddc48793320f2f772715b26b9e193a7a8006579751a0ff546d832aee106a71207d18a06992690097adff5207b61779a2c4bff489c7c58037a9958
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smess (2.0.8)
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.6)
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.3.0)
31
- faraday-net_http (~> 2.0)
30
+ faraday (2.7.1)
31
+ faraday-net_http (>= 2.0, < 3.1)
32
32
  ruby2_keywords (>= 0.0.4)
33
- faraday-net_http (2.0.3)
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.10.0)
38
+ i18n (1.12.0)
39
39
  concurrent-ruby (~> 1.0)
40
40
  json (2.3.0)
41
- jwt (2.4.1)
42
- mail (2.7.1)
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.15.0)
47
- nokogiri (1.13.6)
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.0)
52
- rack (2.2.3.1)
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
- twilio-ruby (5.67.2)
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.4)
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.5.4)
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
- 1.17.3
113
+ 2.3.25
@@ -39,19 +39,27 @@ module Smess
39
39
  Smess.separate_sms(sms.message).reject { |s| s.empty? }
40
40
  end
41
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
52
+ end
53
+
42
54
  def send_one_sms(message)
43
55
  begin
44
56
  opts = {
45
- to: "+#{sms.to}",
57
+ to: to,
46
58
  body: message,
47
59
  status_callback: callback_url,
48
60
  provide_feedback: true
49
61
  }
50
- if messaging_service_sid.present?
51
- opts[:messaging_service_sid] = messaging_service_sid
52
- else
53
- opts[:from] = from
54
- end
62
+ opts.merge!(sender)
55
63
  response = create_client_message(opts)
56
64
  result = normal_result(response)
57
65
  rescue => e
@@ -62,7 +70,7 @@ module Smess
62
70
  end
63
71
 
64
72
  def create_client_message(params)
65
- client.api.account.messages.create(params)
73
+ client.api.account.messages.create(**params)
66
74
  end
67
75
 
68
76
  def client
@@ -0,0 +1,17 @@
1
+ require 'twilio-ruby'
2
+
3
+ module Smess
4
+ class TwilioWhatsapp < Twilio
5
+
6
+ private
7
+
8
+ def to
9
+ "whatsapp:+#{sms.to}"
10
+ end
11
+
12
+ def sender
13
+ {from: "whatsapp:+#{from}"}
14
+ end
15
+
16
+ end
17
+ end
data/lib/smess/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Smess
2
- VERSION = '2.1.0'
2
+ VERSION = '2.2.1'
3
3
  end
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.1.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Westin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-03 00:00:00.000000000 Z
11
+ date: 2023-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -169,17 +169,17 @@ 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
175
176
  - lib/string_ext.rb
176
- - smess-2.0.8.gem
177
177
  - smess.gemspec
178
178
  homepage: https://github.com/eimermusic/smess
179
179
  licenses:
180
180
  - MIT
181
181
  metadata: {}
182
- post_install_message:
182
+ post_install_message:
183
183
  rdoc_options: []
184
184
  require_paths:
185
185
  - lib
@@ -194,8 +194,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  - !ruby/object:Gem::Version
195
195
  version: 1.3.7
196
196
  requirements: []
197
- rubygems_version: 3.0.3
198
- signing_key:
197
+ rubygems_version: 3.2.33
198
+ signing_key:
199
199
  specification_version: 4
200
200
  summary: A messy SMS messenger supporting every aggregator I have gotten my hands
201
201
  on
data/smess-2.0.8.gem DELETED
Binary file