plivo 4.35.0 → 4.36.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: 4075dc6bb995418a806e88b984f8b016d6e0f141
4
- data.tar.gz: 9bcdb5380421a73e49b73ea9c96f512f77f7a991
3
+ metadata.gz: 8201cbdabff4391e2817f5f463d0d0e0ea8ce901
4
+ data.tar.gz: 4eab07c89d90f39d164d37c3b873954f9cbaa201
5
5
  SHA512:
6
- metadata.gz: 612bb679799a48139ec8907873ebd28ba9b54c370dfc60424ea27b5b89f0204b90d0135a86987294342a70edf244c26ad823f35e1e26e69a1d35667944031cb9
7
- data.tar.gz: 2467bacadfbd13bd45da25d0b5104552d033b76a38a54de058322dce285cbe9a9431122ea0697ddc9f0ee5fb7975417d2099823401b8cc7d48138e5a46cb049c
6
+ metadata.gz: ce66937423df4e70bfb62455c904b818c7882e275a774c2d814881eb6e077ba42ee29d898471e7a1882f2099dbb3fbfdc362dbd141aa9ed087554c2baafb1f86
7
+ data.tar.gz: 97b29ec6835d373389535e554ff390bd6f0a481a3f53a862a700dbef46400c9ddfe5133507061cb3452f0ee67d3f6d31999638c518be7847797b2d88a125ec9b
data/.gitignore CHANGED
@@ -12,3 +12,4 @@ tmp/
12
12
  bin/
13
13
  # rspec failure tracking
14
14
  .rspec_status
15
+ ruby-sdk-test/
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
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
+
2
7
  ## [4.35.0](https://github.com/plivo/plivo-ruby/tree/v4.35.0) (2022-01-18)
3
8
  **Adding new attribute - 'message_expiry' in Send Message API**
4
9
  - Added new attribute - message_expiry in Send Message 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
@@ -0,0 +1,7 @@
1
+ .PHONY: build test
2
+
3
+ build:
4
+ docker-compose up --build --remove-orphans
5
+
6
+ test:
7
+ docker exec -it $$CONTAINER /bin/bash -c "bundle exec rake"
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.35.0'
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)
@@ -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
data/lib/plivo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plivo
2
- VERSION = "4.35.0".freeze
2
+ VERSION = "4.36.0".freeze
3
3
  end
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.35.0
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-18 00:00:00.000000000 Z
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