global_sign 1.0.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +100 -2
  4. data/global_sign.gemspec +3 -3
  5. data/lib/global_sign.rb +16 -0
  6. data/lib/global_sign/approver_info.rb +15 -0
  7. data/lib/global_sign/authorized_signer_info.rb +14 -0
  8. data/lib/global_sign/client.rb +16 -1
  9. data/lib/global_sign/csr_decoder.rb +2 -0
  10. data/lib/global_sign/csr_decoder/request.rb +29 -0
  11. data/lib/global_sign/csr_decoder/response.rb +36 -0
  12. data/lib/global_sign/dns_verification.rb +2 -0
  13. data/lib/global_sign/dns_verification/request.rb +55 -0
  14. data/lib/global_sign/dns_verification/response.rb +29 -0
  15. data/lib/global_sign/dns_verification_for_issue.rb +2 -0
  16. data/lib/global_sign/dns_verification_for_issue/request.rb +29 -0
  17. data/lib/global_sign/dns_verification_for_issue/response.rb +53 -0
  18. data/lib/global_sign/dv_approver_list.rb +2 -0
  19. data/lib/global_sign/dv_approver_list/request.rb +27 -0
  20. data/lib/global_sign/dv_approver_list/response.rb +33 -0
  21. data/lib/global_sign/dv_order.rb +2 -0
  22. data/lib/global_sign/dv_order/request.rb +72 -0
  23. data/lib/global_sign/dv_order/response.rb +19 -0
  24. data/lib/global_sign/ev_order.rb +2 -0
  25. data/lib/global_sign/ev_order/request.rb +132 -0
  26. data/lib/global_sign/ev_order/response.rb +19 -0
  27. data/lib/global_sign/jurisdiction_info.rb +12 -0
  28. data/lib/global_sign/order_getter_by_order_id/request.rb +11 -2
  29. data/lib/global_sign/order_getter_by_order_id/response.rb +52 -1
  30. data/lib/global_sign/organization_address.rb +17 -0
  31. data/lib/global_sign/organization_info.rb +26 -0
  32. data/lib/global_sign/organization_info/credit_agency.rb +8 -0
  33. data/lib/global_sign/organization_info_ev.rb +28 -0
  34. data/lib/global_sign/organization_info_ev/business_category_code.rb +9 -0
  35. data/lib/global_sign/ov_order.rb +2 -0
  36. data/lib/global_sign/ov_order/request.rb +79 -0
  37. data/lib/global_sign/ov_order/response.rb +19 -0
  38. data/lib/global_sign/requestor_info.rb +15 -0
  39. data/lib/global_sign/response.rb +11 -8
  40. data/lib/global_sign/url_verification/request.rb +3 -2
  41. data/lib/global_sign/url_verification/response.rb +4 -0
  42. data/lib/global_sign/url_verification_for_issue/response.rb +4 -0
  43. data/lib/global_sign/version.rb +1 -1
  44. metadata +45 -17
  45. data/CHANGELOG.md +0 -4
  46. data/wercker.yml +0 -16
@@ -0,0 +1,29 @@
1
+ module GlobalSign
2
+ module DnsVerification
3
+ class Response < GlobalSign::Response
4
+ module XPath
5
+ ORDER_ID = '//Response/OrderID'
6
+ DNS_TXT = '//Response/DNSTXT'
7
+ VERIFICATION_FQDN_LIST = '//Response/VerificationFQDNList'
8
+ end
9
+
10
+ def response_header
11
+ :OrderResponseHeader
12
+ end
13
+
14
+ def params
15
+ @params ||= {
16
+ order_id: @xml.xpath(XPath::ORDER_ID).text,
17
+ dns_txt: @xml.xpath(XPath::DNS_TXT).text,
18
+ verification_fqdn_list: verification_fqdn_list,
19
+ }
20
+ end
21
+
22
+ private
23
+
24
+ def verification_fqdn_list
25
+ @xml.xpath(XPath::VERIFICATION_FQDN_LIST).children.map(&:text)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,2 @@
1
+ require 'global_sign/dns_verification_for_issue/request'
2
+ require 'global_sign/dns_verification_for_issue/response'
@@ -0,0 +1,29 @@
1
+ module GlobalSign
2
+ module DnsVerificationForIssue
3
+ class Request < GlobalSign::Request
4
+ def initialize(order_id:, approver_fqdn:)
5
+ @order_id = order_id
6
+ @approver_fqdn = approver_fqdn
7
+ end
8
+
9
+ def path
10
+ 'ServerSSLService'
11
+ end
12
+
13
+ def action
14
+ 'DVDNSVerificationForIssue'
15
+ end
16
+
17
+ def request_header
18
+ :OrderRequestHeader
19
+ end
20
+
21
+ def params
22
+ {
23
+ OrderID: @order_id,
24
+ ApproverFQDN: @approver_fqdn,
25
+ }
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,53 @@
1
+ module GlobalSign
2
+ module DnsVerificationForIssue
3
+ class Response < GlobalSign::Response
4
+ module XPath
5
+ Certificate_Info = '//Response/URLVerificationForIssue/CertificateInfo'
6
+ CA_Certificates = '//Response/URLVerificationForIssue/Fulfillment/CACertificates'
7
+ Server_Certificate = '//Response/URLVerificationForIssue/Fulfillment/ServerCertificate'
8
+ end
9
+
10
+ def response_header
11
+ :OrderResponseHeader
12
+ end
13
+
14
+ def params
15
+ @params ||= {
16
+ certificate_info: {
17
+ certificate_status: certificate_info.at('CertificateStatus').text,
18
+ start_date: certificate_info.at('StartDate').text,
19
+ end_date: certificate_info.at('EndDate').text,
20
+ common_name: certificate_info.at('CommonName').text,
21
+ subject_name: certificate_info.at('SubjectName').text,
22
+ },
23
+ fulfillment: {
24
+ ca_certificates: ca_certificates_list,
25
+ server_certificate: {
26
+ x509_cert: server_certificate.at('X509Cert').text,
27
+ pkcs7_cert: server_certificate.at('PKCS7Cert').text,
28
+ }
29
+ }
30
+ }
31
+ end
32
+
33
+ private
34
+
35
+ def certificate_info
36
+ @xml.xpath(XPath::Certificate_Info)
37
+ end
38
+
39
+ def ca_certificates_list
40
+ @xml.xpath(XPath::CA_Certificates).children.map do |c|
41
+ {
42
+ ca_cert_type: c.at('CACertType').text,
43
+ ca_cert: c.at('CACert').text,
44
+ }
45
+ end
46
+ end
47
+
48
+ def server_certificate
49
+ @xml.xpath(XPath::Server_Certificate)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,2 @@
1
+ require 'global_sign/dv_approver_list/request'
2
+ require 'global_sign/dv_approver_list/response'
@@ -0,0 +1,27 @@
1
+ module GlobalSign
2
+ module DVApproverList
3
+ class Request < GlobalSign::Request
4
+ def initialize(fqdn)
5
+ @fqdn = fqdn
6
+ end
7
+
8
+ def path
9
+ 'ServerSSLService'
10
+ end
11
+
12
+ def action
13
+ 'GetDVApproverList'
14
+ end
15
+
16
+ def request_header
17
+ :QueryRequestHeader
18
+ end
19
+
20
+ def params
21
+ {
22
+ FQDN: @fqdn
23
+ }
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,33 @@
1
+ module GlobalSign
2
+ module DVApproverList
3
+ class Response < GlobalSign::Response
4
+ module XPath
5
+ ORDER_ID = '//Response/OrderID'.freeze
6
+ APPROVERS = '//Response/Approvers'.freeze
7
+ SEARCH_ORDER_DETAIL = '//Approvers/SearchOrderDetail'.freeze
8
+ end
9
+
10
+ def response_header
11
+ :QueryResponseHeader
12
+ end
13
+
14
+ def params
15
+ @params ||= {
16
+ order_id: @xml.xpath(XPath::ORDER_ID).text,
17
+ approvers: approvers_list
18
+ }
19
+ end
20
+
21
+ private
22
+
23
+ def approvers_list
24
+ @approvers ||= @xml.xpath(XPath::SEARCH_ORDER_DETAIL).map do |approver|
25
+ {
26
+ type: approver.xpath('ApproverType').text,
27
+ email: approver.xpath('ApproverEmail').text
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,2 @@
1
+ require 'global_sign/dv_order/request'
2
+ require 'global_sign/dv_order/response'
@@ -0,0 +1,72 @@
1
+ module GlobalSign
2
+ module DVOrder
3
+ class Request < GlobalSign::Request
4
+ KIND_RENEWAL = 'renewal'.freeze
5
+
6
+ def initialize(product_code:, order_kind:, validity_period_months:, csr:, approver_email:, order_id:, renewal_target_order_id: nil, contract_info: nil)
7
+ @product_code = product_code
8
+ @order_kind = order_kind
9
+ @validity_period_months = validity_period_months
10
+ @csr = csr
11
+ @approver_email = approver_email
12
+ @order_id = order_id
13
+ @renewal_target_order_id = renewal_target_order_id
14
+ @contract_info = contract_info || GlobalSign.contract
15
+ end
16
+
17
+ def path
18
+ 'ServerSSLService'
19
+ end
20
+
21
+ def action
22
+ 'DVOrder'
23
+ end
24
+
25
+ def request_header
26
+ :OrderRequestHeader
27
+ end
28
+
29
+ def params
30
+ @params = {
31
+ OrderRequestParameter: order_request_parameter,
32
+ OrderID: @order_id,
33
+ ApproverEmail: @approver_email,
34
+ ContactInfo: contact_info
35
+ }
36
+ end
37
+
38
+ private
39
+
40
+ def order_request_parameter
41
+ request_params.tap do |params|
42
+ params[:RenewalTargetOrderID] = @renewal_target_order_id if renew?
43
+ end
44
+ end
45
+
46
+ def request_params
47
+ {
48
+ ProductCode: @product_code,
49
+ OrderKind: @order_kind,
50
+ Licenses: 1,
51
+ ValidityPeriod: {
52
+ Months: @validity_period_months
53
+ },
54
+ CSR: @csr
55
+ }
56
+ end
57
+
58
+ def contact_info
59
+ {
60
+ FirstName: @contract_info.first_name,
61
+ LastName: @contract_info.last_name,
62
+ Phone: @contract_info.phone_number,
63
+ Email: @contract_info.email
64
+ }
65
+ end
66
+
67
+ def renew?
68
+ @order_kind == KIND_RENEWAL
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,19 @@
1
+ module GlobalSign
2
+ module DVOrder
3
+ class Response < GlobalSign::Response
4
+ module XPath
5
+ ORDER_ID = '//Response/OrderID'.freeze
6
+ end
7
+
8
+ def response_header
9
+ :OrderResponseHeader
10
+ end
11
+
12
+ def params
13
+ @params ||= {
14
+ order_id: @xml.xpath(XPath::ORDER_ID).text
15
+ }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,2 @@
1
+ require 'global_sign/ev_order/request'
2
+ require 'global_sign/ev_order/response'
@@ -0,0 +1,132 @@
1
+ module GlobalSign
2
+ module EVOrder
3
+ class Request < GlobalSign::Request
4
+ KIND_RENEWAL = 'renewal'.freeze
5
+
6
+ def initialize(product_code: 'EV', order_kind:, validity_period_months:, csr:, renewal_target_order_id: nil, organization_info_ev:, requestor_info:, approver_info:, authorized_signer_info:, jurisdiction_info:, contract_info: nil)
7
+ @product_code = product_code
8
+ @order_kind = order_kind
9
+ @validity_period_months = validity_period_months
10
+ @csr = csr
11
+ @renewal_target_order_id = renewal_target_order_id
12
+ @organization_info_ev = organization_info_ev
13
+ @requestor_info = requestor_info
14
+ @approver_info = approver_info
15
+ @authorized_signer_info = authorized_signer_info
16
+ @jurisdiction_info = jurisdiction_info
17
+ @contract_info = contract_info || GlobalSign.contract
18
+ end
19
+
20
+ def path
21
+ 'ServerSSLService'
22
+ end
23
+
24
+ def action
25
+ 'EVOrder'
26
+ end
27
+
28
+ def request_header
29
+ :OrderRequestHeader
30
+ end
31
+
32
+ def params
33
+ @params = {
34
+ OrderRequestParameter: order_request_parameter,
35
+ OrganizationInfoEV: organization_info_ev,
36
+ RequestorInfo: requestor_info,
37
+ ApproverInfo: approver_info,
38
+ AuthorizedSignerInfo: authorized_signer_info,
39
+ JurisdictionInfo: jurisdiction_info,
40
+ ContactInfo: contact_info
41
+ }
42
+ end
43
+
44
+ private
45
+
46
+ def order_request_parameter
47
+ request_params.tap do |params|
48
+ params[:RenewalTargetOrderID] = @renewal_target_order_id if renew?
49
+ end
50
+ end
51
+
52
+ def request_params
53
+ {
54
+ ProductCode: @product_code,
55
+ OrderKind: @order_kind,
56
+ Licenses: 1,
57
+ ValidityPeriod: {
58
+ Months: @validity_period_months
59
+ },
60
+ CSR: @csr
61
+ }
62
+ end
63
+
64
+ def contact_info
65
+ {
66
+ FirstName: @contract_info.first_name,
67
+ LastName: @contract_info.last_name,
68
+ Phone: @contract_info.phone_number,
69
+ Email: @contract_info.email
70
+ }
71
+ end
72
+
73
+ def organization_info_ev
74
+ {
75
+ CreditAgency: @organization_info_ev.credit_agency,
76
+ OrganizationCode: @organization_info_ev.organization_code,
77
+ BusinessAssumedName: @organization_info_ev.business_assumed_name,
78
+ BusinessCategoryCode: @organization_info_ev.business_category_code,
79
+ OrganizationAddress: @organization_info_ev.organization_address
80
+ }
81
+ end
82
+
83
+ def requestor_info
84
+ {
85
+ FirstName: @requestor_info.first_name,
86
+ LastName: @requestor_info.last_name,
87
+ Function: @requestor_info.function,
88
+ OrganizationName: @requestor_info.organization_name,
89
+ OrganizationUnit: @requestor_info.organization_unit,
90
+ Phone: @requestor_info.phone_number,
91
+ Email: @requestor_info.email
92
+ }
93
+ end
94
+
95
+ def approver_info
96
+ {
97
+ FirstName: @approver_info.first_name,
98
+ LastName: @approver_info.last_name,
99
+ Function: @approver_info.function,
100
+ OrganizationName: @approver_info.organization_name,
101
+ OrganizationUnit: @approver_info.organization_unit,
102
+ Phone: @approver_info.phone_number,
103
+ Email: @approver_info.email
104
+ }
105
+ end
106
+
107
+ def authorized_signer_info
108
+ {
109
+ FirstName: @authorized_signer_info.first_name,
110
+ LastName: @authorized_signer_info.last_name,
111
+ Function: @authorized_signer_info.function,
112
+ OrganizationName: @authorized_signer_info.organization_name,
113
+ Phone: @authorized_signer_info.phone_number,
114
+ Email: @authorized_signer_info.email
115
+ }
116
+ end
117
+
118
+ def jurisdiction_info
119
+ {
120
+ JurisdictionCountry: @jurisdiction_info.jurisdiction_country,
121
+ StateOrProvince: @jurisdiction_info.state_or_province,
122
+ Locality: @jurisdiction_info.locality,
123
+ IncorporatingAgencyRegistrationNumber: @jurisdiction_info.incorporating_agency_registration_number
124
+ }
125
+ end
126
+
127
+ def renew?
128
+ @order_kind == KIND_RENEWAL
129
+ end
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,19 @@
1
+ module GlobalSign
2
+ module EVOrder
3
+ class Response < GlobalSign::Response
4
+ module XPath
5
+ ORDER_ID = '//Response/OrderID'.freeze
6
+ end
7
+
8
+ def response_header
9
+ :OrderResponseHeader
10
+ end
11
+
12
+ def params
13
+ @params ||= {
14
+ order_id: @xml.xpath(XPath::ORDER_ID).text
15
+ }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ module GlobalSign
2
+ class JurisdictionInfo
3
+ attr_accessor :jurisdiction_country, :state_or_province, :locality, :incorporating_agency_registration_number
4
+
5
+ def initialize(jurisdiction_country:, state_or_province:, locality:, incorporating_agency_registration_number:)
6
+ @jurisdiction_country = jurisdiction_country
7
+ @state_or_province = state_or_province
8
+ @locality = locality
9
+ @incorporating_agency_registration_number = incorporating_agency_registration_number
10
+ end
11
+ end
12
+ end