plivo 4.27.1 → 4.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/lib/plivo/base/resource_interface.rb +9 -1
- data/lib/plivo/resources/brand.rb +24 -5
- data/lib/plivo/resources/calls.rb +2 -1
- data/lib/plivo/resources/campaign.rb +70 -5
- data/lib/plivo/resources/profile.rb +93 -0
- data/lib/plivo/resources/token.rb +66 -0
- data/lib/plivo/resources.rb +2 -0
- data/lib/plivo/rest_client.rb +4 -1
- data/lib/plivo/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9dc7434e8982f184b0e1896144431f32fc82a1e
|
4
|
+
data.tar.gz: 975f64c13a825a1aba8558b821fb2032557648a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24a3cb5257654ae4e8c200cec5ac0291fa407fe669832887258f4e06a7bf9f6715549c4ec0c59f058d6ed9c47d49a387019eae8ee23642725204a54f82bee039
|
7
|
+
data.tar.gz: 65c9323280aa2390745ee00d16e0505ee82802896d3d8fb4b0ef81f8e8d44d6ccf602fb133c8cdc8cf2e588177c02359b5a57fa755ddf9e1e40f768948cc8e06
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [4.30.0](https://github.com/plivo/plivo-go/tree/v4.30.0) (2022-08-26)
|
4
|
+
**Feature - 10DLC APIs**
|
5
|
+
- Added new 10DLC APIs
|
6
|
+
|
7
|
+
## [4.29.0](https://github.com/plivo/plivo-go/tree/v4.29.0) (2022-08-01)
|
8
|
+
**Feature - Token Creation**
|
9
|
+
- `JWT Token Creation API` added functionality to create a new JWT token.
|
10
|
+
|
11
|
+
## [4.28.0](https://github.com/plivo/plivo-go/tree/v4.28.0) (2022-07-11)
|
12
|
+
**Feature - STIR Attestation**
|
13
|
+
- Add stir attestation param as part of Get CDR and Get live call APIs Response
|
14
|
+
|
3
15
|
## [4.27.1](https://github.com/plivo/plivo-ruby/tree/v4.27.1) (2022-06-30)
|
4
16
|
- `from_number`, `to_number` and `stir_verification` added to filter param [Retrieve all calls] (https://www.plivo.com/docs/voice/api/call#retrieve-all-calls)
|
5
17
|
|
data/README.md
CHANGED
@@ -54,7 +54,7 @@ module Plivo
|
|
54
54
|
|
55
55
|
def perform_create(params, use_multipart_conn=false)
|
56
56
|
Response.new(
|
57
|
-
@_client.send_request(@_resource_uri, 'POST', params,
|
57
|
+
@_client.send_request(@_resource_uri, 'POST', params, 10, use_multipart_conn, is_voice_request: @_is_voice_request),
|
58
58
|
@_identifier_string
|
59
59
|
)
|
60
60
|
end
|
@@ -98,6 +98,14 @@ module Plivo
|
|
98
98
|
self
|
99
99
|
end
|
100
100
|
|
101
|
+
def perform_action_with_identifier(identifier = nil, method = 'GET', params = nil)
|
102
|
+
resource_path = identifier ? @_resource_uri + identifier + '/' : @_resource_uri
|
103
|
+
Response.new(
|
104
|
+
@_client.send_request(resource_path, method, params, nil, false, is_voice_request: @_is_voice_request),
|
105
|
+
@_identifier_string
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
101
109
|
def perform_list_without_object(params = nil)
|
102
110
|
response_json = @_client.send_request(@_resource_uri, 'GET', params, nil, false, is_voice_request: @_is_voice_request)
|
103
111
|
parse_and_set(response_json)
|
@@ -38,24 +38,43 @@ module Plivo
|
|
38
38
|
# @param [Hash] options
|
39
39
|
# @option options [String] :type
|
40
40
|
# @option options [Status] :status
|
41
|
+
# @option options [Status] :limit
|
42
|
+
# @option options [Status] :offset
|
41
43
|
# @return [Hash]
|
42
44
|
def list(options=nil)
|
43
45
|
return perform_list_without_object if options.nil?
|
44
46
|
|
45
47
|
params = {}
|
46
|
-
%i[status type].each do |param|
|
48
|
+
%i[status type limit offset].each do |param|
|
47
49
|
if options.key?(param) && valid_param?(param, options[param],
|
48
|
-
[String], true)
|
50
|
+
[String, Integer], true)
|
49
51
|
params[param] = options[param]
|
50
52
|
end
|
51
|
-
end
|
53
|
+
end
|
54
|
+
if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
|
55
|
+
raise_invalid_request('The maximum number of results that can be '\
|
56
|
+
"fetched is 20. limit can't be more than 20 or less than 1")
|
57
|
+
end
|
58
|
+
if options.key?(:offset) && options[:offset] < 0
|
59
|
+
raise_invalid_request("Offset can't be negative")
|
60
|
+
end
|
52
61
|
perform_list_without_object(params)
|
53
62
|
end
|
54
63
|
|
55
64
|
##
|
56
65
|
# Create a new brand
|
57
|
-
def create(
|
58
|
-
|
66
|
+
def create(options=nil)
|
67
|
+
valid_param?(:options, options, Hash, true)
|
68
|
+
if not options[:brand_alias]
|
69
|
+
raise_invalid_request("brand_alias must be provided")
|
70
|
+
end
|
71
|
+
if not options[:brand_type]
|
72
|
+
raise_invalid_request("brand_type must be provided")
|
73
|
+
end
|
74
|
+
if not options[:profile_uuid]
|
75
|
+
raise_invalid_request("profile_uuid must be provided")
|
76
|
+
end
|
77
|
+
perform_create(options)
|
59
78
|
end
|
60
79
|
end
|
61
80
|
end
|
@@ -231,7 +231,8 @@ module Plivo
|
|
231
231
|
request_uuid: @request_uuid,
|
232
232
|
direction: @direction,
|
233
233
|
caller_name: @caller_name,
|
234
|
-
stir_verification: @stir_verification
|
234
|
+
stir_verification: @stir_verification,
|
235
|
+
stir_attestation: @stir_attestation
|
235
236
|
}
|
236
237
|
call_details = call_details.select {|k, v| !v.nil? }
|
237
238
|
call_details.to_s
|
@@ -38,25 +38,90 @@ module Plivo
|
|
38
38
|
# @param [Hash] options
|
39
39
|
# @option options [String] :brand
|
40
40
|
# @option options [Status] :usecase
|
41
|
+
# @option options [Status] :limit
|
42
|
+
# @option options [Status] :offset
|
41
43
|
# @return [Hash]
|
42
44
|
def list(options=nil)
|
43
45
|
return perform_list_without_object if options.nil?
|
44
46
|
|
45
47
|
params = {}
|
46
|
-
%i[usecase brand].each do |param|
|
48
|
+
%i[usecase brand limit offset].each do |param|
|
47
49
|
if options.key?(param) && valid_param?(param, options[param],
|
48
|
-
[String], true)
|
50
|
+
[String, Integer], true)
|
49
51
|
params[param] = options[param]
|
50
52
|
end
|
53
|
+
end
|
54
|
+
if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
|
55
|
+
raise_invalid_request('The maximum number of results that can be '\
|
56
|
+
"fetched is 20. limit can't be more than 20 or less than 1")
|
57
|
+
end
|
58
|
+
if options.key?(:offset) && options[:offset] < 0
|
59
|
+
raise_invalid_request("Offset can't be negative")
|
51
60
|
end
|
52
61
|
perform_list_without_object(params)
|
53
62
|
end
|
54
63
|
|
55
64
|
##
|
56
65
|
# Create a new Camapign
|
57
|
-
def create(
|
58
|
-
|
66
|
+
def create(options=nil)
|
67
|
+
valid_param?(:options, options, Hash, true)
|
68
|
+
if not options[:brand_id]
|
69
|
+
raise_invalid_request("brand_id must be provided")
|
70
|
+
end
|
71
|
+
if not options[:vertical]
|
72
|
+
raise_invalid_request("vertical must be provided")
|
73
|
+
end
|
74
|
+
if not options[:usecase]
|
75
|
+
raise_invalid_request("usecase must be provided")
|
76
|
+
end
|
77
|
+
perform_create(options)
|
78
|
+
end
|
79
|
+
##
|
80
|
+
# campaign number link
|
81
|
+
#
|
82
|
+
def number_link(options=nil)
|
83
|
+
valid_param?(:options, options, Hash, true)
|
84
|
+
if not options[:campaign_id]
|
85
|
+
raise_invalid_request("campaign_id must be provided")
|
86
|
+
end
|
87
|
+
action = options[:campaign_id] + '/Number'
|
88
|
+
perform_action_with_identifier(action, 'POST', options)
|
89
|
+
end
|
90
|
+
##
|
91
|
+
#get campaign numbers
|
92
|
+
#
|
93
|
+
def get_numbers(campaign_id, options = nil)
|
94
|
+
params = {}
|
95
|
+
%i[offset limit].each do |param|
|
96
|
+
if options.key?(param) && valid_param?(param, options[param],
|
97
|
+
[Integer, Integer], true)
|
98
|
+
params[param] = options[param]
|
99
|
+
end
|
100
|
+
end
|
101
|
+
if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
|
102
|
+
raise_invalid_request('The maximum number of results that can be '\
|
103
|
+
"fetched is 20. limit can't be more than 20 or less than 1")
|
104
|
+
end
|
105
|
+
if options.key?(:offset) && options[:offset] < 0
|
106
|
+
raise_invalid_request("Offset can't be negative")
|
107
|
+
end
|
108
|
+
action = campaign_id + '/Number'
|
109
|
+
perform_action_with_identifier(action, 'GET', params)
|
110
|
+
end
|
111
|
+
##
|
112
|
+
#get campaign number
|
113
|
+
#
|
114
|
+
def get_number(campaign_id, number)
|
115
|
+
action = campaign_id + '/Number/' + number
|
116
|
+
perform_action_with_identifier(action, 'GET', nil)
|
117
|
+
end
|
118
|
+
##
|
119
|
+
#unlink campaign number
|
120
|
+
#
|
121
|
+
def number_unlink(campaign_id, number, options = nil)
|
122
|
+
action = campaign_id + '/Number/' + number
|
123
|
+
perform_action_with_identifier(action, 'DELETE', nil)
|
59
124
|
end
|
60
125
|
end
|
61
126
|
end
|
62
|
-
end
|
127
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
module Plivo
|
2
|
+
module Resources
|
3
|
+
include Plivo::Utils
|
4
|
+
class Profile < Base::Resource
|
5
|
+
def initialize(client, options = nil)
|
6
|
+
@_name = 'Profile'
|
7
|
+
@_identifier_string = 'profile_uuid'
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
{
|
13
|
+
api_id: @api_id,
|
14
|
+
profile: @profile
|
15
|
+
}.to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
class ProfileInterface < Base::ResourceInterface
|
19
|
+
def initialize(client, resource_list_json = nil)
|
20
|
+
@_name = 'Profile'
|
21
|
+
@_resource_type = Profile
|
22
|
+
@_identifier_string = 'profile_uuid'
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Get an Profile
|
28
|
+
# @param [String] profile_uuid
|
29
|
+
# @return [Profile] Profile
|
30
|
+
def get(profile_uuid)
|
31
|
+
valid_param?(:profile_uuid, profile_uuid, [String, Symbol], true)
|
32
|
+
perform_get(profile_uuid)
|
33
|
+
end
|
34
|
+
|
35
|
+
# List all Profile
|
36
|
+
def list(options = nil)
|
37
|
+
return perform_list_without_object if options.nil?
|
38
|
+
params = {}
|
39
|
+
%i[offset limit].each do |param|
|
40
|
+
if options.key?(param) && valid_param?(param, options[param],
|
41
|
+
[Integer, Integer], true)
|
42
|
+
params[param] = options[param]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
|
46
|
+
raise_invalid_request('The maximum number of results that can be '\
|
47
|
+
"fetched is 20. limit can't be more than 20 or less than 1")
|
48
|
+
end
|
49
|
+
if options.key?(:offset) && options[:offset] < 0
|
50
|
+
raise_invalid_request("Offset can't be negative")
|
51
|
+
end
|
52
|
+
perform_list_without_object(params)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Delete an Profile
|
56
|
+
# @param [String] profile_uuid
|
57
|
+
def delete(profile_uuid)
|
58
|
+
valid_param?(:profile_uuid, profile_uuid, [String, Symbol], true)
|
59
|
+
perform_action_with_identifier(profile_uuid, 'DELETE', nil)
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# Create a new Profile
|
64
|
+
def create(options = nil)
|
65
|
+
valid_param?(:options, options, Hash, true)
|
66
|
+
if not options[:profile_alias]
|
67
|
+
raise_invalid_request("profile_alias must be provided")
|
68
|
+
end
|
69
|
+
if not options[:customer_type]
|
70
|
+
raise_invalid_request("customer_type must be provided")
|
71
|
+
end
|
72
|
+
if not options[:entity_type]
|
73
|
+
raise_invalid_request("entity_type must be provided")
|
74
|
+
end
|
75
|
+
if not options[:company_name]
|
76
|
+
raise_invalid_request("company_name must be provided")
|
77
|
+
end
|
78
|
+
if not options[:vertical]
|
79
|
+
raise_invalid_request("vertical must be provided")
|
80
|
+
end
|
81
|
+
perform_create(options)
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Update a Profile
|
86
|
+
# {'address': {}, 'authorized_contact': {}, 'entity_type':'', 'vertical': '', 'company_name': '', 'website':''}
|
87
|
+
def update(profile_uuid, options = nil)
|
88
|
+
valid_param?(:options, options, Hash, true)
|
89
|
+
perform_action_with_identifier(profile_uuid, "POST", options)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Plivo
|
2
|
+
module Resources
|
3
|
+
include Plivo
|
4
|
+
include Plivo::Utils
|
5
|
+
class Token < Base::Resource
|
6
|
+
def initialize(client, options = nil)
|
7
|
+
@_name = 'JWT/Token'
|
8
|
+
super
|
9
|
+
@_is_voice_request = true
|
10
|
+
end
|
11
|
+
def to_s
|
12
|
+
{
|
13
|
+
api_id: @api_id,
|
14
|
+
token: @token
|
15
|
+
}.to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class TokenInterface < Base::ResourceInterface
|
20
|
+
def initialize(client, resource_list_json = nil)
|
21
|
+
@_name = 'JWT/Token'
|
22
|
+
@_resource_type = Token
|
23
|
+
super
|
24
|
+
@_is_voice_request = true
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def create(iss , options = nil)
|
29
|
+
valid_param?(:iss, iss, [String, Symbol, Hash], true)
|
30
|
+
params = {}
|
31
|
+
params[:iss] = iss
|
32
|
+
|
33
|
+
return perform_create(params, false) if options.nil?
|
34
|
+
# return perform_action('Record', 'POST', nil, true) if options.nil?
|
35
|
+
valid_param?(:options, options, [Hash], false)
|
36
|
+
|
37
|
+
|
38
|
+
if options.key?("sub") && valid_param?("sub", options["sub"], [String, Symbol], false )
|
39
|
+
params[:sub] = options["sub"]
|
40
|
+
end
|
41
|
+
if options.key("nbf") && valid_param?("nbf", options["nbf"], [Integer, Symbol], false )
|
42
|
+
params[:nbf] = options["nbf"]
|
43
|
+
end
|
44
|
+
if options.key("exp") && valid_param?("exp", options["exp"], [Integer, Symbol], false )
|
45
|
+
params[:exp] = options["exp"]
|
46
|
+
end
|
47
|
+
if options.key?("incoming_allow") || options.key?("outgoing_allow")
|
48
|
+
params[:per] = {}
|
49
|
+
params[:per][:voice] = {}
|
50
|
+
if options.key?("incoming_allow") && valid_param?("incoming_allow", options["incoming_allow"], [TrueClass, FalseClass, String,Symbol], false)
|
51
|
+
params[:per][:voice][:incoming_allow] = options["incoming_allow"]
|
52
|
+
end
|
53
|
+
if options.key?("outgoing_allow") && valid_param?("outgoing_allow", options["outgoing_allow"], [TrueClass, FalseClass, String, Symbol], false)
|
54
|
+
params[:per][:voice][:outgoing_allow] = options["outgoing_allow"]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
if options.key?("app") && valid_param?("app", options["app"], [String, Symbol], false)
|
58
|
+
params[:app] = options["app"]
|
59
|
+
end
|
60
|
+
|
61
|
+
perform_create(params.merge(options), false)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
data/lib/plivo/resources.rb
CHANGED
@@ -7,6 +7,7 @@ require_relative 'resources/pricings'
|
|
7
7
|
require_relative 'resources/numbers'
|
8
8
|
require_relative 'resources/conferences'
|
9
9
|
require_relative 'resources/calls'
|
10
|
+
require_relative 'resources/token'
|
10
11
|
require_relative 'resources/endpoints'
|
11
12
|
require_relative 'resources/addresses'
|
12
13
|
require_relative 'resources/identities'
|
@@ -17,6 +18,7 @@ require_relative 'resources/call_feedback'
|
|
17
18
|
require_relative 'resources/media'
|
18
19
|
require_relative 'resources/brand'
|
19
20
|
require_relative 'resources/campaign'
|
21
|
+
require_relative 'resources/profile'
|
20
22
|
require_relative 'resources/lookup'
|
21
23
|
require_relative 'resources/regulatory_compliance'
|
22
24
|
require_relative 'resources/multipartycalls'
|
data/lib/plivo/rest_client.rb
CHANGED
@@ -8,13 +8,14 @@ module Plivo
|
|
8
8
|
# Resources
|
9
9
|
attr_reader :messages, :account, :subaccounts, :recordings
|
10
10
|
attr_reader :pricings, :numbers, :calls, :conferences
|
11
|
+
attr_reader :token
|
11
12
|
attr_reader :phone_numbers, :applications, :endpoints, :multipartycalls
|
12
13
|
attr_reader :addresses, :identities
|
13
14
|
attr_reader :call_feedback
|
14
15
|
attr_reader :powerpacks
|
15
16
|
attr_reader :powerpacks, :media
|
16
17
|
attr_reader :lookup
|
17
|
-
attr_reader :brand, :campaign
|
18
|
+
attr_reader :brand, :campaign, :profile
|
18
19
|
attr_reader :end_users
|
19
20
|
attr_reader :compliance_document_types, :compliance_documents, :compliance_requirements, :compliance_applications
|
20
21
|
|
@@ -42,6 +43,7 @@ module Plivo
|
|
42
43
|
@media = Resources::MediaInterface.new(self)
|
43
44
|
@brand = Resources::BrandInterface.new(self)
|
44
45
|
@campaign = Resources::CampaignInterface.new(self)
|
46
|
+
@profile = Resources::ProfileInterface.new(self)
|
45
47
|
@subaccounts = Resources::SubaccountInterface.new(self)
|
46
48
|
@recordings = Resources::RecordingInterface.new(self)
|
47
49
|
@pricings = Resources::PricingInterface.new(self)
|
@@ -49,6 +51,7 @@ module Plivo
|
|
49
51
|
@phone_numbers = Resources::PhoneNumberInterface.new(self)
|
50
52
|
@conferences = Resources::ConferenceInterface.new(self)
|
51
53
|
@calls = Resources::CallInterface.new(self)
|
54
|
+
@token = Resources::TokenInterface.new(self)
|
52
55
|
@endpoints = Resources::EndpointInterface.new(self)
|
53
56
|
@applications = Resources::ApplicationInterface.new(self)
|
54
57
|
@addresses = Resources::AddressInterface.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.30.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: 2022-
|
11
|
+
date: 2022-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -199,8 +199,10 @@ files:
|
|
199
199
|
- lib/plivo/resources/phlos.rb
|
200
200
|
- lib/plivo/resources/powerpacks.rb
|
201
201
|
- lib/plivo/resources/pricings.rb
|
202
|
+
- lib/plivo/resources/profile.rb
|
202
203
|
- lib/plivo/resources/recordings.rb
|
203
204
|
- lib/plivo/resources/regulatory_compliance.rb
|
205
|
+
- lib/plivo/resources/token.rb
|
204
206
|
- lib/plivo/rest_client.rb
|
205
207
|
- lib/plivo/utils.rb
|
206
208
|
- lib/plivo/version.rb
|