vgs_api_client 0.0.1.alpha202308242233 → 0.0.1.dev202204182306

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +70 -0
  3. data/docker-compose.yaml +5 -19
  4. data/lib/vgs.rb +82 -0
  5. data/lib/{openapi_client → vgs_api_client}/api/aliases_api.rb +10 -100
  6. data/lib/{openapi_client → vgs_api_client}/api_client.rb +2 -2
  7. data/lib/vgs_api_client/api_error.rb +57 -0
  8. data/lib/{openapi_client → vgs_api_client}/configuration.rb +1 -1
  9. data/lib/vgs_api_client/models/alias_format.rb +44 -0
  10. data/lib/vgs_api_client/models/api_error.rb +249 -0
  11. data/lib/{openapi_client → vgs_api_client}/models/create_aliases_request.rb +2 -2
  12. data/lib/{openapi_client → vgs_api_client}/models/create_aliases_request_new.rb +6 -2
  13. data/lib/{openapi_client → vgs_api_client}/models/create_aliases_request_reference.rb +6 -2
  14. data/lib/{openapi_client → vgs_api_client}/models/inline_response200.rb +1 -1
  15. data/lib/{openapi_client → vgs_api_client}/models/inline_response2001.rb +1 -1
  16. data/lib/{openapi_client → vgs_api_client}/models/inline_response201.rb +1 -1
  17. data/lib/{openapi_client → vgs_api_client}/models/inline_response_default.rb +1 -1
  18. data/lib/{openapi_client/models/alias_dto.rb → vgs_api_client/models/model_alias.rb} +4 -5
  19. data/lib/{openapi_client → vgs_api_client}/models/revealed_data.rb +2 -3
  20. data/lib/{openapi_client → vgs_api_client}/models/update_alias_request.rb +1 -1
  21. data/lib/{openapi_client → vgs_api_client}/models/update_alias_request_data.rb +1 -1
  22. data/lib/vgs_api_client/version.rb +15 -0
  23. data/lib/vgs_api_client.rb +48 -106
  24. data/scripts/assemble/Dockerfile +1 -4
  25. data/scripts/assemble/run.sh +3 -3
  26. data/scripts/publish/Dockerfile +1 -4
  27. data/scripts/publish/run.sh +2 -3
  28. data/scripts/publish.sh +2 -3
  29. data/scripts/run-test-e2e.sh +13 -0
  30. data/scripts/run-test-local.sh +4 -0
  31. data/scripts/test/Dockerfile +5 -9
  32. data/scripts/test/run.sh +26 -9
  33. data/spec/api_client_spec.rb +1 -1
  34. data/spec/configuration_spec.rb +1 -1
  35. data/spec/spec_helper.rb +2 -2
  36. data/spec/test_api_spec.rb +97 -0
  37. data/vgs_api_client-0.0.1.dev202204181658.gem +0 -0
  38. data/vgs_api_client.gemspec +21 -15
  39. metadata +34 -46
  40. data/README.md +0 -39
  41. data/VERSION +0 -1
  42. data/api.yaml +0 -625
  43. data/lib/openapi_client/api_error.rb +0 -57
  44. data/lib/openapi_client/models/alias_format.rb +0 -50
  45. data/lib/openapi_client/models/api_error.rb +0 -0
  46. data/lib/openapi_client/models/batch_aliases_request.rb +0 -264
  47. data/lib/openapi_client/version.rb +0 -15
  48. data/lib/openapi_client.rb +0 -54
  49. data/lib/version.rb +0 -3
  50. data/scripts/lint/Dockerfile +0 -9
  51. data/scripts/lint/run.sh +0 -5
  52. data/scripts/lint.sh +0 -6
  53. data/scripts/run-tests-e2e.sh +0 -8
  54. data/scripts/run-tests.sh +0 -6
  55. data/scripts/test-e2e/Dockerfile +0 -14
  56. data/scripts/test-e2e/run.sh +0 -28
  57. data/spec/test_aliases_api_spec.rb +0 -123
@@ -0,0 +1,97 @@
1
+ require 'spec_helper'
2
+ require 'securerandom'
3
+ require 'vgs'
4
+
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)
9
+ end
10
+
11
+ describe 'redact' do
12
+ 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)
27
+ expect(aliases.length).to eq 2
28
+ data.each_with_index do |item, index|
29
+ expect(aliases[index].value).to eq item[:value]
30
+ expect(aliases[index].storage).to eq item[:storage]
31
+ expect(aliases[index].aliases[0]._alias).to start_with "tok_"
32
+ end
33
+ expect(Set.new(aliases[0].classifiers)).to eq Set.new(%w[credit-card number])
34
+ expect(Set.new(aliases[1].classifiers)).to eq Set.new
35
+ end
36
+ end
37
+
38
+ describe 'reveal' do
39
+ 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)
56
+
57
+ expect(response.length).to eq 2
58
+ original_values = data.map { |i| i[:value] }
59
+ revealed_values = response.values.map { |i| i.value }
60
+ expect(Set.new(original_values)).to eq Set.new(revealed_values)
61
+ end
62
+ end
63
+
64
+ describe 'update' do
65
+ 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]
73
+
74
+ @aliases_api.update(_alias = _alias, data = { :classifiers => ["secure"] })
75
+
76
+ response = @aliases_api.reveal(_alias)
77
+ expect(response[_alias].classifiers).to eq %w[secure]
78
+ end
79
+ end
80
+
81
+ describe 'delete' do
82
+ 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]
90
+
91
+ @aliases_api.delete(_alias = _alias)
92
+
93
+ expect { @aliases_api.reveal(_alias) }.to raise_error(VGS::VgsApiException)
94
+ end
95
+ end
96
+
97
+ end
@@ -1,25 +1,31 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require_relative "lib/version"
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"
4
17
 
5
18
  Gem::Specification.new do |s|
6
19
  s.name = "vgs_api_client"
7
- s.version = VGS::VERSION
20
+ s.version = VgsApiClient::VERSION
8
21
  s.platform = Gem::Platform::RUBY
9
22
  s.authors = ["Very Good Security"]
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
- }
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"
23
29
 
24
30
  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
25
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vgs_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha202308242233
4
+ version: 0.0.1.dev202204182306
5
5
  platform: ruby
6
6
  authors:
7
7
  - Very Good Security
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-24 00:00:00.000000000 Z
11
+ date: 2022-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -50,71 +50,59 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 3.6.0
53
- description: Very Good Security API Client library. More details on https://www.verygoodsecurity.com/
53
+ description: This gem maps to VGS Vault API
54
54
  email:
55
- - support@verygoodsecurity.com
55
+ - dev@verygoodsecurity.com
56
56
  executables: []
57
57
  extensions: []
58
58
  extra_rdoc_files: []
59
59
  files:
60
60
  - DEVELOPMENT.md
61
61
  - Gemfile
62
+ - Gemfile.lock
62
63
  - LICENSE
63
- - README.md
64
64
  - RELEASE.md
65
65
  - Rakefile
66
- - VERSION
67
- - api.yaml
68
66
  - docker-compose.yaml
69
- - lib/openapi_client.rb
70
- - lib/openapi_client/api/aliases_api.rb
71
- - lib/openapi_client/api_client.rb
72
- - lib/openapi_client/api_error.rb
73
- - lib/openapi_client/configuration.rb
74
- - lib/openapi_client/models/alias_dto.rb
75
- - lib/openapi_client/models/alias_format.rb
76
- - lib/openapi_client/models/api_error.rb
77
- - lib/openapi_client/models/batch_aliases_request.rb
78
- - lib/openapi_client/models/create_aliases_request.rb
79
- - lib/openapi_client/models/create_aliases_request_new.rb
80
- - lib/openapi_client/models/create_aliases_request_reference.rb
81
- - lib/openapi_client/models/inline_response200.rb
82
- - lib/openapi_client/models/inline_response2001.rb
83
- - lib/openapi_client/models/inline_response201.rb
84
- - lib/openapi_client/models/inline_response_default.rb
85
- - lib/openapi_client/models/revealed_data.rb
86
- - lib/openapi_client/models/update_alias_request.rb
87
- - lib/openapi_client/models/update_alias_request_data.rb
88
- - lib/openapi_client/version.rb
89
- - lib/version.rb
67
+ - lib/vgs.rb
90
68
  - lib/vgs_api_client.rb
69
+ - lib/vgs_api_client/api/aliases_api.rb
70
+ - lib/vgs_api_client/api_client.rb
71
+ - lib/vgs_api_client/api_error.rb
72
+ - lib/vgs_api_client/configuration.rb
73
+ - lib/vgs_api_client/models/alias_format.rb
74
+ - lib/vgs_api_client/models/api_error.rb
75
+ - lib/vgs_api_client/models/create_aliases_request.rb
76
+ - lib/vgs_api_client/models/create_aliases_request_new.rb
77
+ - lib/vgs_api_client/models/create_aliases_request_reference.rb
78
+ - lib/vgs_api_client/models/inline_response200.rb
79
+ - lib/vgs_api_client/models/inline_response2001.rb
80
+ - lib/vgs_api_client/models/inline_response201.rb
81
+ - lib/vgs_api_client/models/inline_response_default.rb
82
+ - lib/vgs_api_client/models/model_alias.rb
83
+ - lib/vgs_api_client/models/revealed_data.rb
84
+ - lib/vgs_api_client/models/update_alias_request.rb
85
+ - lib/vgs_api_client/models/update_alias_request_data.rb
86
+ - lib/vgs_api_client/version.rb
91
87
  - scripts/assemble/Dockerfile
92
88
  - scripts/assemble/run.sh
93
- - scripts/lint.sh
94
- - scripts/lint/Dockerfile
95
- - scripts/lint/run.sh
96
89
  - scripts/publish.sh
97
90
  - scripts/publish/Dockerfile
98
91
  - scripts/publish/run.sh
99
- - scripts/run-tests-e2e.sh
100
- - scripts/run-tests.sh
101
- - scripts/test-e2e/Dockerfile
102
- - scripts/test-e2e/run.sh
92
+ - scripts/run-test-e2e.sh
93
+ - scripts/run-test-local.sh
103
94
  - scripts/test/Dockerfile
104
95
  - scripts/test/run.sh
105
96
  - spec/api_client_spec.rb
106
97
  - spec/configuration_spec.rb
107
98
  - spec/spec_helper.rb
108
- - spec/test_aliases_api_spec.rb
99
+ - spec/test_api_spec.rb
100
+ - vgs_api_client-0.0.1.dev202204181658.gem
109
101
  - vgs_api_client.gemspec
110
- homepage: https://github.com/verygoodsecurity/vgs-api-client-ruby
102
+ homepage: https://openapi-generator.tech
111
103
  licenses:
112
- - BSD-3-Clause
113
- metadata:
114
- homepage_uri: https://www.verygoodsecurity.com
115
- bug_tracker_uri: https://github.com/verygoodsecurity/vgs-api-client-ruby/issues
116
- documentation_uri: https://www.verygoodsecurity.com/docs
117
- source_code_uri: https://github.com/verygoodsecurity/vgs-api-client-ruby
104
+ - Unlicense
105
+ metadata: {}
118
106
  post_install_message:
119
107
  rdoc_options: []
120
108
  require_paths:
@@ -123,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
111
  requirements:
124
112
  - - ">="
125
113
  - !ruby/object:Gem::Version
126
- version: '2.6'
114
+ version: '2.4'
127
115
  required_rubygems_version: !ruby/object:Gem::Requirement
128
116
  requirements:
129
117
  - - ">"
@@ -133,9 +121,9 @@ requirements: []
133
121
  rubygems_version: 3.3.7
134
122
  signing_key:
135
123
  specification_version: 4
136
- summary: Very Good Security API Client
124
+ summary: A ruby wrapper for the VGS Vault API
137
125
  test_files:
138
126
  - spec/api_client_spec.rb
139
127
  - spec/configuration_spec.rb
140
128
  - spec/spec_helper.rb
141
- - spec/test_aliases_api_spec.rb
129
+ - spec/test_api_spec.rb
data/README.md DELETED
@@ -1,39 +0,0 @@
1
- # vgs-api-client-ruby
2
-
3
- [![CircleCI](https://circleci.com/gh/verygoodsecurity/vgs-api-client-ruby.svg?style=svg)](https://github.com/verygoodsecurity/vgs-api-client-ruby)
4
-
5
- This repository contains a Ruby API client library for the Very Good Security API.
6
-
7
- ### Requirements
8
-
9
- Building and using the API client library requires Ruby 2.6+.
10
-
11
- ### Installation
12
-
13
- ```
14
- gem install vgs-api-client
15
- ```
16
-
17
- ### Development
18
-
19
- Follow [DEVELOPMENT](https://github.com/verygoodsecurity/vgs-api-client-ruby/blob/master/DEVELOPMENT.md) instruction.
20
-
21
- ### Release
22
-
23
- Follow [RELEASE](https://github.com/verygoodsecurity/vgs-api-client-ruby/blob/master/RELEASE.md) instruction.
24
-
25
- ### Documentation
26
-
27
- https://www.verygoodsecurity.com/docs/vault/api/
28
-
29
- ### Tutorial
30
-
31
- https://www.verygoodsecurity.com/docs/tokenization/ruby-tutorial
32
-
33
- ### Artifact
34
-
35
- https://rubygems.org/gems/vgs_api_client/
36
-
37
- ### Support
38
-
39
- support@verygoodsecurity.com
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.1.alpha202308242233