mitake_sms 1.2.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46484a48ae04607708212f2512b21b7a941a365f3282783beca9f695a79c0fc6
4
- data.tar.gz: 446cc3b004842cede09f38f6516a5a03ada342a50d0d79e840a7eefdbc6ba398
3
+ metadata.gz: 42774c4aed1ba07e126a7023b8e2baedf85dc25e53bbeafc4739cff39765d0b3
4
+ data.tar.gz: 978e2c9b36e5cc2a2b79ad6f05b90f360f49c8930f50c5131851eb170a10aaf3
5
5
  SHA512:
6
- metadata.gz: e1fcbca7044f634e710b7fc34afbf19f576529bd1b155d212b1d4be158ea31cee05e950c5089517ae4112a9c63251af462f8df7213ccde4c517a622b4fa4b214
7
- data.tar.gz: c3a4955cd4c9b4476bc36bf032b3af9effc002ccd2646db04d3df195d116ca885e76bb03c6f8a5ce1c7fe423a01fa33510774938729040b5d8d7a6da8ef7dff4
6
+ metadata.gz: '0859b813573741a6ff71f8339c1a56bb4c625a6acdb0f861b1f2407a5981fce7619cd70580301558b0bac4e682350ccbb6ffb9e35b7a8ff30f45f3f6e80c4992'
7
+ data.tar.gz: 350a37d091491be985e03b736b39ea999e28edf7a90eb5edc378a0119719a343eb3aeb6f4d558a17e1ea9bdb233d886e8aba585f38f1894b62d46f8500c03b30
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.3.0] - 2025-05-25
11
+ ### Changed
12
+ - Removed automatic URL encoding of message content
13
+ - Simplified message handling by only converting newlines to ASCII code 6
14
+ - Modified tests to match the updated implementation
15
+
10
16
  ## [1.2.0] - 2025-05-25
11
17
  ### Added
12
18
  - Added proper handling of newlines in message text (converts to ASCII code 6)
@@ -31,20 +31,16 @@ module MitakeSms
31
31
  def send_sms(to, text, options = {})
32
32
  require 'uri'
33
33
  charset = options.delete(:charset) || 'UTF8'
34
-
34
+
35
35
  # Replace any newline characters with ASCII code 6 (ACK)
36
36
  # This is required by the Mitake API to represent line breaks
37
37
  processed_text = text.to_s.gsub("\n", 6.chr)
38
-
39
- # URL encode the message content to handle special characters like '&'
40
- # This is required by the Mitake API
41
- message_text = URI.encode_www_form_component(processed_text)
42
38
 
43
39
  params = {
44
40
  username: @config.username,
45
41
  password: @config.password,
46
42
  dstaddr: to,
47
- smbody: message_text,
43
+ smbody: processed_text,
48
44
  CharsetURL: charset
49
45
  }.merge(options.slice(:from, :response_url, :client_id))
50
46
 
@@ -141,26 +137,22 @@ module MitakeSms
141
137
  # @return [MitakeSms::Response] response object
142
138
  def send_batch(batch, charset = 'UTF8', options = {})
143
139
  require 'uri'
144
-
140
+
145
141
  params = {
146
142
  username: @config.username,
147
143
  password: @config.password,
148
144
  smbody: batch.map do |msg|
149
145
  to = msg[:to]
150
-
146
+
151
147
  # Replace any newline characters with ASCII code 6 (ACK)
152
148
  # This is required by the Mitake API to represent line breaks
153
149
  processed_text = msg[:text].to_s.gsub("\n", 6.chr)
154
-
155
- # URL encode the message content to handle special characters like '&'
156
- # This is required by the Mitake API
157
- message_text = URI.encode_www_form_component(processed_text)
158
-
159
- "#{to}:#{message_text}"
150
+
151
+ "#{to}:#{processed_text}"
160
152
  end.join("\n"),
161
153
  Encoding_PostIn: charset
162
154
  }
163
-
155
+
164
156
  response = @connection.post('SmBulkSend', params)
165
157
  handle_response(response)
166
158
  end
@@ -172,7 +164,7 @@ module MitakeSms
172
164
  # @return [MitakeSms::Response] response object
173
165
  def send_advanced_batch(batch, charset = 'UTF8', options = {})
174
166
  require 'uri'
175
-
167
+
176
168
  # Format each message according to the advanced format
177
169
  # ClientID $$ dstaddr $$ dlvtime $$ vldtime $$ destname $$ response $$ smbody
178
170
  body = batch.map do |msg|
@@ -188,16 +180,12 @@ module MitakeSms
188
180
  vldtime = msg[:vldtime] || ''
189
181
  dest_name = msg[:dest_name] || ''
190
182
  response_url = msg[:response] || ''
191
-
183
+
192
184
  # Replace any newline characters in the message text with ASCII code 6 (ACK)
193
185
  # This is required by the Mitake API to represent line breaks within message content
194
186
  processed_text = msg[:text].to_s.gsub("\n", 6.chr)
195
-
196
- # URL encode the message content to handle special characters like '&'
197
- # This is required by the Mitake API
198
- text = URI.encode_www_form_component(processed_text)
199
187
 
200
- [client_id, to, dlvtime, vldtime, dest_name, response_url, text].join('$$')
188
+ [client_id, to, dlvtime, vldtime, dest_name, response_url, processed_text].join('$$')
201
189
  end.join("\n")
202
190
 
203
191
  params = {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MitakeSms
4
- VERSION = "1.2.0"
4
+ VERSION = "1.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mitake_sms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zac