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
@@ -1,8 +1,9 @@
1
1
  module GlobalSign
2
2
  module OrderGetterByOrderId
3
3
  class Request < GlobalSign::Request
4
- def initialize(order_id:)
4
+ def initialize(order_id:, options: {})
5
5
  @order_id = order_id
6
+ @options = options
6
7
  end
7
8
 
8
9
  def path
@@ -18,7 +19,15 @@ module GlobalSign
18
19
  end
19
20
 
20
21
  def params
21
- { OrderID: @order_id }
22
+ _params = { OrderID: @order_id }
23
+
24
+ # options
25
+ option_params = {}
26
+ option_params[:ReturnCertificateInfo] = true if @options[:certificate_info]
27
+ option_params[:ReturnFulfillment] = true if @options[:fulfillment]
28
+ _params[:OrderQueryOption] = option_params if option_params.present?
29
+
30
+ _params
22
31
  end
23
32
  end
24
33
  end
@@ -5,14 +5,44 @@ module GlobalSign
5
5
  ORDER_ID = '//Response/OrderID'
6
6
  ORDER_STATUS = '//Response/OrderDetail/OrderInfo/OrderStatus'
7
7
  MODIFICATION_EVENTS = '//Response/OrderDetail/ModificationEvents'
8
+
9
+ # options
10
+ CERTIFICATE_INFO = '//Response/OrderDetail/CertificateInfo'
11
+ FULFILLMENT = '//Response/OrderDetail/Fulfillment'
12
+ CA_CERTIFICATES = '//Response/OrderDetail/Fulfillment/CACertificates'
13
+ SERVER_CERTIFICATE = '//Response/OrderDetail/Fulfillment/ServerCertificate'
14
+ end
15
+
16
+ def response_header
17
+ :OrderResponseHeader
8
18
  end
9
19
 
10
20
  def params
11
- @params ||= {
21
+ return @params if @params
22
+ _params = {
12
23
  order_id: @xml.xpath(XPath::ORDER_ID).text,
13
24
  order_status: @xml.xpath(XPath::ORDER_STATUS).text,
14
25
  modification_events: modification_events_list
15
26
  }
27
+
28
+ # options
29
+ _params[:certificate_info] = {
30
+ certificate_status: certificate_info.at('CertificateStatus').text,
31
+ common_name: certificate_info.at('CommonName').text,
32
+ start_date: certificate_info.at('StartDate').try(:text),
33
+ end_date: certificate_info.at('EndDate').try(:text),
34
+ subject_name: certificate_info.at('SubjectName').try(:text),
35
+ } if certificate_info.text.present?
36
+
37
+ _params[:fulfillment] = {
38
+ ca_certificates: ca_certificates_list,
39
+ server_certificate: {
40
+ x509_cert: server_certificate.at('X509Cert').text,
41
+ pkcs7_cert: server_certificate.at('PKCS7Cert').text,
42
+ }
43
+ } if fulfillment.text.present?
44
+
45
+ @params = _params
16
46
  end
17
47
 
18
48
  def order_status_text
@@ -29,6 +59,27 @@ module GlobalSign
29
59
  }
30
60
  end
31
61
  end
62
+
63
+ def certificate_info
64
+ @xml.xpath(XPath::CERTIFICATE_INFO)
65
+ end
66
+
67
+ def fulfillment
68
+ @xml.xpath(XPath::FULFILLMENT)
69
+ end
70
+
71
+ def ca_certificates_list
72
+ @xml.xpath(XPath::CA_CERTIFICATES).children.map do |c|
73
+ {
74
+ ca_cert_type: c.at('CACertType').text,
75
+ ca_cert: c.at('CACert').text,
76
+ }
77
+ end
78
+ end
79
+
80
+ def server_certificate
81
+ @xml.xpath(XPath::SERVER_CERTIFICATE)
82
+ end
32
83
  end
33
84
  end
34
85
  end
@@ -0,0 +1,17 @@
1
+ module GlobalSign
2
+ class OrganizationAddress
3
+ attr_accessor :address_line1, :address_line2, :address_line3, :city, :region, :postal_code, :country, :phone, :fax
4
+
5
+ def initialize(address_line1:, address_line2: nil, address_line3: nil, city:, region:, postal_code:, country:, phone:, fax: nil)
6
+ @address_line1 = address_line1
7
+ @address_line2 = address_line2
8
+ @address_line3 = address_line3
9
+ @city = city
10
+ @region = region
11
+ @postal_code = postal_code
12
+ @country = country
13
+ @phone = phone
14
+ @fax = fax
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ module GlobalSign
2
+ class OrganizationInfo
3
+ attr_accessor :organization_name, :credit_agency, :organization_code, :organization_address
4
+
5
+ def initialize(organization_name:, credit_agency: nil, organization_code: nil, organization_address:)
6
+ @organization_name = organization_name
7
+ @credit_agency = credit_agency
8
+ @organization_code = organization_code
9
+ @organization_address = organization_address_params(organization_address)
10
+ end
11
+
12
+ def organization_address_params(organization_address)
13
+ {
14
+ AddressLine1: organization_address.address_line1,
15
+ AddressLine2: organization_address.address_line2,
16
+ AddressLine3: organization_address.address_line3,
17
+ City: organization_address.city,
18
+ Region: organization_address.region,
19
+ PostalCode: organization_address.postal_code,
20
+ Country: organization_address.country,
21
+ Phone: organization_address.phone,
22
+ Fax: organization_address.fax
23
+ }
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,8 @@
1
+ module GlobalSign
2
+ class OrganizationInfo
3
+ module CreditAgency
4
+ DUNS = 1
5
+ TDB = 2
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,28 @@
1
+ module GlobalSign
2
+ class OrganizationInfoEV
3
+ attr_accessor :credit_agency, :organization_code, :business_assumed_name, :business_category_code, :organization_address
4
+
5
+
6
+ def initialize(credit_agency: nil, organization_code: nil, business_assumed_name: nil, business_category_code:, organization_address:)
7
+ @credit_agency = credit_agency
8
+ @organization_code = organization_code
9
+ @business_assumed_name = business_assumed_name
10
+ @business_category_code = business_category_code
11
+ @organization_address = organization_address_params(organization_address)
12
+ end
13
+
14
+ def organization_address_params(organization_address)
15
+ {
16
+ AddressLine1: organization_address.address_line1,
17
+ AddressLine2: organization_address.address_line2,
18
+ AddressLine3: organization_address.address_line3,
19
+ City: organization_address.city,
20
+ Region: organization_address.region,
21
+ PostalCode: organization_address.postal_code,
22
+ Country: organization_address.country,
23
+ Phone: organization_address.phone,
24
+ Fax: organization_address.fax
25
+ }
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,9 @@
1
+ module GlobalSign
2
+ class OrganizationInfoEV
3
+ module BusinessCategoryCode
4
+ PRIVATE_ORGANIZATION = "PO"
5
+ GOVERNMENT_ENTITY = "GE"
6
+ BUSINESS_ENTITY = "BE"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+ require 'global_sign/ov_order/request'
2
+ require 'global_sign/ov_order/response'
@@ -0,0 +1,79 @@
1
+ module GlobalSign
2
+ module OVOrder
3
+ class Request < GlobalSign::Request
4
+ KIND_RENEWAL = 'renewal'.freeze
5
+
6
+ def initialize(product_code: 'OV', order_kind:, validity_period_months:, csr:, renewal_target_order_id: nil, contract_info: nil, organization_info:)
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
+ @contract_info = contract_info || GlobalSign.contract
13
+ @organization_info = organization_info
14
+ end
15
+
16
+ def path
17
+ 'ServerSSLService'
18
+ end
19
+
20
+ def action
21
+ 'OVOrder'
22
+ end
23
+
24
+ def request_header
25
+ :OrderRequestHeader
26
+ end
27
+
28
+ def params
29
+ @params = {
30
+ OrderRequestParameter: order_request_parameter,
31
+ ContactInfo: contact_info,
32
+ OrganizationInfo: organization_info
33
+ }
34
+ end
35
+
36
+ private
37
+
38
+ def order_request_parameter
39
+ request_params.tap do |params|
40
+ params[:RenewalTargetOrderID] = @renewal_target_order_id if renew?
41
+ end
42
+ end
43
+
44
+ def request_params
45
+ {
46
+ ProductCode: @product_code,
47
+ OrderKind: @order_kind,
48
+ Licenses: 1,
49
+ ValidityPeriod: {
50
+ Months: @validity_period_months
51
+ },
52
+ CSR: @csr
53
+ }
54
+ end
55
+
56
+ def contact_info
57
+ {
58
+ FirstName: @contract_info.first_name,
59
+ LastName: @contract_info.last_name,
60
+ Phone: @contract_info.phone_number,
61
+ Email: @contract_info.email
62
+ }
63
+ end
64
+
65
+ def organization_info
66
+ {
67
+ OrganizationName: @organization_info.organization_name,
68
+ CreditAgency: @organization_info.credit_agency,
69
+ OrganizationCode: @organization_info.organization_code,
70
+ OrganizationAddress: @organization_info.organization_address
71
+ }
72
+ end
73
+
74
+ def renew?
75
+ @order_kind == KIND_RENEWAL
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,19 @@
1
+ module GlobalSign
2
+ module OVOrder
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,15 @@
1
+ module GlobalSign
2
+ class RequestorInfo
3
+ attr_accessor :first_name, :last_name, :function, :organization_name, :organization_unit, :phone_number, :email
4
+
5
+ def initialize(first_name:, last_name:, function: nil, organization_name:, organization_unit: nil, phone_number:, email:)
6
+ @first_name = first_name
7
+ @last_name = last_name
8
+ @function = function
9
+ @organization_name = organization_name
10
+ @organization_unit = organization_unit
11
+ @phone_number = phone_number
12
+ @email = email
13
+ end
14
+ end
15
+ end
@@ -5,21 +5,24 @@ module GlobalSign
5
5
  SUCCESS_CODE = '0'.freeze
6
6
  WARNING_CODE = '1'.freeze
7
7
 
8
- module XPath
9
- RESULT = '//Response/OrderResponseHeader/SuccessCode'
10
- ERRORS = '//Response/OrderResponseHeader/Errors'
11
- end
12
-
13
8
  def initialize(body)
14
9
  @xml = Nokogiri::XML(body)
15
10
  end
16
11
 
12
+ def xpath_result
13
+ "//Response/#{response_header}/SuccessCode"
14
+ end
15
+
16
+ def xpath_errors
17
+ "//Response/#{response_header}/Errors"
18
+ end
19
+
17
20
  def success?
18
- @xml.xpath(XPath::RESULT).text == SUCCESS_CODE
21
+ @xml.xpath(xpath_result).text == SUCCESS_CODE
19
22
  end
20
23
 
21
24
  def warning?
22
- @xml.xpath(XPath::RESULT).text == WARNING_CODE
25
+ @xml.xpath(xpath_result).text == WARNING_CODE
23
26
  end
24
27
 
25
28
  def error?
@@ -41,7 +44,7 @@ module GlobalSign
41
44
  private
42
45
 
43
46
  def errors
44
- @xml.xpath(XPath::ERRORS)
47
+ @xml.xpath(xpath_errors)
45
48
  end
46
49
  end
47
50
  end
@@ -1,7 +1,8 @@
1
1
  module GlobalSign
2
2
  module UrlVerification
3
3
  class Request < GlobalSign::Request
4
- def initialize(order_kind:, validity_period_months:, csr:, renewal_target_order_id: nil, contract_info: nil)
4
+ def initialize(product_code:, order_kind:, validity_period_months:, csr:, renewal_target_order_id: nil, contract_info: nil)
5
+ @product_code = product_code
5
6
  @order_kind = order_kind
6
7
  @validity_period_months = validity_period_months
7
8
  @csr = csr
@@ -24,7 +25,7 @@ module GlobalSign
24
25
  def params
25
26
  _params = {
26
27
  OrderRequestParameter: {
27
- ProductCode: 'DV_LOW_URL',
28
+ ProductCode: @product_code,
28
29
  OrderKind: @order_kind,
29
30
  Licenses: 1,
30
31
  ValidityPeriod: {
@@ -7,6 +7,10 @@ module GlobalSign
7
7
  VERIFICATION_URL_LIST = '//Response/VerificationURLList'
8
8
  end
9
9
 
10
+ def response_header
11
+ :OrderResponseHeader
12
+ end
13
+
10
14
  def params
11
15
  @params ||= {
12
16
  order_id: @xml.xpath(XPath::ORDER_ID).text,
@@ -7,6 +7,10 @@ module GlobalSign
7
7
  Server_Certificate = '//Response/URLVerificationForIssue/Fulfillment/ServerCertificate'
8
8
  end
9
9
 
10
+ def response_header
11
+ :OrderResponseHeader
12
+ end
13
+
10
14
  def params
11
15
  @params ||= {
12
16
  certificate_info: {
@@ -1,3 +1,3 @@
1
1
  module GlobalSign
2
- VERSION = "1.0.0"
2
+ VERSION = "2.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: global_sign
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ku00
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-31 00:00:00.000000000 Z
11
+ date: 2021-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -70,30 +70,30 @@ dependencies:
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '1.13'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '1.13'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '10.0'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '10.0'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -174,7 +174,7 @@ files:
174
174
  - ".env.sample"
175
175
  - ".gitignore"
176
176
  - ".rspec"
177
- - 'CHANGELOG.md '
177
+ - CHANGELOG.md
178
178
  - Gemfile
179
179
  - LICENSE
180
180
  - README.md
@@ -183,14 +183,44 @@ files:
183
183
  - bin/setup
184
184
  - global_sign.gemspec
185
185
  - lib/global_sign.rb
186
+ - lib/global_sign/approver_info.rb
187
+ - lib/global_sign/authorized_signer_info.rb
186
188
  - lib/global_sign/client.rb
187
189
  - lib/global_sign/contract.rb
190
+ - lib/global_sign/csr_decoder.rb
191
+ - lib/global_sign/csr_decoder/request.rb
192
+ - lib/global_sign/csr_decoder/response.rb
193
+ - lib/global_sign/dns_verification.rb
194
+ - lib/global_sign/dns_verification/request.rb
195
+ - lib/global_sign/dns_verification/response.rb
196
+ - lib/global_sign/dns_verification_for_issue.rb
197
+ - lib/global_sign/dns_verification_for_issue/request.rb
198
+ - lib/global_sign/dns_verification_for_issue/response.rb
199
+ - lib/global_sign/dv_approver_list.rb
200
+ - lib/global_sign/dv_approver_list/request.rb
201
+ - lib/global_sign/dv_approver_list/response.rb
202
+ - lib/global_sign/dv_order.rb
203
+ - lib/global_sign/dv_order/request.rb
204
+ - lib/global_sign/dv_order/response.rb
205
+ - lib/global_sign/ev_order.rb
206
+ - lib/global_sign/ev_order/request.rb
207
+ - lib/global_sign/ev_order/response.rb
208
+ - lib/global_sign/jurisdiction_info.rb
188
209
  - lib/global_sign/order_getter_by_order_id.rb
189
210
  - lib/global_sign/order_getter_by_order_id/request.rb
190
211
  - lib/global_sign/order_getter_by_order_id/response.rb
191
212
  - lib/global_sign/order_status.rb
213
+ - lib/global_sign/organization_address.rb
214
+ - lib/global_sign/organization_info.rb
215
+ - lib/global_sign/organization_info/credit_agency.rb
216
+ - lib/global_sign/organization_info_ev.rb
217
+ - lib/global_sign/organization_info_ev/business_category_code.rb
218
+ - lib/global_sign/ov_order.rb
219
+ - lib/global_sign/ov_order/request.rb
220
+ - lib/global_sign/ov_order/response.rb
192
221
  - lib/global_sign/request.rb
193
222
  - lib/global_sign/request_xml_builder.rb
223
+ - lib/global_sign/requestor_info.rb
194
224
  - lib/global_sign/response.rb
195
225
  - lib/global_sign/url_verification.rb
196
226
  - lib/global_sign/url_verification/request.rb
@@ -199,12 +229,11 @@ files:
199
229
  - lib/global_sign/url_verification_for_issue/request.rb
200
230
  - lib/global_sign/url_verification_for_issue/response.rb
201
231
  - lib/global_sign/version.rb
202
- - wercker.yml
203
232
  homepage: https://github.com/pepabo/global_sign
204
233
  licenses:
205
234
  - MIT
206
235
  metadata: {}
207
- post_install_message:
236
+ post_install_message:
208
237
  rdoc_options: []
209
238
  require_paths:
210
239
  - lib
@@ -219,9 +248,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
248
  - !ruby/object:Gem::Version
220
249
  version: '0'
221
250
  requirements: []
222
- rubyforge_project:
223
- rubygems_version: 2.6.7
224
- signing_key:
251
+ rubygems_version: 3.2.3
252
+ signing_key:
225
253
  specification_version: 4
226
254
  summary: A Ruby interface to the GlobalSign API.
227
255
  test_files: []