plivo 4.1.4 → 4.1.5

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
  SHA256:
3
- metadata.gz: b88c26bf2b750e7abb11ffb4bd7e74309680e385b0ac73b815333e18b4fa3e82
4
- data.tar.gz: 7d73e9e25d6e04f1431f01b1ab8819df4b9d16eda3829c71a0401db460a9dbcd
3
+ metadata.gz: f45810d2ccc66e908a95f12c9be59ae5213dae986e55b22cb9ab0790efbf759c
4
+ data.tar.gz: e4a70a6d923039188a7c1c8a083be89d131ac0948e131a1029e678289a85b81d
5
5
  SHA512:
6
- metadata.gz: 9dfcf4b498c3a4bcf472b7a62ecfb1c5e5e83d642e55a81572134be4e193a714de12e31058244e456a4f6e7af7ad57982c65037fd311cf4fcd82d079099eb40c
7
- data.tar.gz: 785367b213909182d445931fadb70385f0e68f42ff2f86fabd31bc27aad0a7d41e033b533167d6c1899694e89cde46cf23fcb345aceb2b2c72831f853148c2aa
6
+ metadata.gz: c7b103f90e8e5864f523f0b8012961002b2a1d118b6322e7143d51441cc77067d93c8f781796c683bb43eab525d2d10056d9101e5af477398bfae5890ec40f2e
7
+ data.tar.gz: 7a04c136f7c4f5df4ae61c383097e4819eb92f8644d95a137bd668a17d381a5117f7071fd6ba758ef0e738d6e83e328c06c38884edaf625ebf9b701a7a7d8d23
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## [4.1.5](https://github.com/plivo/plivo-ruby/releases/tag/v4.1.5) (2018-11-21)
4
+ - Add hangup party details to CDR. CDR filtering allowed by hangup_source and hangup_cause_code.
5
+ - Add sub-account cascade delete support.
6
+
3
7
  ## [4.1.4](https://github.com/plivo/plivo-ruby/releases/tag/v4.1.4) (2018-10-29)
4
8
  - Add live calls filtering by from, to numbers and call_direction.
5
9
 
data/README.md CHANGED
@@ -8,7 +8,7 @@ The Plivo Ruby SDK makes it simpler to integrate communications into your Ruby a
8
8
  Add this line to your application's Gemfile:
9
9
 
10
10
  ```ruby
11
- gem 'plivo', '>= 4.1.4'
11
+ gem 'plivo', '>= 4.1.5'
12
12
  ```
13
13
 
14
14
  And then execute:
@@ -71,13 +71,13 @@ module Plivo
71
71
  self
72
72
  end
73
73
 
74
- def perform_delete
74
+ def perform_delete(params=nil)
75
75
  unless @id
76
76
  raise_invalid_request("Cannot delete a #{@_name} resource "\
77
77
  'without an identifier')
78
78
  end
79
79
 
80
- Response.new(@_client.send_request(@_resource_uri, 'DELETE', nil),
80
+ Response.new(@_client.send_request(@_resource_uri, 'DELETE', params),
81
81
  @_identifier_string)
82
82
  end
83
83
  end
@@ -20,8 +20,15 @@ module Plivo
20
20
  perform_update(params)
21
21
  end
22
22
 
23
- def delete
24
- perform_delete
23
+ def delete(cascade = false)
24
+ valid_param?(:cascade, cascade, [TrueClass, FalseClass],
25
+ false, [true, false])
26
+
27
+ params = {
28
+ :cascade => cascade
29
+ }
30
+
31
+ perform_delete(params)
25
32
  end
26
33
 
27
34
  def to_s
@@ -109,9 +116,9 @@ module Plivo
109
116
  Subaccount.new(@_client, resource_id: subaccount_id).update(name, enabled)
110
117
  end
111
118
 
112
- def delete(subaccount_id)
119
+ def delete(subaccount_id, cascade = false)
113
120
  valid_subaccount?(subaccount_id, true)
114
- Subaccount.new(@_client, resource_id: subaccount_id).delete
121
+ Subaccount.new(@_client, resource_id: subaccount_id).delete(cascade)
115
122
  end
116
123
  end
117
124
 
@@ -216,6 +216,9 @@ module Plivo
216
216
  from_number: @from_number,
217
217
  initiation_time: @initiation_time,
218
218
  parent_call_uuid: @parent_call_uuid,
219
+ hangup_cause_code: @hangup_cause_code,
220
+ hangup_cause_name: @hangup_cause_name,
221
+ hangup_source: @hangup_source,
219
222
  resource_uri: @resource_uri,
220
223
  to_number: @to_number,
221
224
  total_amount: @total_amount,
@@ -330,6 +333,9 @@ module Plivo
330
333
  # - end_time\__lt: lt stands for lesser than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before 2012-03-21 11:47, use end_time\__lt=2012-03-21 11:47
331
334
  # - end_time\__lte: lte stands for lesser than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before or exactly at 2012-03-21 11:47[:30], use end_time\__lte=2012-03-21 11:47[:30]
332
335
  # - Note: The above filters can be combined to get calls that ended in a particular time range. The timestamps need to be UTC timestamps.
336
+ # @option options [String] :parent_call_uuid - Filter the results by parent call uuid.
337
+ # @option options [String] :hangup_source - Filter the results by hangup source
338
+ # @option options [String] :hangup_cause_code - Filter the results by hangup cause code
333
339
  # @option options [Int] :limit - Used to display the number of results per page. The maximum number of results that can be fetched is 20.
334
340
  # @option options [Int] :offset - Denotes the number of value items by which the results should be offset. E.g., If the result contains a 1000 values and limit is set to 10 and offset is set to 705, then values 706 through 715 are displayed in the results. This parameter is also used for pagination of the results.
335
341
 
@@ -341,7 +347,7 @@ module Plivo
341
347
  params_expected = %i[
342
348
  subaccount bill_duration bill_duration__gt bill_duration__gte
343
349
  bill_duration__lt bill_duration__lte end_time end_time__gt
344
- end_time__gte end_time__lt end_time__lte parent_call_uuid
350
+ end_time__gte end_time__lt end_time__lte parent_call_uuid hangup_source
345
351
  ]
346
352
  params_expected.each do |param|
347
353
  if options.key?(param) &&
@@ -356,7 +362,7 @@ module Plivo
356
362
  params[:call_direction] = options[:call_direction]
357
363
  end
358
364
 
359
- %i[offset limit].each do |param|
365
+ %i[offset limit hangup_cause_code].each do |param|
360
366
  if options.key?(param) && valid_param?(param, options[param], [Integer, Integer], true)
361
367
  params[param] = options[param]
362
368
  end
@@ -53,7 +53,7 @@ module Plivo
53
53
  response = case method
54
54
  when 'GET' then send_get(resource_path, data, timeout)
55
55
  when 'POST' then send_post(resource_path, data, timeout, use_multipart_conn)
56
- when 'DELETE' then send_delete(resource_path, timeout)
56
+ when 'DELETE' then send_delete(resource_path, data, timeout)
57
57
  else raise_invalid_request("#{method} not supported by Plivo, yet")
58
58
  end
59
59
 
@@ -184,10 +184,11 @@ module Plivo
184
184
  response
185
185
  end
186
186
 
187
- def send_delete(resource_path, timeout)
187
+ def send_delete(resource_path, data, timeout)
188
188
  response = @conn.delete do |req|
189
189
  req.url resource_path
190
190
  req.options.timeout = timeout if timeout
191
+ req.body = JSON.generate(data) if data
191
192
  end
192
193
  response
193
194
  end
@@ -1,3 +1,3 @@
1
1
  module Plivo
2
- VERSION = '4.1.4'.freeze
2
+ VERSION = '4.1.5'.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.1.4
4
+ version: 4.1.5
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: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday