varanus 0.4.0 → 0.5.0

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: 72820b52f9184bfc3c35816e39b1c721d0e4eabf6c660b6c4da95d5cdb1bf025
4
- data.tar.gz: 3cc5f9ac737e5c375027db08860443b6ece64dac58ad7cf7e515a9f6009e825a
3
+ metadata.gz: f457939fd1e7cb008b0a137827856048714d31a4fb2fda63ec027054ea62da58
4
+ data.tar.gz: 311572c2744ddfa0589282fec69f54eafd9ee1f602caf930f7d20051732c0ae4
5
5
  SHA512:
6
- metadata.gz: 614b412e36992ee4a7c99f06a26e7e5f3768960200e2d962e8ffd9d0aaf64502dc81643be9c038b151ca44de0dea84a952f8a58b1d67b1379f1cf0806a3fdbd5
7
- data.tar.gz: 484a02bacc17c1b26ad7749d10142bf48570a6260b5557267318d25bb3d051ac3a19030f7522ef9684274424d4a7f25d2e863faedf6d64c75932eb1a9fd63af8
6
+ metadata.gz: bc74433391a0cb8c59b8159e480b5acf5f519659216d0b2beaa83b2400bf4873db400b740c5ab2e1282870502edbc8351a13a702c498e5b4e76bc135c78b66c9
7
+ data.tar.gz: 11a6884e37fb4eec2c763f6ca428dd00dca6e113f3158722f5c5deed9468a09ee1496c27862cd623268a30821c4e9de365ed01033723f968825e55f9da7312ec
@@ -1,3 +1,8 @@
1
+ ### Version 0.5.0 (2021-01-26)
2
+ * Add Varanus::Domain
3
+ * Add Varanus::SSL#list and Varanus::SSL#info
4
+ * Add Varanus::Organization
5
+
1
6
  ### 0.4.0 (2021-01-06)
2
7
  * Add Varanus::DCV
3
8
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- varanus (0.4.0)
4
+ varanus (0.5.0)
5
5
  faraday
6
6
  faraday_middleware
7
7
  savon (~> 2.0)
@@ -35,6 +35,18 @@ class Varanus
35
35
  @dcv ||= DCV.new(self)
36
36
  end
37
37
 
38
+ # Retrieve Domain instance
39
+ # @return [Varanus::Domain]
40
+ def domain
41
+ @domain ||= Domain.new(self)
42
+ end
43
+
44
+ # Retrieve Organization instance
45
+ # @return [Varanus::Organization]
46
+ def organization
47
+ @organization ||= Organization.new(self)
48
+ end
49
+
38
50
  # Retrieve Reports instance
39
51
  # @return [Varanus::Reports]
40
52
  def reports
@@ -58,6 +70,8 @@ require 'savon'
58
70
  require 'varanus/error'
59
71
  require 'varanus/rest_resource'
60
72
  require 'varanus/dcv'
73
+ require 'varanus/domain'
74
+ require 'varanus/organization'
61
75
  require 'varanus/reports'
62
76
  require 'varanus/ssl'
63
77
  require 'varanus/ssl/csr'
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A connection to the Domain API
4
+ class Varanus::Domain < Varanus::RestResource
5
+ # Create a new domain. The domain may need to be manually approved after this is
6
+ # called.
7
+ # +name+ is the domain
8
+ # +delegations+ is an Array of Hashes. Each Hash should have an 'orgId' and
9
+ # 'certTypes' key
10
+ # opts may include the following keys:
11
+ # - :description - optional - String
12
+ # - :active - optional - Boolean (defaults to +true+)
13
+ # - :allow_subdomains - optional - set to +false+ if you don't want to allow sub
14
+ # domains for this entry
15
+ #
16
+ # @returns [String] - URL for newly created domain
17
+ def create domain, delegations, opts = {}
18
+ opts = opts.dup
19
+ allow_subdomains = opts.delete(:allow_subdomains)
20
+ domain = "*.#{domain}" if allow_subdomains != false && !domain.start_with?('*.')
21
+
22
+ result = @varanus.connection.post('domain/v1',
23
+ opts.merge(name: domain, delegations: delegations))
24
+ check_result result
25
+ result.headers['Location']
26
+ end
27
+
28
+ # Return info on domain. +id+ must be the id returned by #list
29
+ def info id
30
+ get("domain/v1/#{id}")
31
+ end
32
+
33
+ def list opts = {}
34
+ get_with_size_and_position('domain/v1', opts)
35
+ end
36
+
37
+ def list_with_info opts = {}
38
+ domains = list(opts)
39
+ domains.map! { |domain| info(domain['id']) }
40
+ domains
41
+ end
42
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A connection to the Organization API
4
+ class Varanus::Organization < Varanus::RestResource
5
+ # Return info on organization.
6
+ def info id
7
+ get("organization/v1/#{id}")
8
+ end
9
+
10
+ def list
11
+ get('organization/v1')
12
+ end
13
+ end
@@ -55,6 +55,15 @@ class Varanus::SSL < Varanus::RestResource
55
55
  get("ssl/v1/collect/#{id}/#{type}")
56
56
  end
57
57
 
58
+ # Returns info on the SSL certificate of the given name
59
+ def info id
60
+ get("ssl/v1/#{id}")
61
+ end
62
+
63
+ def list opts = {}
64
+ get_with_size_and_position('ssl/v1', opts)
65
+ end
66
+
58
67
  # Revoke an ssl cert
59
68
  # @param id [Integer] As returned by {#sign}
60
69
  # @param reason [String] Reason for revoking. Sectigo's API will return an error if it
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Varanus
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: varanus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Dilda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-06 00:00:00.000000000 Z
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -205,7 +205,9 @@ files:
205
205
  - docker-compose.yml
206
206
  - lib/varanus.rb
207
207
  - lib/varanus/dcv.rb
208
+ - lib/varanus/domain.rb
208
209
  - lib/varanus/error.rb
210
+ - lib/varanus/organization.rb
209
211
  - lib/varanus/reports.rb
210
212
  - lib/varanus/rest_resource.rb
211
213
  - lib/varanus/ssl.rb