plivo 4.22.0 → 4.25.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/unitTests.yml +32 -0
- data/CHANGELOG.md +17 -1
- data/Gemfile +1 -0
- data/README.md +3 -2
- data/lib/plivo/base.rb +3 -3
- data/lib/plivo/resources/brand.rb +62 -0
- data/lib/plivo/resources/calls.rb +5 -1
- data/lib/plivo/resources/campaign.rb +62 -0
- data/lib/plivo/resources/multipartycalls.rb +16 -16
- data/lib/plivo/resources.rb +2 -0
- data/lib/plivo/rest_client.rb +3 -0
- data/lib/plivo/utils.rb +1 -1
- data/lib/plivo/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f443da345e9dd7008e4da7feb9fb380aa600d2d
|
4
|
+
data.tar.gz: f0a9c52fc349c4741cb0efd72bff4d1ffa72d35d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2bf6055224a1feb6411d683ed13100681b0350e60ab3d76869a8d7cd97dacddbacb16522e8ba6daa685c80792d7d0d13c33f0bf14cf6ca3613eec4638625d8f
|
7
|
+
data.tar.gz: c8c2e8e68cd4c71a4a416f70883b99e3ee73aa2a6ebe4cc3a518382f55f48353dfb89d19b0c3e144c2046c2d3f906a9e82738db5bb9d02341e2e0ed30807919c
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: UnitTest
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ unitTests ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
name: UnitTest
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version: [ '2.4', '2.5', '2.6' ,'2.7', '3.0' ]
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- name: Checkout
|
19
|
+
uses: actions/checkout@v2
|
20
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
- name: Dependencies Installation
|
25
|
+
run: |
|
26
|
+
bundle install --without development
|
27
|
+
- name: Run Tests
|
28
|
+
run: |
|
29
|
+
ruby --version
|
30
|
+
bundle exec rake
|
31
|
+
rm Gemfile.lock
|
32
|
+
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,23 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [4.25.1](https://github.com/plivo/plivo-ruby/tree/v4.25.1) (2022-02-02)
|
4
|
+
**Bugfix - Recording**
|
5
|
+
- Fix for Start Recording API response issue
|
6
|
+
|
7
|
+
## [4.25.0](https://github.com/plivo/plivo-ruby/tree/v4.25.0) (2022-01-27)
|
8
|
+
**Features - MPCStartCallRecording**
|
9
|
+
- parameter name change from statusCallback to recordingCallback
|
10
|
+
|
11
|
+
## [4.24.0](https://github.com/plivo/plivo-ruby/tree/v4.24.0) (2021-12-14)
|
12
|
+
**Features - Voice**
|
13
|
+
- Routing SDK traffic through Akamai endpoints for all the [Voice APIs](https://www.plivo.com/docs/voice/api/overview/)
|
14
|
+
|
15
|
+
## [4.23.0](https://github.com/plivo/plivo-ruby/releases/tag/v4.23.0) (2021-12-02)
|
16
|
+
**Features - Messaging: 10 DLC**
|
17
|
+
- 10DLC API's for brand and campaign support.
|
18
|
+
|
3
19
|
## [4.22.0](https://github.com/plivo/plivo-ruby/releases/tag/v4.22.0) (2021-11-11)
|
4
|
-
**Features - Voice: Multiparty
|
20
|
+
**Features - Voice: Multiparty call**
|
5
21
|
- The [Add Multiparty Call API](https://www.plivo.com/docs/voice/api/multiparty-call/participants#add-a-participant) allows for greater functionality by accepting options like `start recording audio`, `stop recording audio`, and their HTTP methods.
|
6
22
|
- [Multiparty Calls](https://www.plivo.com/docs/voice/api/multiparty-call/) now has new APIs to `stop` and `play` audio.
|
7
23
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# plivo-ruby
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![UnitTest](https://github.com/plivo/plivo-ruby/actions/workflows/unitTests.yml/badge.svg?branch=ns-ut-fix)](https://github.com/plivo/plivo-ruby/actions/workflows/unitTests.yml)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/plivo.svg)](https://badge.fury.io/rb/plivo)
|
4
5
|
|
5
6
|
The Plivo Ruby SDK makes it simpler to integrate communications into your Ruby applications using the Plivo REST API. Using the SDK, you will be able to make voice calls, send SMS and generate Plivo XML to control your call flows.
|
6
7
|
|
@@ -8,7 +9,7 @@ The Plivo Ruby SDK makes it simpler to integrate communications into your Ruby a
|
|
8
9
|
Add this line to your application's Gemfile:
|
9
10
|
|
10
11
|
```ruby
|
11
|
-
gem 'plivo', '>= 4.
|
12
|
+
gem 'plivo', '>= 4.25.1'
|
12
13
|
```
|
13
14
|
|
14
15
|
And then execute:
|
data/lib/plivo/base.rb
CHANGED
@@ -6,9 +6,9 @@ module Plivo
|
|
6
6
|
module Base
|
7
7
|
PLIVO_API_URL = 'https://api.plivo.com'.freeze
|
8
8
|
|
9
|
-
API_VOICE = 'https://
|
10
|
-
API_VOICE_FALLBACK_1 = 'https://
|
11
|
-
API_VOICE_FALLBACK_2 = 'https://
|
9
|
+
API_VOICE = 'https://api.plivo.com'.freeze
|
10
|
+
API_VOICE_FALLBACK_1 = 'https://api.plivo.com'.freeze
|
11
|
+
API_VOICE_FALLBACK_2 = 'https://api.plivo.com'.freeze
|
12
12
|
|
13
13
|
CALLINSIGHTS_API_URL = 'https://stats.plivo.com'.freeze
|
14
14
|
PHLO_API_URL = 'https://phlorunner.plivo.com'.freeze
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Plivo
|
2
|
+
module Resources
|
3
|
+
include Plivo::Utils
|
4
|
+
class Brand < Base::Resource
|
5
|
+
def initialize(client, options = nil)
|
6
|
+
@_name = '10dlc/Brand'
|
7
|
+
@_identifier_string = 'brand_id'
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
{
|
13
|
+
api_id: @api_id,
|
14
|
+
brand: @brand
|
15
|
+
}.to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class BrandInterface < Base::ResourceInterface
|
20
|
+
def initialize(client, resource_list_json = nil)
|
21
|
+
@_name = '10dlc/Brand'
|
22
|
+
@_resource_type = Brand
|
23
|
+
@_identifier_string = 'brand_id'
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Get an Brand
|
29
|
+
# @param [String] brand_id
|
30
|
+
# @return [Brand] Brand
|
31
|
+
def get(brand_id)
|
32
|
+
valid_param?(:brand_id, brand_id, [String, Symbol], true)
|
33
|
+
perform_get(brand_id)
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# List all Brand
|
38
|
+
# @param [Hash] options
|
39
|
+
# @option options [String] :type
|
40
|
+
# @option options [Status] :status
|
41
|
+
# @return [Hash]
|
42
|
+
def list(options=nil)
|
43
|
+
return perform_list_without_object if options.nil?
|
44
|
+
|
45
|
+
params = {}
|
46
|
+
%i[status type].each do |param|
|
47
|
+
if options.key?(param) && valid_param?(param, options[param],
|
48
|
+
[String], true)
|
49
|
+
params[param] = options[param]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
perform_list_without_object(params)
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# Create a new brand
|
57
|
+
def create(params)
|
58
|
+
perform_create(params)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -492,7 +492,11 @@ module Plivo
|
|
492
492
|
# @option options [String] :callback_method - The method which is used to invoke the callback_url URL. Defaults to POST.
|
493
493
|
def record(call_uuid, options = nil)
|
494
494
|
valid_param?(:call_uuid, call_uuid, [String, Symbol], true)
|
495
|
-
Call.new(@_client, resource_id: call_uuid).record(options)
|
495
|
+
response = Call.new(@_client, resource_id: call_uuid).record(options)
|
496
|
+
return Base::Response.new(Hash["api_id" => response.api_id,
|
497
|
+
"recording_id" => response.recording_id,
|
498
|
+
"message" => response.message,
|
499
|
+
"url" => response.url])
|
496
500
|
end
|
497
501
|
|
498
502
|
# @param [String] call_uuid
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Plivo
|
2
|
+
module Resources
|
3
|
+
include Plivo::Utils
|
4
|
+
class Campaign < Base::Resource
|
5
|
+
def initialize(client, options = nil)
|
6
|
+
@_name = '10dlc/Campaign'
|
7
|
+
@_identifier_string = 'campaign_id'
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
{
|
13
|
+
api_id: @api_id,
|
14
|
+
campaign: @campaign
|
15
|
+
}.to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class CampaignInterface < Base::ResourceInterface
|
20
|
+
def initialize(client, resource_list_json = nil)
|
21
|
+
@_name = '10dlc/Campaign'
|
22
|
+
@_resource_type = Campaign
|
23
|
+
@_identifier_string = 'campaign_id'
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Get an Campaign
|
29
|
+
# @param [String] campaign_id
|
30
|
+
# @return [Campaign] Campaign
|
31
|
+
def get(campaign_id)
|
32
|
+
valid_param?(:campaign_id, campaign_id, [String, Symbol], true)
|
33
|
+
perform_get(campaign_id)
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# List all Campaign
|
38
|
+
# @param [Hash] options
|
39
|
+
# @option options [String] :brand
|
40
|
+
# @option options [Status] :usecase
|
41
|
+
# @return [Hash]
|
42
|
+
def list(options=nil)
|
43
|
+
return perform_list_without_object if options.nil?
|
44
|
+
|
45
|
+
params = {}
|
46
|
+
%i[usecase brand].each do |param|
|
47
|
+
if options.key?(param) && valid_param?(param, options[param],
|
48
|
+
[String], true)
|
49
|
+
params[param] = options[param]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
perform_list_without_object(params)
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# Create a new Camapign
|
57
|
+
def create(params)
|
58
|
+
perform_create(params)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -191,15 +191,15 @@ module Plivo
|
|
191
191
|
perform_action_apiresponse(nil, 'DELETE', nil, true)
|
192
192
|
end
|
193
193
|
|
194
|
-
def start_recording(file_format = 'mp3',
|
194
|
+
def start_recording(file_format = 'mp3', recording_callback_url = nil, recording_callback_method='POST')
|
195
195
|
valid_param?(:file_format, file_format, String, false , %w[mp3 wav])
|
196
|
-
valid_url?(:
|
197
|
-
valid_param?(:
|
196
|
+
valid_url?(:recording_callback_url, recording_callback_url, false) unless recording_callback_url.nil?
|
197
|
+
valid_param?(:recording_callback_method, recording_callback_method.upcase,String, false, %w[GET POST])
|
198
198
|
|
199
199
|
params = {}
|
200
200
|
params[:file_format] = file_format.downcase unless file_format.nil?
|
201
|
-
params[:
|
202
|
-
params[:
|
201
|
+
params[:recording_callback_url] = recording_callback_url unless recording_callback_url.nil?
|
202
|
+
params[:recording_callback_method] = recording_callback_method.upcase unless recording_callback_method.nil?
|
203
203
|
|
204
204
|
perform_action_apiresponse('Record', 'POST', params, true)
|
205
205
|
end
|
@@ -216,9 +216,9 @@ module Plivo
|
|
216
216
|
perform_action_apiresponse('Record/Resume', 'POST')
|
217
217
|
end
|
218
218
|
|
219
|
-
def start_participant_recording(member_id, file_format='mp3',
|
219
|
+
def start_participant_recording(member_id, file_format='mp3', recording_callback_url=nil, recording_callback_method='POST')
|
220
220
|
valid_param?(:member_id, member_id, [String, Integer], true)
|
221
|
-
MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], member_id: member_id).start_participant_recording(file_format,
|
221
|
+
MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], member_id: member_id).start_participant_recording(file_format, recording_callback_url, recording_callback_method)
|
222
222
|
end
|
223
223
|
|
224
224
|
def stop_participant_recording(member_id)
|
@@ -288,15 +288,15 @@ module Plivo
|
|
288
288
|
configure_secondary_resource_uri
|
289
289
|
end
|
290
290
|
|
291
|
-
def start_participant_recording(file_format = 'mp3',
|
291
|
+
def start_participant_recording(file_format = 'mp3', recording_callback_url = nil, recording_callback_method='POST')
|
292
292
|
valid_param?(:file_format, file_format, String, false , %w[mp3 wav])
|
293
|
-
valid_url?(:
|
294
|
-
valid_param?(:
|
293
|
+
valid_url?(:recording_callback_url, recording_callback_url, false) unless recording_callback_url.nil?
|
294
|
+
valid_param?(:recording_callback_method, recording_callback_method.upcase,String, false, %w[GET POST])
|
295
295
|
|
296
296
|
params = {}
|
297
297
|
params[:file_format] = file_format.downcase unless file_format.nil?
|
298
|
-
params[:
|
299
|
-
params[:
|
298
|
+
params[:recording_callback_url] = recording_callback_url unless recording_callback_url.nil?
|
299
|
+
params[:recording_callback_method] = recording_callback_method.upcase unless recording_callback_method.nil?
|
300
300
|
|
301
301
|
perform_action_apiresponse('Record', 'POST', params, true)
|
302
302
|
end
|
@@ -480,11 +480,11 @@ module Plivo
|
|
480
480
|
def start_recording(options = {})
|
481
481
|
valid_param?(:options, options, Hash, false)
|
482
482
|
options[:file_format] = 'mp3' unless options.key?(:file_format)
|
483
|
-
options[:
|
483
|
+
options[:recording_callback_method] = 'POST' unless options.key?(:recording_callback_method)
|
484
484
|
valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
|
485
485
|
valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
|
486
486
|
mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
|
487
|
-
MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).start_recording(options[:file_format], options[:
|
487
|
+
MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).start_recording(options[:file_format], options[:recording_callback_url], options[:recording_callback_method])
|
488
488
|
end
|
489
489
|
|
490
490
|
def stop_recording(options = {})
|
@@ -517,12 +517,12 @@ module Plivo
|
|
517
517
|
raise_invalid_request("Member Id is mandatory")
|
518
518
|
end
|
519
519
|
options[:file_format] = 'mp3' unless options.key?(:file_format)
|
520
|
-
options[:
|
520
|
+
options[:recording_callback_method] = 'POST' unless options.key?(:recording_callback_method)
|
521
521
|
valid_param?(:member_id, options[:member_id], [String, Integer], true)
|
522
522
|
valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
|
523
523
|
valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
|
524
524
|
mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
|
525
|
-
MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).start_participant_recording(options[:file_format], options[:
|
525
|
+
MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).start_participant_recording(options[:file_format], options[:recording_callback_url], options[:recording_callback_method])
|
526
526
|
end
|
527
527
|
|
528
528
|
def stop_participant_recording(options = {})
|
data/lib/plivo/resources.rb
CHANGED
@@ -15,6 +15,8 @@ require_relative 'resources/nodes'
|
|
15
15
|
require_relative 'resources/phlo_member'
|
16
16
|
require_relative 'resources/call_feedback'
|
17
17
|
require_relative 'resources/media'
|
18
|
+
require_relative 'resources/brand'
|
19
|
+
require_relative 'resources/campaign'
|
18
20
|
require_relative 'resources/lookup'
|
19
21
|
require_relative 'resources/regulatory_compliance'
|
20
22
|
require_relative 'resources/multipartycalls'
|
data/lib/plivo/rest_client.rb
CHANGED
@@ -14,6 +14,7 @@ module Plivo
|
|
14
14
|
attr_reader :powerpacks
|
15
15
|
attr_reader :powerpacks, :media
|
16
16
|
attr_reader :lookup
|
17
|
+
attr_reader :brand, :campaign
|
17
18
|
attr_reader :end_users
|
18
19
|
attr_reader :compliance_document_types, :compliance_documents, :compliance_requirements, :compliance_applications
|
19
20
|
|
@@ -39,6 +40,8 @@ module Plivo
|
|
39
40
|
@messages = Resources::MessagesInterface.new(self)
|
40
41
|
@powerpacks = Resources::PowerpackInterface.new(self)
|
41
42
|
@media = Resources::MediaInterface.new(self)
|
43
|
+
@brand = Resources::BrandInterface.new(self)
|
44
|
+
@campaign = Resources::CampaignInterface.new(self)
|
42
45
|
@subaccounts = Resources::SubaccountInterface.new(self)
|
43
46
|
@recordings = Resources::RecordingInterface.new(self)
|
44
47
|
@pricings = Resources::PricingInterface.new(self)
|
data/lib/plivo/utils.rb
CHANGED
@@ -227,7 +227,7 @@ module Plivo
|
|
227
227
|
uri += "?"
|
228
228
|
end
|
229
229
|
if parsed_uri.query.to_s.length > 0
|
230
|
-
parsed_uri_query = URI.
|
230
|
+
parsed_uri_query = URI.decode_www_form_component(parsed_uri.query)
|
231
231
|
if method == "GET"
|
232
232
|
queryParamMap = getMapFromQueryString?(parsed_uri_query)
|
233
233
|
params.keys.sort.each { |key|
|
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.25.1
|
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:
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -152,6 +152,7 @@ executables: []
|
|
152
152
|
extensions: []
|
153
153
|
extra_rdoc_files: []
|
154
154
|
files:
|
155
|
+
- ".github/workflows/unitTests.yml"
|
155
156
|
- ".gitignore"
|
156
157
|
- ".rspec"
|
157
158
|
- ".travis.yml"
|
@@ -182,8 +183,10 @@ files:
|
|
182
183
|
- lib/plivo/resources/accounts.rb
|
183
184
|
- lib/plivo/resources/addresses.rb
|
184
185
|
- lib/plivo/resources/applications.rb
|
186
|
+
- lib/plivo/resources/brand.rb
|
185
187
|
- lib/plivo/resources/call_feedback.rb
|
186
188
|
- lib/plivo/resources/calls.rb
|
189
|
+
- lib/plivo/resources/campaign.rb
|
187
190
|
- lib/plivo/resources/conferences.rb
|
188
191
|
- lib/plivo/resources/endpoints.rb
|
189
192
|
- lib/plivo/resources/identities.rb
|