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
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.35
4
+ version: 0.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Very Good Security
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-19 00:00:00.000000000 Z
11
+ date: 2022-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -50,9 +50,9 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 3.6.0
53
- description: This gem maps to VGS Vault API
53
+ description: Very Good Security API Client library. More details on https://www.verygoodsecurity.com/
54
54
  email:
55
- - dev@verygoodsecurity.com
55
+ - support@verygoodsecurity.com
56
56
  executables: []
57
57
  extensions: []
58
58
  extra_rdoc_files: []
@@ -60,47 +60,60 @@ files:
60
60
  - DEVELOPMENT.md
61
61
  - Gemfile
62
62
  - LICENSE
63
+ - README.md
63
64
  - RELEASE.md
64
65
  - Rakefile
66
+ - VERSION
67
+ - api.yaml
65
68
  - docker-compose.yaml
66
- - lib/vgs.rb
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_format.rb
75
+ - lib/openapi_client/models/api_error.rb
76
+ - lib/openapi_client/models/create_aliases_request.rb
77
+ - lib/openapi_client/models/create_aliases_request_new.rb
78
+ - lib/openapi_client/models/create_aliases_request_reference.rb
79
+ - lib/openapi_client/models/inline_response200.rb
80
+ - lib/openapi_client/models/inline_response2001.rb
81
+ - lib/openapi_client/models/inline_response201.rb
82
+ - lib/openapi_client/models/inline_response_default.rb
83
+ - lib/openapi_client/models/model_alias.rb
84
+ - lib/openapi_client/models/revealed_data.rb
85
+ - lib/openapi_client/models/update_alias_request.rb
86
+ - lib/openapi_client/models/update_alias_request_data.rb
87
+ - lib/openapi_client/version.rb
88
+ - lib/version.rb
67
89
  - lib/vgs_api_client.rb
68
- - lib/vgs_api_client/api/aliases_api.rb
69
- - lib/vgs_api_client/api_client.rb
70
- - lib/vgs_api_client/api_error.rb
71
- - lib/vgs_api_client/configuration.rb
72
- - lib/vgs_api_client/models/alias_format.rb
73
- - lib/vgs_api_client/models/api_error.rb
74
- - lib/vgs_api_client/models/create_aliases_request.rb
75
- - lib/vgs_api_client/models/create_aliases_request_new.rb
76
- - lib/vgs_api_client/models/create_aliases_request_reference.rb
77
- - lib/vgs_api_client/models/inline_response200.rb
78
- - lib/vgs_api_client/models/inline_response2001.rb
79
- - lib/vgs_api_client/models/inline_response201.rb
80
- - lib/vgs_api_client/models/inline_response_default.rb
81
- - lib/vgs_api_client/models/model_alias.rb
82
- - lib/vgs_api_client/models/revealed_data.rb
83
- - lib/vgs_api_client/models/update_alias_request.rb
84
- - lib/vgs_api_client/models/update_alias_request_data.rb
85
- - lib/vgs_api_client/version.rb
86
90
  - scripts/assemble/Dockerfile
87
91
  - scripts/assemble/run.sh
92
+ - scripts/lint.sh
93
+ - scripts/lint/Dockerfile
94
+ - scripts/lint/run.sh
88
95
  - scripts/publish.sh
89
96
  - scripts/publish/Dockerfile
90
97
  - scripts/publish/run.sh
91
98
  - scripts/run-tests-e2e.sh
92
99
  - scripts/run-tests.sh
100
+ - scripts/test-e2e/Dockerfile
101
+ - scripts/test-e2e/run.sh
93
102
  - scripts/test/Dockerfile
94
103
  - scripts/test/run.sh
95
104
  - spec/api_client_spec.rb
96
105
  - spec/configuration_spec.rb
97
106
  - spec/spec_helper.rb
98
- - spec/test_api_spec.rb
107
+ - spec/test_aliases_api_spec.rb
99
108
  - vgs_api_client.gemspec
100
- homepage: https://openapi-generator.tech
109
+ homepage: https://github.com/verygoodsecurity/vgs-api-client-ruby
101
110
  licenses:
102
- - Unlicense
103
- metadata: {}
111
+ - BSD-3-Clause
112
+ metadata:
113
+ homepage_uri: https://www.verygoodsecurity.com
114
+ bug_tracker_uri: https://github.com/verygoodsecurity/vgs-api-client-ruby/issues
115
+ documentation_uri: https://www.verygoodsecurity.com/docs
116
+ source_code_uri: https://github.com/verygoodsecurity/vgs-api-client-ruby
104
117
  post_install_message:
105
118
  rdoc_options: []
106
119
  require_paths:
@@ -109,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
122
  requirements:
110
123
  - - ">="
111
124
  - !ruby/object:Gem::Version
112
- version: '2.4'
125
+ version: '2.6'
113
126
  required_rubygems_version: !ruby/object:Gem::Requirement
114
127
  requirements:
115
128
  - - ">="
@@ -119,9 +132,9 @@ requirements: []
119
132
  rubygems_version: 3.3.7
120
133
  signing_key:
121
134
  specification_version: 4
122
- summary: A ruby wrapper for the VGS Vault API
135
+ summary: Very Good Security API Client
123
136
  test_files:
124
137
  - spec/api_client_spec.rb
125
138
  - spec/configuration_spec.rb
126
139
  - spec/spec_helper.rb
127
- - spec/test_api_spec.rb
140
+ - spec/test_aliases_api_spec.rb
data/lib/vgs.rb DELETED
@@ -1,82 +0,0 @@
1
- module VGS
2
- class VgsApiException < StandardError
3
- end
4
-
5
- class Aliases
6
- def initialize(config)
7
- @aliases_api = VgsApiClient::AliasesApi.new(VgsApiClient::ApiClient.new(config))
8
- end
9
-
10
- def redact(data)
11
- begin
12
- requests = data.map do |item|
13
- VgsApiClient::CreateAliasesRequestNew.new(attributes = {
14
- :format => VgsApiClient::AliasFormat.build_from_hash(item[:format]),
15
- :classifiers => item[:classifiers],
16
- :value => item[:value],
17
- :storage => item[:storage]
18
- })
19
- end
20
-
21
- create_aliases_request = VgsApiClient::CreateAliasesRequest.new(attributes = {
22
- :data => requests
23
- })
24
- response = @aliases_api.create_aliases(opts = {
25
- :create_aliases_request => create_aliases_request.to_hash
26
- })
27
-
28
- rescue
29
- raise VgsApiException, "Failed to redact data #{ data }"
30
- else
31
- response.data
32
- end
33
-
34
- end
35
-
36
- def reveal(aliases)
37
- begin
38
- query = aliases.kind_of?(Array) ? aliases.join(",") : aliases
39
- response = @aliases_api.reveal_multiple_aliases(q = query)
40
- rescue
41
- raise VgsApiException, "Failed to reveal aliases #{ aliases }"
42
- else
43
- response.data
44
- end
45
- end
46
-
47
- def delete(_alias)
48
- begin
49
- @aliases_api.delete_alias(_alias = _alias)
50
- rescue
51
- raise VgsApiException, "Failed to delete alias #{ _alias }"
52
- end
53
- end
54
-
55
- def update(_alias, data)
56
- begin
57
- update_alias_request = VgsApiClient::UpdateAliasRequest.new(attributes = {
58
- :data => VgsApiClient::UpdateAliasRequestData.new(attributes = {
59
- :classifiers => data[:classifiers]
60
- })
61
- })
62
- @aliases_api.update_alias(_alias = _alias, opts = {
63
- :update_alias_request => update_alias_request.to_hash
64
- })
65
- rescue
66
- raise VgsApiException, "Failed to update alias #{ _alias }"
67
- end
68
- end
69
- end
70
-
71
- def self.config(username, password, host = 'https://api.sandbox.verygoodvault.com')
72
- raise ArgumentError, 'username is nil' if username.nil?
73
- raise ArgumentError, 'password is nil' if password.nil?
74
-
75
- config = VgsApiClient::Configuration.default
76
- config.username = username
77
- config.password = password
78
- config.host = host
79
- config
80
- end
81
-
82
- end
@@ -1,249 +0,0 @@
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
- require 'date'
14
- require 'time'
15
-
16
- module VgsApiClient
17
- class ApiError
18
- # Explanation of what exactly went wrong.
19
- attr_accessor :detail
20
-
21
- # Request URL.
22
- attr_accessor :href
23
-
24
- # HTTP status code.
25
- attr_accessor :status
26
-
27
- # High-level reason of why the request failed.
28
- attr_accessor :title
29
-
30
- # Attribute mapping from ruby-style variable name to JSON key.
31
- def self.attribute_map
32
- {
33
- :'detail' => :'detail',
34
- :'href' => :'href',
35
- :'status' => :'status',
36
- :'title' => :'title'
37
- }
38
- end
39
-
40
- # Returns all the JSON keys this model knows about
41
- def self.acceptable_attributes
42
- attribute_map.values
43
- end
44
-
45
- # Attribute type mapping.
46
- def self.openapi_types
47
- {
48
- :'detail' => :'String',
49
- :'href' => :'String',
50
- :'status' => :'Integer',
51
- :'title' => :'String'
52
- }
53
- end
54
-
55
- # List of attributes with nullable: true
56
- def self.openapi_nullable
57
- Set.new([
58
- ])
59
- end
60
-
61
- # Initializes the object
62
- # @param [Hash] attributes Model attributes in the form of hash
63
- def initialize(attributes = {})
64
- if (!attributes.is_a?(Hash))
65
- fail ArgumentError, "The input argument (attributes) must be a hash in `VgsApiClient::ApiError` initialize method"
66
- end
67
-
68
- # check to see if the attribute exists and convert string to symbol for hash key
69
- attributes = attributes.each_with_object({}) { |(k, v), h|
70
- if (!self.class.attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `VgsApiClient::ApiError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
- end
73
- h[k.to_sym] = v
74
- }
75
-
76
- if attributes.key?(:'detail')
77
- self.detail = attributes[:'detail']
78
- end
79
-
80
- if attributes.key?(:'href')
81
- self.href = attributes[:'href']
82
- end
83
-
84
- if attributes.key?(:'status')
85
- self.status = attributes[:'status']
86
- end
87
-
88
- if attributes.key?(:'title')
89
- self.title = attributes[:'title']
90
- end
91
- end
92
-
93
- # Show invalid properties with the reasons. Usually used together with valid?
94
- # @return Array for valid properties with the reasons
95
- def list_invalid_properties
96
- invalid_properties = Array.new
97
- invalid_properties
98
- end
99
-
100
- # Check to see if the all the properties in the model are valid
101
- # @return true if the model is valid
102
- def valid?
103
- true
104
- end
105
-
106
- # Checks equality by comparing each attribute.
107
- # @param [Object] Object to be compared
108
- def ==(o)
109
- return true if self.equal?(o)
110
- self.class == o.class &&
111
- detail == o.detail &&
112
- href == o.href &&
113
- status == o.status &&
114
- title == o.title
115
- end
116
-
117
- # @see the `==` method
118
- # @param [Object] Object to be compared
119
- def eql?(o)
120
- self == o
121
- end
122
-
123
- # Calculates hash code according to all attributes.
124
- # @return [Integer] Hash code
125
- def hash
126
- [detail, href, status, title].hash
127
- end
128
-
129
- # Builds the object from hash
130
- # @param [Hash] attributes Model attributes in the form of hash
131
- # @return [Object] Returns the model itself
132
- def self.build_from_hash(attributes)
133
- new.build_from_hash(attributes)
134
- end
135
-
136
- # Builds the object from hash
137
- # @param [Hash] attributes Model attributes in the form of hash
138
- # @return [Object] Returns the model itself
139
- def build_from_hash(attributes)
140
- return nil unless attributes.is_a?(Hash)
141
- self.class.openapi_types.each_pair do |key, type|
142
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
143
- self.send("#{key}=", nil)
144
- elsif type =~ /\AArray<(.*)>/i
145
- # check to ensure the input is an array given that the attribute
146
- # is documented as an array but the input is not
147
- if attributes[self.class.attribute_map[key]].is_a?(Array)
148
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
- end
150
- elsif !attributes[self.class.attribute_map[key]].nil?
151
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
- end
153
- end
154
-
155
- self
156
- end
157
-
158
- # Deserializes the data based on type
159
- # @param string type Data type
160
- # @param string value Value to be deserialized
161
- # @return [Object] Deserialized data
162
- def _deserialize(type, value)
163
- case type.to_sym
164
- when :Time
165
- Time.parse(value)
166
- when :Date
167
- Date.parse(value)
168
- when :String
169
- value.to_s
170
- when :Integer
171
- value.to_i
172
- when :Float
173
- value.to_f
174
- when :Boolean
175
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
- true
177
- else
178
- false
179
- end
180
- when :Object
181
- # generic object (usually a Hash), return directly
182
- value
183
- when /\AArray<(?<inner_type>.+)>\z/
184
- inner_type = Regexp.last_match[:inner_type]
185
- value.map { |v| _deserialize(inner_type, v) }
186
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
- k_type = Regexp.last_match[:k_type]
188
- v_type = Regexp.last_match[:v_type]
189
- {}.tap do |hash|
190
- value.each do |k, v|
191
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
- end
193
- end
194
- else # model
195
- # models (e.g. Pet) or oneOf
196
- klass = VgsApiClient.const_get(type)
197
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
- end
199
- end
200
-
201
- # Returns the string representation of the object
202
- # @return [String] String presentation of the object
203
- def to_s
204
- to_hash.to_s
205
- end
206
-
207
- # to_body is an alias to to_hash (backward compatibility)
208
- # @return [Hash] Returns the object in the form of hash
209
- def to_body
210
- to_hash
211
- end
212
-
213
- # Returns the object in the form of hash
214
- # @return [Hash] Returns the object in the form of hash
215
- def to_hash
216
- hash = {}
217
- self.class.attribute_map.each_pair do |attr, param|
218
- value = self.send(attr)
219
- if value.nil?
220
- is_nullable = self.class.openapi_nullable.include?(attr)
221
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
- end
223
-
224
- hash[param] = _to_hash(value)
225
- end
226
- hash
227
- end
228
-
229
- # Outputs non-array value in the form of hash
230
- # For object, use to_hash. Otherwise, just return the value
231
- # @param [Object] value Any valid value
232
- # @return [Hash] Returns the value in the form of hash
233
- def _to_hash(value)
234
- if value.is_a?(Array)
235
- value.compact.map { |v| _to_hash(v) }
236
- elsif value.is_a?(Hash)
237
- {}.tap do |hash|
238
- value.each { |k, v| hash[k] = _to_hash(v) }
239
- end
240
- elsif value.respond_to? :to_hash
241
- value.to_hash
242
- else
243
- value
244
- end
245
- end
246
-
247
- end
248
-
249
- end
@@ -1,97 +0,0 @@
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