vgs_api_client 0.0.36 → 0.0.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) 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 +10 -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 +1 -1
  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/test/run.sh +2 -2
  32. data/scripts/test-e2e/Dockerfile +1 -9
  33. data/scripts/test-e2e/run.sh +3 -5
  34. data/spec/api_client_spec.rb +1 -1
  35. data/spec/configuration_spec.rb +1 -1
  36. data/spec/spec_helper.rb +2 -2
  37. data/spec/test_aliases_api_spec.rb +79 -53
  38. data/vgs_api_client.gemspec +15 -21
  39. metadata +39 -28
  40. data/lib/vgs.rb +0 -82
  41. data/lib/vgs_api_client/models/api_error.rb +0 -249
@@ -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
@@ -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.36 . | xargs sed -i "s/0.0.36/${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
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.36 . | xargs sed -i "s/0.0.36/$VERSION/g"
8
+ grep -rl 0.0.38 . | xargs sed -i "s/0.0.38/$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
@@ -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 bundler && \
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"]
@@ -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
- mv /vgs-api-client/tmp/Gemfile /vgs-api-client/
28
- mv /vgs-api-client/tmp/vgs_api_client.gemspec /vgs-api-client/
29
- bundle install --without production --binstubs
30
- bundle exec rspec ./spec/*.rb
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`.
@@ -1,29 +1,61 @@
1
1
  require 'spec_helper'
2
2
  require 'securerandom'
3
- require 'vgs'
3
+ require 'vgs_api_client'
4
4
 
5
5
  describe 'AliasesApiSpec' do
6
- before(:all) do
7
- config = VGS.config(username = ENV["VAULT_API_USERNAME"], password = ENV["VAULT_API_PASSWORD"])
8
- @aliases_api = VGS::Aliases.new(config)
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
9
43
  end
10
44
 
11
45
  describe 'redact' do
12
46
  it 'should redact values' do
13
- data = [
14
- {
15
- :format => 'UUID',
16
- :value => '5201784564572092',
17
- :classifiers => %w[credit-card number],
18
- :storage => 'PERSISTENT',
19
- },
20
- {
21
- :format => 'UUID',
22
- :value => 'Joe Doe',
23
- :storage => 'VOLATILE',
24
- }
25
- ]
26
- aliases = @aliases_api.redact(data)
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
27
59
  expect(aliases.length).to eq 2
28
60
  data.each_with_index do |item, index|
29
61
  expect(aliases[index].value).to eq item[:value]
@@ -37,60 +69,54 @@ describe 'AliasesApiSpec' do
37
69
 
38
70
  describe 'reveal' do
39
71
  it 'should reveal aliases' do
40
- data = [
41
- {
42
- :format => 'UUID',
43
- :value => '5201784564572092',
44
- :classifiers => %w[credit-card number],
45
- :storage => 'PERSISTENT',
46
- },
47
- {
48
- :format => 'UUID',
49
- :value => 'Joe Doe',
50
- :storage => 'VOLATILE',
51
- }
52
- ]
53
- aliases = @aliases_api.redact(data).map { |item| item.aliases[0]._alias }
54
-
55
- response = @aliases_api.reveal(aliases)
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
56
86
 
57
87
  expect(response.length).to eq 2
58
88
  original_values = data.map { |i| i[:value] }
59
89
  revealed_values = response.values.map { |i| i.value }
60
- expect(Set.new(original_values)).to eq Set.new(revealed_values)
90
+ expect(Set.new original_values).to eq Set.new revealed_values
61
91
  end
62
92
  end
63
93
 
64
94
  describe 'update' do
65
95
  it 'should update alias' do
66
- data = [
67
- {
68
- :format => 'UUID',
69
- :value => SecureRandom.alphanumeric(10),
70
- }
71
- ]
72
- _alias = @aliases_api.redact(data).map { |item| item.aliases[0]._alias }[0]
96
+ data = [{
97
+ format: 'UUID',
98
+ value: SecureRandom.alphanumeric(10)
99
+ }]
100
+ _alias = @api.redact(data).map { |item| item.aliases[0]._alias }[0]
73
101
 
74
- @aliases_api.update(_alias = _alias, data = { :classifiers => ["secure"] })
102
+ @api.update _alias, classifiers: %w[secure]
75
103
 
76
- response = @aliases_api.reveal(_alias)
104
+ response = @api.reveal _alias
77
105
  expect(response[_alias].classifiers).to eq %w[secure]
78
106
  end
79
107
  end
80
108
 
81
109
  describe 'delete' do
82
110
  it 'should delete alias' do
83
- data = [
84
- {
85
- :format => 'UUID',
86
- :value => '5201784564572092',
87
- }
88
- ]
89
- _alias = @aliases_api.redact(data).map { |item| item.aliases[0]._alias }[0]
111
+ data = [{
112
+ format: 'UUID',
113
+ value: '5201784564572092'
114
+ }]
115
+ _alias = @api.redact(data).map { |item| item.aliases[0]._alias }[0]
90
116
 
91
- @aliases_api.delete(_alias = _alias)
117
+ @api.delete _alias
92
118
 
93
- expect { @aliases_api.reveal(_alias) }.to raise_error(VGS::VgsApiException)
119
+ expect { @api.reveal _alias }.to raise_error(VGS::VgsApiError)
94
120
  end
95
121
  end
96
122
 
@@ -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