Skip to content

Commit 91497ee

Browse files
committed
Pull request #2: Added tracking to the request
Merge in SDK/ruby_telesign from feature/EOA-2027-SS to developer * commit 'f006fbbf00d6fb7bd62a71c2c26d5708a4a7b862': Clean code Update restcliente to add tracking to the request Updat RELEASE file
2 parents c129599 + f006fbb commit 91497ee

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

RELEASE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2.3.0
2+
3+
- Added tracking to request
4+
15
2.2.5
26

37
- Update comments in both methods of messaging.rb class

lib/telesign/rest.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
require 'net/http/persistent'
88

99
module Telesign
10-
SDK_VERSION = '2.2.4'
10+
SDK_VERSION = '2.3.0'
1111

1212
# The TeleSign RestClient is a generic HTTP REST client that can be extended to make requests against any of
1313
# TeleSign's REST API endpoints.
@@ -18,8 +18,6 @@ module Telesign
1818
# See https://developer.telesign.com for detailed API documentation.
1919
class RestClient
2020

21-
@@user_agent = "TeleSignSDK/ruby-{#{SDK_VERSION} #{RUBY_DESCRIPTION} net/http/persistent"
22-
2321
# A simple HTTP Response object to abstract the underlying net/http library response.
2422

2523
# * +http_response+ - A net/http response object.
@@ -51,12 +49,21 @@ def initialize(customer_id,
5149
api_key,
5250
rest_endpoint: 'https://rest-api.telesign.com',
5351
proxy: nil,
54-
timeout: 10)
52+
timeout: 10,
53+
source: 'ruby_telesign',
54+
sdk_version_origin: SDK_VERSION,
55+
sdk_version_dependency: nil)
5556

5657
@customer_id = customer_id
5758
@api_key = api_key
5859
@rest_endpoint = rest_endpoint
5960

61+
@user_agent = "TeleSignSDK/ruby Ruby/#{RUBY_VERSION} net:http:persistent/#{Net::HTTP::VERSION} OriginatingSDK/#{source} SDKVersion/#{sdk_version_origin}"
62+
63+
if (source != 'ruby_telesign' && sdk_version_dependency.nil?)
64+
@user_agent += " DependencySDKVersion/#{sdk_version_dependency}"
65+
end
66+
6067
@http = Net::HTTP::Persistent.new(name: 'telesign', proxy: proxy)
6168

6269
unless timeout.nil?
@@ -216,7 +223,7 @@ def execute(method_function, method_name, resource, **params)
216223
resource,
217224
content_type,
218225
encoded_fields,
219-
user_agent: @@user_agent)
226+
user_agent: @user_agent)
220227

221228
headers.each do |k, v|
222229
request[k] = v

telesign.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = 'telesign'
3-
s.version = '2.2.5'
3+
s.version = '2.3.0'
44
s.licenses = ['MIT']
55
s.date = '2017-05-25'
66
s.summary = 'TeleSign Ruby SDK'

0 commit comments

Comments
 (0)