vgs_api_client 0.0.1.alpha202204211429 → 0.0.1.alpha202204222223
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -0
- data/lib/{vgs_api_client → openapi_client}/api/aliases_api.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/api_client.rb +1 -1
- data/lib/{vgs_api_client → openapi_client}/api_error.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/configuration.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/alias_format.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/api_error.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/create_aliases_request.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/create_aliases_request_new.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/create_aliases_request_reference.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/inline_response200.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/inline_response2001.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/inline_response201.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/inline_response_default.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/model_alias.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/revealed_data.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/update_alias_request.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/models/update_alias_request_data.rb +0 -0
- data/lib/{vgs_api_client → openapi_client}/version.rb +1 -1
- data/lib/openapi_client.rb +53 -0
- data/lib/version.rb +3 -0
- data/lib/vgs_api_client.rb +80 -49
- data/scripts/assemble/run.sh +1 -1
- data/scripts/test/run.sh +2 -2
- data/scripts/test-e2e/Dockerfile +1 -9
- data/scripts/test-e2e/run.sh +3 -5
- data/spec/spec_helper.rb +1 -1
- data/spec/test_aliases_api_spec.rb +37 -45
- data/vgs_api_client.gemspec +14 -20
- metadata +33 -27
- data/lib/vgs.rb +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 716fc5e3d43e5ccfe9e5d59a8335d17baedfcef0ff5cdb7c24b6631301861cd8
|
4
|
+
data.tar.gz: 7c1c478defa70b7b4dc927d2829a7f22fecb04a30dc177eae16f2a21544c0944
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c074abb9a795e20df344d65e75093237962c8b3e699c49468ba7a00847e7b4b8786774b24e32f6a0788caca7b9a118575905e606ded4cd2557d0ab8ca183cd88
|
7
|
+
data.tar.gz: b69bdea385a329b8bd9d5ff91fb16325eab2dd86fc5f9bc3648f4c1d86556603232d98ac80ad938de272e773beda496be5c9428b924615b0388e74490f61651c
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# vgs-api-client-python
|
2
|
+
|
3
|
+
This repository contains a Ruby API client library for the Very Good Security API.
|
4
|
+
|
5
|
+
### Requirements
|
6
|
+
|
7
|
+
Building and using the API client library requires Ruby 2.6+.
|
8
|
+
|
9
|
+
### Installation
|
10
|
+
|
11
|
+
```
|
12
|
+
gem install vgs-api-client
|
13
|
+
```
|
14
|
+
|
15
|
+
### Development
|
16
|
+
|
17
|
+
Follow [DEVELOPMENT](DEVELOPMENT.md) instruction.
|
18
|
+
|
19
|
+
### Release
|
20
|
+
|
21
|
+
Follow [RELEASE](RELEASE.md) instruction.
|
22
|
+
|
23
|
+
### Documentation
|
24
|
+
|
25
|
+
https://www.verygoodsecurity.com/docs/vault/api/
|
26
|
+
|
27
|
+
### Tutorial
|
28
|
+
|
29
|
+
https://www.verygoodsecurity.com/docs/tokenization/ruby-tutorial
|
30
|
+
|
31
|
+
### Support
|
32
|
+
|
33
|
+
support@verygoodsecurity.com
|
File without changes
|
@@ -31,7 +31,7 @@ module VgsApiClient
|
|
31
31
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
32
32
|
def initialize(config = Configuration.default)
|
33
33
|
@config = config
|
34
|
-
@user_agent = "vgs-api-client/0.0.1.
|
34
|
+
@user_agent = "vgs-api-client/0.0.1.alpha202204222223/ruby"
|
35
35
|
@default_headers = {
|
36
36
|
'Content-Type' => 'application/json',
|
37
37
|
'User-Agent' => @user_agent
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,53 @@
|
|
1
|
+
=begin
|
2
|
+
#Vault HTTP API
|
3
|
+
|
4
|
+
#The VGS Vault HTTP API is used for storing, retrieving, and managing sensitive data (aka Tokenization) within a VGS Vault. The VGS API is organized around REST. Our API is built with a predictable resource-oriented structure, uses JSON-encoded requests and responses, follows standard HTTP verbs/responses, and uses industry standard authentication. ## What is VGS Storing sensitive data on your company’s infrastructure often comes with a heavy compliance burden. For instance, storing payments data yourself greatly increases the amount of work needed to become PCI compliant. It also increases your security risk in general. To combat this, companies will minimize the amount of sensitive information they have to handle or store. VGS provides multiple methods for minimizing the sensitive information that needs to be stored which allows customers to secure any type of data for any use-case. **Tokenization** is a method that focuses on securing the storage of data. This is the quickest way to get started and is free. [Get started with Tokenization](https://www.verygoodsecurity.com/docs/tokenization/getting-started). **Zero Data** is a unique method invented by VGS in 2016 that securely stores data like Tokenization, however it also removes the customer’s environment from PCI scope completely providing maximum security, and minimum compliance scope. [Get started with Zero Data](https://www.verygoodsecurity.com/docs/getting-started/before-you-start). Additionally, for scenarios where neither technology is a complete solution, for instance with legacy systems, VGS provides a compliance product which guarantees customers are able to meet their compliance needs no matter what may happen. [Get started with Control](https://www.verygoodsecurity.com/docs/control). ## Learn about Tokenization - [Create an Account for Free Tokenization](https://dashboard.verygoodsecurity.com/tokenization) - [Try a Tokenization Demo](https://www.verygoodsecurity.com/docs/tokenization/getting-started) - [Install a Tokenization SDK](https://www.verygoodsecurity.com/docs/tokenization/client-libraries) ### Authentication This API uses `Basic` authentication. Credentials to access the API can be generated on the [dashboard](https://dashboard.verygoodsecurity.com) by going to the Settings section of the vault of your choosing. [Docs » Guides » Access credentials](https://www.verygoodsecurity.com/docs/settings/access-credentials) ## Resource Limits ### Data Limits This API allows storing data up to 32MB in size. ### Rate Limiting The API allows up to 3,000 requests per minute. Requests are associated with the vault, regardless of the access credentials used to authenticate the request. Your current rate limit is included as HTTP headers in every API response: | Header Name | Description | |-------------------------|----------------------------------------------------------| | `x-ratelimit-remaining` | The number of requests remaining in the 1-minute window. | If you exceed the rate limit, the API will reject the request with HTTP [429 Too Many Requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429). ### Errors The API uses standard HTTP status codes to indicate whether the request succeeded or not. In case of failure, the response body will be JSON in a predefined format. For example, trying to create too many aliases at once results in the following response: ```json { \"errors\": [ { \"status\": 400, \"title\": \"Bad request\", \"detail\": \"Too many values (limit: 20)\", \"href\": \"https://api.sandbox.verygoodvault.com/aliases\" } ] } ```
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: support@verygoodsecurity.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
# Common files
|
14
|
+
require 'openapi_client/api_client'
|
15
|
+
require 'openapi_client/api_error'
|
16
|
+
require 'openapi_client/version'
|
17
|
+
require 'openapi_client/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'openapi_client/models/alias_format'
|
21
|
+
require 'openapi_client/models/api_error'
|
22
|
+
require 'openapi_client/models/create_aliases_request'
|
23
|
+
require 'openapi_client/models/create_aliases_request_new'
|
24
|
+
require 'openapi_client/models/create_aliases_request_reference'
|
25
|
+
require 'openapi_client/models/inline_response200'
|
26
|
+
require 'openapi_client/models/inline_response2001'
|
27
|
+
require 'openapi_client/models/inline_response201'
|
28
|
+
require 'openapi_client/models/inline_response_default'
|
29
|
+
require 'openapi_client/models/model_alias'
|
30
|
+
require 'openapi_client/models/revealed_data'
|
31
|
+
require 'openapi_client/models/update_alias_request'
|
32
|
+
require 'openapi_client/models/update_alias_request_data'
|
33
|
+
|
34
|
+
# APIs
|
35
|
+
require 'openapi_client/api/aliases_api'
|
36
|
+
|
37
|
+
module VgsApiClient
|
38
|
+
class << self
|
39
|
+
# Customize default settings for the SDK using block.
|
40
|
+
# VgsApiClient.configure do |config|
|
41
|
+
# config.username = "xxx"
|
42
|
+
# config.password = "xxx"
|
43
|
+
# end
|
44
|
+
# If no block given, return the default Configuration object.
|
45
|
+
def configure
|
46
|
+
if block_given?
|
47
|
+
yield(Configuration.default)
|
48
|
+
else
|
49
|
+
Configuration.default
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/version.rb
ADDED
data/lib/vgs_api_client.rb
CHANGED
@@ -1,53 +1,84 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# If no block given, return the default Configuration object.
|
45
|
-
def configure
|
46
|
-
if block_given?
|
47
|
-
yield(Configuration.default)
|
1
|
+
require 'openapi_client'
|
2
|
+
|
3
|
+
module VGS
|
4
|
+
class VgsApiException < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
class Aliases
|
8
|
+
def initialize(config)
|
9
|
+
@aliases_api = VgsApiClient::AliasesApi.new(VgsApiClient::ApiClient.new(config))
|
10
|
+
end
|
11
|
+
|
12
|
+
def redact(data)
|
13
|
+
begin
|
14
|
+
requests = data.map do |item|
|
15
|
+
VgsApiClient::CreateAliasesRequestNew.new(attributes = {
|
16
|
+
:format => VgsApiClient::AliasFormat.build_from_hash(item[:format]),
|
17
|
+
:classifiers => item[:classifiers],
|
18
|
+
:value => item[:value],
|
19
|
+
:storage => item[:storage]
|
20
|
+
})
|
21
|
+
end
|
22
|
+
|
23
|
+
create_aliases_request = VgsApiClient::CreateAliasesRequest.new(attributes = {
|
24
|
+
:data => requests
|
25
|
+
})
|
26
|
+
response = @aliases_api.create_aliases(opts = {
|
27
|
+
:create_aliases_request => create_aliases_request.to_hash
|
28
|
+
})
|
29
|
+
|
30
|
+
rescue
|
31
|
+
raise VgsApiException, "Failed to redact data #{ data }"
|
32
|
+
else
|
33
|
+
response.data
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def reveal(aliases)
|
39
|
+
begin
|
40
|
+
query = aliases.kind_of?(Array) ? aliases.join(",") : aliases
|
41
|
+
response = @aliases_api.reveal_multiple_aliases(q = query)
|
42
|
+
rescue
|
43
|
+
raise VgsApiException, "Failed to reveal aliases #{ aliases }"
|
48
44
|
else
|
49
|
-
|
45
|
+
response.data
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def delete(_alias)
|
50
|
+
begin
|
51
|
+
@aliases_api.delete_alias(_alias = _alias)
|
52
|
+
rescue
|
53
|
+
raise VgsApiException, "Failed to delete alias #{ _alias }"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def update(_alias, data)
|
58
|
+
begin
|
59
|
+
update_alias_request = VgsApiClient::UpdateAliasRequest.new(attributes = {
|
60
|
+
:data => VgsApiClient::UpdateAliasRequestData.new(attributes = {
|
61
|
+
:classifiers => data[:classifiers]
|
62
|
+
})
|
63
|
+
})
|
64
|
+
@aliases_api.update_alias(_alias = _alias, opts = {
|
65
|
+
:update_alias_request => update_alias_request.to_hash
|
66
|
+
})
|
67
|
+
rescue
|
68
|
+
raise VgsApiException, "Failed to update alias #{ _alias }"
|
50
69
|
end
|
51
70
|
end
|
52
71
|
end
|
53
|
-
|
72
|
+
|
73
|
+
def self.config(username, password, host = 'https://api.sandbox.verygoodvault.com')
|
74
|
+
raise ArgumentError, 'username is nil' if username.nil?
|
75
|
+
raise ArgumentError, 'password is nil' if password.nil?
|
76
|
+
|
77
|
+
config = VgsApiClient::Configuration.default
|
78
|
+
config.username = username
|
79
|
+
config.password = password
|
80
|
+
config.host = host
|
81
|
+
config
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
data/scripts/assemble/run.sh
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
LIB_VERSION=${LIB_VERSION:-0.0.1.alpha$(date "+%Y%m%d%H%M")}
|
4
4
|
|
5
5
|
# fix version
|
6
|
-
grep -rl 0.0.1.
|
6
|
+
grep -rl 0.0.1.alpha202204222223 . | xargs sed -i "s/0.0.1.alpha202204222223/${LIB_VERSION}/g"
|
7
7
|
|
8
8
|
# build
|
9
9
|
gem build vgs_api_client.gemspec
|
data/scripts/test/run.sh
CHANGED
@@ -5,9 +5,9 @@ set -e
|
|
5
5
|
echo "Installing lib from local sources"
|
6
6
|
# fix version
|
7
7
|
VERSION=0.0.1.alpha$(date "+%Y%m%d%H%M")
|
8
|
-
grep -rl 0.0.1.
|
8
|
+
grep -rl 0.0.1.alpha202204222223 . | xargs sed -i "s/0.0.1.alpha202204222223/$VERSION/g"
|
9
9
|
|
10
10
|
bundle install
|
11
11
|
|
12
12
|
echo "Running tests"
|
13
|
-
bundle exec rspec ./spec/*.rb
|
13
|
+
bundle exec rspec -f documentation ./spec/*.rb
|
data/scripts/test-e2e/Dockerfile
CHANGED
@@ -4,19 +4,11 @@ RUN apk update && \
|
|
4
4
|
apk add bash && \
|
5
5
|
apk add build-base && \
|
6
6
|
apk add libcurl && \
|
7
|
-
gem install
|
8
|
-
gem install rspec-support
|
9
|
-
|
10
|
-
RUN mkdir -p /vgs-api-client/ && \
|
11
|
-
mkdir -p /vgs-api-client/tmp
|
7
|
+
gem install rspec
|
12
8
|
|
13
9
|
ADD ./scripts/test-e2e /vgs-api-client/scripts
|
14
10
|
ADD ./spec /vgs-api-client/spec
|
15
11
|
|
16
|
-
# Temporarily copying gem files to tmp/ dir
|
17
|
-
ADD ./vgs_api_client.gemspec /vgs-api-client/tmp/vgs_api_client.gemspec
|
18
|
-
ADD ./Gemfile /vgs-api-client/tmp/Gemfile
|
19
|
-
|
20
12
|
WORKDIR /vgs-api-client/
|
21
13
|
|
22
14
|
ENTRYPOINT ["bash", "./scripts/run.sh"]
|
data/scripts/test-e2e/run.sh
CHANGED
@@ -9,7 +9,6 @@ ATTEMPT=1
|
|
9
9
|
while [ $ATTEMPT -lt 10 ]; do
|
10
10
|
echo "Attempt ${ATTEMPT} ..."
|
11
11
|
|
12
|
-
bundle install --without production --binstubs
|
13
12
|
gem install vgs_api_client -v ${LIB_VERSION}
|
14
13
|
|
15
14
|
if [[ $? == 0 ]]; then
|
@@ -24,7 +23,6 @@ done
|
|
24
23
|
set -e
|
25
24
|
|
26
25
|
echo "Running tests"
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
bundle exec rspec ./spec/*.rb
|
26
|
+
gem install rspec
|
27
|
+
rspec -f documentation ./spec/*.rb
|
28
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,7 @@ OpenAPI Generator version: 5.4.0
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
# load the gem
|
14
|
-
require '
|
14
|
+
require 'openapi_client'
|
15
15
|
|
16
16
|
# The following was generated by the `rspec --init` command. Conventionally, all
|
17
17
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
@@ -1,29 +1,27 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'securerandom'
|
3
|
-
require '
|
3
|
+
require 'vgs_api_client'
|
4
4
|
|
5
5
|
describe 'AliasesApiSpec' do
|
6
6
|
before(:all) do
|
7
|
-
config = VGS.config(username = ENV[
|
8
|
-
@aliases_api = VGS::Aliases.new
|
7
|
+
config = VGS.config(username = ENV['VAULT_API_USERNAME'], password = ENV['VAULT_API_PASSWORD'])
|
8
|
+
@aliases_api = VGS::Aliases.new config
|
9
9
|
end
|
10
10
|
|
11
11
|
describe 'redact' do
|
12
12
|
it 'should redact values' do
|
13
|
-
data = [
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
]
|
26
|
-
aliases = @aliases_api.redact(data)
|
13
|
+
data = [{
|
14
|
+
format: 'UUID',
|
15
|
+
value: '5201784564572092',
|
16
|
+
classifiers: %w[credit-card number],
|
17
|
+
storage: 'PERSISTENT'
|
18
|
+
},
|
19
|
+
{
|
20
|
+
format: 'UUID',
|
21
|
+
value: 'Joe Doe',
|
22
|
+
storage: 'VOLATILE'
|
23
|
+
}]
|
24
|
+
aliases = @aliases_api.redact data
|
27
25
|
expect(aliases.length).to eq 2
|
28
26
|
data.each_with_index do |item, index|
|
29
27
|
expect(aliases[index].value).to eq item[:value]
|
@@ -37,22 +35,20 @@ describe 'AliasesApiSpec' do
|
|
37
35
|
|
38
36
|
describe 'reveal' do
|
39
37
|
it 'should reveal aliases' do
|
40
|
-
data = [
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
}
|
52
|
-
]
|
38
|
+
data = [{
|
39
|
+
format: 'UUID',
|
40
|
+
value: '5201784564572092',
|
41
|
+
classifiers: %w[credit-card number],
|
42
|
+
storage: 'PERSISTENT'
|
43
|
+
},
|
44
|
+
{
|
45
|
+
format: 'UUID',
|
46
|
+
value: 'Joe Doe',
|
47
|
+
storage: 'VOLATILE'
|
48
|
+
}]
|
53
49
|
aliases = @aliases_api.redact(data).map { |item| item.aliases[0]._alias }
|
54
50
|
|
55
|
-
response = @aliases_api.reveal
|
51
|
+
response = @aliases_api.reveal aliases
|
56
52
|
|
57
53
|
expect(response.length).to eq 2
|
58
54
|
original_values = data.map { |i| i[:value] }
|
@@ -63,15 +59,13 @@ describe 'AliasesApiSpec' do
|
|
63
59
|
|
64
60
|
describe 'update' do
|
65
61
|
it 'should update alias' do
|
66
|
-
data = [
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
}
|
71
|
-
]
|
62
|
+
data = [{
|
63
|
+
format: 'UUID',
|
64
|
+
value: SecureRandom.alphanumeric(10)
|
65
|
+
}]
|
72
66
|
_alias = @aliases_api.redact(data).map { |item| item.aliases[0]._alias }[0]
|
73
67
|
|
74
|
-
@aliases_api.update
|
68
|
+
@aliases_api.update _alias, classifiers: %w[secure]
|
75
69
|
|
76
70
|
response = @aliases_api.reveal(_alias)
|
77
71
|
expect(response[_alias].classifiers).to eq %w[secure]
|
@@ -80,15 +74,13 @@ describe 'AliasesApiSpec' do
|
|
80
74
|
|
81
75
|
describe 'delete' do
|
82
76
|
it 'should delete alias' do
|
83
|
-
data = [
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
}
|
88
|
-
]
|
77
|
+
data = [{
|
78
|
+
format: 'UUID',
|
79
|
+
value: '5201784564572092'
|
80
|
+
}]
|
89
81
|
_alias = @aliases_api.redact(data).map { |item| item.aliases[0]._alias }[0]
|
90
82
|
|
91
|
-
@aliases_api.delete
|
83
|
+
@aliases_api.delete _alias
|
92
84
|
|
93
85
|
expect { @aliases_api.reveal(_alias) }.to raise_error(VGS::VgsApiException)
|
94
86
|
end
|
data/vgs_api_client.gemspec
CHANGED
@@ -1,31 +1,25 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
-
|
4
|
-
#Vault HTTP API
|
5
|
-
|
6
|
-
#The VGS Vault HTTP API is used for storing, retrieving, and managing sensitive data (aka Tokenization) within a VGS Vault. The VGS API is organized around REST. Our API is built with a predictable resource-oriented structure, uses JSON-encoded requests and responses, follows standard HTTP verbs/responses, and uses industry standard authentication. ## What is VGS Storing sensitive data on your company’s infrastructure often comes with a heavy compliance burden. For instance, storing payments data yourself greatly increases the amount of work needed to become PCI compliant. It also increases your security risk in general. To combat this, companies will minimize the amount of sensitive information they have to handle or store. VGS provides multiple methods for minimizing the sensitive information that needs to be stored which allows customers to secure any type of data for any use-case. **Tokenization** is a method that focuses on securing the storage of data. This is the quickest way to get started and is free. [Get started with Tokenization](https://www.verygoodsecurity.com/docs/tokenization/getting-started). **Zero Data** is a unique method invented by VGS in 2016 that securely stores data like Tokenization, however it also removes the customer’s environment from PCI scope completely providing maximum security, and minimum compliance scope. [Get started with Zero Data](https://www.verygoodsecurity.com/docs/getting-started/before-you-start). Additionally, for scenarios where neither technology is a complete solution, for instance with legacy systems, VGS provides a compliance product which guarantees customers are able to meet their compliance needs no matter what may happen. [Get started with Control](https://www.verygoodsecurity.com/docs/control). ## Learn about Tokenization - [Create an Account for Free Tokenization](https://dashboard.verygoodsecurity.com/tokenization) - [Try a Tokenization Demo](https://www.verygoodsecurity.com/docs/tokenization/getting-started) - [Install a Tokenization SDK](https://www.verygoodsecurity.com/docs/tokenization/client-libraries) ### Authentication This API uses `Basic` authentication. Credentials to access the API can be generated on the [dashboard](https://dashboard.verygoodsecurity.com) by going to the Settings section of the vault of your choosing. [Docs » Guides » Access credentials](https://www.verygoodsecurity.com/docs/settings/access-credentials) ## Resource Limits ### Data Limits This API allows storing data up to 32MB in size. ### Rate Limiting The API allows up to 3,000 requests per minute. Requests are associated with the vault, regardless of the access credentials used to authenticate the request. Your current rate limit is included as HTTP headers in every API response: | Header Name | Description | |-------------------------|----------------------------------------------------------| | `x-ratelimit-remaining` | The number of requests remaining in the 1-minute window. | If you exceed the rate limit, the API will reject the request with HTTP [429 Too Many Requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429). ### Errors The API uses standard HTTP status codes to indicate whether the request succeeded or not. In case of failure, the response body will be JSON in a predefined format. For example, trying to create too many aliases at once results in the following response: ```json { \"errors\": [ { \"status\": 400, \"title\": \"Bad request\", \"detail\": \"Too many values (limit: 20)\", \"href\": \"https://api.sandbox.verygoodvault.com/aliases\" } ] } ```
|
7
|
-
|
8
|
-
The version of the OpenAPI document: 1.0.0
|
9
|
-
Contact: support@verygoodsecurity.com
|
10
|
-
Generated by: https://openapi-generator.tech
|
11
|
-
OpenAPI Generator version: 5.4.0
|
12
|
-
|
13
|
-
=end
|
14
|
-
|
15
|
-
$:.push File.expand_path("../lib", __FILE__)
|
16
|
-
require "vgs_api_client/version"
|
3
|
+
require_relative "lib/version"
|
17
4
|
|
18
5
|
Gem::Specification.new do |s|
|
19
6
|
s.name = "vgs_api_client"
|
20
|
-
s.version =
|
7
|
+
s.version = VGS::VERSION
|
21
8
|
s.platform = Gem::Platform::RUBY
|
22
9
|
s.authors = ["Very Good Security"]
|
23
|
-
s.email = ["
|
24
|
-
s.homepage = "https://
|
25
|
-
s.summary = "
|
10
|
+
s.email = ["support@verygoodsecurity.com"]
|
11
|
+
s.homepage = "https://github.com/verygoodsecurity/vgs-api-client-ruby"
|
12
|
+
s.summary = "VGS API Client"
|
26
13
|
s.description = "This gem maps to VGS Vault API"
|
27
|
-
s.license = "
|
28
|
-
s.required_ruby_version = ">= 2.
|
14
|
+
s.license = "BSD-3-Clause"
|
15
|
+
s.required_ruby_version = ">= 2.6"
|
16
|
+
|
17
|
+
s.metadata = {
|
18
|
+
"homepage_uri" => "https://www.verygoodsecurity.com",
|
19
|
+
"bug_tracker_uri" => "https://github.com/verygoodsecurity/vgs-api-client-ruby/issues",
|
20
|
+
"documentation_uri" => "https://www.verygoodsecurity.com/docs",
|
21
|
+
"source_code_uri" => "https://github.com/verygoodsecurity/vgs-api-client-ruby"
|
22
|
+
}
|
29
23
|
|
30
24
|
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
31
25
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vgs_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.alpha202204222223
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Very Good Security
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
version: 3.6.0
|
53
53
|
description: This gem maps to VGS Vault API
|
54
54
|
email:
|
55
|
-
-
|
55
|
+
- support@verygoodsecurity.com
|
56
56
|
executables: []
|
57
57
|
extensions: []
|
58
58
|
extra_rdoc_files: []
|
@@ -60,29 +60,31 @@ files:
|
|
60
60
|
- DEVELOPMENT.md
|
61
61
|
- Gemfile
|
62
62
|
- LICENSE
|
63
|
+
- README.md
|
63
64
|
- RELEASE.md
|
64
65
|
- Rakefile
|
65
66
|
- docker-compose.yaml
|
66
|
-
- lib/
|
67
|
+
- lib/openapi_client.rb
|
68
|
+
- lib/openapi_client/api/aliases_api.rb
|
69
|
+
- lib/openapi_client/api_client.rb
|
70
|
+
- lib/openapi_client/api_error.rb
|
71
|
+
- lib/openapi_client/configuration.rb
|
72
|
+
- lib/openapi_client/models/alias_format.rb
|
73
|
+
- lib/openapi_client/models/api_error.rb
|
74
|
+
- lib/openapi_client/models/create_aliases_request.rb
|
75
|
+
- lib/openapi_client/models/create_aliases_request_new.rb
|
76
|
+
- lib/openapi_client/models/create_aliases_request_reference.rb
|
77
|
+
- lib/openapi_client/models/inline_response200.rb
|
78
|
+
- lib/openapi_client/models/inline_response2001.rb
|
79
|
+
- lib/openapi_client/models/inline_response201.rb
|
80
|
+
- lib/openapi_client/models/inline_response_default.rb
|
81
|
+
- lib/openapi_client/models/model_alias.rb
|
82
|
+
- lib/openapi_client/models/revealed_data.rb
|
83
|
+
- lib/openapi_client/models/update_alias_request.rb
|
84
|
+
- lib/openapi_client/models/update_alias_request_data.rb
|
85
|
+
- lib/openapi_client/version.rb
|
86
|
+
- lib/version.rb
|
67
87
|
- lib/vgs_api_client.rb
|
68
|
-
- lib/vgs_api_client/api/aliases_api.rb
|
69
|
-
- lib/vgs_api_client/api_client.rb
|
70
|
-
- lib/vgs_api_client/api_error.rb
|
71
|
-
- lib/vgs_api_client/configuration.rb
|
72
|
-
- lib/vgs_api_client/models/alias_format.rb
|
73
|
-
- lib/vgs_api_client/models/api_error.rb
|
74
|
-
- lib/vgs_api_client/models/create_aliases_request.rb
|
75
|
-
- lib/vgs_api_client/models/create_aliases_request_new.rb
|
76
|
-
- lib/vgs_api_client/models/create_aliases_request_reference.rb
|
77
|
-
- lib/vgs_api_client/models/inline_response200.rb
|
78
|
-
- lib/vgs_api_client/models/inline_response2001.rb
|
79
|
-
- lib/vgs_api_client/models/inline_response201.rb
|
80
|
-
- lib/vgs_api_client/models/inline_response_default.rb
|
81
|
-
- lib/vgs_api_client/models/model_alias.rb
|
82
|
-
- lib/vgs_api_client/models/revealed_data.rb
|
83
|
-
- lib/vgs_api_client/models/update_alias_request.rb
|
84
|
-
- lib/vgs_api_client/models/update_alias_request_data.rb
|
85
|
-
- lib/vgs_api_client/version.rb
|
86
88
|
- scripts/assemble/Dockerfile
|
87
89
|
- scripts/assemble/run.sh
|
88
90
|
- scripts/publish.sh
|
@@ -99,10 +101,14 @@ files:
|
|
99
101
|
- spec/spec_helper.rb
|
100
102
|
- spec/test_aliases_api_spec.rb
|
101
103
|
- vgs_api_client.gemspec
|
102
|
-
homepage: https://
|
104
|
+
homepage: https://github.com/verygoodsecurity/vgs-api-client-ruby
|
103
105
|
licenses:
|
104
|
-
-
|
105
|
-
metadata:
|
106
|
+
- BSD-3-Clause
|
107
|
+
metadata:
|
108
|
+
homepage_uri: https://www.verygoodsecurity.com
|
109
|
+
bug_tracker_uri: https://github.com/verygoodsecurity/vgs-api-client-ruby/issues
|
110
|
+
documentation_uri: https://www.verygoodsecurity.com/docs
|
111
|
+
source_code_uri: https://github.com/verygoodsecurity/vgs-api-client-ruby
|
106
112
|
post_install_message:
|
107
113
|
rdoc_options: []
|
108
114
|
require_paths:
|
@@ -111,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
117
|
requirements:
|
112
118
|
- - ">="
|
113
119
|
- !ruby/object:Gem::Version
|
114
|
-
version: '2.
|
120
|
+
version: '2.6'
|
115
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
122
|
requirements:
|
117
123
|
- - ">"
|
@@ -121,7 +127,7 @@ requirements: []
|
|
121
127
|
rubygems_version: 3.3.7
|
122
128
|
signing_key:
|
123
129
|
specification_version: 4
|
124
|
-
summary:
|
130
|
+
summary: VGS API Client
|
125
131
|
test_files:
|
126
132
|
- spec/api_client_spec.rb
|
127
133
|
- spec/configuration_spec.rb
|
data/lib/vgs.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
module VGS
|
2
|
-
class VgsApiException < StandardError
|
3
|
-
end
|
4
|
-
|
5
|
-
class Aliases
|
6
|
-
def initialize(config)
|
7
|
-
@aliases_api = VgsApiClient::AliasesApi.new(VgsApiClient::ApiClient.new(config))
|
8
|
-
end
|
9
|
-
|
10
|
-
def redact(data)
|
11
|
-
begin
|
12
|
-
requests = data.map do |item|
|
13
|
-
VgsApiClient::CreateAliasesRequestNew.new(attributes = {
|
14
|
-
:format => VgsApiClient::AliasFormat.build_from_hash(item[:format]),
|
15
|
-
:classifiers => item[:classifiers],
|
16
|
-
:value => item[:value],
|
17
|
-
:storage => item[:storage]
|
18
|
-
})
|
19
|
-
end
|
20
|
-
|
21
|
-
create_aliases_request = VgsApiClient::CreateAliasesRequest.new(attributes = {
|
22
|
-
:data => requests
|
23
|
-
})
|
24
|
-
response = @aliases_api.create_aliases(opts = {
|
25
|
-
:create_aliases_request => create_aliases_request.to_hash
|
26
|
-
})
|
27
|
-
|
28
|
-
rescue
|
29
|
-
raise VgsApiException, "Failed to redact data #{ data }"
|
30
|
-
else
|
31
|
-
response.data
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
def reveal(aliases)
|
37
|
-
begin
|
38
|
-
query = aliases.kind_of?(Array) ? aliases.join(",") : aliases
|
39
|
-
response = @aliases_api.reveal_multiple_aliases(q = query)
|
40
|
-
rescue
|
41
|
-
raise VgsApiException, "Failed to reveal aliases #{ aliases }"
|
42
|
-
else
|
43
|
-
response.data
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def delete(_alias)
|
48
|
-
begin
|
49
|
-
@aliases_api.delete_alias(_alias = _alias)
|
50
|
-
rescue
|
51
|
-
raise VgsApiException, "Failed to delete alias #{ _alias }"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def update(_alias, data)
|
56
|
-
begin
|
57
|
-
update_alias_request = VgsApiClient::UpdateAliasRequest.new(attributes = {
|
58
|
-
:data => VgsApiClient::UpdateAliasRequestData.new(attributes = {
|
59
|
-
:classifiers => data[:classifiers]
|
60
|
-
})
|
61
|
-
})
|
62
|
-
@aliases_api.update_alias(_alias = _alias, opts = {
|
63
|
-
:update_alias_request => update_alias_request.to_hash
|
64
|
-
})
|
65
|
-
rescue
|
66
|
-
raise VgsApiException, "Failed to update alias #{ _alias }"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.config(username, password, host = 'https://api.sandbox.verygoodvault.com')
|
72
|
-
raise ArgumentError, 'username is nil' if username.nil?
|
73
|
-
raise ArgumentError, 'password is nil' if password.nil?
|
74
|
-
|
75
|
-
config = VgsApiClient::Configuration.default
|
76
|
-
config.username = username
|
77
|
-
config.password = password
|
78
|
-
config.host = host
|
79
|
-
config
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|