-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from plivo/SMS-5025
SMS-5025: Add Requester IP to Get and List Messages
- Loading branch information
Showing
12 changed files
with
159 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ tmp/ | |
bin/ | ||
# rspec failure tracking | ||
.rspec_status | ||
ruby-sdk-test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM ruby:3.0.1-alpine | ||
|
||
RUN apk update && apk add git vim bash make gcc musl-dev | ||
|
||
WORKDIR /usr/src/app | ||
RUN gem install json --source 'https://rubygems.org/' | ||
|
||
# Copy setup script | ||
COPY setup_sdk.sh /usr/src/app/ | ||
RUN chmod a+x /usr/src/app/setup_sdk.sh | ||
|
||
ENTRYPOINT [ "/usr/src/app/setup_sdk.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.PHONY: build test | ||
|
||
build: | ||
docker-compose up --build --remove-orphans | ||
|
||
test: | ||
docker exec -it $$CONTAINER /bin/bash -c "bundle exec rake" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
rubySDK: | ||
build: | ||
context: . | ||
image: rubysdk | ||
container_name: rubySDK | ||
environment: | ||
- PLIVO_AUTH_ID=${PLIVO_AUTH_ID} | ||
- PLIVO_AUTH_TOKEN=${PLIVO_AUTH_TOKEN} | ||
- PLIVO_API_DEV_HOST=${PLIVO_API_DEV_HOST} | ||
- PLIVO_API_PROD_HOST=${PLIVO_API_PROD_HOST} | ||
volumes: | ||
- .:/usr/src/app | ||
stdin_open: true | ||
tty: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Plivo | ||
VERSION = "4.35.0".freeze | ||
VERSION = "4.36.0".freeze | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
testDir="ruby-sdk-test" | ||
GREEN="\033[0;32m" | ||
NC="\033[0m" | ||
|
||
if [ ! $PLIVO_API_PROD_HOST ] || [ ! $PLIVO_API_DEV_HOST ] || [ ! $PLIVO_AUTH_ID ] || [ ! $PLIVO_AUTH_TOKEN ]; then | ||
echo "Environment variables not properly set! Please refer to Local Development section in README!" | ||
exit 126 | ||
fi | ||
|
||
cd /usr/src/app | ||
|
||
echo "Setting plivo-api endpoint to dev..." | ||
find /usr/src/app/lib/ -type f -exec sed -i "s/$PLIVO_API_PROD_HOST/$PLIVO_API_DEV_HOST/g" {} \; | ||
|
||
bundle install | ||
|
||
if [ ! -d $testDir ]; then | ||
echo "Creating test dir..." | ||
mkdir -p $testDir | ||
fi | ||
|
||
if [ ! -f $testDir/test.rb ]; then | ||
echo "Creating test file..." | ||
cd $testDir | ||
echo -e "require \"rubygems\"" > test.rb | ||
echo -e "require \"/usr/src/app/lib/plivo.rb\"" >> test.rb | ||
echo -e "include Plivo\n" >> test.rb | ||
echo -e "api = RestClient.new(ENV[\"PLIVO_AUTH_ID\"], ENV[\"PLIVO_AUTH_TOKEN\"])" >> test.rb | ||
cd - | ||
fi | ||
|
||
echo -e "\n\nSDK setup complete!" | ||
echo "To test your changes:" | ||
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)" | ||
echo -e "\t\tNote: To use sdk in test file, import using $GREEN require \"/usr/src/app/lib/plivo.rb\"$NC" | ||
echo -e "\t2. Run a terminal in the container using: $GREEN docker exec -it $HOSTNAME /bin/bash$NC" | ||
echo -e "\t3. Navigate to the test directory: $GREEN cd /usr/src/app/$testDir$NC" | ||
echo -e "\t4. Run your test file: $GREEN ruby test.rb$NC" | ||
echo -e "\t5. For running unit tests, run on host: $GREEN make test CONTAINER=$HOSTNAME$NC" | ||
|
||
# To keep the container running post setup | ||
/bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters