digicert 0.1.2 → 0.2.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
  SHA1:
3
- metadata.gz: fdf876cef7eea96750f7678894027221b448f2e6
4
- data.tar.gz: fcb2979e844e56a22617647f85d50364d2038b0c
3
+ metadata.gz: 6c74c249a9270232627bac89c2dd50fafe7e5716
4
+ data.tar.gz: 437b67f4b9f77b265aa7007bb2e7646cb28f70c8
5
5
  SHA512:
6
- metadata.gz: dfc0e06614d1e50fe1379855abe21f099574c4af48878c9ea109f5a5ad4b61c4b72fe3f7897c30279683160afcacdb72c7cd6f7daf73d3d25ae86a027bfa7d0d
7
- data.tar.gz: c97dc961f495a41aa270e02bcf4cedeedc7cc95071ec5e1a4d6a9230d099fe5fcad3572e8b043bc3f16fb931551df9118703509f01498cef676f2d139953095e
6
+ metadata.gz: b3996047b941dc247f6499730d0988f8aa0e6c4d9d9cf166ffa0b9044e3800f278e6e8bd859694fb2901bdbcfda476ea6f10237f097602a78a22f31f870520cc
7
+ data.tar.gz: bb2d9796001e2a277f2e446308b675d27853d0ee1c1754e6ba7917fcdea64868ff7f555ee9c766f4e64e42631d7c47e4d037cfcf426d40c7b18aa41f5d3a6924
@@ -0,0 +1,13 @@
1
+ ## 0.2.0 (2017-08-09)
2
+
3
+ * Fix reissue/duplication issue for custom attribute (PR #124)
4
+
5
+ ## 0.1.2 (2017-05-20)
6
+
7
+ * Add support for query params in orders (PR #118)
8
+ * Add filter support for digicert resources (PR #120)
9
+ * Expose test stubs and helpers to developer (PR #115)
10
+
11
+ ### 0.1.1 (2017-04-17)
12
+
13
+ * Initial Release - Fully Functional (PR #112)
data/README.md CHANGED
@@ -595,13 +595,11 @@ already exists for that order.
595
595
  ```ruby
596
596
  Digicert::OrderReissuer.create(
597
597
  order: order_id,
598
- certificate: {
599
- common_name: certificate_common_name,
600
- dns_names: [certificate_dns_name],
601
- csr: certificate_csr,
602
- signature_hash: certificate_signature_hash,
603
- server_platform: { id: certificate_server_platform_id },
604
- }
598
+ common_name: certificate_common_name,
599
+ dns_names: [certificate_dns_name],
600
+ csr: certificate_csr,
601
+ signature_hash: certificate_signature_hash,
602
+ server_platform: { id: certificate_server_platform_id },
605
603
  )
606
604
  ```
607
605
 
@@ -615,13 +613,11 @@ hash. The common name and sans need to be the same as the original order.
615
613
  ```ruby
616
614
  Digicert::OrderDuplicator.create(
617
615
  order: order_id,
618
- certificate: {
619
- common_name: certificate_common_name,
620
- dns_names: [certificate_dns_name],
621
- csr: certificate_csr,
622
- signature_hash: certificate_signature_hash,
623
- server_platform: { id: certificate_server_platform_id },
624
- }
616
+ common_name: certificate_common_name,
617
+ dns_names: [certificate_dns_name],
618
+ csr: certificate_csr,
619
+ signature_hash: certificate_signature_hash,
620
+ server_platform: { id: certificate_server_platform_id },
625
621
  )
626
622
  ```
627
623
 
@@ -11,18 +11,16 @@ module Digicert
11
11
  private
12
12
 
13
13
  def validate(attributes)
14
- order_attributes.merge(attributes)
14
+ { certificate: order_attributes.merge(attributes) }
15
15
  end
16
16
 
17
17
  def order_attributes
18
18
  {
19
- certificate: {
20
- common_name: order.certificate.common_name,
21
- dns_names: order.certificate.dns_names,
22
- csr: order.certificate.csr,
23
- signature_hash: order.certificate.signature_hash,
24
- server_platform: { id: order.certificate.server_platform.id },
25
- },
19
+ common_name: order.certificate.common_name,
20
+ dns_names: order.certificate.dns_names,
21
+ csr: order.certificate.csr,
22
+ signature_hash: order.certificate.signature_hash,
23
+ server_platform: { id: order.certificate.server_platform.id },
26
24
  }
27
25
  end
28
26
 
@@ -21,5 +21,5 @@
21
21
  # ++
22
22
 
23
23
  module Digicert
24
- VERSION = "0.1.2".freeze
24
+ VERSION = "0.2.0".freeze
25
25
  end
@@ -67,13 +67,11 @@ RSpec.describe "Certificate Order Duplication" do
67
67
 
68
68
  def certificate_attributes
69
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
- },
70
+ common_name: order.certificate.common_name,
71
+ dns_names: order.certificate.dns_names,
72
+ csr: order.certificate.csr,
73
+ signature_hash: order.certificate.signature_hash,
74
+ server_platform: { id: order.certificate.server_platform.id },
77
75
  }
78
76
  end
79
77
 
@@ -13,9 +13,9 @@ RSpec.describe "Re-issuing a certificate" do
13
13
  # Reissue an existing certificate order, it
14
14
  # usages the order_id from the existing order
15
15
  #
16
- stub_digicert_order_reissue_api(order.id, new_order_attributes)
16
+ stub_digicert_order_reissue_api(order.id, certificate_attributes)
17
17
  reissued_order = Digicert::OrderReissuer.create(
18
- order_id: order.id, **new_order_attributes,
18
+ order_id: order.id, **certificate_attributes,
19
19
  )
20
20
 
21
21
  # Retrieve the request details from the
@@ -76,15 +76,13 @@ RSpec.describe "Re-issuing a certificate" do
76
76
  }
77
77
  end
78
78
 
79
- def new_order_attributes
79
+ def certificate_attributes
80
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
- },
81
+ common_name: order.certificate.common_name,
82
+ dns_names: order.certificate.dns_names,
83
+ csr: order.certificate.csr,
84
+ signature_hash: order.certificate.signature_hash,
85
+ server_platform: { id: order.certificate.server_platform.id },
88
86
  }
89
87
  end
90
88
 
@@ -5,7 +5,7 @@ RSpec.describe Digicert::OrderDuplicator do
5
5
  it "creates a duplicate of an existing order" do
6
6
  stub_digicert_order_fetch_api(order_id)
7
7
 
8
- stub_digicert_order_duplicate_api(order_id, order_attributes)
8
+ stub_digicert_order_duplicate_api(order_id, certificate_attributes)
9
9
  order = Digicert::OrderDuplicator.create(order_id: order_id)
10
10
 
11
11
  expect(order.id).not_to be_nil
@@ -17,15 +17,13 @@ RSpec.describe Digicert::OrderDuplicator do
17
17
  123_456_789
18
18
  end
19
19
 
20
- def order_attributes
20
+ def certificate_attributes
21
21
  {
22
- certificate: {
23
- common_name: order.certificate.common_name,
24
- dns_names: order.certificate.dns_names,
25
- csr: order.certificate.csr,
26
- signature_hash: order.certificate.signature_hash,
27
- server_platform: { id: order.certificate.server_platform.id },
28
- },
22
+ common_name: order.certificate.common_name,
23
+ dns_names: order.certificate.dns_names,
24
+ csr: order.certificate.csr,
25
+ signature_hash: order.certificate.signature_hash,
26
+ server_platform: { id: order.certificate.server_platform.id },
29
27
  }
30
28
  end
31
29
 
@@ -2,14 +2,30 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe Digicert::OrderReissuer do
4
4
  describe ".create" do
5
- it "reissue an existing order" do
6
- stub_digicert_order_fetch_api(order_id)
5
+ context "without custom attributes" do
6
+ it "reissues with existing order attributes" do
7
+ stub_digicert_order_fetch_api(order_id)
8
+ stub_digicert_order_reissue_api(order_id, certificate_attributes)
7
9
 
8
- stub_digicert_order_reissue_api(order_id, order_attributes)
9
- order = Digicert::OrderReissuer.create(order_id: order_id)
10
+ order = Digicert::OrderReissuer.create(order_id: order_id)
10
11
 
11
- expect(order.id).not_to be_nil
12
- expect(order.requests.first.id).not_to be_nil
12
+ expect(order.id).not_to be_nil
13
+ expect(order.requests.first.id).not_to be_nil
14
+ end
15
+ end
16
+
17
+ context "with custom attributes" do
18
+ it "reissues with merging the existing and custom attributes" do
19
+ stub_digicert_order_fetch_api(order_id)
20
+ stub_digicert_order_reissue_api(order_id, certificate_attributes)
21
+
22
+ order = Digicert::OrderReissuer.create(
23
+ order_id: order_id, **certificate_attributes
24
+ )
25
+
26
+ expect(order.id).not_to be_nil
27
+ expect(order.requests.first.id).not_to be_nil
28
+ end
13
29
  end
14
30
  end
15
31
 
@@ -21,15 +37,17 @@ RSpec.describe Digicert::OrderReissuer do
21
37
  @order ||= Digicert::Order.fetch(order_id)
22
38
  end
23
39
 
24
- def order_attributes
40
+ def certificate_attributes
25
41
  {
26
- certificate: {
27
- common_name: order.certificate.common_name,
28
- dns_names: order.certificate.dns_names,
29
- csr: order.certificate.csr,
30
- signature_hash: order.certificate.signature_hash,
31
- server_platform: { id: order.certificate.server_platform.id },
32
- },
42
+ common_name: order.certificate.common_name,
43
+ dns_names: order.certificate.dns_names,
44
+ csr: order.certificate.csr,
45
+ signature_hash: order.certificate.signature_hash,
46
+ server_platform: { id: order.certificate.server_platform.id },
33
47
  }
34
48
  end
49
+
50
+ def new_attributes
51
+ @new_attributes ||= certificate_attributes.merge(signature_hash: "sha512")
52
+ end
35
53
  end
@@ -198,7 +198,7 @@ module Digicert
198
198
  stub_api_response(
199
199
  :post,
200
200
  ["order", "certificate", order_id, "reissue"].join("/"),
201
- data: attributes,
201
+ data: { certificate: attributes },
202
202
  filename: "order_reissued",
203
203
  status: 201,
204
204
  )
@@ -208,7 +208,7 @@ module Digicert
208
208
  stub_api_response(
209
209
  :post,
210
210
  ["order", "certificate", order_id, "duplicate"].join("/"),
211
- data: attributes,
211
+ data: { certificate: attributes },
212
212
  filename: "order_duplicated",
213
213
  status: 201,
214
214
  )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digicert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-20 00:00:00.000000000 Z
11
+ date: 2017-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: r509
@@ -122,6 +122,7 @@ files:
122
122
  - ".sample.env"
123
123
  - ".sample.pryrc"
124
124
  - ".travis.yml"
125
+ - CHANGELOG.md
125
126
  - CODE_OF_CONDUCT.md
126
127
  - Gemfile
127
128
  - LICENSE.txt