vgs_api_client 0.0.1.alpha202205041401 → 0.0.1.alpha202205061106

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4aca2a7276532fd047363d6709fb86ad758b98c377799f74eb31ccc41898659f
4
- data.tar.gz: 5426a43aea34516ccf91abb8e258f8d33936f98a89dcda48c51e7291ce2d6a08
3
+ metadata.gz: e8d208382b2cb0dd131ad0bc675ecbe55b3eb99dbee0e7743e330d617fea5ab3
4
+ data.tar.gz: 3b894e835af90b18273e87845dd7046baa87c91c7dfe6ff9c608e9611856ca1e
5
5
  SHA512:
6
- metadata.gz: '088118fca1debb13b98f7940fbeae6e6da2976eadea5848e251766a3b56e7319f7a274b9159f3c3ef5ae6fe2fac8e3dd19c37b4c944c48b8551e63894521944f'
7
- data.tar.gz: 49bad418da5df2d3f1471e8bf776fe48afc4e0d5b695ecd4af0fa0172f3e2b2b8a48e9a2914d68a77b952beab9e52000a00a255c24e780f89ad9170d347b6dda
6
+ metadata.gz: 8b821ee515bf980470fb32b0d3bf94c6c093c61cfd83e6263d622270b4db9267ec0af75242acec4b7ecd18b80ea4332975c0ec74eb8f5fddbe96b3249336f5be
7
+ data.tar.gz: 03d452e1a98273d877319e8fe9995e2e91240f6cf6c8b3af5992428f21568c62ca698b33e9f60049fbd4e3b9fa0c869a8fbfdb592dce1f4db015dcb71e6d5ef4
data/README.md CHANGED
@@ -16,11 +16,11 @@ gem install vgs-api-client
16
16
 
17
17
  ### Development
18
18
 
19
- Follow [DEVELOPMENT](https://github.com/verygoodsecurity/vgs-api-client-ruby/blob/master/DEVELOPMENT.md) instruction.
19
+ Follow [DEVELOPMENT](DEVELOPMENT.md) instruction.
20
20
 
21
21
  ### Release
22
22
 
23
- Follow [RELEASE](https://github.com/verygoodsecurity/vgs-api-client-ruby/blob/master/RELEASE.md) instruction.
23
+ Follow [RELEASE](RELEASE.md) instruction.
24
24
 
25
25
  ### Documentation
26
26
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1.alpha202205041401
1
+ 0.0.1.alpha202205061106
@@ -31,7 +31,7 @@ module VgsApiClient
31
31
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
32
  def initialize(config = Configuration.default)
33
33
  @config = config
34
- @user_agent = "vgs-api-client/0.0.1.alpha202205041401/ruby"
34
+ @user_agent = "vgs-api-client/0.0.1.alpha202205061106/ruby"
35
35
  @default_headers = {
36
36
  'Content-Type' => 'application/json',
37
37
  'User-Agent' => @user_agent
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.4.0
11
11
  =end
12
12
 
13
13
  module VgsApiClient
14
- VERSION = '0.0.1.alpha202205041401'
14
+ VERSION = '0.0.1.alpha202205061106'
15
15
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module VGS
2
- VERSION = '0.0.1.alpha202205041401'
2
+ VERSION = '0.0.1.alpha202205061106'
3
3
  end
@@ -6,6 +6,7 @@ module VGS
6
6
 
7
7
  class Aliases
8
8
  def initialize(config)
9
+ raise ArgumentError, 'config is nil' if config.nil?
9
10
  @aliases_api = VgsApiClient::AliasesApi.new(VgsApiClient::ApiClient.new(config))
10
11
  end
11
12
 
@@ -13,7 +14,7 @@ module VGS
13
14
  begin
14
15
  requests = data.map do |item|
15
16
  VgsApiClient::CreateAliasesRequestNew.new(attributes = {
16
- :format => VgsApiClient::AliasFormat.build_from_hash(item[:format] || "UUID"),
17
+ :format => VgsApiClient::AliasFormat.build_from_hash(item[:format]),
17
18
  :classifiers => item[:classifiers],
18
19
  :value => item[:value],
19
20
  :storage => item[:storage]
@@ -77,6 +78,7 @@ module VGS
77
78
  config.username = username
78
79
  config.password = password
79
80
  config.host = host
81
+ config.server_index = nil
80
82
  config
81
83
  end
82
84
  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.1.alpha202205041401 . | xargs sed -i "s/0.0.1.alpha202205041401/${LIB_VERSION}/g"
6
+ grep -rl 0.0.1.alpha202205061106 . | xargs sed -i "s/0.0.1.alpha202205061106/${LIB_VERSION}/g"
7
7
 
8
8
  # build
9
9
  gem build vgs_api_client.gemspec
data/scripts/test/run.sh CHANGED
@@ -5,7 +5,7 @@ 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.1.alpha202205041401 . | xargs sed -i "s/0.0.1.alpha202205041401/$VERSION/g"
8
+ grep -rl 0.0.1.alpha202205061106 . | xargs sed -i "s/0.0.1.alpha202205061106/$VERSION/g"
9
9
 
10
10
  bundle install
11
11
 
@@ -3,9 +3,43 @@ require 'securerandom'
3
3
  require 'vgs_api_client'
4
4
 
5
5
  describe 'AliasesApiSpec' do
6
- before(:all) do
6
+ before(:each) do
7
7
  config = VGS.config(username = ENV['VAULT_API_USERNAME'], password = ENV['VAULT_API_PASSWORD'])
8
- @aliases_api = VGS::Aliases.new config
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::VgsApiException)
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::VgsApiException)
42
+ end
9
43
  end
10
44
 
11
45
  describe 'redact' do
@@ -21,7 +55,7 @@ describe 'AliasesApiSpec' do
21
55
  value: 'Joe Doe',
22
56
  storage: 'VOLATILE'
23
57
  }]
24
- aliases = @aliases_api.redact data
58
+ aliases = @api.redact data
25
59
  expect(aliases.length).to eq 2
26
60
  data.each_with_index do |item, index|
27
61
  expect(aliases[index].value).to eq item[:value]
@@ -46,14 +80,14 @@ describe 'AliasesApiSpec' do
46
80
  value: 'Joe Doe',
47
81
  storage: 'VOLATILE'
48
82
  }]
49
- aliases = @aliases_api.redact(data).map { |item| item.aliases[0]._alias }
83
+ aliases = @api.redact(data).map { |item| item.aliases[0]._alias }
50
84
 
51
- response = @aliases_api.reveal aliases
85
+ response = @api.reveal aliases
52
86
 
53
87
  expect(response.length).to eq 2
54
88
  original_values = data.map { |i| i[:value] }
55
89
  revealed_values = response.values.map { |i| i.value }
56
- expect(Set.new(original_values)).to eq Set.new(revealed_values)
90
+ expect(Set.new original_values).to eq Set.new revealed_values
57
91
  end
58
92
  end
59
93
 
@@ -63,11 +97,11 @@ describe 'AliasesApiSpec' do
63
97
  format: 'UUID',
64
98
  value: SecureRandom.alphanumeric(10)
65
99
  }]
66
- _alias = @aliases_api.redact(data).map { |item| item.aliases[0]._alias }[0]
100
+ _alias = @api.redact(data).map { |item| item.aliases[0]._alias }[0]
67
101
 
68
- @aliases_api.update _alias, classifiers: %w[secure]
102
+ @api.update _alias, classifiers: %w[secure]
69
103
 
70
- response = @aliases_api.reveal(_alias)
104
+ response = @api.reveal _alias
71
105
  expect(response[_alias].classifiers).to eq %w[secure]
72
106
  end
73
107
  end
@@ -78,11 +112,11 @@ describe 'AliasesApiSpec' do
78
112
  format: 'UUID',
79
113
  value: '5201784564572092'
80
114
  }]
81
- _alias = @aliases_api.redact(data).map { |item| item.aliases[0]._alias }[0]
115
+ _alias = @api.redact(data).map { |item| item.aliases[0]._alias }[0]
82
116
 
83
- @aliases_api.delete _alias
117
+ @api.delete _alias
84
118
 
85
- expect { @aliases_api.reveal(_alias) }.to raise_error(VGS::VgsApiException)
119
+ expect { @api.reveal _alias }.to raise_error(VGS::VgsApiException)
86
120
  end
87
121
  end
88
122
 
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Very Good Security"]
10
10
  s.email = ["support@verygoodsecurity.com"]
11
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/"
12
+ s.summary = "VGS API Client"
13
+ s.description = "This gem maps to VGS Vault API"
14
14
  s.license = "BSD-3-Clause"
15
15
  s.required_ruby_version = ">= 2.6"
16
16
 
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.alpha202205041401
4
+ version: 0.0.1.alpha202205061106
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-05-04 00:00:00.000000000 Z
11
+ date: 2022-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -50,7 +50,7 @@ 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
55
  - support@verygoodsecurity.com
56
56
  executables: []
@@ -132,7 +132,7 @@ requirements: []
132
132
  rubygems_version: 3.3.7
133
133
  signing_key:
134
134
  specification_version: 4
135
- summary: Very Good Security API Client
135
+ summary: VGS API Client
136
136
  test_files:
137
137
  - spec/api_client_spec.rb
138
138
  - spec/configuration_spec.rb