digicert 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.hound.yml +3 -0
- data/.rspec +0 -1
- data/.rubocop.yml +629 -0
- data/.sample.env +4 -0
- data/.sample.pryrc +3 -0
- data/.travis.yml +5 -2
- data/LICENSE.txt +21 -0
- data/README.md +812 -9
- data/bin/console +2 -5
- data/bin/rspec +17 -0
- data/digicert.gemspec +7 -14
- data/lib/digicert.rb +40 -2
- data/lib/digicert/actions.rb +9 -0
- data/lib/digicert/actions/all.rb +27 -0
- data/lib/digicert/actions/base.rb +11 -0
- data/lib/digicert/actions/create.rb +25 -0
- data/lib/digicert/actions/fetch.rb +21 -0
- data/lib/digicert/actions/update.rb +25 -0
- data/lib/digicert/base.rb +35 -0
- data/lib/digicert/base_order.rb +39 -0
- data/lib/digicert/certificate.rb +43 -0
- data/lib/digicert/certificate_downloader.rb +137 -0
- data/lib/digicert/certificate_request.rb +19 -0
- data/lib/digicert/client_certificate/base.rb +17 -0
- data/lib/digicert/client_certificate/digital_signature_plus.rb +13 -0
- data/lib/digicert/client_certificate/email_security_plus.rb +13 -0
- data/lib/digicert/client_certificate/premium.rb +17 -0
- data/lib/digicert/config.rb +21 -0
- data/lib/digicert/configuration.rb +26 -0
- data/lib/digicert/container.rb +35 -0
- data/lib/digicert/container_template.rb +32 -0
- data/lib/digicert/csr_generator.rb +43 -0
- data/lib/digicert/debugger.rb +34 -0
- data/lib/digicert/domain.rb +59 -0
- data/lib/digicert/duplicate_certificate.rb +21 -0
- data/lib/digicert/duplicate_certificate_finder.rb +42 -0
- data/lib/digicert/email_validation.rb +35 -0
- data/lib/digicert/errors.rb +30 -0
- data/lib/digicert/errors/forbidden.rb +9 -0
- data/lib/digicert/errors/request_error.rb +37 -0
- data/lib/digicert/errors/server_error.rb +9 -0
- data/lib/digicert/errors/unauthorized.rb +9 -0
- data/lib/digicert/expiring_order.rb +21 -0
- data/lib/digicert/findable.rb +33 -0
- data/lib/digicert/order.rb +81 -0
- data/lib/digicert/order_cancellation.rb +25 -0
- data/lib/digicert/order_duplicator.rb +11 -0
- data/lib/digicert/order_manager.rb +39 -0
- data/lib/digicert/order_reissuer.rb +11 -0
- data/lib/digicert/organization.rb +43 -0
- data/lib/digicert/product.rb +14 -0
- data/lib/digicert/request.rb +123 -0
- data/lib/digicert/response.rb +30 -0
- data/lib/digicert/ssl_certificate/base.rb +9 -0
- data/lib/digicert/ssl_certificate/ssl_ev_plus.rb +13 -0
- data/lib/digicert/ssl_certificate/ssl_plus.rb +13 -0
- data/lib/digicert/ssl_certificate/ssl_wildcard.rb +13 -0
- data/lib/digicert/version.rb +23 -1
- data/spec/acceptance/certificate_download_spec.rb +68 -0
- data/spec/acceptance/duplicating_certificate_spec.rb +86 -0
- data/spec/acceptance/reissuing_certificate_spec.rb +104 -0
- data/spec/digicert/actions/all_spec.rb +26 -0
- data/spec/digicert/actions/create_spec.rb +47 -0
- data/spec/digicert/actions/fetch_spec.rb +28 -0
- data/spec/digicert/actions/update_spec.rb +39 -0
- data/spec/digicert/certificate_downloader_spec.rb +89 -0
- data/spec/digicert/certificate_request_spec.rb +49 -0
- data/spec/digicert/certificate_spec.rb +93 -0
- data/spec/digicert/client_certificate/digital_signature_plus_spec.rb +32 -0
- data/spec/digicert/client_certificate/email_security_plus_spec.rb +36 -0
- data/spec/digicert/client_certificate/premium_spec.rb +34 -0
- data/spec/digicert/config_spec.rb +39 -0
- data/spec/digicert/container_spec.rb +44 -0
- data/spec/digicert/container_template_spec.rb +32 -0
- data/spec/digicert/csr_generator_spec.rb +31 -0
- data/spec/digicert/domain_spec.rb +89 -0
- data/spec/digicert/duplicate_certificate_finder_spec.rb +27 -0
- data/spec/digicert/duplicate_certificate_spec.rb +15 -0
- data/spec/digicert/email_validation_spec.rb +26 -0
- data/spec/digicert/expiring_order_spec.rb +16 -0
- data/spec/digicert/findable_spec.rb +19 -0
- data/spec/digicert/order_cancellation_spec.rb +24 -0
- data/spec/digicert/order_duplicator_spec.rb +35 -0
- data/spec/digicert/order_reissuer_spec.rb +35 -0
- data/spec/digicert/order_spec.rb +134 -0
- data/spec/digicert/organization_spec.rb +61 -0
- data/spec/digicert/product_spec.rb +28 -0
- data/spec/digicert/request_spec.rb +47 -0
- data/spec/digicert/ssl_certificate/ssl_ev_plus_spec.rb +35 -0
- data/spec/digicert/ssl_certificate/ssl_plus_spec.rb +36 -0
- data/spec/digicert/ssl_certificate/ssl_wildcard_spec.rb +35 -0
- data/spec/fixtures/certificate.pem +79 -0
- data/spec/fixtures/certificate.zip +0 -0
- data/spec/fixtures/certificate_request.json +116 -0
- data/spec/fixtures/certificate_requests.json +59 -0
- data/spec/fixtures/certificate_revoked.json +13 -0
- data/spec/fixtures/container.json +15 -0
- data/spec/fixtures/container_created.json +3 -0
- data/spec/fixtures/container_template.json +15 -0
- data/spec/fixtures/container_templates.json +14 -0
- data/spec/fixtures/containers.json +14 -0
- data/spec/fixtures/domain.json +71 -0
- data/spec/fixtures/domain_created.json +3 -0
- data/spec/fixtures/domains.json +49 -0
- data/spec/fixtures/email_validations.json +17 -0
- data/spec/fixtures/empty.json +0 -0
- data/spec/fixtures/errors.json +6 -0
- data/spec/fixtures/expiring_orders.json +20 -0
- data/spec/fixtures/order.json +107 -0
- data/spec/fixtures/order_created.json +9 -0
- data/spec/fixtures/order_duplicated.json +8 -0
- data/spec/fixtures/order_duplications.json +57 -0
- data/spec/fixtures/order_reissued.json +8 -0
- data/spec/fixtures/orders.json +93 -0
- data/spec/fixtures/organization.json +35 -0
- data/spec/fixtures/organization_created.json +3 -0
- data/spec/fixtures/organizations.json +84 -0
- data/spec/fixtures/ping.json +3 -0
- data/spec/fixtures/product.json +71 -0
- data/spec/fixtures/products.json +100 -0
- data/spec/fixtures/rsa4096.key +51 -0
- data/spec/requests/certificate_duplication_spec.rb +41 -0
- data/spec/requests/certificate_generation_spec.rb +93 -0
- data/spec/requests/certificate_reissuing_spec.rb +38 -0
- data/spec/requests/container_management_spec.rb +36 -0
- data/spec/requests/domain_management_spec.rb +64 -0
- data/spec/requests/order_client_email_security_plus_spec.rb +38 -0
- data/spec/requests/order_management_spec.rb +24 -0
- data/spec/requests/order_ssl_ev_plus_spec.rb +57 -0
- data/spec/requests/order_ssl_wildcard_spec.rb +57 -0
- data/spec/requests/organization_management_spec.rb +22 -0
- data/spec/requests/product_management_spec.rb +24 -0
- data/spec/requests/request_management_spec.rb +24 -0
- data/spec/spec_helper.rb +35 -0
- data/spec/support/fake_digicert_api.rb +324 -0
- metadata +162 -5
@@ -0,0 +1,30 @@
|
|
1
|
+
require "json"
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
module Digicert
|
5
|
+
class Response
|
6
|
+
def initialize(response)
|
7
|
+
@response = response
|
8
|
+
end
|
9
|
+
|
10
|
+
def parse
|
11
|
+
parse_response || response
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
attr_reader :response
|
17
|
+
|
18
|
+
def parse_response
|
19
|
+
if response.body
|
20
|
+
JSON.parse(response.body, object_class: response_object_klass)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def response_object_klass
|
25
|
+
Digicert.configuration.response_klass
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class ResponseObject < OpenStruct;end
|
30
|
+
end
|
data/lib/digicert/version.rb
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2017 Ribose Inc.
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
# ++
|
22
|
+
|
1
23
|
module Digicert
|
2
|
-
VERSION = "0.1.
|
24
|
+
VERSION = "0.1.1".freeze
|
3
25
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "digicert"
|
3
|
+
|
4
|
+
RSpec.describe "Download a certificate" do
|
5
|
+
it "creates and download an approved certificate" do
|
6
|
+
name_id = "ssl_plus"
|
7
|
+
|
8
|
+
# Retrieve the product details uisng the
|
9
|
+
# name id specificed for that specific one
|
10
|
+
#
|
11
|
+
stub_digicert_product_fetch_api(name_id)
|
12
|
+
product = Digicert::Product.fetch(name_id)
|
13
|
+
|
14
|
+
# Order a new certificate using the product details
|
15
|
+
# server platform, signature hash and other fields
|
16
|
+
#
|
17
|
+
order_attributes = build_order_attributes(product)
|
18
|
+
stub_digicert_order_create_api("ssl_plus", order_attributes)
|
19
|
+
order = Digicert::Order.create("ssl_plus", order_attributes)
|
20
|
+
|
21
|
+
# Retrieve the certificate order details with the
|
22
|
+
# certificate id in it, so we can use this one to
|
23
|
+
# download the certificate using the API
|
24
|
+
#
|
25
|
+
stub_digicert_order_fetch_api(order.id)
|
26
|
+
certificate_order = Digicert::Order.fetch(order.id)
|
27
|
+
|
28
|
+
# Now that we have the certicate orders detials with
|
29
|
+
# the certificate id and the order status, so let's assume
|
30
|
+
# all requiremetns are meet and let's fetch the certificate
|
31
|
+
#
|
32
|
+
certificate_id = certificate_order.certificate.id
|
33
|
+
stub_digicert_certificate_download_by_platform(certificate_id)
|
34
|
+
certificate = Digicert::CertificateDownloader.fetch(certificate_id)
|
35
|
+
|
36
|
+
# Normally zip archieves content starts with `PK` and then
|
37
|
+
# the content of the files inside the zip folder
|
38
|
+
#
|
39
|
+
# Source: http://filext.com/faq/look_into_files.php
|
40
|
+
#
|
41
|
+
expect(certificate.code.to_i).to eq(200)
|
42
|
+
expect(certificate.body.start_with?("PK")).to be_truthy
|
43
|
+
end
|
44
|
+
|
45
|
+
def build_order_attributes(product)
|
46
|
+
{
|
47
|
+
certificate: {
|
48
|
+
organization_units: ["Developer Operations"],
|
49
|
+
server_platform: { id: product.server_platforms.first.id },
|
50
|
+
profile_option: "some_ssl_profile",
|
51
|
+
|
52
|
+
csr: "------ [CSR HERE] ------",
|
53
|
+
common_name: "digicert.com",
|
54
|
+
signature_hash: product.signature_hash_types.allowed_hash_types[0].id,
|
55
|
+
},
|
56
|
+
organization: { id: organizations.first.id },
|
57
|
+
validity_years: product.allowed_validity_years.last,
|
58
|
+
disable_renewal_notifications: false,
|
59
|
+
renewal_of_order_id: 314152,
|
60
|
+
payment_method: "balance",
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
def organizations
|
65
|
+
stub_digicert_organization_list_api
|
66
|
+
Digicert::Organization.all
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "Certificate Order Duplication" do
|
4
|
+
it "duplicates and download a certificate" do
|
5
|
+
name_id = "ssl_plus"
|
6
|
+
|
7
|
+
# Create a new order for a specific product
|
8
|
+
# and it usages the attributes form a helper
|
9
|
+
#
|
10
|
+
stub_digicert_order_create_api(name_id, order_attributes)
|
11
|
+
order = Digicert::Order.create(name_id, order_attributes)
|
12
|
+
|
13
|
+
# Duplicate the certificate order
|
14
|
+
# We have the order id from the previous order
|
15
|
+
# creation interface, let's use that to duplicate
|
16
|
+
# the certificate order
|
17
|
+
#
|
18
|
+
order_obj = Digicert::Order.find(order.id)
|
19
|
+
stub_digicert_order_duplicate_api(order.id, certificate_attributes)
|
20
|
+
duplicate_order = order_obj.duplicate(certificate_attributes)
|
21
|
+
|
22
|
+
# Retrieve the request details from the
|
23
|
+
# Order Reissuing requests, if it needs further
|
24
|
+
# processing then we can use that id to do that
|
25
|
+
#
|
26
|
+
request_id = duplicate_order.requests.first.id
|
27
|
+
stub_digicert_certificate_request_fetch_api(request_id)
|
28
|
+
request = Digicert::CertificateRequest.fetch(request_id)
|
29
|
+
|
30
|
+
# We can recheck the request status, and once that
|
31
|
+
# is approved (manually/using the interface), then
|
32
|
+
# we can use that to retrieve the order details
|
33
|
+
#
|
34
|
+
stub_digicert_order_fetch_api(request.order.id)
|
35
|
+
certificate_order = Digicert::Order.fetch(request.order.id)
|
36
|
+
|
37
|
+
# Finally we can use that certificate id from that
|
38
|
+
# certificate_order's certificate and then we can
|
39
|
+
# write it to some files.
|
40
|
+
#
|
41
|
+
certificate_id = certificate_order.certificate.id
|
42
|
+
stub_digicert_certificate_download_by_platform(certificate_id)
|
43
|
+
certificate = Digicert::CertificateDownloader.fetch(certificate_id)
|
44
|
+
|
45
|
+
expect(certificate.code.to_i).to eq(200)
|
46
|
+
expect(certificate.body.start_with?("PK")).to be_truthy
|
47
|
+
end
|
48
|
+
|
49
|
+
def order_attributes
|
50
|
+
{
|
51
|
+
certificate: {
|
52
|
+
organization_units: ["Developer Operations"],
|
53
|
+
server_platform: { id: "platform_id" },
|
54
|
+
profile_option: "some_ssl_profile",
|
55
|
+
|
56
|
+
csr: "------ [CSR HERE] ------",
|
57
|
+
common_name: "digicert.com",
|
58
|
+
signature_hash: "sha256",
|
59
|
+
},
|
60
|
+
organization: { id: 123_456 },
|
61
|
+
validity_years: 1,
|
62
|
+
disable_renewal_notifications: false,
|
63
|
+
renewal_of_order_id: 314152,
|
64
|
+
payment_method: "balance",
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
def certificate_attributes
|
69
|
+
{
|
70
|
+
certificate: {
|
71
|
+
common_name: order.certificate.common_name,
|
72
|
+
dns_names: order.certificate.dns_names,
|
73
|
+
csr: order.certificate.csr,
|
74
|
+
signature_hash: order.certificate.signature_hash,
|
75
|
+
server_platform: { id: order.certificate.server_platform.id },
|
76
|
+
}
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
def order
|
81
|
+
order_id = 542772
|
82
|
+
|
83
|
+
stub_digicert_order_fetch_api(order_id)
|
84
|
+
@order ||= Digicert::Order.fetch(order_id)
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "Re-issuing a certificate" do
|
4
|
+
it "reissues and download a certificate" do
|
5
|
+
name_id = "ssl_plus"
|
6
|
+
|
7
|
+
# Create a new order for a specific product
|
8
|
+
# and it usages the attributes form a helper
|
9
|
+
#
|
10
|
+
stub_digicert_order_create_api(name_id, order_attributes)
|
11
|
+
order = Digicert::Order.create(name_id, order_attributes)
|
12
|
+
|
13
|
+
# Reissue an existing certificate order, it
|
14
|
+
# usages the order_id from the existing order
|
15
|
+
#
|
16
|
+
stub_digicert_order_reissue_api(order.id, new_order_attributes)
|
17
|
+
reissued_order = Digicert::OrderReissuer.create(
|
18
|
+
order_id: order.id, **new_order_attributes,
|
19
|
+
)
|
20
|
+
|
21
|
+
# Retrieve the request details from the
|
22
|
+
# Order Reissuing requests, if it needs further
|
23
|
+
# processing then we can use that id to do that
|
24
|
+
#
|
25
|
+
request_id = reissued_order.requests.first.id
|
26
|
+
stub_digicert_certificate_request_fetch_api(request_id)
|
27
|
+
request = Digicert::CertificateRequest.fetch(request_id)
|
28
|
+
|
29
|
+
# Let's checks the request status if it's pending
|
30
|
+
# then we can update the status using the update
|
31
|
+
# interface on Digicert::CertificateRequest
|
32
|
+
#
|
33
|
+
if request.status == "pending"
|
34
|
+
stub_digicert_certificate_request_update_api(
|
35
|
+
request_id, request_status_attributes,
|
36
|
+
)
|
37
|
+
|
38
|
+
Digicert::CertificateRequest.update(request_id, request_status_attributes)
|
39
|
+
end
|
40
|
+
|
41
|
+
# We can recheck the request status, and once that
|
42
|
+
# is approved (manually/using the interface), then
|
43
|
+
# we can use that to retrieve the order details
|
44
|
+
#
|
45
|
+
stub_digicert_order_fetch_api(request.order.id)
|
46
|
+
certificate_order = Digicert::Order.fetch(request.order.id)
|
47
|
+
|
48
|
+
# Finally we can use that certificate id from that
|
49
|
+
# certificate_order's certificate and then we can
|
50
|
+
# write it to some files.
|
51
|
+
#
|
52
|
+
certificate_id = certificate_order.certificate.id
|
53
|
+
stub_digicert_certificate_download_by_platform(certificate_id)
|
54
|
+
certificate = Digicert::CertificateDownloader.fetch(certificate_id)
|
55
|
+
|
56
|
+
expect(certificate.code.to_i).to eq(200)
|
57
|
+
expect(certificate.body.start_with?("PK")).to be_truthy
|
58
|
+
end
|
59
|
+
|
60
|
+
def order_attributes
|
61
|
+
{
|
62
|
+
certificate: {
|
63
|
+
organization_units: ["Developer Operations"],
|
64
|
+
server_platform: { id: "platform_id" },
|
65
|
+
profile_option: "some_ssl_profile",
|
66
|
+
|
67
|
+
csr: "------ [CSR HERE] ------",
|
68
|
+
common_name: "digicert.com",
|
69
|
+
signature_hash: "sha256",
|
70
|
+
},
|
71
|
+
organization: { id: 123_456 },
|
72
|
+
validity_years: 1,
|
73
|
+
disable_renewal_notifications: false,
|
74
|
+
renewal_of_order_id: 314152,
|
75
|
+
payment_method: "balance",
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def new_order_attributes
|
80
|
+
{
|
81
|
+
certificate: {
|
82
|
+
common_name: order.certificate.common_name,
|
83
|
+
dns_names: order.certificate.dns_names,
|
84
|
+
csr: order.certificate.csr,
|
85
|
+
signature_hash: order.certificate.signature_hash,
|
86
|
+
server_platform: { id: order.certificate.server_platform.id },
|
87
|
+
}
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
def request_status_attributes
|
92
|
+
{
|
93
|
+
status: "approved",
|
94
|
+
processor_comment: "Your domain is approved",
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
def order
|
99
|
+
order_id = 542772
|
100
|
+
stub_digicert_order_fetch_api(order_id)
|
101
|
+
|
102
|
+
@order ||= Digicert::Order.fetch(order_id)
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "digicert/base"
|
3
|
+
|
4
|
+
RSpec.describe "Digicert::Actions::ALL" do
|
5
|
+
describe ".all" do
|
6
|
+
it "retrieves the list of resources" do
|
7
|
+
stub_digicert_organization_list_api
|
8
|
+
organizations = Digicert::TestAllAction.all
|
9
|
+
|
10
|
+
expect(organizations.count).to eq(2)
|
11
|
+
expect(organizations.first.name).not_to be_nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Digicert
|
16
|
+
class TestAllAction < Digicert::Base
|
17
|
+
include Digicert::Actions::All
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def resource_path
|
22
|
+
"organization"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "digicert/base"
|
3
|
+
|
4
|
+
RSpec.describe "Digicert::Actions::Create" do
|
5
|
+
describe ".create" do
|
6
|
+
it "creates a new resource" do
|
7
|
+
stub_digicert_container_create_api(container_attributes)
|
8
|
+
resource = Digicert::TestCreateAction.create(container_attributes)
|
9
|
+
|
10
|
+
expect(resource.id).not_to be_nil
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module Digicert
|
15
|
+
class TestCreateAction < Digicert::Base
|
16
|
+
include Digicert::Actions::Create
|
17
|
+
|
18
|
+
def initialize(attributes = {})
|
19
|
+
@container_id = attributes.delete(:container_id)
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def resource_creation_path
|
26
|
+
["container", @container_id, "children"].join("/")
|
27
|
+
end
|
28
|
+
|
29
|
+
def validate(name:, template_id:, **attributes)
|
30
|
+
{
|
31
|
+
name: name,
|
32
|
+
template_id: template_id,
|
33
|
+
|
34
|
+
}.merge(attributes)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def container_attributes
|
40
|
+
{
|
41
|
+
container_id: 123_456_789,
|
42
|
+
name: "History Department",
|
43
|
+
template_id: 5,
|
44
|
+
description: "History, Civ, Ancient Languages",
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|