telesign 2.0.0 → 2.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab9def95b96cf38a18a3da1f0bdeb190bb2b1251
4
- data.tar.gz: 2b56069c25921ede2a59470e077d45b36536a60f
3
+ metadata.gz: f2469ff0545e1d6a18b42e08d748316be9ae2229
4
+ data.tar.gz: edba5fd4a806d74d05bc2056ca969d095911f1be
5
5
  SHA512:
6
- metadata.gz: 7717044b79a5869bf239d0c0e0f522337a8e90cdcc0be80e3cf69c56e419307a804f2c59252118d413309b0338325a5672e583f25c40f5638bcbc0c0864843af
7
- data.tar.gz: 17264a1b3234d6b5dfe37a492c867200db0f2943faa6dab287d31c8313544e7629469c142ef1b6209d7c03298daeca23ee682d0033d092927bfb2846cbd3b425
6
+ metadata.gz: b061850acaacb000e4095979bf5c5f4eafa64386b019a412d7855cfa0e2ab0478c5d438f27ce7023507c51b9621f710ec41a6832e7dc8a6aaf947b7c8066d054
7
+ data.tar.gz: e27c9be87b4e690dbf94710e37e11ac050b87e7415e7d31f820a75df7f958039bbd69a1ce466ed0043e9f2edf190057e1bb613cec8368861a0f9771fc60d4f23
@@ -12,8 +12,8 @@ module Telesign
12
12
  # flow you must check the status using TeleSign's servers on your backend. Do not rely on the SDK alone to
13
13
  # indicate a successful verification.
14
14
  #
15
- # See https://developer.telesign.com/docs/auto-verify-sdk#section-obtaining-verification-status for detailed API
16
- # documentation.
15
+ # See https://developer.telesign.com/docs/auto-verify-sdk-self#section-obtaining-verification-status for detailed
16
+ # API documentation.
17
17
  def status(external_id, **params)
18
18
 
19
19
  self.get(AUTOVERIFY_STATUS_RESOURCE % {:external_id => external_id},
@@ -11,7 +11,7 @@ module Telesign
11
11
 
12
12
  # Send a message to the target phone_number.
13
13
  #
14
- # See https://developer.telesign.com/v2.0/docs/messaging-api for detailed API documentation.
14
+ # See https://developer.telesign.com/docs/messaging-api for detailed API documentation.
15
15
  def message(phone_number, message, message_type, **params)
16
16
 
17
17
  self.post(MESSAGING_RESOURCE,
@@ -23,7 +23,7 @@ module Telesign
23
23
 
24
24
  # Retrieves the current status of the message.
25
25
  #
26
- # See https://developer.telesign.com/v2.0/docs/messaging-api for detailed API documentation.
26
+ # See https://developer.telesign.com/docs/messaging-api for detailed API documentation.
27
27
  def status(reference_id, **params)
28
28
 
29
29
  self.get(MESSAGING_STATUS_RESOURCE % {:reference_id => reference_id},
data/lib/telesign/rest.rb CHANGED
@@ -7,7 +7,7 @@ require 'securerandom'
7
7
  require 'net/http/persistent'
8
8
 
9
9
  module Telesign
10
- SDK_VERSION = '2.0.0'
10
+ SDK_VERSION = '2.1.0'
11
11
 
12
12
  # The TeleSign RestClient is a generic HTTP REST client that can be extended to make requests against any of
13
13
  # TeleSign's REST API endpoints.
@@ -44,18 +44,18 @@ module Telesign
44
44
  # TeleSign RestClient, useful for making generic RESTful requests against the API.
45
45
  #
46
46
  # * +customer_id+ - Your customer_id string associated with your account.
47
- # * +secret_key+ - Your secret_key string associated with your account.
48
- # * +api_host+ - (optional) Override the default api_host to target another endpoint string.
47
+ # * +api_key+ - Your api_key string associated with your account.
48
+ # * +rest_endpoint+ - (optional) Override the default rest_endpoint to target another endpoint.
49
49
  # * +timeout+ - (optional) How long to wait for the server to send data before giving up, as a float.
50
50
  def initialize(customer_id,
51
- secret_key,
52
- api_host: 'https://rest-api.telesign.com',
51
+ api_key,
52
+ rest_endpoint: 'https://rest-api.telesign.com',
53
53
  proxy: nil,
54
54
  timeout: 10)
55
55
 
56
56
  @customer_id = customer_id
57
- @secret_key = secret_key
58
- @api_host = api_host
57
+ @api_key = api_key
58
+ @rest_endpoint = rest_endpoint
59
59
 
60
60
  @http = Net::HTTP::Persistent.new(name: 'telesign', proxy: proxy)
61
61
 
@@ -70,10 +70,10 @@ module Telesign
70
70
  # Creates the canonicalized string_to_sign and generates the HMAC signature. This is used to authenticate requests
71
71
  # against the TeleSign REST API.
72
72
  #
73
- # See https://developer.telesign.com/docs/authentication-1 for detailed API documentation.
73
+ # See https://developer.telesign.com/docs/authentication for detailed API documentation.
74
74
  #
75
75
  # * +customer_id+ - Your account customer_id.
76
- # * +secret_key+ - Your account secret_key.
76
+ # * +api_key+ - Your account api_key.
77
77
  # * +method_name+ - The HTTP method name of the request as a upper case string, should be one of 'POST', 'GET',
78
78
  # 'PUT' or 'DELETE'.
79
79
  # * +resource+ - The partial resource URI to perform the request against, as a string.
@@ -82,7 +82,7 @@ module Telesign
82
82
  # * +nonce+ - A unique cryptographic nonce for the request, as a string.
83
83
  # * +user_agent+ - (optional) User Agent associated with the request, as a string.
84
84
  def self.generate_telesign_headers(customer_id,
85
- secret_key,
85
+ api_key,
86
86
  method_name,
87
87
  resource,
88
88
  url_encoded_fields,
@@ -119,17 +119,17 @@ module Telesign
119
119
  string_to_sign << "\n#{resource}"
120
120
 
121
121
  digest = OpenSSL::Digest.new('sha256')
122
- key = Base64.decode64(secret_key)
122
+ key = Base64.decode64(api_key)
123
123
 
124
124
  signature = Base64.encode64(OpenSSL::HMAC.digest(digest, key, string_to_sign)).strip
125
125
 
126
126
  authorization = "TSA #{customer_id}:#{signature}"
127
127
 
128
128
  headers = {
129
- 'Authorization': authorization,
130
- 'Date': date_rfc2616,
131
- 'x-ts-auth-method': auth_method,
132
- 'x-ts-nonce': nonce
129
+ :'Authorization'=>authorization,
130
+ :'Date'=>date_rfc2616,
131
+ :'x-ts-auth-method'=>auth_method,
132
+ :'x-ts-nonce'=>nonce
133
133
  }
134
134
 
135
135
  unless user_agent.nil?
@@ -189,12 +189,12 @@ module Telesign
189
189
  # * +params+ - Body params to perform the HTTP request with, as a hash.
190
190
  def execute(method_function, method_name, resource, **params)
191
191
 
192
- resource_uri = URI.parse("#{@api_host}#{resource}")
192
+ resource_uri = URI.parse("#{@rest_endpoint}#{resource}")
193
193
 
194
194
  url_encoded_fields = URI.encode_www_form(params)
195
195
 
196
196
  headers = RestClient.generate_telesign_headers(@customer_id,
197
- @secret_key,
197
+ @api_key,
198
198
  method_name,
199
199
  resource,
200
200
  url_encoded_fields,
@@ -10,7 +10,7 @@ module Telesign
10
10
  # Score is an API that delivers reputation scoring based on phone number intelligence, traffic patterns, machine
11
11
  # learning, and a global data consortium.
12
12
  #
13
- # See https://developer.telesign.com/docs/rest_api-phoneid-score for detailed API documentation.
13
+ # See https://developer.telesign.com/docs/score-api for detailed API documentation.
14
14
  def score(phone_number, account_lifecycle_event, **params)
15
15
 
16
16
  self.post(SCORE_RESOURCE % {:phone_number => phone_number},
data/lib/telesign/util.rb CHANGED
@@ -11,13 +11,13 @@ module Telesign
11
11
 
12
12
  # Verify that a callback was made by TeleSign and was not sent by a malicious client by verifying the signature.
13
13
  #
14
- # * +secret_key+ - the TeleSign API secret_key associated with your account.
14
+ # * +api_key+ - the TeleSign API api_key associated with your account.
15
15
  # * +signature+ - the TeleSign Authorization header value supplied in the callback, as a string.
16
16
  # * +json_str+ - the POST body text, that is, the JSON string sent by TeleSign describing the transaction status.
17
- def verify_telesign_callback_signature(secret_key, signature, json_str)
17
+ def verify_telesign_callback_signature(api_key, signature, json_str)
18
18
 
19
19
  digest = OpenSSL::Digest.new('sha256')
20
- key = Base64.decode64(secret_key)
20
+ key = Base64.decode64(api_key)
21
21
 
22
22
  your_signature = Base64.encode64(OpenSSL::HMAC.digest(digest, key, json_str)).strip
23
23
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telesign
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TeleSign
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-26 00:00:00.000000000 Z
11
+ date: 2017-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-http-persistent
@@ -30,6 +30,76 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 3.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: test-unit
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: mocha
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: codecov
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: simplecov
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
33
103
  description: TeleSign Ruby SDK
34
104
  email: support@telesign.com
35
105
  executables: []