plivo 4.62.5 → 4.63.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 +5 -5
- data/CHANGELOG.md +8 -0
- data/Jenkinsfile +1 -1
- data/lib/plivo/base_client.rb +38 -0
- data/lib/plivo/resources/phone_number_compliance.rb +237 -0
- data/lib/plivo/resources.rb +1 -0
- data/lib/plivo/rest_client.rb +4 -0
- data/lib/plivo/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b7feb166ac65a790e3e4a2f867a5bc0a20b45b821542eb42c7554f23bb646a1e
|
|
4
|
+
data.tar.gz: 5441a2c40447077ea816bfd3cb0ad759d4f78524e24a99bd663f16d028a9dd7b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b16eb173bdde01de8ad84060be549bb4c1d0b017bdf7b9e891e32bfa6d85977f4e8289e9b6284fb771d4f47ff9eb7437a9e8b86724890a2f8e5de4cbe30d5a6
|
|
7
|
+
data.tar.gz: 52a2ba4dffbdd811c35d2025035dae287c52e6c3d189fced80bebf72bdf4183204fa666361a50f8004df2403e20fe3857321471bc673f5492f1f69cf2fb3fe64
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [4.63.0](https://github.com/plivo/plivo-ruby/tree/v4.63.0) (2026-04-08)
|
|
4
|
+
**Feature - PhoneNumber Compliance API support**
|
|
5
|
+
- Added `phone_number_compliance_requirements` resource for discovering compliance requirements by country, number type, and user type
|
|
6
|
+
- Added `phone_number_compliances` resource with full CRUD support (create, get, list, update, delete) for compliance applications
|
|
7
|
+
- Added `phone_number_compliance_link` resource for bulk linking phone numbers to accepted compliance applications
|
|
8
|
+
- Added PATCH HTTP method support to `base_client` for compliance application updates
|
|
9
|
+
- Create and update operations support multipart file uploads for compliance documents
|
|
10
|
+
|
|
3
11
|
## [4.62.5](https://github.com/plivo/plivo-ruby/tree/v4.62.5) (2026-01-21)
|
|
4
12
|
**Feature - HA Number support**
|
|
5
13
|
- Added `ha_enable` optional parameter to PhoneNumber `buy` method
|
data/Jenkinsfile
CHANGED
data/lib/plivo/base_client.rb
CHANGED
|
@@ -47,6 +47,7 @@ module Plivo
|
|
|
47
47
|
response = case method
|
|
48
48
|
when 'GET' then send_get(resource_path, data, timeout, is_voice_request: options[:is_voice_request], voice_retry_count: @@voice_retry_count)
|
|
49
49
|
when 'POST' then send_post(resource_path, data, timeout, use_multipart_conn, is_voice_request: options[:is_voice_request], voice_retry_count: @@voice_retry_count)
|
|
50
|
+
when 'PATCH' then send_patch(resource_path, data, timeout, use_multipart_conn, is_voice_request: options[:is_voice_request], voice_retry_count: @@voice_retry_count)
|
|
50
51
|
when 'DELETE' then send_delete(resource_path, data, timeout, is_voice_request: options[:is_voice_request], voice_retry_count: @@voice_retry_count)
|
|
51
52
|
else raise_invalid_request("#{method} not supported by Plivo, yet")
|
|
52
53
|
end
|
|
@@ -64,6 +65,7 @@ module Plivo
|
|
|
64
65
|
elsif options[:is_lookup_request] == true
|
|
65
66
|
response = case method
|
|
66
67
|
when 'GET' then send_get(resource_path, data, timeout, is_lookup_request: options[:is_lookup_request])
|
|
68
|
+
when 'PATCH' then send_patch(resource_path, data, timeout, use_multipart_conn, is_lookup_request: options[:is_lookup_request])
|
|
67
69
|
else raise_invalid_request("#{method} not supported by Plivo, yet")
|
|
68
70
|
end
|
|
69
71
|
process_response(method, response.to_hash)
|
|
@@ -71,6 +73,7 @@ module Plivo
|
|
|
71
73
|
response = case method
|
|
72
74
|
when 'GET' then send_get(resource_path, data, timeout)
|
|
73
75
|
when 'POST' then send_post(resource_path, data, timeout, use_multipart_conn)
|
|
76
|
+
when 'PATCH' then send_patch(resource_path, data, timeout, use_multipart_conn)
|
|
74
77
|
when 'DELETE' then send_delete(resource_path, data, timeout)
|
|
75
78
|
else raise_invalid_request("#{method} not supported by Plivo, yet")
|
|
76
79
|
end
|
|
@@ -311,6 +314,41 @@ module Plivo
|
|
|
311
314
|
response
|
|
312
315
|
end
|
|
313
316
|
|
|
317
|
+
def send_patch(resource_path, data, timeout, use_multipart_conn, options = nil)
|
|
318
|
+
if use_multipart_conn
|
|
319
|
+
multipart_conn = Faraday.new(@base_uri) do |faraday|
|
|
320
|
+
faraday.headers = {
|
|
321
|
+
'User-Agent' => @headers['User-Agent'],
|
|
322
|
+
'Accept' => @headers['Accept']
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
# DANGER: Basic auth should always come after headers, else
|
|
326
|
+
# The headers will replace the basic_auth
|
|
327
|
+
|
|
328
|
+
faraday.request :multipart
|
|
329
|
+
faraday.request :url_encoded
|
|
330
|
+
faraday.headers['Authorization'] = "Basic #{Base64.strict_encode64("#{auth_id}:#{auth_token}")}"
|
|
331
|
+
|
|
332
|
+
faraday.proxy=@proxy_hash if @proxy_hash
|
|
333
|
+
faraday.response :json, content_type: /\bjson$/
|
|
334
|
+
faraday.adapter Faraday.default_adapter
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
response = multipart_conn.patch do |req|
|
|
338
|
+
req.url resource_path
|
|
339
|
+
req.options.timeout = timeout if timeout
|
|
340
|
+
req.body = data
|
|
341
|
+
end
|
|
342
|
+
else
|
|
343
|
+
response = @conn.patch do |req|
|
|
344
|
+
req.url resource_path
|
|
345
|
+
req.options.timeout = timeout if timeout
|
|
346
|
+
req.body = JSON.generate(data) if data
|
|
347
|
+
end
|
|
348
|
+
end
|
|
349
|
+
response
|
|
350
|
+
end
|
|
351
|
+
|
|
314
352
|
def send_delete(resource_path, data, timeout, options = nil)
|
|
315
353
|
if options
|
|
316
354
|
if options[:voice_retry_count] == 0 and options[:is_voice_request] == true
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
module Plivo
|
|
2
|
+
module Resources
|
|
3
|
+
include Plivo::Utils
|
|
4
|
+
|
|
5
|
+
class PhoneNumberComplianceRequirement < Base::Resource
|
|
6
|
+
def initialize(client, options = nil)
|
|
7
|
+
@_name = 'PhoneNumber/Compliance/Requirements'
|
|
8
|
+
@_identifier_string = 'requirement_id'
|
|
9
|
+
super
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def to_s
|
|
13
|
+
{
|
|
14
|
+
api_id: @api_id,
|
|
15
|
+
requirement_id: @requirement_id,
|
|
16
|
+
country_iso: @country_iso,
|
|
17
|
+
number_type: @number_type,
|
|
18
|
+
user_type: @user_type,
|
|
19
|
+
document_types: @document_types
|
|
20
|
+
}.delete_if { |key, value| value.nil? }.to_s
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class PhoneNumberComplianceRequirementsInterface < Base::ResourceInterface
|
|
25
|
+
def initialize(client, resource_list_json = nil)
|
|
26
|
+
@_name = 'PhoneNumber/Compliance/Requirements'
|
|
27
|
+
@_resource_type = PhoneNumberComplianceRequirement
|
|
28
|
+
@_identifier_string = 'requirement_id'
|
|
29
|
+
super
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
##
|
|
33
|
+
# Get phone number compliance requirements
|
|
34
|
+
# @param [Hash] options
|
|
35
|
+
# @option options [String] :country_iso
|
|
36
|
+
# @option options [String] :number_type
|
|
37
|
+
# @option options [String] :user_type
|
|
38
|
+
# @return [PhoneNumberComplianceRequirement]
|
|
39
|
+
def get(options = nil)
|
|
40
|
+
params = {}
|
|
41
|
+
if options
|
|
42
|
+
valid_param?(:options, options, Hash, true)
|
|
43
|
+
%i[country_iso number_type user_type].each do |param|
|
|
44
|
+
if options.key?(param) &&
|
|
45
|
+
valid_param?(param, options[param], [String, Symbol], false)
|
|
46
|
+
params[param] = options[param]
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
perform_get_without_identifier(params)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class PhoneNumberCompliance < Base::Resource
|
|
55
|
+
def initialize(client, options = nil)
|
|
56
|
+
@_name = 'PhoneNumber/Compliance'
|
|
57
|
+
@_identifier_string = 'compliance_id'
|
|
58
|
+
super
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def update(params)
|
|
62
|
+
unless @id
|
|
63
|
+
raise_invalid_request("Cannot update a #{@_name} resource "\
|
|
64
|
+
'without an identifier')
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
response_json = @_client.send_request(@_resource_uri, 'PATCH', params, nil, true, is_voice_request: false)
|
|
68
|
+
parse_and_set(response_json)
|
|
69
|
+
self
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def delete
|
|
73
|
+
perform_delete
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def to_s
|
|
77
|
+
{
|
|
78
|
+
api_id: @api_id,
|
|
79
|
+
compliance_id: @compliance_id,
|
|
80
|
+
alias: @alias,
|
|
81
|
+
status: @status,
|
|
82
|
+
country_iso: @country_iso,
|
|
83
|
+
number_type: @number_type,
|
|
84
|
+
user_type: @user_type,
|
|
85
|
+
created_at: @created_at,
|
|
86
|
+
updated_at: @updated_at
|
|
87
|
+
}.delete_if { |key, value| value.nil? }.to_s
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
class PhoneNumberCompliancesInterface < Base::ResourceInterface
|
|
92
|
+
def initialize(client, resource_list_json = nil)
|
|
93
|
+
@_name = 'PhoneNumber/Compliance'
|
|
94
|
+
@_resource_type = PhoneNumberCompliance
|
|
95
|
+
@_identifier_string = 'compliance_id'
|
|
96
|
+
super
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
##
|
|
100
|
+
# Create a phone number compliance application
|
|
101
|
+
# @param [Hash] data_hash - compliance data (country_iso, number_type, alias, end_user, documents, etc.)
|
|
102
|
+
# @param [Array] documents - list of local file paths for document uploads (optional)
|
|
103
|
+
# @return [Response]
|
|
104
|
+
def create(data_hash, documents = nil)
|
|
105
|
+
params = { data: JSON.generate(data_hash) }
|
|
106
|
+
if documents
|
|
107
|
+
documents.each_with_index do |filepath, index|
|
|
108
|
+
file_extension = filepath.split('.')[-1]
|
|
109
|
+
content_type = case file_extension
|
|
110
|
+
when 'jpeg', 'jpg' then 'image/jpeg'
|
|
111
|
+
when 'png' then 'image/png'
|
|
112
|
+
when 'pdf' then 'application/pdf'
|
|
113
|
+
else raise_invalid_request("#{file_extension} is not supported")
|
|
114
|
+
end
|
|
115
|
+
params["documents[#{index}].file"] = Faraday::UploadIO.new(filepath, content_type)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
perform_create(params, true)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
##
|
|
122
|
+
# Get a phone number compliance application
|
|
123
|
+
# @param [String] compliance_id
|
|
124
|
+
# @param [Hash] options
|
|
125
|
+
# @option options [String] :expand
|
|
126
|
+
# @return [PhoneNumberCompliance]
|
|
127
|
+
def get(compliance_id, options = nil)
|
|
128
|
+
valid_param?(:compliance_id, compliance_id, [String, Symbol], true)
|
|
129
|
+
params = {}
|
|
130
|
+
if options
|
|
131
|
+
valid_param?(:options, options, Hash, true)
|
|
132
|
+
if options.key?(:expand) &&
|
|
133
|
+
valid_param?(:expand, options[:expand], [String, Symbol], false)
|
|
134
|
+
params[:expand] = options[:expand]
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
perform_get(compliance_id, params)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
##
|
|
141
|
+
# List phone number compliance applications
|
|
142
|
+
# @param [Hash] options
|
|
143
|
+
# @option options [Int] :limit
|
|
144
|
+
# @option options [Int] :offset
|
|
145
|
+
# @option options [String] :status
|
|
146
|
+
# @option options [String] :country_iso
|
|
147
|
+
# @option options [String] :number_type
|
|
148
|
+
# @option options [String] :user_type
|
|
149
|
+
# @option options [String] :alias
|
|
150
|
+
# @option options [String] :expand
|
|
151
|
+
# @return [Hash]
|
|
152
|
+
def list(options = nil)
|
|
153
|
+
return perform_list if options.nil?
|
|
154
|
+
valid_param?(:options, options, Hash, true)
|
|
155
|
+
|
|
156
|
+
params = {}
|
|
157
|
+
%i[status country_iso number_type user_type alias expand].each do |param|
|
|
158
|
+
if options.key?(param) &&
|
|
159
|
+
valid_param?(param, options[param], [String, Symbol], false)
|
|
160
|
+
params[param] = options[param]
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
%i[offset limit].each do |param|
|
|
165
|
+
if options.key?(param) && valid_param?(param, options[param],
|
|
166
|
+
[Integer], false)
|
|
167
|
+
params[param] = options[param]
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
raise_invalid_request("Offset can't be negative") if options.key?(:offset) && options[:offset] < 0
|
|
172
|
+
|
|
173
|
+
if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
|
|
174
|
+
raise_invalid_request('The maximum number of results that can be '\
|
|
175
|
+
"fetched is 20. limit can't be more than 20 or less than 1")
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
perform_list(params)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
##
|
|
182
|
+
# Update a phone number compliance application
|
|
183
|
+
# @param [String] compliance_id
|
|
184
|
+
# @param [Hash] data_hash - compliance data to update
|
|
185
|
+
# @param [Array] documents - list of local file paths for document uploads (optional)
|
|
186
|
+
# @return [PhoneNumberCompliance]
|
|
187
|
+
def update(compliance_id, data_hash, documents = nil)
|
|
188
|
+
valid_param?(:compliance_id, compliance_id, [String, Symbol], true)
|
|
189
|
+
|
|
190
|
+
params = { data: JSON.generate(data_hash) }
|
|
191
|
+
if documents
|
|
192
|
+
documents.each_with_index do |filepath, index|
|
|
193
|
+
file_extension = filepath.split('.')[-1]
|
|
194
|
+
content_type = case file_extension
|
|
195
|
+
when 'jpeg', 'jpg' then 'image/jpeg'
|
|
196
|
+
when 'png' then 'image/png'
|
|
197
|
+
when 'pdf' then 'application/pdf'
|
|
198
|
+
else raise_invalid_request("#{file_extension} is not supported")
|
|
199
|
+
end
|
|
200
|
+
params["documents[#{index}].file"] = Faraday::UploadIO.new(filepath, content_type)
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
PhoneNumberCompliance.new(@_client,
|
|
205
|
+
resource_id: compliance_id).update(params)
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
##
|
|
209
|
+
# Delete a phone number compliance application
|
|
210
|
+
# @param [String] compliance_id
|
|
211
|
+
def delete(compliance_id)
|
|
212
|
+
valid_param?(:compliance_id, compliance_id, [String, Symbol], true)
|
|
213
|
+
PhoneNumberCompliance.new(@_client,
|
|
214
|
+
resource_id: compliance_id).delete
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
class PhoneNumberComplianceLinkInterface < Base::ResourceInterface
|
|
219
|
+
def initialize(client, resource_list_json = nil)
|
|
220
|
+
@_name = 'PhoneNumber/Compliance/Link'
|
|
221
|
+
@_resource_type = PhoneNumberCompliance
|
|
222
|
+
@_identifier_string = 'compliance_id'
|
|
223
|
+
super
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
##
|
|
227
|
+
# Link numbers to compliance applications
|
|
228
|
+
# @param [Array] numbers - list of hashes with 'number' and 'compliance_application_id'
|
|
229
|
+
# @return [Response]
|
|
230
|
+
def create(numbers)
|
|
231
|
+
valid_param?(:numbers, numbers, Array, true)
|
|
232
|
+
params = { numbers: numbers }
|
|
233
|
+
perform_create(params)
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
end
|
data/lib/plivo/resources.rb
CHANGED
|
@@ -22,6 +22,7 @@ require_relative 'resources/campaign'
|
|
|
22
22
|
require_relative 'resources/profile'
|
|
23
23
|
require_relative 'resources/lookup'
|
|
24
24
|
require_relative 'resources/regulatory_compliance'
|
|
25
|
+
require_relative 'resources/phone_number_compliance'
|
|
25
26
|
require_relative 'resources/multipartycalls'
|
|
26
27
|
require_relative 'resources/verify_session'
|
|
27
28
|
require_relative 'resources/tollfree_verification'
|
data/lib/plivo/rest_client.rb
CHANGED
|
@@ -22,6 +22,7 @@ module Plivo
|
|
|
22
22
|
attr_reader :tollfree_verifications
|
|
23
23
|
attr_reader :verify_caller_id
|
|
24
24
|
attr_reader :maskingsession
|
|
25
|
+
attr_reader :phone_number_compliance_requirements, :phone_number_compliances, :phone_number_compliance_link
|
|
25
26
|
|
|
26
27
|
def initialize(auth_id = nil, auth_token = nil, proxy_options = nil, timeout = 5)
|
|
27
28
|
configure_base_uri
|
|
@@ -69,6 +70,9 @@ module Plivo
|
|
|
69
70
|
@compliance_documents = Resources::ComplianceDocumentsInterface.new(self)
|
|
70
71
|
@compliance_requirements = Resources::ComplianceRequirementsInterface.new(self)
|
|
71
72
|
@compliance_applications = Resources::ComplianceApplicationsInterface.new(self)
|
|
73
|
+
@phone_number_compliance_requirements = Resources::PhoneNumberComplianceRequirementsInterface.new(self)
|
|
74
|
+
@phone_number_compliances = Resources::PhoneNumberCompliancesInterface.new(self)
|
|
75
|
+
@phone_number_compliance_link = Resources::PhoneNumberComplianceLinkInterface.new(self)
|
|
72
76
|
@verify_session = Resources::SessionInterface.new(self)
|
|
73
77
|
@tollfree_verifications = Resources::TollfreeVerificationsInterface.new(self)
|
|
74
78
|
@verify_caller_id = Resources::VerifyCallerIdInterface.new(self)
|
data/lib/plivo/version.rb
CHANGED
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.
|
|
4
|
+
version: 4.63.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Plivo SDKs Team
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -190,6 +190,7 @@ files:
|
|
|
190
190
|
- lib/plivo/resources/numbers.rb
|
|
191
191
|
- lib/plivo/resources/phlo_member.rb
|
|
192
192
|
- lib/plivo/resources/phlos.rb
|
|
193
|
+
- lib/plivo/resources/phone_number_compliance.rb
|
|
193
194
|
- lib/plivo/resources/powerpacks.rb
|
|
194
195
|
- lib/plivo/resources/pricings.rb
|
|
195
196
|
- lib/plivo/resources/profile.rb
|
|
@@ -241,7 +242,7 @@ homepage: https://github.com/plivo/plivo-ruby
|
|
|
241
242
|
licenses:
|
|
242
243
|
- MIT
|
|
243
244
|
metadata: {}
|
|
244
|
-
post_install_message:
|
|
245
|
+
post_install_message:
|
|
245
246
|
rdoc_options: []
|
|
246
247
|
require_paths:
|
|
247
248
|
- lib
|
|
@@ -256,9 +257,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
256
257
|
- !ruby/object:Gem::Version
|
|
257
258
|
version: '0'
|
|
258
259
|
requirements: []
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
signing_key:
|
|
260
|
+
rubygems_version: 3.4.19
|
|
261
|
+
signing_key:
|
|
262
262
|
specification_version: 4
|
|
263
263
|
summary: A Ruby SDK to make voice calls & send SMS using Plivo and to generate Plivo
|
|
264
264
|
XML
|