vgs_api_client 0.0.35 → 0.0.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +39 -0
  3. data/VERSION +1 -0
  4. data/api.yaml +537 -0
  5. data/docker-compose.yaml +18 -4
  6. data/lib/{vgs_api_client → openapi_client}/api/aliases_api.rb +1 -1
  7. data/lib/{vgs_api_client → openapi_client}/api_client.rb +2 -2
  8. data/lib/{vgs_api_client → openapi_client}/api_error.rb +1 -1
  9. data/lib/{vgs_api_client → openapi_client}/configuration.rb +1 -1
  10. data/lib/{vgs_api_client → openapi_client}/models/alias_format.rb +4 -1
  11. data/lib/openapi_client/models/api_error.rb +0 -0
  12. data/lib/{vgs_api_client → openapi_client}/models/create_aliases_request.rb +1 -1
  13. data/lib/{vgs_api_client → openapi_client}/models/create_aliases_request_new.rb +1 -1
  14. data/lib/{vgs_api_client → openapi_client}/models/create_aliases_request_reference.rb +1 -1
  15. data/lib/{vgs_api_client → openapi_client}/models/inline_response200.rb +1 -1
  16. data/lib/{vgs_api_client → openapi_client}/models/inline_response2001.rb +1 -1
  17. data/lib/{vgs_api_client → openapi_client}/models/inline_response201.rb +1 -1
  18. data/lib/{vgs_api_client → openapi_client}/models/inline_response_default.rb +1 -1
  19. data/lib/{vgs_api_client → openapi_client}/models/model_alias.rb +1 -1
  20. data/lib/{vgs_api_client → openapi_client}/models/revealed_data.rb +1 -1
  21. data/lib/{vgs_api_client → openapi_client}/models/update_alias_request.rb +1 -1
  22. data/lib/{vgs_api_client → openapi_client}/models/update_alias_request_data.rb +1 -1
  23. data/lib/{vgs_api_client → openapi_client}/version.rb +2 -2
  24. data/lib/openapi_client.rb +53 -0
  25. data/lib/version.rb +3 -0
  26. data/lib/vgs_api_client.rb +106 -48
  27. data/scripts/assemble/run.sh +2 -2
  28. data/scripts/lint/Dockerfile +9 -0
  29. data/scripts/lint/run.sh +5 -0
  30. data/scripts/lint.sh +6 -0
  31. data/scripts/publish/run.sh +2 -1
  32. data/scripts/publish.sh +2 -1
  33. data/scripts/run-tests-e2e.sh +3 -5
  34. data/scripts/run-tests.sh +1 -2
  35. data/scripts/test/Dockerfile +2 -0
  36. data/scripts/test/run.sh +7 -27
  37. data/scripts/test-e2e/Dockerfile +14 -0
  38. data/scripts/test-e2e/run.sh +28 -0
  39. data/spec/api_client_spec.rb +1 -1
  40. data/spec/configuration_spec.rb +1 -1
  41. data/spec/spec_helper.rb +2 -2
  42. data/spec/test_aliases_api_spec.rb +123 -0
  43. data/vgs_api_client.gemspec +15 -21
  44. metadata +43 -30
  45. data/lib/vgs.rb +0 -82
  46. data/lib/vgs_api_client/models/api_error.rb +0 -249
  47. data/spec/test_api_spec.rb +0 -97
@@ -1,53 +1,111 @@
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 'vgs_api_client/api_client'
15
- require 'vgs_api_client/api_error'
16
- require 'vgs_api_client/version'
17
- require 'vgs_api_client/configuration'
18
-
19
- # Models
20
- require 'vgs_api_client/models/alias_format'
21
- require 'vgs_api_client/models/api_error'
22
- require 'vgs_api_client/models/create_aliases_request'
23
- require 'vgs_api_client/models/create_aliases_request_new'
24
- require 'vgs_api_client/models/create_aliases_request_reference'
25
- require 'vgs_api_client/models/inline_response200'
26
- require 'vgs_api_client/models/inline_response2001'
27
- require 'vgs_api_client/models/inline_response201'
28
- require 'vgs_api_client/models/inline_response_default'
29
- require 'vgs_api_client/models/model_alias'
30
- require 'vgs_api_client/models/revealed_data'
31
- require 'vgs_api_client/models/update_alias_request'
32
- require 'vgs_api_client/models/update_alias_request_data'
33
-
34
- # APIs
35
- require 'vgs_api_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)
1
+ require 'openapi_client'
2
+
3
+ module VGS
4
+ class VgsApiError < StandardError
5
+ end
6
+
7
+ class UnauthorizedError < VgsApiError
8
+ end
9
+
10
+ class NotFoundError < VgsApiError
11
+ end
12
+
13
+ class ForbiddenError < VgsApiError
14
+ end
15
+
16
+ class Aliases
17
+ def initialize(config)
18
+ raise ArgumentError, 'config is nil' if config.nil?
19
+ @aliases_api = VgsApiClient::AliasesApi.new(VgsApiClient::ApiClient.new(config))
20
+ end
21
+
22
+ private def map_exception(message, error)
23
+ error_message = message
24
+ if error.is_a? VgsApiClient::ApiError
25
+ error_message += ". Details: #{error.message}"
26
+ case error.code
27
+ when 401
28
+ UnauthorizedError.new error_message
29
+ when 403
30
+ ForbiddenError.new error_message
31
+ when 404
32
+ NotFoundError.new error_message
33
+ else
34
+ VgsApiError.new error_message
35
+ end
48
36
  else
49
- Configuration.default
37
+ VgsApiError.new error_message
50
38
  end
51
39
  end
40
+
41
+ def redact(data)
42
+ begin
43
+ requests = data.map do |item|
44
+ VgsApiClient::CreateAliasesRequestNew.new(attributes = {
45
+ :format => VgsApiClient::AliasFormat.build_from_hash(item[:format] || "UUID"),
46
+ :classifiers => item[:classifiers],
47
+ :value => item[:value],
48
+ :storage => item[:storage]
49
+ })
50
+ end
51
+
52
+ create_aliases_request = VgsApiClient::CreateAliasesRequest.new(attributes = {
53
+ :data => requests
54
+ })
55
+ response = @aliases_api.create_aliases(opts = {
56
+ :create_aliases_request => create_aliases_request.to_hash
57
+ })
58
+ rescue Exception => e
59
+ raise map_exception("Failed to redact data #{ data }", e)
60
+ else
61
+ response.data
62
+ end
63
+ end
64
+
65
+ def reveal(aliases)
66
+ begin
67
+ query = aliases.kind_of?(Array) ? aliases.join(",") : aliases
68
+ response = @aliases_api.reveal_multiple_aliases(q = query)
69
+ rescue Exception => e
70
+ raise map_exception("Failed to reveal aliases #{ aliases }", e)
71
+ else
72
+ response.data
73
+ end
74
+ end
75
+
76
+ def delete(_alias)
77
+ begin
78
+ @aliases_api.delete_alias(_alias = _alias)
79
+ rescue Exception => e
80
+ raise map_exception("Failed to delete alias #{ _alias }", e)
81
+ end
82
+ end
83
+
84
+ def update(_alias, data)
85
+ begin
86
+ update_alias_request = VgsApiClient::UpdateAliasRequest.new(attributes = {
87
+ :data => VgsApiClient::UpdateAliasRequestData.new(attributes = {
88
+ :classifiers => data[:classifiers]
89
+ })
90
+ })
91
+ @aliases_api.update_alias(_alias = _alias, opts = {
92
+ :update_alias_request => update_alias_request.to_hash
93
+ })
94
+ rescue Exception => e
95
+ raise map_exception("Failed to update alias #{ _alias }", e)
96
+ end
97
+ end
98
+ end
99
+
100
+ def self.config(username, password, host = 'https://api.sandbox.verygoodvault.com')
101
+ raise ArgumentError, 'username is nil' if username.nil?
102
+ raise ArgumentError, 'password is nil' if password.nil?
103
+
104
+ config = VgsApiClient::Configuration.default
105
+ config.username = username
106
+ config.password = password
107
+ config.host = host
108
+ config.server_index = nil
109
+ config
52
110
  end
53
111
  end
@@ -1,9 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
- LIB_VERSION=${LIB_VERSION:-0.0.1.dev$(date "+%Y%m%d%H%M")}
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.35 . | xargs sed -i "s/0.0.35/${LIB_VERSION}/g"
6
+ grep -rl 0.0.38 . | xargs sed -i "s/0.0.38/${LIB_VERSION}/g"
7
7
 
8
8
  # build
9
9
  gem build vgs_api_client.gemspec
@@ -0,0 +1,9 @@
1
+ FROM ruby:3.1.2-alpine3.15
2
+
3
+ RUN apk update && \
4
+ apk add bash && \
5
+ gem install rubocop
6
+
7
+ WORKDIR /vgs-api-client/
8
+
9
+ ENTRYPOINT ["bash", "./scripts/lint/run.sh"]
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ rubocop .
data/scripts/lint.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ docker-compose build lint && \
6
+ docker-compose run lint
@@ -5,7 +5,8 @@ set -e
5
5
  usage() { echo "Required env var '$1' is missing"; exit 1; }
6
6
 
7
7
  [ -z "${ARTIFACT_REPOSITORY_TOKEN}" ] && usage "ARTIFACT_REPOSITORY_TOKEN" ;
8
- [ -z "${LIB_VERSION}" ] && usage "LIB_VERSION" ;
8
+
9
+ LIB_VERSION=${LIB_VERSION:-0.0.1.alpha$(date "+%Y%m%d%H%M")}
9
10
 
10
11
  mkdir ~/.gem
11
12
  echo ":rubygems_api_key: ${ARTIFACT_REPOSITORY_TOKEN}" > ~/.gem/credentials
data/scripts/publish.sh CHANGED
@@ -5,7 +5,8 @@ set -e
5
5
  usage() { echo "Required env var '$1' is missing"; exit 1; }
6
6
 
7
7
  [ -z "${ARTIFACT_REPOSITORY_TOKEN}" ] && usage "ARTIFACT_REPOSITORY_TOKEN" ;
8
- [ -z "${LIB_VERSION}" ] && usage "LIB_VERSION" ;
8
+
9
+ export LIB_VERSION=${LIB_VERSION:-0.0.1.alpha$(date "+%Y%m%d%H%M")}
9
10
 
10
11
  docker-compose build && \
11
12
  docker-compose run assemble && \
@@ -2,9 +2,7 @@
2
2
 
3
3
  set -e
4
4
 
5
- usage() { echo "Required env var '$1' is missing"; exit 1; }
5
+ export LIB_VERSION=${LIB_VERSION:-0.0.1.alpha$(date "+%Y%m%d%H%M")}
6
6
 
7
- [ -z "${LIB_VERSION}" ] && usage "LIB_VERSION" ;
8
-
9
- docker-compose build && \
10
- docker-compose run test
7
+ docker-compose build test-e2e && \
8
+ docker-compose run test-e2e
data/scripts/run-tests.sh CHANGED
@@ -2,6 +2,5 @@
2
2
 
3
3
  set -e
4
4
 
5
- docker-compose build && \
6
- docker-compose run assemble && \
5
+ docker-compose build test && \
7
6
  docker-compose run test
@@ -7,6 +7,8 @@ RUN apk update && \
7
7
  gem install bundler && \
8
8
  gem install rspec-support
9
9
 
10
+ ADD . /vgs-api-client
11
+
10
12
  WORKDIR /vgs-api-client/
11
13
 
12
14
  ENTRYPOINT ["bash", "./scripts/test/run.sh"]
data/scripts/test/run.sh CHANGED
@@ -2,32 +2,12 @@
2
2
 
3
3
  set -e
4
4
 
5
- rm vgs_api_client-*.gem || true
5
+ echo "Installing lib from local sources"
6
+ # fix version
7
+ VERSION=0.0.1.alpha$(date "+%Y%m%d%H%M")
8
+ grep -rl 0.0.38 . | xargs sed -i "s/0.0.38/$VERSION/g"
6
9
 
7
- if [[ -n "${LIB_VERSION}" ]]; then
8
- echo "Installing lib from rubygems.org ${LIB_VERSION} ..."
10
+ bundle install
9
11
 
10
- set +e
11
- ATTEMPT=1
12
- while [ $ATTEMPT -lt 60 ]; do
13
- echo "Attempt ${ATTEMPT} ..."
14
-
15
- bundle install --without production --binstubs
16
- gem install vgs_api_client -v ${LIB_VERSION}
17
-
18
- if [[ $? == 0 ]]; then
19
- echo "Installed ${LIB_VERSION}"
20
- break
21
- fi
22
-
23
- ATTEMPT=$((ATTEMPT+1))
24
-
25
- sleep 5
26
- done
27
- set -e
28
- else
29
- echo "Installing lib from local sources"
30
- bundle install
31
- fi
32
-
33
- bundle exec rspec ./spec/test_api_spec.rb
12
+ echo "Running tests"
13
+ bundle exec rspec -f documentation ./spec/*.rb
@@ -0,0 +1,14 @@
1
+ FROM ruby:3.1.2-alpine3.15
2
+
3
+ RUN apk update && \
4
+ apk add bash && \
5
+ apk add build-base && \
6
+ apk add libcurl && \
7
+ gem install rspec
8
+
9
+ ADD ./scripts/test-e2e /vgs-api-client/scripts
10
+ ADD ./spec /vgs-api-client/spec
11
+
12
+ WORKDIR /vgs-api-client/
13
+
14
+ ENTRYPOINT ["bash", "./scripts/run.sh"]
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ echo "Installing lib from rubygems.org ${LIB_VERSION} ..."
6
+
7
+ set +e
8
+ ATTEMPT=1
9
+ while [ $ATTEMPT -lt 10 ]; do
10
+ echo "Attempt ${ATTEMPT} ..."
11
+
12
+ gem install vgs_api_client -v ${LIB_VERSION}
13
+
14
+ if [[ $? == 0 ]]; then
15
+ echo "Installed ${LIB_VERSION}"
16
+ break
17
+ fi
18
+
19
+ ATTEMPT=$((ATTEMPT+1))
20
+
21
+ sleep 5
22
+ done
23
+ set -e
24
+
25
+ echo "Running tests"
26
+ gem install rspec
27
+ rspec -f documentation ./spec/*.rb
28
+
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Vault HTTP API
3
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\" } ] } ```
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 and is implemented using industry best practices to ensure the security of the connection. Read more about [Identity and Access Management at VGS](https://www.verygoodsecurity.com/docs/vault/the-platform/iam) 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
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: support@verygoodsecurity.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Vault HTTP API
3
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\" } ] } ```
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 and is implemented using industry best practices to ensure the security of the connection. Read more about [Identity and Access Management at VGS](https://www.verygoodsecurity.com/docs/vault/the-platform/iam) 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
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: support@verygoodsecurity.com
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Vault HTTP API
3
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\" } ] } ```
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 and is implemented using industry best practices to ensure the security of the connection. Read more about [Identity and Access Management at VGS](https://www.verygoodsecurity.com/docs/vault/the-platform/iam) 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
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: support@verygoodsecurity.com
@@ -11,7 +11,7 @@ OpenAPI Generator version: 5.4.0
11
11
  =end
12
12
 
13
13
  # load the gem
14
- require 'vgs_api_client'
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`.
@@ -0,0 +1,123 @@
1
+ require 'spec_helper'
2
+ require 'securerandom'
3
+ require 'vgs_api_client'
4
+
5
+ describe 'AliasesApiSpec' do
6
+ before(:each) do
7
+ config = VGS.config(username = ENV['VAULT_API_USERNAME'], password = ENV['VAULT_API_PASSWORD'])
8
+ @api = VGS::Aliases.new config
9
+ end
10
+
11
+ describe 'invalid auth' do
12
+ it 'should fail if invalid auth provided' do
13
+ invalid_config = VGS.config(username = 'Invalid', password = 'Invalid')
14
+ api = VGS::Aliases.new invalid_config
15
+ data = [{
16
+ format: 'UUID',
17
+ value: 'Joe Doe'
18
+ }]
19
+
20
+ expect { api.redact data }.to raise_error(VGS::UnauthorizedError)
21
+ end
22
+ end
23
+
24
+ describe 'invalid config' do
25
+ it 'should fail if invalid config provided' do
26
+ expect { VGS::Aliases.new nil }.to raise_error(ArgumentError)
27
+ end
28
+ end
29
+
30
+ describe 'invalid host' do
31
+ it 'should fail if invalid host provided' do
32
+ config = VGS.config(
33
+ username = ENV['VAULT_API_USERNAME'],
34
+ password = ENV['VAULT_API_PASSWORD'],
35
+ host = 'https://echo.apps.verygood.systems')
36
+ api = VGS::Aliases.new config
37
+ data = [{
38
+ format: 'UUID',
39
+ value: 'Joe Doe'
40
+ }]
41
+ expect { api.redact data }.to raise_error(VGS::NotFoundError)
42
+ end
43
+ end
44
+
45
+ describe 'redact' do
46
+ it 'should redact values' do
47
+ data = [{
48
+ format: 'UUID',
49
+ value: '5201784564572092',
50
+ classifiers: %w[credit-card number],
51
+ storage: 'PERSISTENT'
52
+ },
53
+ {
54
+ format: 'UUID',
55
+ value: 'Joe Doe',
56
+ storage: 'VOLATILE'
57
+ }]
58
+ aliases = @api.redact data
59
+ expect(aliases.length).to eq 2
60
+ data.each_with_index do |item, index|
61
+ expect(aliases[index].value).to eq item[:value]
62
+ expect(aliases[index].storage).to eq item[:storage]
63
+ expect(aliases[index].aliases[0]._alias).to start_with "tok_"
64
+ end
65
+ expect(Set.new(aliases[0].classifiers)).to eq Set.new(%w[credit-card number])
66
+ expect(Set.new(aliases[1].classifiers)).to eq Set.new
67
+ end
68
+ end
69
+
70
+ describe 'reveal' do
71
+ it 'should reveal aliases' do
72
+ data = [{
73
+ format: 'UUID',
74
+ value: '5201784564572092',
75
+ classifiers: %w[credit-card number],
76
+ storage: 'PERSISTENT'
77
+ },
78
+ {
79
+ format: 'UUID',
80
+ value: 'Joe Doe',
81
+ storage: 'VOLATILE'
82
+ }]
83
+ aliases = @api.redact(data).map { |item| item.aliases[0]._alias }
84
+
85
+ response = @api.reveal aliases
86
+
87
+ expect(response.length).to eq 2
88
+ original_values = data.map { |i| i[:value] }
89
+ revealed_values = response.values.map { |i| i.value }
90
+ expect(Set.new original_values).to eq Set.new revealed_values
91
+ end
92
+ end
93
+
94
+ describe 'update' do
95
+ it 'should update alias' do
96
+ data = [{
97
+ format: 'UUID',
98
+ value: SecureRandom.alphanumeric(10)
99
+ }]
100
+ _alias = @api.redact(data).map { |item| item.aliases[0]._alias }[0]
101
+
102
+ @api.update _alias, classifiers: %w[secure]
103
+
104
+ response = @api.reveal _alias
105
+ expect(response[_alias].classifiers).to eq %w[secure]
106
+ end
107
+ end
108
+
109
+ describe 'delete' do
110
+ it 'should delete alias' do
111
+ data = [{
112
+ format: 'UUID',
113
+ value: '5201784564572092'
114
+ }]
115
+ _alias = @api.redact(data).map { |item| item.aliases[0]._alias }[0]
116
+
117
+ @api.delete _alias
118
+
119
+ expect { @api.reveal _alias }.to raise_error(VGS::VgsApiError)
120
+ end
121
+ end
122
+
123
+ end
@@ -1,31 +1,25 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- =begin
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 = VgsApiClient::VERSION
7
+ s.version = VGS::VERSION
21
8
  s.platform = Gem::Platform::RUBY
22
9
  s.authors = ["Very Good Security"]
23
- s.email = ["dev@verygoodsecurity.com"]
24
- s.homepage = "https://openapi-generator.tech"
25
- s.summary = "A ruby wrapper for the VGS Vault API"
26
- s.description = "This gem maps to VGS Vault API"
27
- s.license = "Unlicense"
28
- s.required_ruby_version = ">= 2.4"
10
+ s.email = ["support@verygoodsecurity.com"]
11
+ s.homepage = "https://github.com/verygoodsecurity/vgs-api-client-ruby"
12
+ s.summary = "Very Good Security API Client"
13
+ s.description = "Very Good Security API Client library. More details on https://www.verygoodsecurity.com/"
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