vgs_api_client 0.0.1.alpha202204211352 → 0.0.1.alpha202204221804

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: 61a7daed6f42c1bb5700264df93d0282fc3ec726dc616633f264660bc4d3162c
4
- data.tar.gz: b4c99f82457673878d7da57ad7c419098e1260a595ef06917dacada117b1eb7a
3
+ metadata.gz: ad6f53cf37b26adf6ad0d2d8601bce2d3812dfd8f33f5956fb2bc7a1a0adedc6
4
+ data.tar.gz: b1f5add24e6548547ffacda7cde9ebf25f2db4fcbe7f350b2fa8836efe93544e
5
5
  SHA512:
6
- metadata.gz: 1308bad4a12ed44acfc24339f5b949261b8038705cf430349ae740f81df55abb403da43e0a250d8252472d62e19d70d2484e7104e9bff131813f18f95aebe125
7
- data.tar.gz: e9e79f67722c829550b8eb2c24e594ef70daa5e3abce8e4ebda2d6d43cf1ec33de8c7ecea50f2f7023673323f7a1cedd8e59f6ccc136fc74b4cf3aa827e4e83b
6
+ metadata.gz: 0e24e515b39092e5027afa40defa1efb5c4162fbc9889118d9dcd114beb8b0fbdba030f181f4df81f7031d1e573f1743f2d7ed8e6e3057a255715c32bf91e967
7
+ data.tar.gz: d738f6848d1e2e61bd074319153ecd7dd8646efa59f428f103e86a208e54762d4e7921ad95090d530bfb1fb60725cf8e5f8f7c2978d3e0de05bc8dec1f0bd9c3
data/Gemfile.lock ADDED
@@ -0,0 +1,70 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ vgs_api_client (0.0.1.alpha202204221804)
5
+ typhoeus (~> 1.0, >= 1.0.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ byebug (11.1.3)
12
+ coderay (1.1.3)
13
+ diff-lcs (1.5.0)
14
+ ethon (0.15.0)
15
+ ffi (>= 1.15.0)
16
+ ffi (1.15.5)
17
+ jaro_winkler (1.5.4)
18
+ method_source (1.0.0)
19
+ parallel (1.22.1)
20
+ parser (3.1.2.0)
21
+ ast (~> 2.4.1)
22
+ pry (0.13.1)
23
+ coderay (~> 1.1)
24
+ method_source (~> 1.0)
25
+ pry-byebug (3.9.0)
26
+ byebug (~> 11.0)
27
+ pry (~> 0.13.0)
28
+ psych (4.0.3)
29
+ stringio
30
+ rainbow (3.1.1)
31
+ rake (13.0.6)
32
+ rspec (3.11.0)
33
+ rspec-core (~> 3.11.0)
34
+ rspec-expectations (~> 3.11.0)
35
+ rspec-mocks (~> 3.11.0)
36
+ rspec-core (3.11.0)
37
+ rspec-support (~> 3.11.0)
38
+ rspec-expectations (3.11.0)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.11.0)
41
+ rspec-mocks (3.11.1)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.11.0)
44
+ rspec-support (3.11.0)
45
+ rubocop (0.66.0)
46
+ jaro_winkler (~> 1.5.1)
47
+ parallel (~> 1.10)
48
+ parser (>= 2.5, != 2.5.1.1)
49
+ psych (>= 3.1.0)
50
+ rainbow (>= 2.2.2, < 4.0)
51
+ ruby-progressbar (~> 1.7)
52
+ unicode-display_width (>= 1.4.0, < 1.6)
53
+ ruby-progressbar (1.11.0)
54
+ stringio (3.0.1)
55
+ typhoeus (1.4.0)
56
+ ethon (>= 0.9.0)
57
+ unicode-display_width (1.5.0)
58
+
59
+ PLATFORMS
60
+ x86_64-darwin-21
61
+
62
+ DEPENDENCIES
63
+ pry-byebug
64
+ rake (~> 13.0.1)
65
+ rspec (~> 3.6, >= 3.6.0)
66
+ rubocop (~> 0.66.0)
67
+ vgs_api_client!
68
+
69
+ BUNDLED WITH
70
+ 2.3.11
data/datadog.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'datadog_api_client'
2
+
3
+ api_instance = DatadogAPIClient::V1::IPRangesAPI.new
4
+
5
+ begin
6
+ result = api_instance.get_ip_ranges
7
+ p result
8
+ rescue DatadogAPIClient::V1::APIError => e
9
+ puts "Error when calling IPRangesAPI->get_ip_ranges: #{e}"
10
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module VGS
2
+ VERSION = '0.0.1.alpha202204221804'
3
+ end
@@ -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.alpha202204211352/ruby"
34
+ @user_agent = "vgs-api-client/0.0.1.alpha202204221804/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.alpha202204211352'
14
+ VERSION = '0.0.1.alpha202204221804'
15
15
  end
@@ -1,15 +1,3 @@
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
1
  # Common files
14
2
  require 'vgs_api_client/api_client'
15
3
  require 'vgs_api_client/api_error'
@@ -34,20 +22,85 @@ require 'vgs_api_client/models/update_alias_request_data'
34
22
  # APIs
35
23
  require 'vgs_api_client/api/aliases_api'
36
24
 
37
- module VgsApiClient
38
- class << self
39
- # Customize default settings for the SDK using block.
40
- # VgsApiClient.configure do |config|
41
- # config.username = "xxx"
42
- # config.password = "xxx"
43
- # end
44
- # If no block given, return the default Configuration object.
45
- def configure
46
- if block_given?
47
- yield(Configuration.default)
25
+ module VGS
26
+ class VgsApiException < StandardError
27
+ end
28
+
29
+ class Aliases
30
+ def initialize(config)
31
+ @aliases_api = VgsApiClient::AliasesApi.new(VgsApiClient::ApiClient.new(config))
32
+ end
33
+
34
+ def redact(data)
35
+ begin
36
+ requests = data.map do |item|
37
+ VgsApiClient::CreateAliasesRequestNew.new(attributes = {
38
+ :format => VgsApiClient::AliasFormat.build_from_hash(item[:format]),
39
+ :classifiers => item[:classifiers],
40
+ :value => item[:value],
41
+ :storage => item[:storage]
42
+ })
43
+ end
44
+
45
+ create_aliases_request = VgsApiClient::CreateAliasesRequest.new(attributes = {
46
+ :data => requests
47
+ })
48
+ response = @aliases_api.create_aliases(opts = {
49
+ :create_aliases_request => create_aliases_request.to_hash
50
+ })
51
+
52
+ rescue
53
+ raise VgsApiException, "Failed to redact data #{ data }"
48
54
  else
49
- Configuration.default
55
+ response.data
50
56
  end
57
+
51
58
  end
59
+
60
+ def reveal(aliases)
61
+ begin
62
+ query = aliases.kind_of?(Array) ? aliases.join(",") : aliases
63
+ response = @aliases_api.reveal_multiple_aliases(q = query)
64
+ rescue
65
+ raise VgsApiException, "Failed to reveal aliases #{ aliases }"
66
+ else
67
+ response.data
68
+ end
69
+ end
70
+
71
+ def delete(_alias)
72
+ begin
73
+ @aliases_api.delete_alias(_alias = _alias)
74
+ rescue
75
+ raise VgsApiException, "Failed to delete alias #{ _alias }"
76
+ end
77
+ end
78
+
79
+ def update(_alias, data)
80
+ begin
81
+ update_alias_request = VgsApiClient::UpdateAliasRequest.new(attributes = {
82
+ :data => VgsApiClient::UpdateAliasRequestData.new(attributes = {
83
+ :classifiers => data[:classifiers]
84
+ })
85
+ })
86
+ @aliases_api.update_alias(_alias = _alias, opts = {
87
+ :update_alias_request => update_alias_request.to_hash
88
+ })
89
+ rescue
90
+ raise VgsApiException, "Failed to update alias #{ _alias }"
91
+ end
92
+ end
93
+ end
94
+
95
+ def self.config(username, password, host = 'https://api.sandbox.verygoodvault.com')
96
+ raise ArgumentError, 'username is nil' if username.nil?
97
+ raise ArgumentError, 'password is nil' if password.nil?
98
+
99
+ config = VgsApiClient::Configuration.default
100
+ config.username = username
101
+ config.password = password
102
+ config.host = host
103
+ config
52
104
  end
53
- end
105
+
106
+ end
@@ -1,9 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
- LIB_VERSION=${LIB_VERSION:-0.0.1.alpha$(date "+%Y%m%d%H%M")}
3
+ LIB_VERSION=${LIB_VERSION:-0.0.1.alpha202204221804.alpha$(date "+%Y%m%d%H%M")}
4
4
 
5
5
  # fix version
6
- grep -rl 0.0.1.alpha202204211352 . | xargs sed -i "s/0.0.1.alpha202204211352/${LIB_VERSION}/g"
6
+ grep -rl 0.0.1.alpha202204221804 . | xargs sed -i "s/0.0.1.alpha202204221804/${LIB_VERSION}/g"
7
7
 
8
8
  # build
9
9
  gem build vgs_api_client.gemspec
@@ -6,7 +6,7 @@ usage() { echo "Required env var '$1' is missing"; exit 1; }
6
6
 
7
7
  [ -z "${ARTIFACT_REPOSITORY_TOKEN}" ] && usage "ARTIFACT_REPOSITORY_TOKEN" ;
8
8
 
9
- LIB_VERSION=${LIB_VERSION:-0.0.1.alpha$(date "+%Y%m%d%H%M")}
9
+ LIB_VERSION=${LIB_VERSION:-0.0.1.alpha202204221804.alpha$(date "+%Y%m%d%H%M")}
10
10
 
11
11
  mkdir ~/.gem
12
12
  echo ":rubygems_api_key: ${ARTIFACT_REPOSITORY_TOKEN}" > ~/.gem/credentials
data/scripts/publish.sh CHANGED
@@ -6,7 +6,7 @@ usage() { echo "Required env var '$1' is missing"; exit 1; }
6
6
 
7
7
  [ -z "${ARTIFACT_REPOSITORY_TOKEN}" ] && usage "ARTIFACT_REPOSITORY_TOKEN" ;
8
8
 
9
- export LIB_VERSION=${LIB_VERSION:-0.0.1.alpha$(date "+%Y%m%d%H%M")}
9
+ export LIB_VERSION=${LIB_VERSION:-0.0.1.alpha202204221804.alpha$(date "+%Y%m%d%H%M")}
10
10
 
11
11
  docker-compose build && \
12
12
  docker-compose run assemble && \
@@ -2,7 +2,7 @@
2
2
 
3
3
  set -e
4
4
 
5
- export LIB_VERSION=${LIB_VERSION:-0.0.1.alpha$(date "+%Y%m%d%H%M")}
5
+ export LIB_VERSION=${LIB_VERSION:-0.0.1.alpha202204221804.alpha$(date "+%Y%m%d%H%M")}
6
6
 
7
7
  docker-compose build test-e2e && \
8
8
  docker-compose run test-e2e
data/scripts/test/run.sh CHANGED
@@ -4,10 +4,10 @@ set -e
4
4
 
5
5
  echo "Installing lib from local sources"
6
6
  # fix version
7
- VERSION=0.0.1.alpha$(date "+%Y%m%d%H%M")
8
- grep -rl 0.0.1.alpha202204211352 . | xargs sed -i "s/0.0.1.alpha202204211352/$VERSION/g"
7
+ VERSION=0.0.1.alpha202204221804.alpha$(date "+%Y%m%d%H%M")
8
+ grep -rl 0.0.1.alpha202204221804 . | xargs sed -i "s/0.0.1.alpha202204221804/$VERSION/g"
9
9
 
10
10
  bundle install
11
11
 
12
12
  echo "Running tests"
13
- bundle exec rspec ./spec/*.rb
13
+ bundle exec rspec -f documentation ./spec/*.rb
@@ -27,4 +27,4 @@ echo "Running tests"
27
27
  mv /vgs-api-client/tmp/Gemfile /vgs-api-client/
28
28
  mv /vgs-api-client/tmp/vgs_api_client.gemspec /vgs-api-client/
29
29
  bundle install --without production --binstubs
30
- bundle exec rspec ./spec/*.rb
30
+ bundle exec rspec -f documentation ./spec/*.rb
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'securerandom'
3
- require 'vgs'
3
+ require 'vgs_api_client'
4
4
 
5
5
  describe 'AliasesApiSpec' do
6
6
  before(:all) do
data/test.rb ADDED
@@ -0,0 +1,93 @@
1
+ require 'vgs'
2
+
3
+ # Defining the host is optional and defaults to https://api.sandbox.verygoodvault.com.
4
+ # For production use https://api.live.verygoodvault.com
5
+ config = VGS.config(
6
+ host = "https://api.sandbox.verygoodvault.com",
7
+ username = ENV["VAULT_API_USERNAME"],
8
+ password = ENV["VAULT_API_PASSWORD"]
9
+ )
10
+
11
+ # in this example we are storing three tokens within your VGS vault using a single API call
12
+ # this will return three tokens which can be stored in your system and used individually or together
13
+ # through any VGS Vault product including our Zero Data platform.
14
+ #
15
+ # the aliases namespace allows you to directly store, manage, and
16
+ # retrieve tokens from your vgs vault.
17
+ #
18
+ # in the below example we demonstrate how to store payment card and personally identifiable
19
+ # information in a single API call.
20
+ #
21
+ # see https://www.verygoodsecurity.com/docs/vault/what-is-zero-data
22
+ # to learn how to remove any servers handling sentistive information
23
+ # 100% from pci scope.
24
+
25
+ api = VGS::Aliases.new(config)
26
+
27
+ # first, let's create a request payload to tokenize our sensitive data.
28
+ data = [
29
+ # credit card
30
+ dict(
31
+ # format is used to determine how the stored token is represented
32
+ # see https://www.verygoodsecurity.com/docs/terminology/nomenclature#alias-formats
33
+ # to learn about different formats and representations available
34
+ # to tokenize secured data.
35
+ :format => "PFPT",
36
+ :value => "4111111111111111",
37
+ # see https://www.verygoodsecurity.com/docs/vault/concepts#classifiers
38
+ # to learn how to classify and tag your data to help secure access and
39
+ # route data compliantly.
40
+ :classifiers => ["credit-card", "number"],
41
+ :storage => "PERSISTENT"
42
+ ),
43
+ # card security code
44
+ dict(
45
+ :format => "UUID",
46
+ :value => "123",
47
+ :classifiers => ["credit-card", "csc"],
48
+ # learn how volatile storage allows you to maintain full pci compliance
49
+ # https://www.verygoodsecurity.com/docs/terminology/nomenclature#storage
50
+ :storage => "VOLATILE"
51
+ ),
52
+ # social security number
53
+ dict(
54
+ :format => "UUID",
55
+ :value => "078-05-1120",
56
+ :classifiers => ["pii", "ssn"]
57
+ )
58
+ ]
59
+ puts "Tokenizing multiple values..."
60
+
61
+ aliases = api.redact(data)
62
+
63
+ puts "Tokens created #{aliases}"
64
+
65
+ # example of how to find the alias associated to each value
66
+ puts aliases.map { |record| record.aliases[0]._alias }
67
+
68
+
69
+ # next, let's update the classifiers and re-alias
70
+ first_alias = aliases[0].aliases[0]._alias
71
+
72
+ api.update(first_alias, { :classifiers => ["bank-account", "test-tag"] })
73
+
74
+ puts "Token #{first_alias} updated"
75
+
76
+ # now let's retrieve it back
77
+ revealed = api.reveal(first_alias)
78
+
79
+ puts "Token #{first_alias} retrieved\n{revealed}"
80
+
81
+ # finally, let's delete an alias
82
+ api.delete(first_alias)
83
+
84
+ puts "Token #{first_alias} deleted"
85
+
86
+ # now let's fetch it back to ensure it's not usable.
87
+ puts "Trying to retrieve deleted token #{first_alias}..."
88
+ begin
89
+ api.reveal(first_alias)
90
+ rescue => error
91
+ puts "We can no longer fetch the token, it has been deleted: #{error.message}"
92
+ end
93
+
@@ -1,32 +1,26 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
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"
3
+ require_relative "lib/version"
17
4
 
18
5
  Gem::Specification.new do |s|
19
6
  s.name = "vgs_api_client"
20
- s.version = VgsApiClient::VERSION
7
+ s.version = VGS::VERSION
21
8
  s.platform = Gem::Platform::RUBY
22
9
  s.authors = ["Very Good Security"]
23
- s.email = ["dev@verygoodsecurity.com"]
24
- s.homepage = "https://openapi-generator.tech"
25
- s.summary = "A ruby wrapper for the VGS Vault API"
10
+ s.email = ["support@verygoodsecurity.com"]
11
+ s.homepage = "https://github.com/verygoodsecurity/vgs-api-client-ruby"
12
+ s.summary = "VGS API Client"
26
13
  s.description = "This gem maps to VGS Vault API"
27
- s.license = "Unlicense"
14
+ s.license = "BSD"
28
15
  s.required_ruby_version = ">= 2.4"
29
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
+
30
24
  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
25
 
32
26
  s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
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.alpha202204211352
4
+ version: 0.0.1.alpha202204221804
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-21 00:00:00.000000000 Z
11
+ date: 2022-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -52,18 +52,20 @@ dependencies:
52
52
  version: 3.6.0
53
53
  description: This gem maps to VGS Vault API
54
54
  email:
55
- - dev@verygoodsecurity.com
55
+ - support@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
64
  - RELEASE.md
64
65
  - Rakefile
66
+ - datadog.rb
65
67
  - docker-compose.yaml
66
- - lib/vgs.rb
68
+ - lib/version.rb
67
69
  - lib/vgs_api_client.rb
68
70
  - lib/vgs_api_client/api/aliases_api.rb
69
71
  - lib/vgs_api_client/api_client.rb
@@ -98,11 +100,16 @@ files:
98
100
  - spec/configuration_spec.rb
99
101
  - spec/spec_helper.rb
100
102
  - spec/test_aliases_api_spec.rb
103
+ - test.rb
101
104
  - vgs_api_client.gemspec
102
- homepage: https://openapi-generator.tech
105
+ homepage: https://github.com/verygoodsecurity/vgs-api-client-ruby
103
106
  licenses:
104
- - Unlicense
105
- metadata: {}
107
+ - BSD
108
+ metadata:
109
+ homepage_uri: https://www.verygoodsecurity.com
110
+ bug_tracker_uri: https://github.com/verygoodsecurity/vgs-api-client-ruby/issues
111
+ documentation_uri: https://www.verygoodsecurity.com/docs
112
+ source_code_uri: https://github.com/verygoodsecurity/vgs-api-client-ruby
106
113
  post_install_message:
107
114
  rdoc_options: []
108
115
  require_paths:
@@ -121,7 +128,7 @@ requirements: []
121
128
  rubygems_version: 3.3.7
122
129
  signing_key:
123
130
  specification_version: 4
124
- summary: A ruby wrapper for the VGS Vault API
131
+ summary: VGS API Client
125
132
  test_files:
126
133
  - spec/api_client_spec.rb
127
134
  - spec/configuration_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