plivo 4.27.0 → 4.29.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: 1ac7974dc26d379831ecc8637397c0cbf43156b5
4
- data.tar.gz: 65b7a24f1cba9542117edefd8c19a48fc89e39bd
3
+ metadata.gz: ec364fb43089ee282e74b34a0583506cf779b969
4
+ data.tar.gz: 35c6813354cbc974ebe0643b00c74d1032c7b8cd
5
5
  SHA512:
6
- metadata.gz: 6b897b48d2cc18aeccbf0d5a9795fafe5f025d8d7375aad700bcdc05ea9c94a7786db3f667ed37af56df127749f66b3a6039deb90700582b8a536538e34c6278
7
- data.tar.gz: 9dcc97d2cb1fe1d6473daf99652a5ec7fec9aaea5c8681b67e7acf4aff56f4261e9496cf096835ae64b79a0bea574e2e51a7c91169797fadbe4a856c6e4cbd20
6
+ metadata.gz: 72145e3123568e80e427b3335877943bb75ffac9afb88d16f222c9e5622e8876d9342697c749b1c04e912d2c92b35063ef82cdc89ef3ca78b7fc71542d903354
7
+ data.tar.gz: 6f52fa44fc0f450b0f0aeee39a076bb0bf7c4021575d41cf4d23f861bd9270044c37974518d862403921fbee13238254c037f11de7b99aa2cf91115425b7b8e3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Change Log
2
2
 
3
+ ## [4.29.0](https://github.com/plivo/plivo-go/tree/v4.29.0) (2022-08-01)
4
+ **Feature - Token Creation**
5
+ - `JWT Token Creation API` added functionality to create a new JWT token.
6
+
7
+ ## [4.28.0](https://github.com/plivo/plivo-go/tree/v4.28.0) (2022-07-11)
8
+ **Feature - STIR Attestation**
9
+ - Add stir attestation param as part of Get CDR and Get live call APIs Response
10
+
11
+ ## [4.27.1](https://github.com/plivo/plivo-ruby/tree/v4.27.1) (2022-06-30)
12
+ - `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)
13
+
3
14
  ## [4.27.0](https://github.com/plivo/plivo-ruby/tree/v4.27.0) (2022-05-05)
4
15
  **Feature - List all recordings**
5
16
  - `from_number` and `to_number` added to filter param [List all recordings](https://www.plivo.com/docs/voice/api/recording#list-all-recordings)
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.27.0'
12
+ gem 'plivo', '>= 4.29.0'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -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
@@ -275,14 +276,14 @@ module Plivo
275
276
  # @option options [String] :parent_call_uuid - The call_uuid of the first leg in an ongoing conference call. It is recommended to use this parameter in scenarios where a member who is already present in the conference intends to add new members by initiating outbound API calls. This minimizes the delay in adding a new memeber to the conference.
276
277
  # @option options [Boolean] :error_parent_not_found - if set to true and the parent_call_uuid cannot be found, the API request would return an error. If set to false, the outbound call API request will be executed even if the parent_call_uuid is not found. Defaults to false.
277
278
  # @return [Call] Call
278
- def create(from, to, answer_url, options = nil)
279
+ def create(from, to, answer_url, options = nil)
279
280
  valid_param?(:from, from, [String, Symbol, Integer], true)
280
281
  valid_param?(:to, to, Array, true)
281
282
  to.each do |to_num|
282
283
  valid_param?(:to_num, to_num, [Integer, String, Symbol], true)
283
284
  end
284
285
  valid_param?(:answer_url, answer_url, [String, Symbol], true)
285
-
286
+
286
287
 
287
288
  params = {
288
289
  from: from,
@@ -345,31 +346,6 @@ module Plivo
345
346
  return perform_list if options.nil?
346
347
  valid_param?(:options, options, Hash, true)
347
348
 
348
- params = {}
349
- params_expected = %i[
350
- subaccount bill_duration bill_duration__gt bill_duration__gte
351
- bill_duration__lt bill_duration__lte end_time end_time__gt
352
- end_time__gte end_time__lt end_time__lte parent_call_uuid hangup_source
353
- ]
354
- params_expected.each do |param|
355
- if options.key?(param) &&
356
- valid_param?(param, options[param], [String, Symbol], true)
357
- params[param] = options[param]
358
- end
359
- end
360
-
361
- if options.key?(:call_direction) &&
362
- valid_param?(:call_direction, options[:call_direction],
363
- [String, Symbol], true, %w[inbound outbound])
364
- params[:call_direction] = options[:call_direction]
365
- end
366
-
367
- %i[offset limit hangup_cause_code].each do |param|
368
- if options.key?(param) && valid_param?(param, options[param], [Integer, Integer], true)
369
- params[param] = options[param]
370
- end
371
- end
372
-
373
349
  raise_invalid_request("Offset can't be negative") if options.key?(:offset) && options[:offset] < 0
374
350
 
375
351
  if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
@@ -377,6 +353,47 @@ module Plivo
377
353
  "fetched is 20. limit can't be more than 20 or less than 1")
378
354
  end
379
355
 
356
+ # initial list of possible params
357
+ params = %i[
358
+ bill_duration
359
+ bill_duration__gt
360
+ bill_duration__gte
361
+ bill_duration__lt
362
+ bill_duration__lte
363
+ call_direction
364
+ end_time
365
+ end_time__gt
366
+ end_time__gte
367
+ end_time__lt
368
+ end_time__lte
369
+ from_number
370
+ hangup_cause_code
371
+ hangup_source
372
+ limit
373
+ offset
374
+ parent_call_uuid
375
+ subaccount
376
+ to_number
377
+ stir_verification
378
+ ].reduce({}) do |result_hash, param|
379
+ if options.key?(param)
380
+ if param == :call_direction
381
+ if valid_param?(:call_direction, options[:call_direction],
382
+ [String, Symbol], true, %w[inbound outbound])
383
+ result_hash[:call_direction] = options[:call_direction]
384
+ end
385
+ elsif %i[offset limit hangup_cause_code].include?(param)
386
+ if valid_param?(param, options[param], [Integer, Integer], true)
387
+ result_hash[param] = options[param]
388
+ end
389
+ elsif valid_param?(param, options[param], [String, Symbol], true)
390
+ result_hash[param] = options[param]
391
+ end
392
+ end
393
+
394
+ result_hash
395
+ end
396
+
380
397
  perform_list(params)
381
398
  end
382
399
 
@@ -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
+
@@ -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'
@@ -8,6 +8,7 @@ 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
@@ -49,6 +50,7 @@ module Plivo
49
50
  @phone_numbers = Resources::PhoneNumberInterface.new(self)
50
51
  @conferences = Resources::ConferenceInterface.new(self)
51
52
  @calls = Resources::CallInterface.new(self)
53
+ @token = Resources::TokenInterface.new(self)
52
54
  @endpoints = Resources::EndpointInterface.new(self)
53
55
  @applications = Resources::ApplicationInterface.new(self)
54
56
  @addresses = Resources::AddressInterface.new(self)
data/lib/plivo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plivo
2
- VERSION = "4.27.0".freeze
2
+ VERSION = "4.29.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.27.0
4
+ version: 4.29.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-05-05 00:00:00.000000000 Z
11
+ date: 2022-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -155,7 +155,6 @@ files:
155
155
  - ".github/workflows/unitTests.yml"
156
156
  - ".gitignore"
157
157
  - ".rspec"
158
- - ".travis.yml"
159
158
  - AUTHORS.md
160
159
  - CHANGELOG.md
161
160
  - Gemfile
@@ -202,6 +201,7 @@ files:
202
201
  - lib/plivo/resources/pricings.rb
203
202
  - lib/plivo/resources/recordings.rb
204
203
  - lib/plivo/resources/regulatory_compliance.rb
204
+ - lib/plivo/resources/token.rb
205
205
  - lib/plivo/rest_client.rb
206
206
  - lib/plivo/utils.rb
207
207
  - lib/plivo/version.rb
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- bundler_args: --without development
5
- rvm:
6
- - ruby-head
7
- - 2.4.0
8
- - 2.3.0
9
- - 2.2.0
10
- - 2.1
11
- - 2.0.0