telesignenterprise 2.3.1 → 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 -6
 - 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
         
     | 
| 
         @@ -5,13 +5,13 @@ VERIFY_VOICE_RESOURCE = '/v1/verify/call' 
     | 
|
| 
       5 
5 
     | 
    
         
             
            VERIFY_SMART_RESOURCE = '/v1/verify/smart'
         
     | 
| 
       6 
6 
     | 
    
         
             
            VERIFY_STATUS_RESOURCE = '/v1/verify/%{reference_id}'
         
     | 
| 
       7 
7 
     | 
    
         
             
            VERIFY_COMPLETION_RESOURCE = '/v1/verify/completion/%{reference_id}'
         
     | 
| 
      
 8 
     | 
    
         
            +
            VERIFY_OMNICHANNEL_RESOURCE = '/verification'
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
            module TelesignEnterprise
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
12 
     | 
    
         
             
              # The Verify API delivers phone-based verification and two-factor authentication using a time-based, one-time passcode
         
     | 
| 
       12 
13 
     | 
    
         
             
              # sent via SMS message and Voice call.
         
     | 
| 
       13 
14 
     | 
    
         
             
              class VerifyClient < Telesign::RestClient
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
15 
     | 
    
         
             
                def initialize(customer_id,
         
     | 
| 
       16 
16 
     | 
    
         
             
                               api_key,
         
     | 
| 
       17 
17 
     | 
    
         
             
                               rest_endpoint: 'https://rest-ww.telesign.com',
         
     | 
| 
         @@ -23,12 +23,38 @@ module TelesignEnterprise 
     | 
|
| 
       23 
23 
     | 
    
         
             
                        timeout: timeout)
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
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
         
     | 
| 
       26 
53 
     | 
    
         
             
                # The SMS Verify API delivers phone-based verification and two-factor authentication using a time-based,
         
     | 
| 
       27 
54 
     | 
    
         
             
                # one-time passcode sent over SMS.
         
     | 
| 
       28 
55 
     | 
    
         
             
                #
         
     | 
| 
       29 
56 
     | 
    
         
             
                # See https://developer.telesign.com/docs/rest_api-verify-sms for detailed API documentation.
         
     | 
| 
       30 
57 
     | 
    
         
             
                def sms(phone_number, **params)
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
58 
     | 
    
         
             
                  self.post(VERIFY_SMS_RESOURCE,
         
     | 
| 
       33 
59 
     | 
    
         
             
                            phone_number: phone_number,
         
     | 
| 
       34 
60 
     | 
    
         
             
                            **params)
         
     | 
| 
         @@ -39,7 +65,6 @@ module TelesignEnterprise 
     | 
|
| 
       39 
65 
     | 
    
         
             
                #
         
     | 
| 
       40 
66 
     | 
    
         
             
                # See https://developer.telesign.com/docs/rest_api-verify-call for detailed API documentation.
         
     | 
| 
       41 
67 
     | 
    
         
             
                def voice(phone_number, **params)
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
68 
     | 
    
         
             
                  self.post(VERIFY_VOICE_RESOURCE,
         
     | 
| 
       44 
69 
     | 
    
         
             
                            phone_number: phone_number,
         
     | 
| 
       45 
70 
     | 
    
         
             
                            **params)
         
     | 
| 
         @@ -51,7 +76,6 @@ module TelesignEnterprise 
     | 
|
| 
       51 
76 
     | 
    
         
             
                #
         
     | 
| 
       52 
77 
     | 
    
         
             
                # See https://developer.telesign.com/docs/rest_api-smart-verify for detailed API documentation.
         
     | 
| 
       53 
78 
     | 
    
         
             
                def smart(phone_number, ucid, **params)
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
79 
     | 
    
         
             
                  self.post(VERIFY_SMART_RESOURCE,
         
     | 
| 
       56 
80 
     | 
    
         
             
                            phone_number: phone_number,
         
     | 
| 
       57 
81 
     | 
    
         
             
                            ucid: ucid,
         
     | 
| 
         @@ -62,7 +86,6 @@ module TelesignEnterprise 
     | 
|
| 
       62 
86 
     | 
    
         
             
                #
         
     | 
| 
       63 
87 
     | 
    
         
             
                # See https://developer.telesign.com/docs/rest_api-verify-transaction-callback for detailed API documentation.
         
     | 
| 
       64 
88 
     | 
    
         
             
                def status(reference_id, **params)
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
89 
     | 
    
         
             
                  self.get(VERIFY_STATUS_RESOURCE % {:reference_id => reference_id},
         
     | 
| 
       67 
90 
     | 
    
         
             
                           **params)
         
     | 
| 
       68 
91 
     | 
    
         
             
                end
         
     | 
| 
         @@ -72,10 +95,17 @@ module TelesignEnterprise 
     | 
|
| 
       72 
95 
     | 
    
         
             
                #
         
     | 
| 
       73 
96 
     | 
    
         
             
                # See https://developer.telesign.com/docs/completion-service-for-verify-products for detailed API documentation.
         
     | 
| 
       74 
97 
     | 
    
         
             
                def completion(reference_id, **params)
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
98 
     | 
    
         
             
                  self.put(VERIFY_COMPLETION_RESOURCE % {:reference_id => reference_id},
         
     | 
| 
       77 
99 
     | 
    
         
             
                           **params)
         
     | 
| 
       78 
100 
     | 
    
         
             
                end
         
     | 
| 
       79 
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 
     | 
    
         
            +
             
     | 
| 
       80 
110 
     | 
    
         
             
              end
         
     | 
| 
       81 
111 
     | 
    
         
             
            end
         
     |