plivo 4.34.0 → 4.36.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +9 -0
- data/Dockerfile +12 -0
- data/Makefile +7 -0
- data/README.md +21 -1
- data/docker-compose.yml +18 -0
- data/lib/plivo/resources/messages.rb +13 -1
- data/lib/plivo/version.rb +1 -1
- data/setup_sdk.sh +45 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8201cbdabff4391e2817f5f463d0d0e0ea8ce901
|
4
|
+
data.tar.gz: 4eab07c89d90f39d164d37c3b873954f9cbaa201
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce66937423df4e70bfb62455c904b818c7882e275a774c2d814881eb6e077ba42ee29d898471e7a1882f2099dbb3fbfdc362dbd141aa9ed087554c2baafb1f86
|
7
|
+
data.tar.gz: 97b29ec6835d373389535e554ff390bd6f0a481a3f53a862a700dbef46400c9ddfe5133507061cb3452f0ee67d3f6d31999638c518be7847797b2d88a125ec9b
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
# Change Log
|
2
|
+
|
3
|
+
## [4.36.0](https://github.com/plivo/plivo-ruby/tree/v4.36.0) (2022-01-25)
|
4
|
+
**Adding new attribute - 'requester_ip' in Get Message and List Mssage APIs**
|
5
|
+
- Add `requester_ip` to the response for the [list all messages API](https://www.plivo.com/docs/sms/api/message/list-all-messages/) and the [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message)
|
6
|
+
|
7
|
+
## [4.35.0](https://github.com/plivo/plivo-ruby/tree/v4.35.0) (2022-01-18)
|
8
|
+
**Adding new attribute - 'message_expiry' in Send Message API**
|
9
|
+
- Added new attribute - message_expiry in Send Message API
|
10
|
+
|
2
11
|
## [4.34.0](https://github.com/plivo/plivo-ruby/tree/v4.34.0) (2022-12-16)
|
3
12
|
**10DLC: Update Campaign API**
|
4
13
|
- Added Update Campaign API
|
data/Dockerfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
FROM ruby:3.0.1-alpine
|
2
|
+
|
3
|
+
RUN apk update && apk add git vim bash make gcc musl-dev
|
4
|
+
|
5
|
+
WORKDIR /usr/src/app
|
6
|
+
RUN gem install json --source 'https://rubygems.org/'
|
7
|
+
|
8
|
+
# Copy setup script
|
9
|
+
COPY setup_sdk.sh /usr/src/app/
|
10
|
+
RUN chmod a+x /usr/src/app/setup_sdk.sh
|
11
|
+
|
12
|
+
ENTRYPOINT [ "/usr/src/app/setup_sdk.sh" ]
|
data/Makefile
ADDED
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.
|
12
|
+
gem 'plivo', '>= 4.36.0'
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
@@ -173,3 +173,23 @@ More examples are available [here](https://github.com/plivo/plivo-examples-ruby)
|
|
173
173
|
|
174
174
|
## Reporting issues
|
175
175
|
Report any feedback or problems with this version by [opening an issue on Github](https://github.com/plivo/plivo-ruby/issues).
|
176
|
+
|
177
|
+
## Local Development
|
178
|
+
> Note: Requires latest versions of Docker & Docker-Compose. If you're on MacOS, ensure Docker Desktop is running.
|
179
|
+
1. Export the following environment variables in your host machine:
|
180
|
+
```bash
|
181
|
+
export PLIVO_AUTH_ID=<your_auth_id>
|
182
|
+
export PLIVO_AUTH_TOKEN=<your_auth_token>
|
183
|
+
export PLIVO_API_DEV_HOST=<plivoapi_dev_endpoint>
|
184
|
+
export PLIVO_API_PROD_HOST=<plivoapi_public_endpoint>
|
185
|
+
```
|
186
|
+
2. Run `make build`. This will create a docker container in which the sdk will be setup and dependencies will be installed.
|
187
|
+
> The entrypoint of the docker container will be the `setup_sdk.sh` script. The script will handle all the necessary changes required for local development.
|
188
|
+
3. The above command will print the docker container id (and instructions to connect to it) to stdout.
|
189
|
+
4. The testing code can be added to `<sdk_dir_path>/ruby-sdk-test/test.rb` in host
|
190
|
+
(or `/usr/src/app/ruby-sdk-test/test.rb` in container)
|
191
|
+
5. The sdk directory will be mounted as a volume in the container. So any changes in the sdk code will also be reflected inside the container.
|
192
|
+
> To use the local code in the test file, import the sdk in test file using:
|
193
|
+
`require "/usr/src/app/lib/plivo.rb"`
|
194
|
+
6. To run unit tests, run `make test CONTAINER=<cont_id>` in host, where `<cont_id>` is the docker container id created in 2.
|
195
|
+
(The docker container should be running)
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
version: '3'
|
2
|
+
|
3
|
+
services:
|
4
|
+
|
5
|
+
rubySDK:
|
6
|
+
build:
|
7
|
+
context: .
|
8
|
+
image: rubysdk
|
9
|
+
container_name: rubySDK
|
10
|
+
environment:
|
11
|
+
- PLIVO_AUTH_ID=${PLIVO_AUTH_ID}
|
12
|
+
- PLIVO_AUTH_TOKEN=${PLIVO_AUTH_TOKEN}
|
13
|
+
- PLIVO_API_DEV_HOST=${PLIVO_API_DEV_HOST}
|
14
|
+
- PLIVO_API_PROD_HOST=${PLIVO_API_PROD_HOST}
|
15
|
+
volumes:
|
16
|
+
- .:/usr/src/app
|
17
|
+
stdin_open: true
|
18
|
+
tty: true
|
@@ -30,7 +30,8 @@ module Plivo
|
|
30
30
|
total_amount: @total_amount,
|
31
31
|
total_rate: @total_rate,
|
32
32
|
powerpack_id: @powerpack_id,
|
33
|
-
units: @units
|
33
|
+
units: @units,
|
34
|
+
requester_ip: @requester_ip
|
34
35
|
}.to_s
|
35
36
|
end
|
36
37
|
end
|
@@ -69,6 +70,7 @@ module Plivo
|
|
69
70
|
# @option options [String] :method The method used to call the url. Defaults to POST.
|
70
71
|
# @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.
|
71
72
|
# @option options [String] :trackable set to false
|
73
|
+
# @option options[Int]: message_expiry, int value
|
72
74
|
# @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'])
|
73
75
|
# @option options[List]: media_ids Minimum one media ids should be present in Media ids list to send mms. Maximum allowd 10 media ids inside the list (e.g, media_ids : ['1fs211ba-355b-11ea-bbc9-02121c1190q7'])
|
74
76
|
|
@@ -122,6 +124,11 @@ module Plivo
|
|
122
124
|
if value.key?(:log) &&
|
123
125
|
valid_param?(:log, value[:log], [TrueClass, FalseClass], true)
|
124
126
|
params[:log] = value[:log]
|
127
|
+
end
|
128
|
+
|
129
|
+
if value.key?(:message_expiry) &&
|
130
|
+
valid_param?(:message_expiry, value[:message_expiry], [Integer, Integer], true)
|
131
|
+
params[:message_expiry] = value[:message_expiry]
|
125
132
|
end
|
126
133
|
|
127
134
|
if value.key?(:trackable) &&
|
@@ -219,6 +226,11 @@ module Plivo
|
|
219
226
|
params[:media_ids] = options[:media_ids]
|
220
227
|
end
|
221
228
|
|
229
|
+
if options.key?(:message_expiry) &&
|
230
|
+
valid_param?(:message_expiry, options[:message_expiry], [Integer, Integer], true)
|
231
|
+
params[:message_expiry] = options[:message_expiry]
|
232
|
+
end
|
233
|
+
|
222
234
|
if options.key?(:trackable) &&
|
223
235
|
valid_param?(:trackable, options[:trackable], [TrueClass, FalseClass], true)
|
224
236
|
params[:trackable] = options[:trackable]
|
data/lib/plivo/version.rb
CHANGED
data/setup_sdk.sh
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
testDir="ruby-sdk-test"
|
5
|
+
GREEN="\033[0;32m"
|
6
|
+
NC="\033[0m"
|
7
|
+
|
8
|
+
if [ ! $PLIVO_API_PROD_HOST ] || [ ! $PLIVO_API_DEV_HOST ] || [ ! $PLIVO_AUTH_ID ] || [ ! $PLIVO_AUTH_TOKEN ]; then
|
9
|
+
echo "Environment variables not properly set! Please refer to Local Development section in README!"
|
10
|
+
exit 126
|
11
|
+
fi
|
12
|
+
|
13
|
+
cd /usr/src/app
|
14
|
+
|
15
|
+
echo "Setting plivo-api endpoint to dev..."
|
16
|
+
find /usr/src/app/lib/ -type f -exec sed -i "s/$PLIVO_API_PROD_HOST/$PLIVO_API_DEV_HOST/g" {} \;
|
17
|
+
|
18
|
+
bundle install
|
19
|
+
|
20
|
+
if [ ! -d $testDir ]; then
|
21
|
+
echo "Creating test dir..."
|
22
|
+
mkdir -p $testDir
|
23
|
+
fi
|
24
|
+
|
25
|
+
if [ ! -f $testDir/test.rb ]; then
|
26
|
+
echo "Creating test file..."
|
27
|
+
cd $testDir
|
28
|
+
echo -e "require \"rubygems\"" > test.rb
|
29
|
+
echo -e "require \"/usr/src/app/lib/plivo.rb\"" >> test.rb
|
30
|
+
echo -e "include Plivo\n" >> test.rb
|
31
|
+
echo -e "api = RestClient.new(ENV[\"PLIVO_AUTH_ID\"], ENV[\"PLIVO_AUTH_TOKEN\"])" >> test.rb
|
32
|
+
cd -
|
33
|
+
fi
|
34
|
+
|
35
|
+
echo -e "\n\nSDK setup complete!"
|
36
|
+
echo "To test your changes:"
|
37
|
+
echo -e "\t1. Add your test code in <path_to_cloned_sdk>/$testDir/test.rb on host (or /usr/src/app/$testDir/test.rb in the container)"
|
38
|
+
echo -e "\t\tNote: To use sdk in test file, import using $GREEN require \"/usr/src/app/lib/plivo.rb\"$NC"
|
39
|
+
echo -e "\t2. Run a terminal in the container using: $GREEN docker exec -it $HOSTNAME /bin/bash$NC"
|
40
|
+
echo -e "\t3. Navigate to the test directory: $GREEN cd /usr/src/app/$testDir$NC"
|
41
|
+
echo -e "\t4. Run your test file: $GREEN ruby test.rb$NC"
|
42
|
+
echo -e "\t5. For running unit tests, run on host: $GREEN make test CONTAINER=$HOSTNAME$NC"
|
43
|
+
|
44
|
+
# To keep the container running post setup
|
45
|
+
/bin/bash
|
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.36.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: 2023-01-
|
11
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -157,12 +157,15 @@ files:
|
|
157
157
|
- ".rspec"
|
158
158
|
- AUTHORS.md
|
159
159
|
- CHANGELOG.md
|
160
|
+
- Dockerfile
|
160
161
|
- Gemfile
|
161
162
|
- Jenkinsfile
|
162
163
|
- LICENSE.txt
|
164
|
+
- Makefile
|
163
165
|
- README.md
|
164
166
|
- Rakefile
|
165
167
|
- ci/config.yml
|
168
|
+
- docker-compose.yml
|
166
169
|
- examples/conference_bridge.rb
|
167
170
|
- examples/jwt.rb
|
168
171
|
- examples/lookup.rb
|
@@ -238,6 +241,7 @@ files:
|
|
238
241
|
- lib/plivo/xml/w.rb
|
239
242
|
- lib/plivo/xml/wait.rb
|
240
243
|
- plivo.gemspec
|
244
|
+
- setup_sdk.sh
|
241
245
|
homepage: https://github.com/plivo/plivo-ruby
|
242
246
|
licenses:
|
243
247
|
- MIT
|