telesignenterprise 2.3.0 → 2.4.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 +4 -4
- data/lib/telesignenterprise/messaging.rb +27 -1
- data/lib/telesignenterprise/verify.rb +36 -7
- 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: ad367b3204a2209e7074a0c1fa167665c05a70ba5760f43d127ac4106e4bbe75
|
4
|
+
data.tar.gz: fec6f5ac5dc947a2245f973a5f74da4bd80922763b027c18d033c54fcd03a344
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87d874486d7ec7f68efbd427143399249b93d0569e1f9be1f786f668f9fba7ce61a802d9970f9d59ae9b96720eb2a9343ca93d7e7ded0a5bdcb35ba8662f0ef9
|
7
|
+
data.tar.gz: 7d9e8d2ab6a188a078d8921567a8e996a5fce47bed9133e8ad7d203cafe6feb126c306cbc123e7fad5710d79244d5384e8dd791b4ec548d17cbcfd48339257a8
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'telesign'
|
2
2
|
|
3
|
+
OMNI_MESSAGING_RESOURCE = '/v1/omnichannel'
|
3
4
|
module TelesignEnterprise
|
4
5
|
|
5
6
|
# TeleSign's Messaging API allows you to easily send SMS messages. You can send alerts, reminders, and notifications,
|
6
7
|
# or you can send verification messages containing one-time passcodes (OTP).
|
7
8
|
class MessagingClient < Telesign::MessagingClient
|
8
|
-
|
9
9
|
def initialize(customer_id,
|
10
10
|
api_key,
|
11
11
|
rest_endpoint: 'https://rest-ww.telesign.com',
|
@@ -16,5 +16,31 @@ module TelesignEnterprise
|
|
16
16
|
rest_endpoint: rest_endpoint,
|
17
17
|
timeout: timeout)
|
18
18
|
end
|
19
|
+
# Telesign Messaging allows you to easily send a message to the target recipient using any of Telesign's supported channels.
|
20
|
+
class OmniMessagingClient < Telesign::RestClient
|
21
|
+
def initialize(customer_id,
|
22
|
+
api_key,
|
23
|
+
rest_endpoint,
|
24
|
+
timeout: nil)
|
25
|
+
|
26
|
+
super(customer_id,
|
27
|
+
api_key,
|
28
|
+
rest_endpoint: rest_endpoint,
|
29
|
+
timeout: timeout)
|
30
|
+
end
|
31
|
+
def omni_message(**params)
|
32
|
+
self.post(OMNI_MESSAGING_RESOURCE, **params)
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def content_type
|
37
|
+
"application/json"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def omni_message (**params)
|
42
|
+
omni_msg = OmniMessagingClient.new(@customer_id, @api_key, @rest_endpoint)
|
43
|
+
omni_msg.omni_message(**params)
|
44
|
+
end
|
19
45
|
end
|
20
46
|
end
|
@@ -3,16 +3,15 @@ require 'telesign/rest'
|
|
3
3
|
VERIFY_SMS_RESOURCE = '/v1/verify/sms'
|
4
4
|
VERIFY_VOICE_RESOURCE = '/v1/verify/call'
|
5
5
|
VERIFY_SMART_RESOURCE = '/v1/verify/smart'
|
6
|
-
VERIFY_PUSH_RESOURCE = '/v2/verify/push'
|
7
6
|
VERIFY_STATUS_RESOURCE = '/v1/verify/%{reference_id}'
|
8
7
|
VERIFY_COMPLETION_RESOURCE = '/v1/verify/completion/%{reference_id}'
|
8
|
+
VERIFY_OMNICHANNEL_RESOURCE = '/verification'
|
9
9
|
|
10
10
|
module TelesignEnterprise
|
11
11
|
|
12
12
|
# The Verify API delivers phone-based verification and two-factor authentication using a time-based, one-time passcode
|
13
13
|
# sent via SMS message and Voice call.
|
14
14
|
class VerifyClient < Telesign::RestClient
|
15
|
-
|
16
15
|
def initialize(customer_id,
|
17
16
|
api_key,
|
18
17
|
rest_endpoint: 'https://rest-ww.telesign.com',
|
@@ -24,12 +23,38 @@ module TelesignEnterprise
|
|
24
23
|
timeout: timeout)
|
25
24
|
end
|
26
25
|
|
26
|
+
class OmniVerifyClient < Telesign::RestClient
|
27
|
+
def initialize(customer_id,
|
28
|
+
api_key,
|
29
|
+
rest_endpoint: 'https://verify.telesign.com',
|
30
|
+
timeout: nil)
|
31
|
+
|
32
|
+
super(customer_id,
|
33
|
+
api_key,
|
34
|
+
rest_endpoint: rest_endpoint,
|
35
|
+
timeout: timeout)
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_verification_process(phone_number, **params)
|
39
|
+
params = { recipient: { phone_number:phone_number } }
|
40
|
+
if !params.key?("verification_policy")
|
41
|
+
params[:verification_policy] = [{ method: 'sms', fallback_time: 30 }]
|
42
|
+
end
|
43
|
+
self.post(VERIFY_OMNICHANNEL_RESOURCE, **params)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def content_type
|
49
|
+
"application/json"
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
27
53
|
# The SMS Verify API delivers phone-based verification and two-factor authentication using a time-based,
|
28
54
|
# one-time passcode sent over SMS.
|
29
55
|
#
|
30
56
|
# See https://developer.telesign.com/docs/rest_api-verify-sms for detailed API documentation.
|
31
57
|
def sms(phone_number, **params)
|
32
|
-
|
33
58
|
self.post(VERIFY_SMS_RESOURCE,
|
34
59
|
phone_number: phone_number,
|
35
60
|
**params)
|
@@ -40,7 +65,6 @@ module TelesignEnterprise
|
|
40
65
|
#
|
41
66
|
# See https://developer.telesign.com/docs/rest_api-verify-call for detailed API documentation.
|
42
67
|
def voice(phone_number, **params)
|
43
|
-
|
44
68
|
self.post(VERIFY_VOICE_RESOURCE,
|
45
69
|
phone_number: phone_number,
|
46
70
|
**params)
|
@@ -52,7 +76,6 @@ module TelesignEnterprise
|
|
52
76
|
#
|
53
77
|
# See https://developer.telesign.com/docs/rest_api-smart-verify for detailed API documentation.
|
54
78
|
def smart(phone_number, ucid, **params)
|
55
|
-
|
56
79
|
self.post(VERIFY_SMART_RESOURCE,
|
57
80
|
phone_number: phone_number,
|
58
81
|
ucid: ucid,
|
@@ -63,7 +86,6 @@ module TelesignEnterprise
|
|
63
86
|
#
|
64
87
|
# See https://developer.telesign.com/docs/rest_api-verify-transaction-callback for detailed API documentation.
|
65
88
|
def status(reference_id, **params)
|
66
|
-
|
67
89
|
self.get(VERIFY_STATUS_RESOURCE % {:reference_id => reference_id},
|
68
90
|
**params)
|
69
91
|
end
|
@@ -73,10 +95,17 @@ module TelesignEnterprise
|
|
73
95
|
#
|
74
96
|
# See https://developer.telesign.com/docs/completion-service-for-verify-products for detailed API documentation.
|
75
97
|
def completion(reference_id, **params)
|
76
|
-
|
77
98
|
self.put(VERIFY_COMPLETION_RESOURCE % {:reference_id => reference_id},
|
78
99
|
**params)
|
79
100
|
end
|
80
101
|
|
102
|
+
# Use this action to create a verification process for the specified phone number.
|
103
|
+
#
|
104
|
+
# See https://developer.telesign.com/enterprise/reference/createverificationprocess for detailed API documentation.
|
105
|
+
def create_verification_process(phone_number, **params)
|
106
|
+
omni_verify = OmniVerifyClient.new(@customer_id, @api_key, rest_endpoint: @rest_endpoint)
|
107
|
+
omni_verify.create_verification_process(phone_number, **params)
|
108
|
+
end
|
109
|
+
|
81
110
|
end
|
82
111
|
end
|