plivo 4.3.2 → 4.3.3

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: cdb4a669c03b7deb0f58e4bfa5ea0060c7c36f44
4
- data.tar.gz: f86fd0d66544f3effebe5068a29dbb0a85cda211
3
+ metadata.gz: 504b141117cfbd9ffc076c66e3e02ff8dd962648
4
+ data.tar.gz: c4874e55c3f11321dfdb19ed00e37a5394a75a65
5
5
  SHA512:
6
- metadata.gz: 5f8ed82897344fbd79ab88bcbf992e2910c38a86d047b164395adfa165824fa1967bf30a6cced151fa8b77c20a730d453b8269405e9f609143b12ce9de6a546e
7
- data.tar.gz: a2285dad0cff34a4b0e31c1118ebe02db9970f5e9747803872cd7f6a1f4be7de91571330e4f9dbeb0f4cf8826abd6bcdbfe669453b45341613aa0259337adf5d
6
+ metadata.gz: a4b984f5f38711bace19f6700a4b7715ae82cd6d12e43d3e734f258451908365ea7cc7d30092739bc583376bb85032b973592bcb2ba15b2cc4c3b3a16a942748
7
+ data.tar.gz: 1e334d8825c60460a34034557d47a3aeaf2bca6df3c608d5eb0904fea8675f4a9f616efaaaa9eab1524c07d73472d35ad5bdad8bc4343f7d245a37fef46f84c6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ ## [4.3.3](https://github.com/plivo/plivo-ruby/releases/tag/v4.3.3) (2019-12-04)
4
+ - Add MMS support
5
+
3
6
  ## [4.3.2](https://github.com/plivo/plivo-ruby/releases/tag/v4.3.2) (2019-11-13)
4
7
  - Add GetInput XML support
5
8
 
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.3.2'
11
+ gem 'plivo', '>= 4.3.3'
12
12
  ```
13
13
 
14
14
  And then execute:
@@ -70,7 +70,15 @@ module Plivo
70
70
  method == 'POST' ? parse_and_set(params) : self
71
71
  self
72
72
  end
73
-
73
+
74
+ def perform_action_apiresponse(action = nil, method = 'GET', params = nil, parse = false)
75
+ resource_path = action ? @_resource_uri + action + '/' : @_resource_uri
76
+ response = @_client.send_request(resource_path, method, params)
77
+ parse ? parse_and_set(response) : self
78
+ method == 'POST' ? parse_and_set(params) : self
79
+ return response
80
+ end
81
+
74
82
  def perform_delete(params=nil)
75
83
  unless @id
76
84
  raise_invalid_request("Cannot delete a #{@_name} resource "\
@@ -7,6 +7,17 @@ module Plivo
7
7
  @_identifier_string = 'message_uuid'
8
8
  super
9
9
  end
10
+ def listMedia()
11
+ perform_action_apiresponse('Media', 'GET')
12
+ end
13
+
14
+ def deleteMedia()
15
+ perform_action_apiresponse('Media', 'DELETE')
16
+ end
17
+
18
+ def getMedia(media_id)
19
+ perform_action_apiresponse('Media/' + media_id + '/', 'GET')
20
+ end
10
21
 
11
22
  def to_s
12
23
  {
@@ -44,7 +55,7 @@ module Plivo
44
55
  # @param [Array] dst
45
56
  # @param [String] text
46
57
  # @param [Hash] options
47
- # @option options [String] :type The type of message. Should be `sms` for a text message. Defaults to `sms`.
58
+ # @option options [String] :type The type of message. Should be `sms` or `mms`. Defaults to `sms`.
48
59
  # @option options [String] :url The URL to which with the status of the message is sent. The following parameters are sent to the URL:
49
60
  # - To - Phone number of the recipient
50
61
  # - From - Phone number of the sender
@@ -61,9 +72,11 @@ module Plivo
61
72
  # @option options [String] :method The method used to call the url. Defaults to POST.
62
73
  # @option options [String] :log If set to false, the content of this message will not be logged on the Plivo infrastructure and the dst value will be masked (e.g., 141XXXXX528). Default is set to true.
63
74
  # @option options [String] :trackable set to false
64
- def create(src, dst, text, options = nil, powerpack_uuid = nil)
75
+ #@option options[List]: media_urls Minimum one media url should be present in Media urls list to send mms. Maximum allowd 10 media urls inside the list (e.g, media_urls : ['https//example.com/test.jpg', 'https://example.com/abcd.gif'])
76
+
77
+ def create(src, dst, text = nil, options = nil, powerpack_uuid = nil)
65
78
  valid_param?(:src, src, [Integer, String, Symbol], false)
66
- valid_param?(:text, text, [String, Symbol], true)
79
+ valid_param?(:text, text, [String, Symbol], false)
67
80
  valid_param?(:dst, dst, Array, true)
68
81
  valid_param?(:powerpack_uuid, powerpack_uuid, [String, Symbol], false)
69
82
  dst.each do |dst_num|
@@ -93,7 +106,7 @@ module Plivo
93
106
  valid_param?(:options, options, Hash, true)
94
107
 
95
108
  if options.key?(:type) &&
96
- valid_param?(:type, options[:type], String, true, 'sms')
109
+ valid_param?(:type, options[:type], String, true, ['sms', 'mms'])
97
110
  params[:type] = options[:type]
98
111
  end
99
112
 
@@ -116,6 +129,11 @@ module Plivo
116
129
  valid_param?(:trackable, options[:trackable], [TrueClass, FalseClass], true)
117
130
  params[:trackable] = options[:trackable]
118
131
  end
132
+
133
+ if options.key?(:media_urls) &&
134
+ valid_param?(:media_urls, options[:media_urls], Array, true)
135
+ params[:media_urls] = options[:media_urls]
136
+ end
119
137
  perform_create(params)
120
138
  end
121
139
 
@@ -133,6 +151,7 @@ module Plivo
133
151
  # @option options [Int] :limit Used to display the number of results per page. The maximum number of results that can be fetched is 20.
134
152
  # @option options [Int] :offset Denotes the number of value items by which the results should be offset. Eg:- 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.
135
153
  # @option options [String] :error_code Delivery Response code returned by the carrier attempting the delivery. See Supported error codes {https://www.plivo.com/docs/api/message/#standard-plivo-error-codes}.
154
+ #@option options[List]: media_urls Minimum one media url should be present in Media urls list to send mms. Maximum allowd 10 media urls inside the list (e.g, media_urls : ['https//example.com/test.jpg', 'https://example.com/abcd.gif'])
136
155
  def list(options = nil)
137
156
  return perform_list if options.nil?
138
157
  valid_param?(:options, options, Hash, true)
data/lib/plivo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plivo
2
- VERSION = '4.3.2'.freeze
2
+ VERSION = '4.3.3'.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.3.2
4
+ version: 4.3.3
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: 2019-11-13 00:00:00.000000000 Z
11
+ date: 2019-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday