telesign 2.2.1 → 2.2.2
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/lib/telesign/rest.rb +12 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ad9fd458e954d102980ed5e2380aaaa4cebe2401f2201187dc2f11d4ccfaedd
|
4
|
+
data.tar.gz: 69566f11309a7921fd808279b92f0fcbf505b3eb86201e3e974f42536ef150e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 919892dffccb57bfcb6cf91c8d52c3880bf7f1f8b4ba31a9517177510cf4727ce0db2e14d2c36354bf87edf666248c139f9c95452ff30accc1c591b05b24af4c
|
7
|
+
data.tar.gz: 388113fb396df0f128bc261120771608d516cecae83fc27044637fbed0ef661f2648c594ff74e34f1581fc9f9933eaf0420a4f8ac7ff0824ff41685ac3e9a5ea
|
data/lib/telesign/rest.rb
CHANGED
@@ -7,7 +7,7 @@ require 'securerandom'
|
|
7
7
|
require 'net/http/persistent'
|
8
8
|
|
9
9
|
module Telesign
|
10
|
-
SDK_VERSION = '2.2.
|
10
|
+
SDK_VERSION = '2.2.2'
|
11
11
|
|
12
12
|
# The TeleSign RestClient is a generic HTTP REST client that can be extended to make requests against any of
|
13
13
|
# TeleSign's REST API endpoints.
|
@@ -18,7 +18,7 @@ module Telesign
|
|
18
18
|
# See https://developer.telesign.com for detailed API documentation.
|
19
19
|
class RestClient
|
20
20
|
|
21
|
-
|
21
|
+
@@user_agent = "TeleSignSDK/ruby-{#{SDK_VERSION} #{RUBY_DESCRIPTION} net/http/persistent"
|
22
22
|
|
23
23
|
# A simple HTTP Response object to abstract the underlying net/http library response.
|
24
24
|
|
@@ -194,20 +194,20 @@ module Telesign
|
|
194
194
|
|
195
195
|
request = method_function.new(resource_uri.request_uri)
|
196
196
|
|
197
|
-
|
198
|
-
|
199
|
-
|
197
|
+
encoded_fields = ''
|
198
|
+
if %w[POST PUT].include? method_name
|
199
|
+
if content_type == "application/x-www-form-urlencoded"
|
200
|
+
unless params.empty?
|
200
201
|
encoded_fields = URI.encode_www_form(params, Encoding::UTF_8)
|
201
202
|
request.set_form_data(params)
|
202
|
-
else
|
203
|
-
encoded_fields = params.to_json
|
204
|
-
request.body = encoded_fields
|
205
|
-
request.set_content_type("application/json")
|
206
203
|
end
|
207
204
|
else
|
208
|
-
encoded_fields =
|
209
|
-
|
205
|
+
encoded_fields = params.to_json
|
206
|
+
request.body = encoded_fields
|
207
|
+
request.set_content_type("application/json")
|
210
208
|
end
|
209
|
+
else
|
210
|
+
resource_uri.query = URI.encode_www_form(params, Encoding::UTF_8)
|
211
211
|
end
|
212
212
|
|
213
213
|
headers = RestClient.generate_telesign_headers(@customer_id,
|
@@ -216,7 +216,7 @@ module Telesign
|
|
216
216
|
resource,
|
217
217
|
content_type,
|
218
218
|
encoded_fields,
|
219
|
-
user_agent:
|
219
|
+
user_agent: @@user_agent)
|
220
220
|
|
221
221
|
headers.each do |k, v|
|
222
222
|
request[k] = v
|