plivo 4.52.0 → 4.53.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34497f9d142b84bc7c0de42434efea2a2a739b12
4
- data.tar.gz: 7a05d083a44046f3d659b6aa4c1a698f1e87ce89
3
+ metadata.gz: 165ab55e98fbfd73f9ea8e8f7cebc6016a76e703
4
+ data.tar.gz: e33c4b9315f62bee5102194d593bec08bff5df3e
5
5
  SHA512:
6
- metadata.gz: 824b576009892ffda04e7daac13a926b6804faaedde5ba362707bde53f0fe9e9059db04e131ef2edc54f1c7f6b19e7c364737026b3bd79d85fa8e9a29c2460ee
7
- data.tar.gz: 38880270d8fedbebf5e5a8c66c06aad68e654c8c408f621818b104110392801a2ac2547d1a1161abf3cb603aa0ead8ed071c65c80ccfa408bb47e1582dd51253
6
+ metadata.gz: 6b7af2135d6c3107c4da88719a23c82134a304ec5c65c16dbe7983fe1ae9033098d99ee93f05a5e73021d4d4aa2b11336dec13f80dc40f625d597e6471d975ec
7
+ data.tar.gz: b11f266cecc2848ffda32719f9d4eb78583dc4d4aca26c58e7d16b9ab4fbf4ed5adfc3e0797fc6eb8c447b22593ce49a931951319390b820da0dc7681e95a724
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
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
+
3
12
  ## [4.52.0](https://github.com/plivo/plivo-ruby/tree/v4.52.0) (2023-11-08)
4
13
  **[BETA] Feature - TollFree Verification API Support**
5
14
  - API support for Create, Update, Get, Delete, and List Tollfree Verification.
@@ -23,6 +32,7 @@
23
32
  **Feature - Added New Param 'carrier_fees', 'carrier_fees_rate', 'destination_network' in Get Message and List Message APIs**
24
33
  - Added new params on message get and list response
25
34
 
35
+
26
36
  ## [4.47.0](https://github.com/plivo/plivo-ruby/tree/v4.47.0) (2023-08-03)
27
37
  **Feature - DLT parameters**
28
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.52.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)
@@ -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)
@@ -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,7 @@ 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'
25
26
  require_relative 'resources/tollfree_verification'
26
27
 
27
28
  module Plivo
@@ -18,6 +18,7 @@ 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
21
22
  attr_reader :tollfree_verifications
22
23
 
23
24
  def initialize(auth_id = nil, auth_token = nil, proxy_options = nil, timeout = 5)
@@ -65,6 +66,7 @@ module Plivo
65
66
  @compliance_documents = Resources::ComplianceDocumentsInterface.new(self)
66
67
  @compliance_requirements = Resources::ComplianceRequirementsInterface.new(self)
67
68
  @compliance_applications = Resources::ComplianceApplicationsInterface.new(self)
69
+ @verify_session = Resources::SessionInterface.new(self)
68
70
  @tollfree_verifications = Resources::TollfreeVerificationsInterface.new(self)
69
71
  end
70
72
  end
data/lib/plivo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plivo
2
- VERSION = "4.52.0".freeze
2
+ VERSION = "4.53.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.52.0
4
+ version: 4.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Plivo SDKs Team
@@ -194,6 +194,7 @@ files:
194
194
  - lib/plivo/resources/regulatory_compliance.rb
195
195
  - lib/plivo/resources/token.rb
196
196
  - lib/plivo/resources/tollfree_verification.rb
197
+ - lib/plivo/resources/verify_session.rb
197
198
  - lib/plivo/rest_client.rb
198
199
  - lib/plivo/template.rb
199
200
  - lib/plivo/utils.rb