Class: Telesign::ScoreClient
- Inherits:
-
RestClient
- Object
- RestClient
- Telesign::ScoreClient
- Defined in:
- lib/telesign/score.rb
Overview
Obtain a risk recommendation for a phone number using TeleSign Intelligence Cloud API. Supports POST /intelligence/phone endpoint (Cloud migration). Sends phone number and parameters in request body as form-urlencoded. See developer.telesign.com/enterprise/reference/submitphonenumberforintelligencecloud for detailed API documentation.
Instance Method Summary collapse
-
#initialize(customer_id, api_key, rest_endpoint: DETECT_HOST, **kwargs) ⇒ ScoreClient
constructor
A new instance of ScoreClient.
-
#score(phone_number, account_lifecycle_event, **params) ⇒ Object
Required parameters: - phone_number - account_lifecycle_event (“create”, “sign-in”, “transact”, “update”, “delete”) Optional parameters: account_id, device_id, email_address, external_id, originating_ip, etc.
Methods inherited from RestClient
#delete, generate_telesign_headers, #get, #patch, #post, #put
Constructor Details
#initialize(customer_id, api_key, rest_endpoint: DETECT_HOST, **kwargs) ⇒ ScoreClient
Returns a new instance of ScoreClient.
14 15 16 |
# File 'lib/telesign/score.rb', line 14 def initialize(customer_id, api_key, rest_endpoint: DETECT_HOST, **kwargs) super(customer_id, api_key, rest_endpoint: rest_endpoint, **kwargs) end |
Instance Method Details
#score(phone_number, account_lifecycle_event, **params) ⇒ Object
Required parameters:
- phone_number
- account_lifecycle_event ("create", "sign-in", "transact", "update", "delete")
Optional parameters: account_id, device_id, email_address, external_id, originating_ip, etc.
22 23 24 25 26 27 28 29 30 |
# File 'lib/telesign/score.rb', line 22 def score(phone_number, account_lifecycle_event, **params) raise ArgumentError, 'phone_number cannot be null or empty' if phone_number.nil? || phone_number.empty? raise ArgumentError, 'account_lifecycle_event cannot be null or empty' if account_lifecycle_event.nil? || account_lifecycle_event.empty? params[:phone_number] = phone_number params[:account_lifecycle_event] = account_lifecycle_event self.post(INTELLIGENCE_RESOURCE, **params) end |