vgs_api_client 0.0.1.alpha202401251923 → 0.0.1.dev202204182306

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) 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 +1 -1
  6. data/lib/{openapi_client → vgs_api_client}/api_client.rb +2 -2
  7. data/lib/{openapi_client → vgs_api_client}/api_error.rb +1 -1
  8. data/lib/{openapi_client → vgs_api_client}/configuration.rb +1 -1
  9. data/lib/{openapi_client → vgs_api_client}/models/alias_format.rb +1 -4
  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 +1 -1
  12. data/lib/{openapi_client → vgs_api_client}/models/create_aliases_request_new.rb +1 -1
  13. data/lib/{openapi_client → vgs_api_client}/models/create_aliases_request_reference.rb +1 -1
  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 → vgs_api_client}/models/model_alias.rb +1 -1
  19. data/lib/{openapi_client → vgs_api_client}/models/revealed_data.rb +1 -1
  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/{openapi_client → vgs_api_client}/version.rb +2 -2
  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 -45
  40. data/README.md +0 -39
  41. data/VERSION +0 -1
  42. data/api.yaml +0 -537
  43. data/lib/openapi_client/models/api_error.rb +0 -0
  44. data/lib/openapi_client.rb +0 -53
  45. data/lib/version.rb +0 -3
  46. data/scripts/lint/Dockerfile +0 -9
  47. data/scripts/lint/run.sh +0 -5
  48. data/scripts/lint.sh +0 -6
  49. data/scripts/run-tests-e2e.sh +0 -8
  50. data/scripts/run-tests.sh +0 -6
  51. data/scripts/test-e2e/Dockerfile +0 -14
  52. data/scripts/test-e2e/run.sh +0 -28
  53. data/spec/test_aliases_api_spec.rb +0 -123
@@ -1,123 +0,0 @@
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