vgs_api_client 0.0.1.alpha202205021814 → 0.0.1.alpha202205031253

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee2cb645b843767a5fd1524c3ebc5c140d30a4be61d70e60d98dfda76eedd364
4
- data.tar.gz: 64c7d5651f393a6bac981bdc0e90b4341a48b2eb2bd9e7323fee44c649e27aae
3
+ metadata.gz: 59992eda95c2b4979524c25c9b283c4807eceb48424726b5a42457baa391ec8d
4
+ data.tar.gz: 5d0a5c7f3e60a38ebb1f30dd432d162ccf74e49b00585acf40da52768f28066c
5
5
  SHA512:
6
- metadata.gz: 100283efabf041fdb79bbaa4955ef0edaea7609d23930e5a4afcd6ad32de990de384a4173b5abb1f700b129398fdfea70e4686824dc885d2e3d6ca015aaca2e9
7
- data.tar.gz: 61cf28f420d71681fcb170f96044aed1200369306208b31ed899d1f8a6f348c821b574e822db0c19597d3334195f791539ea3d71be983cf95844b572db0a4876
6
+ metadata.gz: a23afd5d0b592589cb4607f296e857cd1cb77a9f3d69cb87cf6862b01fd2c7b8f85f91b29dc6b7547b752770ad334d81c7f067f16a0bfd89dbccc567240fdc72
7
+ data.tar.gz: 7f33c73fccbcde9202d6bafb363d3ac454558c93e3bf2b82e5727eb64ab88baebad0ba5e5cd752d5327b699bbe7d615341bdcffcb41ae0ad3bf3eb7f7d83d4bb
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.alpha202205021814
1
+ 0.0.1.alpha202205031253
@@ -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.alpha202205021814/ruby"
34
+ @user_agent = "vgs-api-client/0.0.1.alpha202205031253/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.alpha202205021814'
14
+ VERSION = '0.0.1.alpha202205031253'
15
15
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module VGS
2
- VERSION = '0.0.1.alpha202205021814'
2
+ VERSION = '0.0.1.alpha202205031253'
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.alpha202205021814 . | xargs sed -i "s/0.0.1.alpha202205021814/${LIB_VERSION}/g"
6
+ grep -rl 0.0.1.alpha202205031253 . | xargs sed -i "s/0.0.1.alpha202205031253/${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.alpha202205021814 . | xargs sed -i "s/0.0.1.alpha202205021814/$VERSION/g"
8
+ grep -rl 0.0.1.alpha202205031253 . | xargs sed -i "s/0.0.1.alpha202205031253/$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.alpha202205021814
4
+ version: 0.0.1.alpha202205031253
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-02 00:00:00.000000000 Z
11
+ date: 2022-05-03 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