plivo 4.51.0 → 4.53.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9064c62f724b62e2aeea109723c81030fe138ef
4
- data.tar.gz: 8a0348e73d6792c79034d23cb1e7e90748304183
3
+ metadata.gz: 165ab55e98fbfd73f9ea8e8f7cebc6016a76e703
4
+ data.tar.gz: e33c4b9315f62bee5102194d593bec08bff5df3e
5
5
  SHA512:
6
- metadata.gz: 7f2331bc3b7eb435076f747b19e54a30662051b534baff258c5dbaba40baf6ae659f1d7abd073c5529e3fad97ec4aca3018896bd63aa7d7003759171a75fc798
7
- data.tar.gz: cae52fb1615526472e629ca5455c12f4b38b06f9d8332f709487e1f5f2e3e213005981a9fd4a4b57a5285e6c4c3065614c7f5bf4b5e94f29ca9996f202d096a5
6
+ metadata.gz: 6b7af2135d6c3107c4da88719a23c82134a304ec5c65c16dbe7983fe1ae9033098d99ee93f05a5e73021d4d4aa2b11336dec13f80dc40f625d597e6471d975ec
7
+ data.tar.gz: b11f266cecc2848ffda32719f9d4eb78583dc4d4aca26c58e7d16b9ab4fbf4ed5adfc3e0797fc6eb8c447b22593ce49a931951319390b820da0dc7681e95a724
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Change Log
2
2
 
3
+
4
+ ## [4.53.0](https://github.com/plivo/plivo-ruby/tree/v4.53.0) (2023-11-08)
5
+ **Feature - Verify Service**
6
+ -Added Support for Verify Service Public API'S
7
+ -Create Session API(POST): To create a verify session (2FA). Allowed params recipient, method, channel, callback_url, app_uuid
8
+ -Get Session API(GET): To retrieve a particular session
9
+ -List Sessions : To retrieve all the sessions
10
+ -Validate Session : To validate OTP for a particular session
11
+
12
+ ## [4.52.0](https://github.com/plivo/plivo-ruby/tree/v4.52.0) (2023-11-08)
13
+ **[BETA] Feature - TollFree Verification API Support**
14
+ - API support for Create, Update, Get, Delete, and List Tollfree Verification.
15
+ - Added New Param `toll_free_sms_verification_id` and `toll_free_sms_verification_order_status` in to the response of the [list all numbers API], [list single number API]
16
+ - Added `toll_free_sms_verification_order_status` filter to AccountPhoneNumber - list all my numbers API.
17
+
3
18
  ## [4.51.0](https://github.com/plivo/plivo-ruby/tree/v4.51.0) (2023-10-16)
4
19
  **Introducing campaign_source & import partner camapign API**
5
20
  - New field campaign_source introduced
@@ -17,6 +32,7 @@
17
32
  **Feature - Added New Param 'carrier_fees', 'carrier_fees_rate', 'destination_network' in Get Message and List Message APIs**
18
33
  - Added new params on message get and list response
19
34
 
35
+
20
36
  ## [4.47.0](https://github.com/plivo/plivo-ruby/tree/v4.47.0) (2023-08-03)
21
37
  **Feature - DLT parameters**
22
38
  - Added new params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory` to the [send message API](https://www.plivo.com/docs/sms/api/message/send-a-message/)
data/README.md CHANGED
@@ -9,7 +9,7 @@ The Plivo Ruby SDK makes it simpler to integrate communications into your Ruby a
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'plivo', '>= 4.51.0'
12
+ gem 'plivo', '>= 4.53.0'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -197,4 +197,4 @@ export PLIVO_API_PROD_HOST=<plivoapi_public_endpoint>
197
197
  (The docker container should be running)
198
198
 
199
199
  > Test code and unit tests can also be run within the container using
200
- `make run` and `make test` respectively. (`CONTAINER` argument should be omitted when running from the container)
200
+ `make run` and `make test` respectively. (`CONTAINER` argument should be omitted when running from the container)
@@ -0,0 +1,42 @@
1
+ require 'rubygems'
2
+ require "plivo"
3
+
4
+ include Plivo
5
+ include Plivo::Exceptions
6
+
7
+ AUTH_ID = 'AUTH_ID'
8
+ AUTH_TOKEN = 'AUTH_TOKEN'
9
+
10
+ api = RestClient.new(AUTH_ID, AUTH_TOKEN)
11
+
12
+ begin
13
+ response = api.tollfree_verifications.get('uuid')
14
+ puts response
15
+ rescue PlivoRESTError => e
16
+ puts 'Exception: ' + e.message
17
+ end
18
+
19
+
20
+ begin
21
+ response = api.tollfree_verifications.create('18773582986', '2FA', 'dasas',
22
+ 'd5a9c4d4-d086-42db-940f-e798d480d064', 'VERBAL', 'https://www.aa.com,http://google.com',
23
+ '100', 'qwqwq')
24
+ puts response
25
+ rescue PlivoRESTError => e
26
+ puts 'Exception: ' + e.message
27
+ end
28
+
29
+ begin
30
+ response = api.tollfree_verifications.update('uuid', usecase: '2FA')
31
+ puts response
32
+ rescue PlivoRESTError => e
33
+ puts 'Exception: ' + e.message
34
+ end
35
+
36
+
37
+ begin
38
+ response = api.tollfree_verifications.delete('uuid')
39
+ puts response
40
+ rescue PlivoRESTError => e
41
+ puts 'Exception: ' + e.message
42
+ end
@@ -97,7 +97,7 @@ module Plivo
97
97
  objects: @_resource_list
98
98
  }
99
99
  end
100
-
100
+
101
101
  def perform_action(action = nil, method = 'GET', params = nil, parse = false)
102
102
  resource_path = action ? @_resource_uri + action + '/' : @_resource_uri
103
103
  response = @_client.send_request(resource_path, method, params, nil, false, is_voice_request: @_is_voice_request)
@@ -37,7 +37,9 @@ module Plivo
37
37
  voice_rate: @voice_rate,
38
38
  tendlc_campaign_id: @tendlc_campaign_id,
39
39
  tendlc_registration_status: @tendlc_registration_status,
40
- toll_free_sms_verification: @toll_free_sms_verification
40
+ toll_free_sms_verification: @toll_free_sms_verification,
41
+ toll_free_sms_verification_id: @toll_free_sms_verification_id,
42
+ toll_free_sms_verification_order_status: @toll_free_sms_verification_order_status
41
43
  }.to_s
42
44
  end
43
45
  end
@@ -185,7 +187,9 @@ module Plivo
185
187
  tendlc_registration_status: @tendlc_registration_status,
186
188
  toll_free_sms_verification: @toll_free_sms_verification,
187
189
  renewal_date: @renewal_date,
188
- cnam_lookup: @cnam_lookup
190
+ cnam_lookup: @cnam_lookup,
191
+ toll_free_sms_verification_id: @toll_free_sms_verification_id,
192
+ toll_free_sms_verification_order_status: @toll_free_sms_verification_order_status
189
193
  }.to_s
190
194
  end
191
195
  end
@@ -231,6 +235,8 @@ module Plivo
231
235
  # @option options [String] :cnam_lookup The Cnam Lookup Configuration associated with that number. The following values are valid:
232
236
  # - enabled - Returns the list of numbers for which Cnam Lookup configuration is enabled
233
237
  # - disabled - Returns the list of numbers for which Cnam Lookup configuration is disabled
238
+ # @option options [String] :toll_free_sms_verification_id The id of tollfree verification that the number is currently linked with.
239
+ # @option options [String] :toll_free_sms_verification_order_status Indicates the tollfree verification status of a number.
234
240
  def list(options = nil)
235
241
  return perform_list if options.nil?
236
242
 
@@ -238,7 +244,7 @@ module Plivo
238
244
 
239
245
  params = {}
240
246
 
241
- %i[number_startswith subaccount alias tendlc_campaign_id tendlc_registration_status toll_free_sms_verification renewal_date renewal_date__lt renewal_date__lte renewal_date__gt renewal_date__gte cnam_lookup].each do |param|
247
+ %i[number_startswith subaccount alias tendlc_campaign_id tendlc_registration_status toll_free_sms_verification renewal_date renewal_date__lt renewal_date__lte renewal_date__gt renewal_date__gte cnam_lookup toll_free_sms_verification_order_status].each do |param|
242
248
  if options.key?(param) &&
243
249
  valid_param?(param, options[param], [String, Symbol], true)
244
250
  params[param] = options[param]
@@ -0,0 +1,178 @@
1
+ module Plivo
2
+ module Resources
3
+ include Plivo::Utils
4
+
5
+ class TollfreeVerification < Base::Resource
6
+ def initialize(client, options = nil)
7
+ @_name = 'TollfreeVerification'
8
+ @_identifier_string = 'tollfree_verification'
9
+ super
10
+ end
11
+
12
+ def update(options = nil)
13
+ return perform_update({}) if options.nil?
14
+
15
+ valid_param?(:options, options, Hash, true)
16
+
17
+ params = {}
18
+ params_expected = %i[ usecase usecase_summary profile_uuid optin_type optin_image_url volume message_sample callback_method callback_url extra_data additional_information ]
19
+ params_expected.each do |param|
20
+ if options.key?(param) &&
21
+ valid_param?(param, options[param], [String, Symbol], false)
22
+ params[param] = options[param]
23
+ end
24
+ end
25
+
26
+ perform_update(params)
27
+ end
28
+
29
+ def delete
30
+ perform_delete
31
+ end
32
+
33
+ def to_s
34
+ {
35
+ api_id: @api_id,
36
+ uuid: @uuid,
37
+ number: @number,
38
+ created_at: @created_at,
39
+ updated_at: @updated_at,
40
+ callback_method: @callback_url,
41
+ callback_url: @callback_url,
42
+ extra_data: @extra_data,
43
+ additional_information: @additional_information,
44
+ message_sample: @message_sample,
45
+ optin_image_url: @optin_image_url,
46
+ optin_type: @optin_type,
47
+ profile_uuid: @profile_uuid,
48
+ rejection_reason: @rejection_reason,
49
+ status: @status,
50
+ usecase: @usecase,
51
+ usecase_summary: @usecase_summary,
52
+ volume: @volume
53
+ }.delete_if { |key, value| value.nil? }.to_s
54
+ end
55
+ end
56
+
57
+ class TollfreeVerificationsInterface < Base::ResourceInterface
58
+ def initialize(client, resource_list_json = nil)
59
+ @_name = 'TollfreeVerification'
60
+ @_resource_type = TollfreeVerification
61
+ @_identifier_string = 'tollfree_verification'
62
+ super
63
+ end
64
+
65
+ ##
66
+ # Get an TollfreeVerification
67
+ # @param [String] uuid
68
+ # return [TollfreeVerification]
69
+ def get(uuid)
70
+ valid_param?(:uuid, uuid, [String, Symbol], true)
71
+ perform_get(uuid)
72
+ end
73
+
74
+ ##
75
+ # List all TollfreeVerification
76
+ # @param [Hash] options
77
+ # @option options [Int] :offset
78
+ # @option options [Int] :limit
79
+ # @return [Hash]
80
+ def list(options = nil)
81
+ return perform_list if options.nil?
82
+ valid_param?(:options, options, Hash, true)
83
+
84
+ params = {}
85
+ params_expected = %i[ profile_uuid number status created__lt created__gt usecase created__lte created__gte ]
86
+ params_expected.each do |param|
87
+ if options.key?(param) &&
88
+ valid_param?(param, options[param], [String, Symbol], true)
89
+ params[param] = options[param]
90
+ end
91
+ end
92
+
93
+ %i[offset limit].each do |param|
94
+ if options.key?(param) && valid_param?(param, options[param],
95
+ [Integer], true)
96
+ params[param] = options[param]
97
+ end
98
+ end
99
+
100
+ raise_invalid_request("Offset can't be negative") if options.key?(:offset) && options[:offset] < 0
101
+
102
+ if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
103
+ raise_invalid_request('The maximum number of results that can be '\
104
+ "fetched is 20. limit can't be more than 20 or less than 1")
105
+ end
106
+
107
+ perform_list(params)
108
+ end
109
+
110
+ ##
111
+ # Create an TollfreeVerification
112
+ # @param [String] number
113
+ # @param [String] usecase
114
+ # @param [String] usecase_summary
115
+ # @param [String] profile_uuid
116
+ # @param [String] optin_type
117
+ # @param [String] optin_image_url
118
+ # @param [String] volume
119
+ # @param [String] message_sample
120
+ # @param [String] callback_url
121
+ # @param [String] callback_method
122
+ # @param [String] extra_data
123
+ # @param [String] additional_information
124
+ # return [TollfreeVerification] TollfreeVerification
125
+ def create(number, usecase, usecase_summary, profile_uuid, optin_type, optin_image_url, volume, message_sample, callback_url = nil, callback_method = nil, extra_data = nil, additional_information = nil)
126
+ valid_param?(:number, number, [String, Symbol], true)
127
+ valid_param?(:usecase, usecase, [String, Symbol], true)
128
+ valid_param?(:usecase_summary, usecase_summary, [String, Symbol], true)
129
+ valid_param?(:profile_uuid, profile_uuid, [String, Symbol], true)
130
+ valid_param?(:optin_type, optin_type, [String, Symbol], true)
131
+ valid_param?(:optin_image_url, optin_image_url, [String, Symbol], true)
132
+ valid_param?(:volume, volume, [String, Symbol], true)
133
+ valid_param?(:message_sample, message_sample, [String, Symbol], true)
134
+ valid_param?(:callback_url, callback_url, [String, Symbol], false)
135
+ valid_param?(:callback_method, callback_method, [String, Symbol], false)
136
+ valid_param?(:extra_data, extra_data, [String, Symbol], false)
137
+ valid_param?(:additional_information, additional_information, [String, Symbol], false)
138
+
139
+ params = {
140
+ number: number,
141
+ usecase: usecase,
142
+ usecase_summary: usecase_summary,
143
+ profile_uuid: profile_uuid,
144
+ optin_type: optin_type,
145
+ optin_image_url: optin_image_url,
146
+ volume: volume,
147
+ message_sample: message_sample,
148
+ callback_url: callback_url,
149
+ callback_method: callback_method,
150
+ extra_data: extra_data,
151
+ additional_information: additional_information
152
+ }.delete_if { |key, value| value.nil? }
153
+
154
+ return perform_create(params)
155
+ end
156
+
157
+ ##
158
+ # Update an TollfreeVerification
159
+ # @param [String] uuid
160
+ # @param [Hash] options
161
+ # return [TollfreeVerification]
162
+ def update(uuid, options = nil)
163
+ valid_param?(:uuid, uuid, [String, Symbol], true)
164
+ TollfreeVerification.new(@_client,
165
+ resource_id: uuid).update(options)
166
+ end
167
+
168
+ ##
169
+ # Delete an TollfreeVerification.
170
+ # @param [String] uuid
171
+ def delete(uuid)
172
+ valid_param?(:uuid, uuid, [String, Symbol], true)
173
+ TollfreeVerification.new(@_client,
174
+ resource_id: uuid).delete
175
+ end
176
+ end
177
+ end
178
+ end
@@ -0,0 +1,106 @@
1
+ module Plivo
2
+ module Resources
3
+ include Plivo::Utils
4
+ class Session < Base::Resource
5
+ def initialize(client, options = nil)
6
+ @_name = 'Session'
7
+ @_identifier_string = 'session_uuid'
8
+ super
9
+ end
10
+ def to_s
11
+ {
12
+ api_id: @api_id,
13
+ session_uuid: @session_uuid,
14
+ app_uuid: @app_uuid,
15
+ alias: @alias,
16
+ recipient: @recipient,
17
+ channel: @channel,
18
+ status: @status,
19
+ count: @count,
20
+ requestor_ip: @requestor_ip,
21
+ destination_country_iso2: @destination_country_iso2,
22
+ destination_network: @destination_network,
23
+ attempt_details: @attempt_details,
24
+ charges: @charges,
25
+ created_at: @created_at,
26
+ updated_at: @updated_at
27
+ }.to_s
28
+ end
29
+ end
30
+
31
+ class SessionInterface < Base::ResourceInterface
32
+ def initialize(client, resource_list_json = nil)
33
+ @_name = 'Verify/Session'
34
+ @_resource_type = Session
35
+ @_identifier_string = 'session_uuid'
36
+ super
37
+ end
38
+
39
+ # @param [String] session_uuid
40
+ def get(session_uuid)
41
+ perform_get(session_uuid)
42
+ end
43
+
44
+ def create(app_uuid = nil, recipient = nil,channel = nil,url = nil, method = nil)
45
+ valid_param?(:app_uuid, app_uuid, [String, Symbol], false)
46
+ valid_param?(:recipient, recipient, [Integer, String, Symbol], true)
47
+ valid_param?(:channel, channel, [String, Symbol], false)
48
+ valid_param?(:url, url, [String], false)
49
+ valid_param?(:method, method, String, false, %w[POST GET])
50
+
51
+ params = {
52
+ app_uuid: app_uuid,
53
+ recipient: recipient,
54
+ channel: channel,
55
+ url: url,
56
+ method: method
57
+ }
58
+ perform_create(params)
59
+ end
60
+
61
+ def list(options = nil)
62
+ return perform_list if options.nil?
63
+ valid_param?(:options, options, Hash, true)
64
+ params = {}
65
+ params_expected = %i[
66
+ subaccount status session_time__gt session_time__gte
67
+ session_time__lt session_time__lte session_time country alias app_uuid recipient
68
+ ]
69
+
70
+ params_expected.each do |param|
71
+ if options.key?(param) &&
72
+ valid_param?(param, options[param], [String, Symbol], true)
73
+ params[param] = options[param]
74
+ end
75
+ end
76
+
77
+ %i[offset limit].each do |param|
78
+ if options.key?(param) &&
79
+ valid_param?(param, options[param], [Integer, Integer], true)
80
+ params[param] = options[param]
81
+ end
82
+ end
83
+
84
+ if options.key?(:limit) &&
85
+ (options[:limit] > 20 || options[:limit] <= 0)
86
+ raise_invalid_request('The maximum number of results that can be '\
87
+ "fetched is 20. limit can't be more than 20 or less than 1")
88
+ end
89
+
90
+ raise_invalid_request("Offset can't be negative") if options.key?(:offset) && options[:offset] < 0
91
+
92
+ perform_list_without_object(params)
93
+ end
94
+
95
+ def validate(session_uuid = nil, otp = nil)
96
+ valid_param?(:session_uuid, session_uuid, [String, Symbol], true)
97
+ valid_param?(:otp, otp, [String], true)
98
+ id = session_uuid
99
+ params = {
100
+ otp: otp
101
+ }
102
+ perform_action_with_identifier(id, 'POST', params)
103
+ end
104
+ end
105
+ end
106
+ end
@@ -22,6 +22,8 @@ require_relative 'resources/profile'
22
22
  require_relative 'resources/lookup'
23
23
  require_relative 'resources/regulatory_compliance'
24
24
  require_relative 'resources/multipartycalls'
25
+ require_relative 'resources/verify_session'
26
+ require_relative 'resources/tollfree_verification'
25
27
 
26
28
  module Plivo
27
29
  module Resources
@@ -18,6 +18,8 @@ module Plivo
18
18
  attr_reader :brand, :campaign, :profile
19
19
  attr_reader :end_users
20
20
  attr_reader :compliance_document_types, :compliance_documents, :compliance_requirements, :compliance_applications
21
+ attr_reader :verify_session
22
+ attr_reader :tollfree_verifications
21
23
 
22
24
  def initialize(auth_id = nil, auth_token = nil, proxy_options = nil, timeout = 5)
23
25
  configure_base_uri
@@ -64,6 +66,8 @@ module Plivo
64
66
  @compliance_documents = Resources::ComplianceDocumentsInterface.new(self)
65
67
  @compliance_requirements = Resources::ComplianceRequirementsInterface.new(self)
66
68
  @compliance_applications = Resources::ComplianceApplicationsInterface.new(self)
69
+ @verify_session = Resources::SessionInterface.new(self)
70
+ @tollfree_verifications = Resources::TollfreeVerificationsInterface.new(self)
67
71
  end
68
72
  end
69
73
  end
data/lib/plivo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plivo
2
- VERSION = "4.51.0".freeze
2
+ VERSION = "4.53.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.51.0
4
+ version: 4.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Plivo SDKs Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-16 00:00:00.000000000 Z
11
+ date: 2023-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -158,6 +158,7 @@ files:
158
158
  - examples/multi_party_call.rb
159
159
  - examples/phlos.rb
160
160
  - examples/regulatory_compliance.rb
161
+ - examples/tollfree_verification.rb
161
162
  - lib/plivo.rb
162
163
  - lib/plivo/base.rb
163
164
  - lib/plivo/base/resource.rb
@@ -192,6 +193,8 @@ files:
192
193
  - lib/plivo/resources/recordings.rb
193
194
  - lib/plivo/resources/regulatory_compliance.rb
194
195
  - lib/plivo/resources/token.rb
196
+ - lib/plivo/resources/tollfree_verification.rb
197
+ - lib/plivo/resources/verify_session.rb
195
198
  - lib/plivo/rest_client.rb
196
199
  - lib/plivo/template.rb
197
200
  - lib/plivo/utils.rb