Skip to content

Commit 3d876ea

Browse files
Pull request #13: feature/EOA-5905-FS-Intellegence-Cloud-Api
Merge in SDK/ruby_telesign_enterprise from feature/EOA-5905-FS-Intellegence-Cloud-Api to developer Squashed commit of the following: commit 95950f588522af3cf4c156aadc003151f14c074f Author: Juan Camilo Martinez <jmartinez@telesign.com> Date: Wed Jan 28 11:30:18 2026 -0500 Fix unitest commit 1e6863116713d5b4badfde2440e1515e3e0ed7f5 Merge: 67bed70 68a3626 Author: Juan Camilo Martinez <jmartinez@telesign.com> Date: Wed Jan 28 10:07:31 2026 -0500 fix merge and version commit 67bed70931a7e735c23193cc2080f8ecc33bc3ad Author: MousumiMohanty <@telesign.com> Date: Tue Jan 13 15:38:29 2026 +0530 resolved the conflict and update the release commit 893763160601e6cd35cfb7a936d09a32a94def73 Author: MousumiMohanty <@telesign.com> Date: Fri Nov 14 18:41:12 2025 +0530 Added support for Intelligence Cloud to use new endpoint+removed Legacy PID Score
1 parent 68a3626 commit 3d876ea

8 files changed

Lines changed: 71 additions & 65 deletions

File tree

RELEASE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
5.0.0
2+
3+
- Added support for Intelligence Cloud to use new endpoint.
4+
- Removed Legacy PID Score.
5+
16
4.0.0
27

38
- Added full support for App Verify API.

examples/phoneid_score/1_check_phone_number_risk_level.rb

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require 'telesignenterprise'
2+
3+
customer_id = 'FFFFFFFF-EEEE-DDDD-1234-AB1234567890'
4+
api_key = 'ABC12345yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=='
5+
6+
phone_number = '11234567890'
7+
account_lifecycle_event = 'create'
8+
9+
score_client = TelesignEnterprise::ScoreClient.new(customer_id, api_key)
10+
response = score_client.score(phone_number, account_lifecycle_event)
11+
12+
if response.ok
13+
puts format("Phone number %s has a '%s' risk level and the recommendation is to '%s' the transaction.",
14+
phone_number,
15+
response.json['risk']['level'],
16+
response.json['risk']['recommendation'])
17+
else
18+
puts "Request failed with status code: #{response.status_code}. Details: #{response.json}"
19+
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module TelesignEnterprise
2-
SDK_VERSION = '4.0.0'
2+
SDK_VERSION = '5.0.0'
33
end

lib/telesignenterprise/phoneid.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
require_relative 'constants'
33

44
PHONEID_STANDARD_RESOURCE = '/v1/phoneid/standard/%{phone_number}'
5-
PHONEID_SCORE_RESOURCE = '/v1/phoneid/score/%{phone_number}'
65
PHONEID_LIVE_RESOURCE = '/v1/phoneid/live/%{phone_number}'
76
PHONEID_GET_INFO_PATH = '/v1/phoneid/%{phone_number}'
87
PHONEID_GET_INFO_PATH_ALT = '/v1/phoneid'
@@ -44,16 +43,6 @@ def standard(phone_number, **params)
4443
**params)
4544
end
4645

47-
# Score is an API that delivers reputation scoring based on phone number intelligence, traffic patterns, machine
48-
# learning, and a global data consortium.
49-
#
50-
# See https://developer.telesign.com/docs/rest_api-phoneid-score for detailed API documentation.
51-
def score(phone_number, ucid, **params)
52-
self.get(PHONEID_SCORE_RESOURCE % {:phone_number => phone_number},
53-
ucid: ucid,
54-
**params)
55-
end
56-
5746
# The PhoneID Live API delivers insights such as whether a phone is active or disconnected, a device is reachable
5847
# or unreachable and its roaming status.
5948
#

lib/telesignenterprise/score.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ScoreClient < Telesign::ScoreClient
88

99
def initialize(customer_id,
1010
api_key,
11-
rest_endpoint: 'https://rest-ww.telesign.com',
11+
rest_endpoint: 'https://detect.telesign.com',
1212
timeout: nil,
1313
source: 'ruby_telesign_enterprise',
1414
sdk_version_origin: TelesignEnterprise::SDK_VERSION,

telesignenterprise.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require_relative 'lib/telesignenterprise/constants'
33
Gem::Specification.new do |s|
44
s.name = 'telesignenterprise'
55
s.version = TelesignEnterprise::SDK_VERSION
6-
s.add_runtime_dependency 'telesign', '~> 3.0.0'
6+
s.add_runtime_dependency 'telesign', '~> 4.0.0'
77
s.licenses = ['MIT']
88
s.date = '2017-05-02'
99
s.summary = 'TeleSign Enterprise Ruby SDK'

test/test_rest.rb

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ class TestRest < Test::Unit::TestCase
99

1010
def setup
1111
@customer_id = 'FFFFFFFF-EEEE-DDDD-1234-AB1234567890'
12-
@api_key = 'EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=='
12+
@api_key = 'ABC12345yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=='
1313
@phone_number = '1234567890'
1414
@reference_id = '0123456789ABCDEF0123456789ABCDEF'
15+
@account_lifecycle_event = 'create'
16+
@score_client = TelesignEnterprise::ScoreClient.new(@customer_id, @api_key, rest_endpoint: 'https://detect.telesign.com')
1517
end
1618

1719
def test_phoneid_standard
@@ -29,39 +31,47 @@ def test_phoneid_standard
2931
assert_requested :get, "http://localhost/v1/phoneid/standard/#{@phone_number}", headers: {'Date' => /.*\S.*/}
3032
end
3133

32-
def test_phoneid_score
33-
34-
stub_request(:get, "localhost/v1/phoneid/score/#{@phone_number}?ucid=TOOL").to_return(body: '{}')
35-
36-
client = TelesignEnterprise::PhoneIdClient.new(@customer_id,
37-
@api_key,
38-
rest_endpoint: 'http://localhost')
39-
40-
client.score(@phone_number, 'TOOL')
41-
42-
assert_requested :get, "http://localhost/v1/phoneid/score/#{@phone_number}?ucid=TOOL"
43-
assert_not_requested :get, "http://localhost/v1/phoneid/score/#{@phone_number}?ucid=TOOL", headers: {'Content-Type' => /.*\S.*/}
44-
assert_requested :get, "http://localhost/v1/phoneid/score/#{@phone_number}?ucid=TOOL", headers: {'x-ts-auth-method' => 'HMAC-SHA256'}
45-
assert_requested :get, "http://localhost/v1/phoneid/score/#{@phone_number}?ucid=TOOL", headers: {'x-ts-nonce' => /.*\S.*/}
46-
assert_requested :get, "http://localhost/v1/phoneid/score/#{@phone_number}?ucid=TOOL", headers: {'Date' => /.*\S.*/}
47-
end
48-
49-
def test_score
50-
51-
stub_request(:post, "localhost/v1/score/#{@phone_number}").to_return(body: '{}')
52-
53-
client = TelesignEnterprise::ScoreClient.new(@customer_id,
54-
@api_key,
55-
rest_endpoint: 'http://localhost')
56-
57-
client.score(@phone_number, 'create')
58-
59-
assert_requested :post, "http://localhost/v1/score/#{@phone_number}"
60-
assert_requested :post, "http://localhost/v1/score/#{@phone_number}", body: 'account_lifecycle_event=create'
61-
assert_requested :post, "http://localhost/v1/score/#{@phone_number}", headers: {'Content-Type' => 'application/x-www-form-urlencoded'}
62-
assert_requested :post, "http://localhost/v1/score/#{@phone_number}", headers: {'x-ts-auth-method' => 'HMAC-SHA256'}
63-
assert_requested :post, "http://localhost/v1/score/#{@phone_number}", headers: {'x-ts-nonce' => /.*\S.*/}
64-
assert_requested :post, "http://localhost/v1/score/#{@phone_number}", headers: {'Date' => /.*\S.*/}
34+
def test_score_success
35+
36+
stub_request(:post, "https://detect.telesign.com/intelligence/phone")
37+
.with(
38+
body: hash_including({
39+
'phone_number' => @phone_number,
40+
'account_lifecycle_event' => @account_lifecycle_event
41+
}),
42+
headers: { 'Content-Type' => 'application/x-www-form-urlencoded' }
43+
)
44+
.to_return(
45+
status: 200,
46+
body: '{"risk": {"level": "low", "recommendation": "allow"}}',
47+
headers: { 'Content-Type' => 'application/json' }
48+
)
49+
50+
response = @score_client.score(@phone_number, @account_lifecycle_event)
51+
52+
puts "Response status code: #{response.status_code}"
53+
puts "Response headers: #{response.headers}"
54+
puts "Response body: #{response.body}"
55+
puts "Parsed JSON response: #{response.json}"
56+
57+
assert response.ok
58+
assert_equal 'low', response.json['risk']['level']
59+
assert_equal 'allow', response.json['risk']['recommendation']
60+
61+
assert_requested :post, "https://detect.telesign.com/intelligence/phone"
62+
assert_requested :post, "https://detect.telesign.com/intelligence/phone",
63+
body: hash_including({
64+
'phone_number' => @phone_number,
65+
'account_lifecycle_event' => @account_lifecycle_event
66+
})
67+
assert_requested :post, "https://detect.telesign.com/intelligence/phone",
68+
headers: {'Content-Type' => 'application/x-www-form-urlencoded'}
69+
assert_requested :post, "https://detect.telesign.com/intelligence/phone",
70+
headers: {'x-ts-auth-method' => 'HMAC-SHA256'}
71+
assert_requested :post, "https://detect.telesign.com/intelligence/phone",
72+
headers: {'x-ts-nonce' => /.*\S.*/}
73+
assert_requested :post, "https://detect.telesign.com/intelligence/phone",
74+
headers: {'Date' => /.*\S.*/}
6575
end
6676

6777
def test_messaging

0 commit comments

Comments
 (0)