Skip to content

Commit

Permalink
SECURITY-9728: general update on repository
Browse files Browse the repository at this point in the history
Co-authored-by: Borisz <[email protected]>
  • Loading branch information
dsztanko and Borcsa134 committed Aug 8, 2024
1 parent 339f272 commit 746956f
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SESSION_VALIDATOR_KEYID=''
SESSION_VALIDATOR_URL=''
KEY_POOL='[{"keyId":"","secret":"","acceptOnly":0}]'
6 changes: 3 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-versions: ['2.6', '2.7', '3.0']
ruby-versions: ['2.6', '2.7', '3.0', '3.2']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-versions }}
Expand All @@ -28,4 +28,4 @@ jobs:
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.gem
Gemfile.lock
.ruby-version
.env
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: test sh

test:
docker compose run --rm app bash -c "bundle install && rspec"

sh:
docker compose run --rm app bash -c "bundle install && bash"
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# session-validator-client-ruby ![Build status](https://travis-ci.org/emartech/session-validator-client-ruby.svg?branch=master)
# Session Validator Client Ruby ![Build Status](https://github.com/emartech/session-validator-client-ruby/actions/workflows/ruby.yml/badge.svg)

Ruby client for Emarsys session validator service.

Expand All @@ -10,35 +10,38 @@ gem install session-validator-client

## Usage

Setup the following environment variables:

* `KEY_POOL`
* `SESSION_VALIDATOR_KEYID`
* `SESSION_VALIDATOR_URL`

### Validating a single Msid
`valid?(msid)` returns `true` if `msid` is valid
Copy `.env.example` to `.env` and set the necessary values for usage in your service.

### Create client
```ruby
require "session_validator"

client = SessionValidator::Client.new
client.valid?("staging_int_5ad5f96f307cf9.61063404")
```

### Batch validating multiple MSIDS
`filter_invalid(msids)` returns an array of the invalid MSIDS.
### Requests without Escher
For mTLS on GAP.

```ruby
require "session_validator"

client = SessionValidator::Client.new
client = SessionValidator::Client.new(use_escher: false)
```

### Validating a single MSID
```ruby
client.valid?("staging_int_5ad5f96f307cf9.61063404")
```

### Batch validating multiple MSIDs
Returns an array of the invalid MSIDs.
```ruby
client.filter_invalid(["staging_int_5ad5f96f307cf9.61063404", "staging_int_5ad5f96f307cf9.61063405"])
```

## Running tests
## Local development

### Running tests
```bash
$ bundle install
$ rspec
make test
```
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
app:
image: ruby:3.2.5
working_dir: /home/app/src
volumes:
- .:/home/app/src
2 changes: 1 addition & 1 deletion session-validator-client.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "session-validator-client"
s.version = "5.1.0"
s.version = "5.1.1"
s.summary = "Ruby client for Emarsys session validator service"
s.authors = ["Emarsys Technologies Ltd."]
s.email = "[email protected]"
Expand Down

0 comments on commit 746956f

Please sign in to comment.