├── .env.sample ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .rspec ├── CHANGELOG.md ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── bin ├── console └── setup ├── gemfiles ├── active_support_6.gemfile └── active_support_7.gemfile ├── global_sign.gemspec ├── lib ├── global_sign.rb └── global_sign │ ├── approver_info.rb │ ├── authorized_signer_info.rb │ ├── client.rb │ ├── contract.rb │ ├── csr_decoder.rb │ ├── csr_decoder │ ├── request.rb │ └── response.rb │ ├── dns_verification.rb │ ├── dns_verification │ ├── request.rb │ └── response.rb │ ├── dns_verification_for_issue.rb │ ├── dns_verification_for_issue │ ├── request.rb │ └── response.rb │ ├── dv_approver_list.rb │ ├── dv_approver_list │ ├── request.rb │ └── response.rb │ ├── dv_order.rb │ ├── dv_order │ ├── request.rb │ └── response.rb │ ├── ev_order.rb │ ├── ev_order │ ├── request.rb │ └── response.rb │ ├── jurisdiction_info.rb │ ├── order_getter_by_order_id.rb │ ├── order_getter_by_order_id │ ├── request.rb │ └── response.rb │ ├── order_status.rb │ ├── organization_address.rb │ ├── organization_info.rb │ ├── organization_info │ └── credit_agency.rb │ ├── organization_info_ev.rb │ ├── organization_info_ev │ └── business_category_code.rb │ ├── ov_order.rb │ ├── ov_order │ ├── request.rb │ └── response.rb │ ├── request.rb │ ├── request_xml_builder.rb │ ├── requestor_info.rb │ ├── response.rb │ ├── url_verification.rb │ ├── url_verification │ ├── request.rb │ └── response.rb │ ├── url_verification_for_issue.rb │ ├── url_verification_for_issue │ ├── request.rb │ └── response.rb │ └── version.rb └── spec ├── fixtures ├── csrs │ └── valid.csr ├── global_sign_request.xml └── vcr_cassettes │ ├── csr_decoder │ ├── failure.yml │ └── success.yml │ ├── dns_verification │ ├── new │ │ ├── failure.yml │ │ └── success.yml │ └── renewal │ │ ├── failure.yml │ │ └── success.yml │ ├── dns_verification_for_issue │ ├── failure.yml │ └── success.yml │ ├── dv_approver_list │ ├── failure.yml │ └── success.yml │ ├── dv_order │ ├── new │ │ ├── failure.yml │ │ └── success.yml │ └── renewal │ │ ├── failure.yml │ │ └── success.yml │ ├── ev_order │ ├── new │ │ ├── failure.yml │ │ └── success.yml │ └── renewal │ │ ├── failure.yml │ │ └── success.yml │ ├── order_getter_by_order_id │ ├── failure.yml │ ├── success.yml │ ├── with_certificate_info.yml │ ├── with_certificate_info_order_status_initial.yml │ └── with_fulfillment.yml │ ├── ov_order │ ├── new │ │ ├── failure.yml │ │ └── success.yml │ └── renewal │ │ ├── failure.yml │ │ └── success.yml │ ├── url_verification │ ├── new │ │ ├── failure.yml │ │ └── success.yml │ └── renewal │ │ ├── failure.yml │ │ └── success.yml │ └── url_verification_for_issue │ ├── failure.yml │ └── success.yml ├── global_sign ├── client_spec.rb ├── csr_decoder │ └── response_spec.rb ├── dns_verification │ └── response_spec.rb ├── dns_verification_for_issue │ └── response_spec.rb ├── dv_approver_list │ └── response_spec.rb ├── dv_order │ └── response_spec.rb ├── ev_order │ └── response_spec.rb ├── order_getter_by_order_id │ ├── request_spec.rb │ └── response_spec.rb ├── ov_order │ └── response_spec.rb ├── request_spec.rb ├── request_xml_builder_spec.rb ├── url_verification │ └── response_spec.rb └── url_verification_for_issue │ └── response_spec.rb ├── global_sign_spec.rb ├── spec_helper.rb └── support └── csr_helper.rb /.env.sample: -------------------------------------------------------------------------------- 1 | USER_NAME='PAR12345_taro' 2 | PASSWORD='password' 3 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | strategy: 8 | fail-fast: false 9 | matrix: 10 | ruby: [2.7, 3.0, 3.1, 3.2] 11 | gemfile: ["active_support_6", "active_support_7"] 12 | 13 | runs-on: ubuntu-latest 14 | 15 | env: 16 | BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile 17 | 18 | steps: 19 | - uses: actions/checkout@v2 20 | 21 | - uses: ruby/setup-ruby@v1 22 | with: 23 | ruby-version: ${{ matrix.ruby }} 24 | bundler-cache: true 25 | cache-version: ${{ matrix.gemfile }} 26 | 27 | - run: bundle exec rspec 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | vendor/bundle 11 | .env 12 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --format documentation 2 | --color 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2.3.0 2 | - Support GlobalSign API: EVOrder 3 | 4 | ## 2.2.0 5 | 6 | - Added `options` optional keyword argument to `GlobalSign::Client` 7 | - It supports `timeout` which specifies number of seconds to wait for request 8 | 9 | ## 2.1.1 10 | - Fixed bug: `GlobalSign::OrderGetterByOrderId::Request` NoMethodError: undefined method `text` for nil:NilClass 11 | 12 | ## 2.1.0 13 | 14 | - Support GlobalSign API: DecodeCSR 15 | - Support GlobalSign API: DVDNSOrder & DVDNSVerificationForIssue 16 | - Added `options` optional keyword argument to `GlobalSign::OrderGetterByOrderId::Request` for getting certificate info and fulfillment 17 | 18 | ## 2.0.0 19 | 20 | - Added `product_code` required keyword argument to `GlobalSign::UrlVerification::Request` for selecting SSL certificate type 21 | 22 | ## 1.0.0 23 | 24 | - Support GlobalSign API: URLVerification & URLVerificationForIssue 25 | - Support GlobalSign API: GetOrderByOrderID 26 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in global_sign.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016- GMO Pepabo, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | task :default => :spec 3 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "bundler/setup" 4 | require "global_sign" 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require "pry" 11 | # Pry.start 12 | 13 | require "irb" 14 | IRB.start 15 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | set -vx 5 | 6 | bundle install 7 | 8 | # Do any other automated setup that you need to do here 9 | -------------------------------------------------------------------------------- /gemfiles/active_support_6.gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'activesupport', "~> 6.0" 4 | 5 | # Specify your gem's dependencies in global_sign.gemspec 6 | gemspec path: '../' 7 | -------------------------------------------------------------------------------- /gemfiles/active_support_7.gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'activesupport', "~> 7.0" 4 | 5 | # Specify your gem's dependencies in global_sign.gemspec 6 | gemspec path: '../' 7 | -------------------------------------------------------------------------------- /global_sign.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'global_sign/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = 'global_sign' 8 | spec.version = GlobalSign::VERSION 9 | spec.authors = ['ku00'] 10 | spec.email = ['skentaro36@gmail.com'] 11 | 12 | spec.summary = %q{A Ruby interface to the GlobalSign API.} 13 | spec.description = %q{A Ruby interface to the GlobalSign API.} 14 | spec.homepage = 'https://github.com/pepabo/global_sign' 15 | spec.license = 'MIT' 16 | 17 | spec.files = `git ls-files -z`.split("\x0").reject do |f| 18 | f.match(%r{^(.github|test|spec|features)/}) 19 | end 20 | spec.bindir = 'exe' 21 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 22 | spec.require_paths = ['lib'] 23 | 24 | spec.add_runtime_dependency 'activesupport' 25 | spec.add_runtime_dependency 'builder' 26 | spec.add_runtime_dependency 'faraday' 27 | spec.add_runtime_dependency 'nokogiri' 28 | 29 | spec.add_development_dependency 'bundler' 30 | spec.add_development_dependency 'rake' 31 | spec.add_development_dependency 'rspec' 32 | spec.add_development_dependency 'webmock' 33 | spec.add_development_dependency 'vcr' 34 | spec.add_development_dependency 'pry-byebug' 35 | spec.add_development_dependency 'dotenv' 36 | end 37 | -------------------------------------------------------------------------------- /lib/global_sign.rb: -------------------------------------------------------------------------------- 1 | require 'active_support' 2 | require 'active_support/core_ext' 3 | 4 | require 'global_sign/version' 5 | require 'global_sign/client' 6 | require 'global_sign/contract' 7 | require 'global_sign/organization_address' 8 | require 'global_sign/organization_info' 9 | require 'global_sign/organization_info/credit_agency' 10 | require 'global_sign/organization_info_ev' 11 | require 'global_sign/organization_info_ev/business_category_code' 12 | require 'global_sign/requestor_info' 13 | require 'global_sign/approver_info' 14 | require 'global_sign/authorized_signer_info' 15 | require 'global_sign/jurisdiction_info' 16 | require 'global_sign/request_xml_builder' 17 | require 'global_sign/request' 18 | require 'global_sign/response' 19 | require 'global_sign/order_status' 20 | 21 | require 'global_sign/url_verification' 22 | require 'global_sign/url_verification_for_issue' 23 | require 'global_sign/order_getter_by_order_id' 24 | require 'global_sign/csr_decoder' 25 | require 'global_sign/dns_verification' 26 | require 'global_sign/dns_verification_for_issue' 27 | require 'global_sign/dv_approver_list' 28 | require 'global_sign/dv_order' 29 | require 'global_sign/ov_order' 30 | require 'global_sign/ev_order' 31 | 32 | module GlobalSign 33 | class << self 34 | attr_accessor :configuration, :contract 35 | 36 | def configure 37 | @configuration ||= Configuration.new 38 | yield @configuration if block_given? 39 | end 40 | 41 | def set_contract 42 | # initialize with nil, because the initialize method requires keyword args 43 | @contract ||= Contract.new(first_name: nil, last_name: nil, phone_number: nil, email: nil) 44 | yield @contract if block_given? 45 | end 46 | end 47 | 48 | class Configuration 49 | attr_accessor :user_name, :password, :endpoint 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /lib/global_sign/approver_info.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | class ApproverInfo 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 16 | -------------------------------------------------------------------------------- /lib/global_sign/authorized_signer_info.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | class AuthorizedSignerInfo 3 | attr_accessor :first_name, :last_name, :function, :organization_name, :phone_number, :email 4 | 5 | def initialize(first_name:, last_name:, function: nil, organization_name:, phone_number:, email:) 6 | @first_name = first_name 7 | @last_name = last_name 8 | @function = function 9 | @organization_name = organization_name 10 | @phone_number = phone_number 11 | @email = email 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /lib/global_sign/client.rb: -------------------------------------------------------------------------------- 1 | require 'faraday' 2 | 3 | module GlobalSign 4 | class Client 5 | def initialize(options: {}) 6 | @configuration = GlobalSign.configuration 7 | 8 | @connection = Faraday::Connection.new(url: @configuration.endpoint) do |conn| 9 | conn.request :url_encoded 10 | conn.adapter Faraday.default_adapter 11 | conn.options[:timeout] = options[:timeout] if options[:timeout].present? 12 | end 13 | end 14 | 15 | def process(request) 16 | response_class = find_response_class_for(request) 17 | 18 | response = @connection.post do |req| 19 | req.url request.path 20 | req.headers['Content-Type'] = 'text/xml' 21 | req.body = request.to_xml 22 | end 23 | 24 | response_class.new(response.body) 25 | end 26 | 27 | def find_response_class_for(request) 28 | case request 29 | when GlobalSign::CsrDecoder::Request 30 | GlobalSign::CsrDecoder::Response 31 | when GlobalSign::DnsVerification::Request 32 | GlobalSign::DnsVerification::Response 33 | when GlobalSign::DnsVerificationForIssue::Request 34 | GlobalSign::DnsVerificationForIssue::Response 35 | when GlobalSign::UrlVerification::Request 36 | GlobalSign::UrlVerification::Response 37 | when GlobalSign::UrlVerificationForIssue::Request 38 | GlobalSign::UrlVerificationForIssue::Response 39 | when GlobalSign::OrderGetterByOrderId::Request 40 | GlobalSign::OrderGetterByOrderId::Response 41 | when GlobalSign::DVApproverList::Request 42 | GlobalSign::DVApproverList::Response 43 | when GlobalSign::DVOrder::Request 44 | GlobalSign::DVOrder::Response 45 | when GlobalSign::OVOrder::Request 46 | GlobalSign::OVOrder::Response 47 | when GlobalSign::EVOrder::Request 48 | GlobalSign::EVOrder::Response 49 | else 50 | raise ArgumentError, 'invalid request argument' 51 | end 52 | end 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /lib/global_sign/contract.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | class Contract 3 | attr_accessor :first_name, :last_name, :phone_number, :email 4 | 5 | def initialize(first_name:, last_name:, phone_number:, email:) 6 | @first_name = first_name 7 | @last_name = last_name 8 | @phone_number = phone_number 9 | @email = email 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/global_sign/csr_decoder.rb: -------------------------------------------------------------------------------- 1 | require 'global_sign/csr_decoder/request' 2 | require 'global_sign/csr_decoder/response' 3 | -------------------------------------------------------------------------------- /lib/global_sign/csr_decoder/request.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | module CsrDecoder 3 | class Request < GlobalSign::Request 4 | def initialize(csr:, product_type:) 5 | @csr = csr 6 | @product_type = product_type 7 | end 8 | 9 | def path 10 | 'GASService' 11 | end 12 | 13 | def action 14 | 'DecodeCSR' 15 | end 16 | 17 | def request_header 18 | :QueryRequestHeader 19 | end 20 | 21 | def params 22 | { 23 | CSR: @csr, 24 | ProductType: @product_type 25 | } 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/global_sign/csr_decoder/response.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | module CsrDecoder 3 | class Response < GlobalSign::Response 4 | module XPath 5 | CSRData = '//Response/CSRData' 6 | CertificatePreview = '//Response/CertificatePreview' 7 | end 8 | 9 | def response_header 10 | :QueryResponseHeader 11 | end 12 | 13 | def params 14 | @params ||= { 15 | csr_data: detail(@xml.xpath(XPath::CSRData)), 16 | certificate_preview: detail(@xml.xpath(XPath::CertificatePreview)) 17 | } 18 | end 19 | 20 | private 21 | 22 | def detail(data) 23 | { 24 | common_name: data.at('CommonName').try(:text) || '', 25 | organization: data.at('Organization').try(:text) || '', 26 | organization_unit: data.at('Organization').try(:text) || '', 27 | locality: data.at('Locality').try(:text) || '', 28 | state: data.at('State').try(:text) || '', 29 | country: data.at('Country').try(:text) || '', 30 | email_address: data.at('EmailAddress').try(:text) || '', 31 | key_length: data.at('KeyLength').try(:text) || '' 32 | } 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/global_sign/dns_verification.rb: -------------------------------------------------------------------------------- 1 | require 'global_sign/dns_verification/request' 2 | require 'global_sign/dns_verification/response' 3 | -------------------------------------------------------------------------------- /lib/global_sign/dns_verification/request.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | module DnsVerification 3 | class Request < GlobalSign::UrlVerification::Request 4 | def initialize(product_code:, order_kind:, validity_period_months:, csr:, renewal_target_order_id: nil, contract_info: nil) 5 | @product_code = product_code 6 | @order_kind = order_kind 7 | @validity_period_months = validity_period_months 8 | @csr = csr 9 | @renewal_target_order_id = renewal_target_order_id 10 | @contract_info = contract_info || GlobalSign.contract 11 | end 12 | 13 | def path 14 | 'ServerSSLService' 15 | end 16 | 17 | def action 18 | 'DVDNSOrder' 19 | end 20 | 21 | def request_header 22 | :OrderRequestHeader 23 | end 24 | 25 | def params 26 | _params = { 27 | OrderRequestParameter: { 28 | ProductCode: @product_code, 29 | OrderKind: @order_kind, 30 | Licenses: 1, 31 | ValidityPeriod: { 32 | Months: @validity_period_months 33 | }, 34 | CSR: @csr, 35 | }, 36 | ContactInfo: { 37 | FirstName: @contract_info.first_name, 38 | LastName: @contract_info.last_name, 39 | Phone: @contract_info.phone_number, 40 | Email: @contract_info.email 41 | } 42 | } 43 | 44 | # require `RenewalTargetOrderID` to request a renewal certificate 45 | if @order_kind == 'renewal' 46 | _params[:OrderRequestParameter].merge!( 47 | { RenewalTargetOrderID: @renewal_target_order_id } 48 | ) 49 | end 50 | 51 | _params 52 | end 53 | end 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /lib/global_sign/dns_verification/response.rb: -------------------------------------------------------------------------------- 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 30 | -------------------------------------------------------------------------------- /lib/global_sign/dns_verification_for_issue.rb: -------------------------------------------------------------------------------- 1 | require 'global_sign/dns_verification_for_issue/request' 2 | require 'global_sign/dns_verification_for_issue/response' 3 | -------------------------------------------------------------------------------- /lib/global_sign/dns_verification_for_issue/request.rb: -------------------------------------------------------------------------------- 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 30 | -------------------------------------------------------------------------------- /lib/global_sign/dns_verification_for_issue/response.rb: -------------------------------------------------------------------------------- 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 54 | -------------------------------------------------------------------------------- /lib/global_sign/dv_approver_list.rb: -------------------------------------------------------------------------------- 1 | require 'global_sign/dv_approver_list/request' 2 | require 'global_sign/dv_approver_list/response' 3 | -------------------------------------------------------------------------------- /lib/global_sign/dv_approver_list/request.rb: -------------------------------------------------------------------------------- 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 28 | -------------------------------------------------------------------------------- /lib/global_sign/dv_approver_list/response.rb: -------------------------------------------------------------------------------- 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 34 | -------------------------------------------------------------------------------- /lib/global_sign/dv_order.rb: -------------------------------------------------------------------------------- 1 | require 'global_sign/dv_order/request' 2 | require 'global_sign/dv_order/response' 3 | -------------------------------------------------------------------------------- /lib/global_sign/dv_order/request.rb: -------------------------------------------------------------------------------- 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 73 | -------------------------------------------------------------------------------- /lib/global_sign/dv_order/response.rb: -------------------------------------------------------------------------------- 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 20 | -------------------------------------------------------------------------------- /lib/global_sign/ev_order.rb: -------------------------------------------------------------------------------- 1 | require 'global_sign/ev_order/request' 2 | require 'global_sign/ev_order/response' 3 | -------------------------------------------------------------------------------- /lib/global_sign/ev_order/request.rb: -------------------------------------------------------------------------------- 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 133 | -------------------------------------------------------------------------------- /lib/global_sign/ev_order/response.rb: -------------------------------------------------------------------------------- 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 20 | -------------------------------------------------------------------------------- /lib/global_sign/jurisdiction_info.rb: -------------------------------------------------------------------------------- 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 13 | -------------------------------------------------------------------------------- /lib/global_sign/order_getter_by_order_id.rb: -------------------------------------------------------------------------------- 1 | require 'global_sign/order_getter_by_order_id/request' 2 | require 'global_sign/order_getter_by_order_id/response' 3 | -------------------------------------------------------------------------------- /lib/global_sign/order_getter_by_order_id/request.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | module OrderGetterByOrderId 3 | class Request < GlobalSign::Request 4 | def initialize(order_id:, options: {}) 5 | @order_id = order_id 6 | @options = options 7 | end 8 | 9 | def path 10 | 'GASService' 11 | end 12 | 13 | def action 14 | 'GetOrderByOrderID' 15 | end 16 | 17 | def request_header 18 | :QueryRequestHeader 19 | end 20 | 21 | def params 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 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/global_sign/order_getter_by_order_id/response.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | module OrderGetterByOrderId 3 | class Response < GlobalSign::Response 4 | module XPath 5 | ORDER_ID = '//Response/OrderID' 6 | ORDER_STATUS = '//Response/OrderDetail/OrderInfo/OrderStatus' 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 18 | end 19 | 20 | def params 21 | return @params if @params 22 | _params = { 23 | order_id: @xml.xpath(XPath::ORDER_ID).text, 24 | order_status: @xml.xpath(XPath::ORDER_STATUS).text, 25 | modification_events: modification_events_list 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 46 | end 47 | 48 | def order_status_text 49 | OrderStatus::STATUS_MAPPING[params[:order_status]] 50 | end 51 | 52 | private 53 | 54 | def modification_events_list 55 | @xml.xpath(XPath::MODIFICATION_EVENTS).children.map do |element| 56 | { 57 | name: element.at('ModificationEventName').text, 58 | timestamp: element.at('ModificationEventTimestamp').text, 59 | } 60 | end 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 83 | end 84 | end 85 | end 86 | -------------------------------------------------------------------------------- /lib/global_sign/order_status.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | class OrderStatus 3 | STATUS_MAPPING = { 4 | '1' => 'initial', 5 | '2' => 'waiting_for_phishing_check', 6 | '3' => 'cancelled_before_issue', 7 | '4' => 'completed_issue', 8 | '5' => 'cancelled_after_issue', 9 | '6' => 'waiting_for_revocation', 10 | '7' => 'revoked', 11 | }.each_value(&:freeze).freeze 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /lib/global_sign/organization_address.rb: -------------------------------------------------------------------------------- 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 18 | -------------------------------------------------------------------------------- /lib/global_sign/organization_info.rb: -------------------------------------------------------------------------------- 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 27 | -------------------------------------------------------------------------------- /lib/global_sign/organization_info/credit_agency.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | class OrganizationInfo 3 | module CreditAgency 4 | DUNS = 1 5 | TDB = 2 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/global_sign/organization_info_ev.rb: -------------------------------------------------------------------------------- 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 29 | -------------------------------------------------------------------------------- /lib/global_sign/organization_info_ev/business_category_code.rb: -------------------------------------------------------------------------------- 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 10 | -------------------------------------------------------------------------------- /lib/global_sign/ov_order.rb: -------------------------------------------------------------------------------- 1 | require 'global_sign/ov_order/request' 2 | require 'global_sign/ov_order/response' 3 | -------------------------------------------------------------------------------- /lib/global_sign/ov_order/request.rb: -------------------------------------------------------------------------------- 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 80 | -------------------------------------------------------------------------------- /lib/global_sign/ov_order/response.rb: -------------------------------------------------------------------------------- 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 20 | -------------------------------------------------------------------------------- /lib/global_sign/request.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | class Request 3 | def to_xml 4 | GlobalSign::RequestXmlBuilder.build_xml( 5 | action: action, 6 | params: auth_token_params.merge(params) 7 | ) 8 | end 9 | 10 | def auth_token_params 11 | { "#{request_header}": auth_token_hash } 12 | end 13 | 14 | def auth_token_hash 15 | { 16 | AuthToken: { 17 | UserName: GlobalSign.configuration.user_name, 18 | Password: GlobalSign.configuration.password, 19 | } 20 | } 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/global_sign/request_xml_builder.rb: -------------------------------------------------------------------------------- 1 | require 'nokogiri' 2 | 3 | module GlobalSign 4 | class RequestXmlBuilder 5 | module XmlNamespace 6 | BODY = 'http://schemas.xmlsoap.org/soap/envelope/'.freeze 7 | ACTION = 'https://system.globalsign.com/kb/ws/v1/'.freeze 8 | end 9 | 10 | class << self 11 | def build_xml(action:, params:) 12 | xml = xml_envelope(action).at('//Request') << xml_body(params).root.elements 13 | 14 | builder = Nokogiri::XML::Builder.with(xml) 15 | builder.doc.root.to_xml 16 | end 17 | 18 | def xml_envelope(action) 19 | Nokogiri::XML( 20 | <<-EOS 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | EOS 29 | ) do |configuration| 30 | configuration.default_xml.noblanks 31 | end 32 | end 33 | 34 | def xml_body(params) 35 | Nokogiri.XML(params.to_xml) do |configuration| 36 | configuration.default_xml.noblanks 37 | end 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/global_sign/requestor_info.rb: -------------------------------------------------------------------------------- 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 16 | -------------------------------------------------------------------------------- /lib/global_sign/response.rb: -------------------------------------------------------------------------------- 1 | require 'nokogiri' 2 | 3 | module GlobalSign 4 | class Response 5 | SUCCESS_CODE = '0'.freeze 6 | WARNING_CODE = '1'.freeze 7 | 8 | def initialize(body) 9 | @xml = Nokogiri::XML(body) 10 | end 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 | 20 | def success? 21 | @xml.xpath(xpath_result).text == SUCCESS_CODE 22 | end 23 | 24 | def warning? 25 | @xml.xpath(xpath_result).text == WARNING_CODE 26 | end 27 | 28 | def error? 29 | !success? && !warning? 30 | end 31 | 32 | def error_code 33 | errors.at('ErrorCode').try(:text) 34 | end 35 | 36 | def error_field 37 | errors.at('ErrorField').try(:text) 38 | end 39 | 40 | def error_message 41 | errors.at('ErrorMessage').try(:text) 42 | end 43 | 44 | private 45 | 46 | def errors 47 | @xml.xpath(xpath_errors) 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/global_sign/url_verification.rb: -------------------------------------------------------------------------------- 1 | require 'global_sign/url_verification/request' 2 | require 'global_sign/url_verification/response' 3 | -------------------------------------------------------------------------------- /lib/global_sign/url_verification/request.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | module UrlVerification 3 | class Request < GlobalSign::Request 4 | def initialize(product_code:, order_kind:, validity_period_months:, csr:, renewal_target_order_id: nil, contract_info: nil) 5 | @product_code = product_code 6 | @order_kind = order_kind 7 | @validity_period_months = validity_period_months 8 | @csr = csr 9 | @renewal_target_order_id = renewal_target_order_id 10 | @contract_info = contract_info || GlobalSign.contract 11 | end 12 | 13 | def path 14 | 'ServerSSLService' 15 | end 16 | 17 | def action 18 | 'URLVerification' 19 | end 20 | 21 | def request_header 22 | :OrderRequestHeader 23 | end 24 | 25 | def params 26 | _params = { 27 | OrderRequestParameter: { 28 | ProductCode: @product_code, 29 | OrderKind: @order_kind, 30 | Licenses: 1, 31 | ValidityPeriod: { 32 | Months: @validity_period_months 33 | }, 34 | CSR: @csr, 35 | }, 36 | ContactInfo: { 37 | FirstName: @contract_info.first_name, 38 | LastName: @contract_info.last_name, 39 | Phone: @contract_info.phone_number, 40 | Email: @contract_info.email 41 | } 42 | } 43 | 44 | # require `RenewalTargetOrderID` to request a renewal certificate 45 | if @order_kind == 'renewal' 46 | _params[:OrderRequestParameter].merge!( 47 | { RenewalTargetOrderID: @renewal_target_order_id } 48 | ) 49 | end 50 | 51 | _params 52 | end 53 | end 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /lib/global_sign/url_verification/response.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | module UrlVerification 3 | class Response < GlobalSign::Response 4 | module XPath 5 | ORDER_ID = '//Response/OrderID' 6 | META_TAG = '//Response/MetaTag' 7 | VERIFICATION_URL_LIST = '//Response/VerificationURLList' 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 | meta_tag: @xml.xpath(XPath::META_TAG).text, 18 | verification_url_list: verification_url_list, 19 | } 20 | end 21 | 22 | private 23 | 24 | def verification_url_list 25 | @xml.xpath(XPath::VERIFICATION_URL_LIST).children.map(&:text) 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/global_sign/url_verification_for_issue.rb: -------------------------------------------------------------------------------- 1 | require 'global_sign/url_verification_for_issue/request' 2 | require 'global_sign/url_verification_for_issue/response' 3 | -------------------------------------------------------------------------------- /lib/global_sign/url_verification_for_issue/request.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | module UrlVerificationForIssue 3 | class Request < GlobalSign::Request 4 | def initialize(order_id:, approver_url:) 5 | @order_id = order_id 6 | @approver_url = approver_url 7 | end 8 | 9 | def path 10 | 'ServerSSLService' 11 | end 12 | 13 | def action 14 | 'URLVerificationForIssue' 15 | end 16 | 17 | def request_header 18 | :OrderRequestHeader 19 | end 20 | 21 | def params 22 | { 23 | OrderID: @order_id, 24 | ApproverURL: @approver_url, 25 | } 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/global_sign/url_verification_for_issue/response.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | module UrlVerificationForIssue 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 54 | -------------------------------------------------------------------------------- /lib/global_sign/version.rb: -------------------------------------------------------------------------------- 1 | module GlobalSign 2 | VERSION = "2.3.0" 3 | end 4 | -------------------------------------------------------------------------------- /spec/fixtures/csrs/valid.csr: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 3 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 4 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 5 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 6 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 7 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 8 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 9 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 10 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 11 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 12 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 13 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 14 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 15 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 16 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 17 | -----END CERTIFICATE REQUEST----- 18 | -------------------------------------------------------------------------------- /spec/fixtures/global_sign_request.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | DV_LOW_URL 7 | new 8 | 1 9 | 10 | 6 11 | 12 | xxxxx 13 | 14 | 15 | Pepabo 16 | Taro 17 | 090-1234-5678 18 | pepabo.taro@example.com 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/csr_decoder/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/GASService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | -----BEGIN CERTIFICATE REQUEST----- 19 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 20 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 21 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 22 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 23 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 24 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 25 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 26 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 27 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 28 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 29 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 30 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 31 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 32 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 33 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 34 | -----END CERTIFICATE REQUEST----- 35 | INVALID 36 | 37 | 38 | 39 | 40 | 41 | headers: 42 | User-Agent: 43 | - Faraday v0.9.2 44 | Content-Type: 45 | - text/xml 46 | Accept-Encoding: 47 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 48 | Accept: 49 | - "*/*" 50 | response: 51 | status: 52 | code: 200 53 | message: OK 54 | headers: 55 | Date: 56 | - Wed, 19 Oct 2016 03:57:51 GMT 57 | Set-Cookie: 58 | - JSESSIONID=AC607804400D5B880A0124555EC2E45E; Path=/kb 59 | Content-Type: 60 | - text/xml;charset=UTF-8 61 | Content-Length: 62 | - '730' 63 | Strict-Transport-Security: 64 | - max-age=60 65 | body: 66 | encoding: UTF-8 67 | string: -1-1Internal system error. Please reexecute what you were doing. If error persists, please contact GlobalSign Support2016-10-19T12:51:15.596+09:00 68 | http_version: 69 | recorded_at: Wed, 19 Oct 2016 03:57:51 GMT 70 | recorded_with: VCR 3.0.3 71 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/csr_decoder/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/GASService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | -----BEGIN CERTIFICATE REQUEST----- 19 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 20 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 21 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 22 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 23 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 24 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 25 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 26 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 27 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 28 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 29 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 30 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 31 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 32 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 33 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 34 | -----END CERTIFICATE REQUEST----- 35 | DV_LOW 36 | 37 | 38 | 39 | 40 | 41 | headers: 42 | User-Agent: 43 | - Faraday v0.9.2 44 | Content-Type: 45 | - text/xml 46 | Accept-Encoding: 47 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 48 | Accept: 49 | - "*/*" 50 | response: 51 | status: 52 | code: 200 53 | message: OK 54 | headers: 55 | Date: 56 | - Wed, 19 Oct 2016 03:51:15 GMT 57 | Set-Cookie: 58 | - JSESSIONID=7C5C0AF8FB2AD1AE6F66524D32460F9A; Path=/kb 59 | Content-Type: 60 | - text/xml;charset=UTF-8 61 | Content-Length: 62 | - '3118' 63 | Strict-Transport-Security: 64 | - max-age=60 65 | body: 66 | encoding: UTF-8 67 | string: 02016-10-19T12:51:15.596+09:00www.example.comGMO Pepabo, Inc.-Shibuya-kuTokyoJPexample@pepabo.com2048www.example.com 68 | http_version: 69 | recorded_at: Wed, 19 Oct 2016 03:51:15 GMT 70 | recorded_with: VCR 3.0.3 71 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dns_verification/new/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW_DNS 21 | invalid_kind 22 | 1 23 | 24 | 1 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | 44 | 45 | Pepabo 46 | Taro 47 | 090-1234-5678 48 | pepabo.taro@example.com 49 | 50 | 51 | 52 | 53 | 54 | headers: 55 | User-Agent: 56 | - Faraday v0.9.2 57 | Content-Type: 58 | - text/xml 59 | Accept-Encoding: 60 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 61 | Accept: 62 | - "*/*" 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Date: 69 | - Fri, 30 Sep 2016 01:27:28 GMT 70 | Set-Cookie: 71 | - JSESSIONID=F5EBC49A0267239CEE7D7943059D4BAB; Path=/kb 72 | Content-Type: 73 | - text/xml;charset=UTF-8 74 | Content-Length: 75 | - '1018' 76 | Strict-Transport-Security: 77 | - max-age=60 78 | body: 79 | encoding: UTF-8 80 | string: -1-103OrderRequestParameter.OrderKindParameter length check error. Please check that the parameters match the API specification. Please review the specific ErrorMessage returned in the XML response for parameter details and consult the XML Field definitions section of the applicable API document.2016-09-30T10:27:28.520+09:00 81 | http_version: 82 | recorded_at: Fri, 30 Sep 2016 01:27:28 GMT 83 | recorded_with: VCR 3.0.3 84 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dns_verification/new/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW_DNS 21 | new 22 | 1 23 | 24 | 1 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | 44 | 45 | Pepabo 46 | Taro 47 | 090-1234-5678 48 | pepabo.taro@example.com 49 | 50 | 51 | 52 | 53 | 54 | headers: 55 | User-Agent: 56 | - Faraday v0.9.2 57 | Content-Type: 58 | - text/xml 59 | Accept-Encoding: 60 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 61 | Accept: 62 | - "*/*" 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Date: 69 | - Fri, 30 Sep 2016 01:26:29 GMT 70 | Set-Cookie: 71 | - JSESSIONID=85ADE8D7D82019DE847DF9EC876AF95F; Path=/kb 72 | Content-Type: 73 | - text/xml;charset=UTF-8 74 | Content-Length: 75 | - '689' 76 | Strict-Transport-Security: 77 | - max-age=60 78 | body: 79 | encoding: UTF-8 80 | string: 02016-09-30T10:26:39.373+09:00CEAP1609307388globalsign-domain-verification=YlhVOpMzmFGzcAzKqDNxxqKGylnWsj_Ioc1Cqq-nTswww.example.comexample.com 81 | http_version: 82 | recorded_at: Fri, 30 Sep 2016 01:26:39 GMT 83 | recorded_with: VCR 3.0.3 84 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dns_verification/renewal/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW_DNS 21 | invalid_kind 22 | 1 23 | 24 | 1 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | xxxx123456789 44 | 45 | 46 | Pepabo 47 | Taro 48 | 090-1234-5678 49 | pepabo.taro@example.com 50 | 51 | 52 | 53 | 54 | 55 | headers: 56 | User-Agent: 57 | - Faraday v0.9.2 58 | Content-Type: 59 | - text/xml 60 | Accept-Encoding: 61 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 62 | Accept: 63 | - "*/*" 64 | response: 65 | status: 66 | code: 200 67 | message: OK 68 | headers: 69 | Date: 70 | - Fri, 30 Sep 2016 01:27:28 GMT 71 | Set-Cookie: 72 | - JSESSIONID=F5EBC49A0267239CEE7D7943059D4BAB; Path=/kb 73 | Content-Type: 74 | - text/xml;charset=UTF-8 75 | Content-Length: 76 | - '1018' 77 | Strict-Transport-Security: 78 | - max-age=60 79 | body: 80 | encoding: UTF-8 81 | string: -1-6102The renewal of the certificate failed. Please note that when renewing a certificate, the Comm on Name of the original certificate and this request must be the same. Please also check that the status of the original order is ISSUED and that the order has not been previously renewed.2016-09-30T10:27:28.520+09:00 82 | http_version: 83 | recorded_at: Fri, 30 Sep 2016 01:27:28 GMT 84 | recorded_with: VCR 3.0.3 85 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dns_verification/renewal/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW_DNS 21 | renewal 22 | 1 23 | 24 | 1 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | xxxx123456789 44 | 45 | 46 | Pepabo 47 | Taro 48 | 090-1234-5678 49 | pepabo.taro@example.com 50 | 51 | 52 | 53 | 54 | 55 | headers: 56 | User-Agent: 57 | - Faraday v0.9.2 58 | Content-Type: 59 | - text/xml 60 | Accept-Encoding: 61 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 62 | Accept: 63 | - "*/*" 64 | response: 65 | status: 66 | code: 200 67 | message: OK 68 | headers: 69 | Date: 70 | - Fri, 30 Sep 2016 01:26:29 GMT 71 | Set-Cookie: 72 | - JSESSIONID=85ADE8D7D82019DE847DF9EC876AF95F; Path=/kb 73 | Content-Type: 74 | - text/xml;charset=UTF-8 75 | Content-Length: 76 | - '689' 77 | Strict-Transport-Security: 78 | - max-age=60 79 | body: 80 | encoding: UTF-8 81 | string: 02016-09-30T10:26:39.373+09:00CEAP1609307388globalsign-domain-verification=YlhVOpMzmFGzcAzKqDNxxqKGylnWsj_Ioc1Cqq-nTswww.example.comexample.com 82 | http_version: 83 | recorded_at: Fri, 30 Sep 2016 01:26:39 GMT 84 | recorded_with: VCR 3.0.3 85 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dns_verification_for_issue/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | xxxx123456789 20 | www.example.com 21 | 22 | 23 | 24 | 25 | headers: 26 | User-Agent: 27 | - Faraday v0.9.2 28 | Content-Type: 29 | - text/xml 30 | Accept-Encoding: 31 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 32 | Accept: 33 | - "*/*" 34 | response: 35 | status: 36 | code: 200 37 | message: OK 38 | headers: 39 | Date: 40 | - Thu, 06 Oct 2016 05:31:30 GMT 41 | Set-Cookie: 42 | - JSESSIONID=5244FA32FFA126355DF005354E6A234D; Path=/kb 43 | Content-Type: 44 | - text/xml;charset=UTF-8 45 | Content-Length: 46 | - '837' 47 | Strict-Transport-Security: 48 | - max-age=60 49 | body: 50 | encoding: UTF-8 51 | string: '-1-4147We were unable to verify the domain http://example.com. Please ensure: 1. The domain is publicly accessible. 2. The verification meta tag is located in an approved location (See API specification for details). 3. The meta tag exactly matches the one we have provided.2016-10-06T14:31:30.857+09:00' 52 | http_version: 53 | recorded_at: Thu, 06 Oct 2016 05:31:30 GMT 54 | recorded_with: VCR 3.0.3 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dns_verification_for_issue/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | xxxx123456789 20 | www.example.com 21 | 22 | 23 | 24 | 25 | headers: 26 | User-Agent: 27 | - Faraday v0.9.2 28 | Content-Type: 29 | - text/xml 30 | Accept-Encoding: 31 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 32 | Accept: 33 | - "*/*" 34 | response: 35 | status: 36 | code: 200 37 | message: OK 38 | headers: 39 | Date: 40 | - Thu, 06 Oct 2016 05:53:21 GMT 41 | Set-Cookie: 42 | - JSESSIONID=52921AE65629FCEB0A05B3300C55BAC2; Path=/kb 43 | Content-Type: 44 | - text/xml;charset=UTF-8 45 | Transfer-Encoding: 46 | - chunked 47 | Strict-Transport-Security: 48 | - max-age=60 49 | body: 50 | encoding: UTF-8 51 | string: |- 52 | 02016-10-06T14:53:27.191+09:0042016-10-06T14:53:23.000+09:002016-11-06T14:53:23.000+09:00example.comCN = example.com, O = null, OU = Domain Control Validated, L = null, ST = null, C = JPROOT-----BEGIN CERTIFICATE----- 53 | aaaaa 54 | -----END CERTIFICATE----- 55 | INTER-----BEGIN CERTIFICATE----- 56 | bbbbb 57 | -----END CERTIFICATE----- 58 | -----BEGIN CERTIFICATE----- 59 | ccccc 60 | -----END CERTIFICATE----- 61 | -----BEGIN PKCS7----- 62 | ddddd 63 | -----END PKCS7----- 64 | 65 | http_version: 66 | recorded_at: Thu, 06 Oct 2016 05:53:27 GMT 67 | recorded_with: VCR 3.0.3 68 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dv_approver_list/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | headers: 25 | User-Agent: 26 | - Faraday v0.9.2 27 | Content-Type: 28 | - text/xml 29 | Accept-Encoding: 30 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 31 | Accept: 32 | - "*/*" 33 | response: 34 | status: 35 | code: 200 36 | message: OK 37 | headers: 38 | Date: 39 | - Wed, 09 Aug 2017 21:43:00 GMT 40 | Set-Cookie: 41 | - JSESSIONID=CF26EE95719F1F4F874B4EC9FA8CE1FA; Path=/kb 42 | Content-Type: 43 | - text/xml;charset=UTF-8 44 | Content-Length: 45 | - '757' 46 | Strict-Transport-Security: 47 | - max-age=60 48 | body: 49 | encoding: UTF-8 50 | string: -1-102FQDNMandatory 52 | parameter missing. Please check that the parameters match the API specification. 53 | Please review the specific ErrorMessage returned in the XML response for parameter 54 | details and consult the XML Field definitions section of the applicable API 55 | document.2017-08-09T06:43:00.083-03:00 56 | http_version: 57 | recorded_at: Wed, 09 Aug 2017 21:43:00 GMT 58 | recorded_with: VCR 3.0.3 59 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dv_approver_list/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | example.com 20 | 21 | 22 | 23 | 24 | headers: 25 | User-Agent: 26 | - Faraday v0.9.2 27 | Content-Type: 28 | - text/xml 29 | Accept-Encoding: 30 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 31 | Accept: 32 | - "*/*" 33 | response: 34 | status: 35 | code: 200 36 | message: OK 37 | headers: 38 | Date: 39 | - Wed, 09 Aug 2017 19:53:29 GMT 40 | Set-Cookie: 41 | - JSESSIONID=E0F573D7D2404531573B376E0DB83A2E; Path=/kb 42 | Content-Type: 43 | - text/xml;charset=UTF-8 44 | Content-Length: 45 | - '1070' 46 | Strict-Transport-Security: 47 | - max-age=60 48 | body: 49 | encoding: UTF-8 50 | string: 02017-08-09T04:53:30.572-03:00GENERICadmin@example.comGENERICadministrator@example.comGENERIChostmaster@example.comGENERICpostmaster@example.comGENERICwebmaster@example.comxxxx123456789 52 | http_version: 53 | recorded_at: Wed, 09 Aug 2017 19:53:30 GMT 54 | recorded_with: VCR 3.0.3 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dv_order/new/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW 21 | new 22 | 1 23 | 24 | 6 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | 44 | xxxx123456789 45 | admin@example.com 46 | 47 | Pepabo 48 | Taro 49 | 090-1234-5678 50 | pepabo.taro@example.com 51 | 52 | 53 | 54 | 55 | 56 | headers: 57 | User-Agent: 58 | - Faraday v0.9.2 59 | Content-Type: 60 | - text/xml 61 | Accept-Encoding: 62 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 63 | Accept: 64 | - "*/*" 65 | response: 66 | status: 67 | code: 200 68 | message: OK 69 | headers: 70 | Date: 71 | - Thu, 10 Aug 2017 16:11:37 GMT 72 | Set-Cookie: 73 | - JSESSIONID=086FCE03C342BF9AD5D61F76F6F19910; Path=/kb 74 | Content-Type: 75 | - text/xml;charset=UTF-8 76 | Content-Length: 77 | - '633' 78 | Strict-Transport-Security: 79 | - max-age=60 80 | body: 81 | encoding: UTF-8 82 | string: -1-4004OrderIDThe 84 | specified OrderID already exists. Please make sure you supplied a valid OrderID.2017-08-10T01:11:42.227-03:00 86 | http_version: 87 | recorded_at: Thu, 10 Aug 2017 16:11:42 GMT 88 | recorded_with: VCR 3.0.3 89 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dv_order/new/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW 21 | new 22 | 1 23 | 24 | 6 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | 44 | xxxx123456789 45 | admin@example.com 46 | 47 | Pepabo 48 | Taro 49 | 090-1234-5678 50 | pepabo.taro@example.com 51 | 52 | 53 | 54 | 55 | 56 | headers: 57 | User-Agent: 58 | - Faraday v0.9.2 59 | Content-Type: 60 | - text/xml 61 | Accept-Encoding: 62 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 63 | Accept: 64 | - "*/*" 65 | response: 66 | status: 67 | code: 200 68 | message: OK 69 | headers: 70 | Date: 71 | - Thu, 10 Aug 2017 14:36:53 GMT 72 | Set-Cookie: 73 | - JSESSIONID=92BC1F45C777E914AB392D56FC2DE4D3; Path=/kb 74 | Content-Type: 75 | - text/xml;charset=UTF-8 76 | Content-Length: 77 | - '390' 78 | Strict-Transport-Security: 79 | - max-age=60 80 | body: 81 | encoding: UTF-8 82 | string: 02017-08-10T11:37:00.251-03:00xxxx123456789 84 | http_version: 85 | recorded_at: Thu, 10 Aug 2017 14:37:00 GMT 86 | recorded_with: VCR 3.0.3 87 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dv_order/renewal/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW 21 | renewal 22 | 1 23 | 24 | 6 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | xxxx123456789 44 | 45 | xxxx123456780 46 | admin@example.com 47 | 48 | Pepabo 49 | Taro 50 | 090-1234-5678 51 | pepabo.taro@example.com 52 | 53 | 54 | 55 | 56 | 57 | headers: 58 | User-Agent: 59 | - Faraday v0.9.2 60 | Content-Type: 61 | - text/xml 62 | Accept-Encoding: 63 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 64 | Accept: 65 | - "*/*" 66 | response: 67 | status: 68 | code: 200 69 | message: OK 70 | headers: 71 | Date: 72 | - Thu, 10 Aug 2017 19:18:18 GMT 73 | Set-Cookie: 74 | - JSESSIONID=21E696DF23D5442849A720E0169A068E; Path=/kb 75 | Content-Type: 76 | - text/xml;charset=UTF-8 77 | Content-Length: 78 | - '627' 79 | Strict-Transport-Security: 80 | - max-age=60 81 | body: 82 | encoding: UTF-8 83 | string: -1-1Internal 85 | system error. Please reexecute what you were doing. If error persists, please 86 | contact GlobalSign Support2017-08-10T04:18:18.426-03:00 88 | http_version: 89 | recorded_at: Thu, 10 Aug 2017 19:18:18 GMT 90 | recorded_with: VCR 3.0.3 91 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/dv_order/renewal/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW 21 | renewal 22 | 1 23 | 24 | 6 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | xxxx123456789 44 | 45 | xxxx123456780 46 | admin@example.com 47 | 48 | Pepabo 49 | Taro 50 | 090-1234-5678 51 | pepabo.taro@example.com 52 | 53 | 54 | 55 | 56 | 57 | headers: 58 | User-Agent: 59 | - Faraday v0.9.2 60 | Content-Type: 61 | - text/xml 62 | Accept-Encoding: 63 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 64 | Accept: 65 | - "*/*" 66 | response: 67 | status: 68 | code: 200 69 | message: OK 70 | headers: 71 | Date: 72 | - Thu, 10 Aug 2017 19:18:18 GMT 73 | Set-Cookie: 74 | - JSESSIONID=21E696DF23D5442849A720E0169A068E; Path=/kb 75 | Content-Type: 76 | - text/xml;charset=UTF-8 77 | Content-Length: 78 | - '627' 79 | Strict-Transport-Security: 80 | - max-age=60 81 | body: 82 | encoding: UTF-8 83 | string: 02017-08-10T04:18:00.231-03:00xxxx123456780 85 | http_version: 86 | recorded_at: Thu, 10 Aug 2017 19:18:00 GMT 87 | recorded_with: VCR 3.0.3 88 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/ev_order/new/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | EV 21 | new 22 | 1 23 | 24 | 12 25 | 26 | 27 | 28 | 29 | 30 | 123456789 31 | 32 | PO 33 | 34 | 26-1 35 | 36 | 37 | Shibuya 38 | Tokyo 39 | 150-0031 40 | JP 41 | 090-1234-5678 42 | 43 | 44 | 45 | 46 | Example 47 | Requestor 48 | 49 | CompanyName, Inc. 50 | 51 | 090-1234-5678 52 | requestor@example.com 53 | 54 | 55 | Example 56 | Approver 57 | 58 | CompanyName, Inc. 59 | 60 | 090-1234-5678 61 | approver@example.com 62 | 63 | 64 | Example 65 | AuthorizedSigner 66 | 67 | CompanyName, Inc. 68 | 090-1234-5678 69 | authorized_signer@example.com 70 | 71 | 72 | JP 73 | Tokyo 74 | Shibuya 75 | 1234-12-123456 76 | 77 | 78 | Example 79 | Taro 80 | 090-1234-5678 81 | taro@example.com 82 | 83 | 84 | 85 | 86 | 87 | headers: 88 | User-Agent: 89 | - Faraday v0.9.2 90 | Content-Type: 91 | - text/xml 92 | Accept-Encoding: 93 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 94 | Accept: 95 | - "*/*" 96 | response: 97 | status: 98 | code: 200 99 | message: OK 100 | headers: 101 | Date: 102 | - Thu, 10 Aug 2017 16:11:37 GMT 103 | Set-Cookie: 104 | - JSESSIONID=086FCE03C342BF9AD5D61F76F6F19910; Path=/kb 105 | Content-Type: 106 | - text/xml;charset=UTF-8 107 | Content-Length: 108 | - '633' 109 | Strict-Transport-Security: 110 | - max-age=60 111 | body: 112 | encoding: UTF-8 113 | string: |- 114 | 115 | 116 | 117 | 118 | 119 | -1 120 | 121 | 122 | -102 123 | OrderRequestParameter.CSR 124 | Mandatory parameter missing. Please check that the parameters match the API specification. Please review the specific ErrorMessage returned in the XML response for parameter details and consult the XML Field definitions section of the applicable API document. 125 | 126 | 127 | 2018-09-23T23:19:59.013+09:00 128 | 129 | 130 | 131 | 132 | 133 | 134 | http_version: 135 | recorded_at: Thu, 10 Aug 2017 16:11:42 GMT 136 | recorded_with: VCR 3.0.3 137 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/order_getter_by_order_id/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/GASService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | invalid_order_id 20 | 21 | 22 | 23 | 24 | headers: 25 | User-Agent: 26 | - Faraday v0.9.2 27 | Content-Type: 28 | - text/xml 29 | Accept-Encoding: 30 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 31 | Accept: 32 | - "*/*" 33 | response: 34 | status: 35 | code: 200 36 | message: OK 37 | headers: 38 | Date: 39 | - Wed, 19 Oct 2016 03:57:51 GMT 40 | Set-Cookie: 41 | - JSESSIONID=AC607804400D5B880A0124555EC2E45E; Path=/kb 42 | Content-Type: 43 | - text/xml;charset=UTF-8 44 | Content-Length: 45 | - '730' 46 | Strict-Transport-Security: 47 | - max-age=60 48 | body: 49 | encoding: UTF-8 50 | string: -1-1Internal system error. Please reexecute what you were doing. If error persists, please contact GlobalSign Support2016-10-19T12:57:51.873+09:00 51 | http_version: 52 | recorded_at: Wed, 19 Oct 2016 03:57:51 GMT 53 | recorded_with: VCR 3.0.3 54 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/order_getter_by_order_id/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/GASService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | xxxx123456789 20 | 21 | 22 | 23 | 24 | headers: 25 | User-Agent: 26 | - Faraday v0.9.2 27 | Content-Type: 28 | - text/xml 29 | Accept-Encoding: 30 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 31 | Accept: 32 | - "*/*" 33 | response: 34 | status: 35 | code: 200 36 | message: OK 37 | headers: 38 | Date: 39 | - Wed, 19 Oct 2016 03:51:15 GMT 40 | Set-Cookie: 41 | - JSESSIONID=7C5C0AF8FB2AD1AE6F66524D32460F9A; Path=/kb 42 | Content-Type: 43 | - text/xml;charset=UTF-8 44 | Content-Length: 45 | - '3118' 46 | Strict-Transport-Security: 47 | - max-age=60 48 | body: 49 | encoding: UTF-8 50 | string: 02016-10-19T12:51:15.596+09:00xxxx123456789xxxx123456789DV_LOW_MONTH_OPNew1falsefalsefalsefalsefalsewww.example.com2016-10-05T14:11:30.335+09:002016-10-05T14:11:24.023+09:0010JPY1falsefalsefalsefalseORDER_REQUEST2016-10-05T14:11:24.023+09:00ORDER_VALIDATE_REGISTER2016-10-05T14:11:30.335+09:00READY_VARIFICATION_URL2016-10-05T14:11:31.255+09:00 51 | http_version: 52 | recorded_at: Wed, 19 Oct 2016 03:51:15 GMT 53 | recorded_with: VCR 3.0.3 54 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/order_getter_by_order_id/with_certificate_info.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/GASService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | xxxx123456789 20 | 21 | true 22 | 23 | 24 | 25 | 26 | 27 | headers: 28 | User-Agent: 29 | - Faraday v0.9.2 30 | Content-Type: 31 | - text/xml 32 | Accept-Encoding: 33 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 34 | Accept: 35 | - "*/*" 36 | response: 37 | status: 38 | code: 200 39 | message: OK 40 | headers: 41 | Date: 42 | - Wed, 19 Oct 2016 03:51:15 GMT 43 | Set-Cookie: 44 | - JSESSIONID=7C5C0AF8FB2AD1AE6F66524D32460F9A; Path=/kb 45 | Content-Type: 46 | - text/xml;charset=UTF-8 47 | Content-Length: 48 | - '3118' 49 | Strict-Transport-Security: 50 | - max-age=60 51 | body: 52 | encoding: UTF-8 53 | string: 02016-10-19T12:51:15.596+09:00xxxx123456789xxxx123456789DV_LOW_MONTH_OPNew1falsefalsefalsefalsefalsewww.example.com2016-10-05T14:11:30.335+09:002016-10-05T14:11:24.023+09:0040JPY1falsefalsefalsefalse42016-10-06T14:53:23.000+09:002016-11-06T14:53:23.000+09:00example.comCN = example.com, O = null, OU = Domain Control Validated, L = null, ST = null, C = JPORDER_REQUEST2016-10-05T14:11:24.023+09:00ORDER_VALIDATE_REGISTER2016-10-05T14:11:30.335+09:00READY_VARIFICATION_URL2016-10-05T14:11:31.255+09:00 54 | http_version: 55 | recorded_at: Wed, 19 Oct 2016 03:51:15 GMT 56 | recorded_with: VCR 3.0.3 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/order_getter_by_order_id/with_certificate_info_order_status_initial.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/GASService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | xxxx123456789 20 | 21 | true 22 | 23 | 24 | 25 | 26 | 27 | headers: 28 | User-Agent: 29 | - Faraday v0.9.2 30 | Content-Type: 31 | - text/xml 32 | Accept-Encoding: 33 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 34 | Accept: 35 | - "*/*" 36 | response: 37 | status: 38 | code: 200 39 | message: OK 40 | headers: 41 | Date: 42 | - Wed, 19 Oct 2016 03:51:15 GMT 43 | Set-Cookie: 44 | - JSESSIONID=7C5C0AF8FB2AD1AE6F66524D32460F9A; Path=/kb 45 | Content-Type: 46 | - text/xml;charset=UTF-8 47 | Content-Length: 48 | - '3118' 49 | Strict-Transport-Security: 50 | - max-age=60 51 | body: 52 | encoding: UTF-8 53 | string: 02016-10-19T12:51:15.596+09:00xxxx123456789xxxx123456789DV_LOW_MONTH_OPNew1falsefalsefalsefalsefalsewww.example.com2016-10-05T14:11:30.335+09:002016-10-05T14:11:24.023+09:0010JPY1falsefalsefalsefalse1example.comORDER_REQUEST2016-10-05T14:11:24.023+09:00ORDER_VALIDATE_REGISTER2016-10-05T14:11:30.335+09:00READY_VARIFICATION_URL2016-10-05T14:11:31.255+09:00 54 | http_version: 55 | recorded_at: Wed, 19 Oct 2016 03:51:15 GMT 56 | recorded_with: VCR 3.0.3 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/order_getter_by_order_id/with_fulfillment.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/GASService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | xxxx123456789 20 | 21 | true 22 | 23 | 24 | 25 | 26 | 27 | headers: 28 | User-Agent: 29 | - Faraday v0.9.2 30 | Content-Type: 31 | - text/xml 32 | Accept-Encoding: 33 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 34 | Accept: 35 | - "*/*" 36 | response: 37 | status: 38 | code: 200 39 | message: OK 40 | headers: 41 | Date: 42 | - Wed, 19 Oct 2016 03:51:15 GMT 43 | Set-Cookie: 44 | - JSESSIONID=7C5C0AF8FB2AD1AE6F66524D32460F9A; Path=/kb 45 | Content-Type: 46 | - text/xml;charset=UTF-8 47 | Content-Length: 48 | - '3118' 49 | Strict-Transport-Security: 50 | - max-age=60 51 | body: 52 | encoding: UTF-8 53 | string: 02016-10-19T12:51:15.596+09:00xxxx123456789xxxx123456789DV_LOW_MONTH_OPNew1falsefalsefalsefalsefalsewww.example.com2016-10-05T14:11:30.335+09:002016-10-05T14:11:24.023+09:0040JPY1falsefalsefalsefalseROOT-----BEGIN CERTIFICATE----- 54 | aaaaa 55 | -----END CERTIFICATE----- 56 | INTER-----BEGIN CERTIFICATE----- 57 | bbbbb 58 | -----END CERTIFICATE----- 59 | -----BEGIN CERTIFICATE----- 60 | ccccc 61 | -----END CERTIFICATE----- 62 | -----BEGIN PKCS7----- 63 | ddddd 64 | -----END PKCS7----- 65 | ORDER_REQUEST2016-10-05T14:11:24.023+09:00ORDER_VALIDATE_REGISTER2016-10-05T14:11:30.335+09:00READY_VARIFICATION_URL2016-10-05T14:11:31.255+09:00 66 | http_version: 67 | recorded_at: Wed, 19 Oct 2016 03:51:15 GMT 68 | recorded_with: VCR 3.0.3 69 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/ov_order/new/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | OV 21 | new 22 | 1 23 | 24 | 12 25 | 26 | 27 | 28 | 29 | Pepabo 30 | Taro 31 | 090-1234-5678 32 | pepabo.taro@example.com 33 | 34 | 35 | CompanyName, Inc. 36 | 2 37 | 111 38 | 39 | 26-1 40 | 41 | 42 | Shibuya 43 | Tokyo 44 | 150-0031 45 | JP 46 | 090-1234-5678 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | headers: 55 | User-Agent: 56 | - Faraday v0.9.2 57 | Content-Type: 58 | - text/xml 59 | Accept-Encoding: 60 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 61 | Accept: 62 | - "*/*" 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Date: 69 | - Thu, 10 Aug 2017 16:11:37 GMT 70 | Set-Cookie: 71 | - JSESSIONID=086FCE03C342BF9AD5D61F76F6F19910; Path=/kb 72 | Content-Type: 73 | - text/xml;charset=UTF-8 74 | Content-Length: 75 | - '633' 76 | Strict-Transport-Security: 77 | - max-age=60 78 | body: 79 | encoding: UTF-8 80 | string: |- 81 | 82 | 83 | 84 | 85 | 86 | -1 87 | 88 | 89 | -102 90 | OrderRequestParameter.CSR 91 | Mandatory parameter missing. Please check that the parameters match the API specification. Please review the specific ErrorMessage returned in the XML response for parameter details and consult the XML Field definitions section of the applicable API document. 92 | 93 | 94 | 2018-09-23T23:19:59.013+09:00 95 | 96 | 97 | 98 | 99 | 100 | 101 | http_version: 102 | recorded_at: Thu, 10 Aug 2017 16:11:42 GMT 103 | recorded_with: VCR 3.0.3 104 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/ov_order/new/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | OV 21 | new 22 | 1 23 | 24 | 12 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | 44 | 45 | Pepabo 46 | Taro 47 | 090-1234-5678 48 | pepabo.taro@example.com 49 | 50 | 51 | CompanyName, Inc. 52 | 2 53 | 111 54 | 55 | 26-1 56 | 57 | 58 | Shibuya 59 | Tokyo 60 | 150-0031 61 | JP 62 | 090-1234-5678 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | headers: 71 | User-Agent: 72 | - Faraday v0.9.2 73 | Content-Type: 74 | - text/xml 75 | Accept-Encoding: 76 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 77 | Accept: 78 | - "*/*" 79 | response: 80 | status: 81 | code: 200 82 | message: OK 83 | headers: 84 | Date: 85 | - Thu, 10 Aug 2017 14:36:53 GMT 86 | Set-Cookie: 87 | - JSESSIONID=92BC1F45C777E914AB392D56FC2DE4D3; Path=/kb 88 | Content-Type: 89 | - text/xml;charset=UTF-8 90 | Content-Length: 91 | - '390' 92 | Strict-Transport-Security: 93 | - max-age=60 94 | body: 95 | encoding: UTF-8 96 | string: |- 97 | 98 | 99 | 100 | 101 | 102 | 0 103 | 104 | 2018-09-18T15:41:21.255+09:00 105 | 106 | xxxx123456789 107 | 108 | 109 | 110 | 111 | http_version: 112 | recorded_at: Thu, 10 Aug 2017 14:37:00 GMT 113 | recorded_with: VCR 3.0.3 114 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/ov_order/renewal/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | OV 21 | renewal 22 | 1 23 | 24 | 12 25 | 26 | 27 | xxxx123456789 28 | 29 | 30 | Pepabo 31 | Taro 32 | 090-1234-5678 33 | pepabo.taro@example.com 34 | 35 | 36 | CompanyName, Inc. 37 | 2 38 | 111 39 | 40 | 26-1 41 | 42 | 43 | Shibuya 44 | Tokyo 45 | 150-0031 46 | JP 47 | 090-1234-5678 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | headers: 56 | User-Agent: 57 | - Faraday v0.9.2 58 | Content-Type: 59 | - text/xml 60 | Accept-Encoding: 61 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 62 | Accept: 63 | - "*/*" 64 | response: 65 | status: 66 | code: 200 67 | message: OK 68 | headers: 69 | Date: 70 | - Thu, 10 Aug 2017 19:18:18 GMT 71 | Set-Cookie: 72 | - JSESSIONID=21E696DF23D5442849A720E0169A068E; Path=/kb 73 | Content-Type: 74 | - text/xml;charset=UTF-8 75 | Content-Length: 76 | - '627' 77 | Strict-Transport-Security: 78 | - max-age=60 79 | body: 80 | encoding: UTF-8 81 | string: |- 82 | 83 | 84 | 85 | 86 | 87 | -1 88 | 89 | 90 | -102 91 | OrderRequestParameter.CSR 92 | Mandatory parameter missing. Please check that the parameters match the API specification. Please review the specific ErrorMessage returned in the XML response for parameter details and consult the XML Field definitions section of the applicable API document. 93 | 94 | 95 | 2018-09-23T23:19:59.013+09:00 96 | 97 | 98 | 99 | 100 | 101 | 102 | http_version: 103 | recorded_at: Thu, 10 Aug 2017 19:18:18 GMT 104 | recorded_with: VCR 3.0.3 105 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/ov_order/renewal/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | OV 21 | renewal 22 | 1 23 | 24 | 12 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | xxxx123456789 44 | 45 | 46 | Pepabo 47 | Taro 48 | 090-1234-5678 49 | pepabo.taro@example.com 50 | 51 | 52 | CompanyName, Inc. 53 | 2 54 | 111 55 | 56 | 26-1 57 | 58 | 59 | Shibuya 60 | Tokyo 61 | 150-0031 62 | JP 63 | 090-1234-5678 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | headers: 72 | User-Agent: 73 | - Faraday v0.9.2 74 | Content-Type: 75 | - text/xml 76 | Accept-Encoding: 77 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 78 | Accept: 79 | - "*/*" 80 | response: 81 | status: 82 | code: 200 83 | message: OK 84 | headers: 85 | Date: 86 | - Thu, 10 Aug 2017 19:18:18 GMT 87 | Set-Cookie: 88 | - JSESSIONID=21E696DF23D5442849A720E0169A068E; Path=/kb 89 | Content-Type: 90 | - text/xml;charset=UTF-8 91 | Content-Length: 92 | - '627' 93 | Strict-Transport-Security: 94 | - max-age=60 95 | body: 96 | encoding: UTF-8 97 | string: |- 98 | 99 | 100 | 101 | 102 | 103 | 0 104 | 105 | 2018-09-18T15:41:21.255+09:00 106 | 107 | xxxx123456780 108 | 109 | 110 | 111 | 112 | http_version: 113 | recorded_at: Thu, 10 Aug 2017 19:18:00 GMT 114 | recorded_with: VCR 3.0.3 115 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/url_verification/new/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW_URL 21 | invalid_kind 22 | 1 23 | 24 | 1 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | 44 | 45 | Pepabo 46 | Taro 47 | 090-1234-5678 48 | pepabo.taro@example.com 49 | 50 | 51 | 52 | 53 | 54 | headers: 55 | User-Agent: 56 | - Faraday v0.9.2 57 | Content-Type: 58 | - text/xml 59 | Accept-Encoding: 60 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 61 | Accept: 62 | - "*/*" 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Date: 69 | - Fri, 30 Sep 2016 01:27:28 GMT 70 | Set-Cookie: 71 | - JSESSIONID=F5EBC49A0267239CEE7D7943059D4BAB; Path=/kb 72 | Content-Type: 73 | - text/xml;charset=UTF-8 74 | Content-Length: 75 | - '1018' 76 | Strict-Transport-Security: 77 | - max-age=60 78 | body: 79 | encoding: UTF-8 80 | string: -1-103OrderRequestParameter.OrderKindParameter length check error. Please check that the parameters match the API specification. Please review the specific ErrorMessage returned in the XML response for parameter details and consult the XML Field definitions section of the applicable API document.2016-09-30T10:27:28.520+09:00 81 | http_version: 82 | recorded_at: Fri, 30 Sep 2016 01:27:28 GMT 83 | recorded_with: VCR 3.0.3 84 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/url_verification/new/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW_URL 21 | new 22 | 1 23 | 24 | 1 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | 44 | 45 | Pepabo 46 | Taro 47 | 090-1234-5678 48 | pepabo.taro@example.com 49 | 50 | 51 | 52 | 53 | 54 | headers: 55 | User-Agent: 56 | - Faraday v0.9.2 57 | Content-Type: 58 | - text/xml 59 | Accept-Encoding: 60 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 61 | Accept: 62 | - "*/*" 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Date: 69 | - Fri, 30 Sep 2016 01:26:29 GMT 70 | Set-Cookie: 71 | - JSESSIONID=85ADE8D7D82019DE847DF9EC876AF95F; Path=/kb 72 | Content-Type: 73 | - text/xml;charset=UTF-8 74 | Content-Length: 75 | - '689' 76 | Strict-Transport-Security: 77 | - max-age=60 78 | body: 79 | encoding: UTF-8 80 | string: 02016-09-30T10:26:39.373+09:00CEAP1609307388<meta name="globalsign-domain-verification" content="3_CE928vnJlefwSsc-ni6FfKy05Yo-aWwxEWunJd8P" />www.example.comexample.com 81 | http_version: 82 | recorded_at: Fri, 30 Sep 2016 01:26:39 GMT 83 | recorded_with: VCR 3.0.3 84 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/url_verification/renewal/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW_URL 21 | invalid_kind 22 | 1 23 | 24 | 1 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | xxxx123456789 44 | 45 | 46 | Pepabo 47 | Taro 48 | 090-1234-5678 49 | pepabo.taro@example.com 50 | 51 | 52 | 53 | 54 | 55 | headers: 56 | User-Agent: 57 | - Faraday v0.9.2 58 | Content-Type: 59 | - text/xml 60 | Accept-Encoding: 61 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 62 | Accept: 63 | - "*/*" 64 | response: 65 | status: 66 | code: 200 67 | message: OK 68 | headers: 69 | Date: 70 | - Fri, 30 Sep 2016 01:27:28 GMT 71 | Set-Cookie: 72 | - JSESSIONID=F5EBC49A0267239CEE7D7943059D4BAB; Path=/kb 73 | Content-Type: 74 | - text/xml;charset=UTF-8 75 | Content-Length: 76 | - '1018' 77 | Strict-Transport-Security: 78 | - max-age=60 79 | body: 80 | encoding: UTF-8 81 | string: -1-6102The renewal of the certificate failed. Please note that when renewing a certificate, the Common Name of the original certificate and this request must be the same. Please also check that the status of the original order is ISSUED and that the order has not been previously renewed.2016-09-30T10:27:28.520+09:00 82 | http_version: 83 | recorded_at: Fri, 30 Sep 2016 01:27:28 GMT 84 | recorded_with: VCR 3.0.3 85 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/url_verification/renewal/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | 20 | DV_LOW_URL 21 | new 22 | 1 23 | 24 | 1 25 | 26 | -----BEGIN CERTIFICATE REQUEST----- 27 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 28 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 29 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 30 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 31 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 32 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 33 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 34 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 35 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 36 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 37 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 38 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 39 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 40 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 41 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 42 | -----END CERTIFICATE REQUEST----- 43 | xxxx123456789 44 | 45 | 46 | Pepabo 47 | Taro 48 | 090-1234-5678 49 | pepabo.taro@example.com 50 | 51 | 52 | 53 | 54 | 55 | headers: 56 | User-Agent: 57 | - Faraday v0.9.2 58 | Content-Type: 59 | - text/xml 60 | Accept-Encoding: 61 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 62 | Accept: 63 | - "*/*" 64 | response: 65 | status: 66 | code: 200 67 | message: OK 68 | headers: 69 | Date: 70 | - Fri, 30 Sep 2016 01:26:29 GMT 71 | Set-Cookie: 72 | - JSESSIONID=85ADE8D7D82019DE847DF9EC876AF95F; Path=/kb 73 | Content-Type: 74 | - text/xml;charset=UTF-8 75 | Content-Length: 76 | - '689' 77 | Strict-Transport-Security: 78 | - max-age=60 79 | body: 80 | encoding: UTF-8 81 | string: 02016-09-30T10:26:39.373+09:00CEAP1609307388<meta name="globalsign-domain-verification" content="3_CE928vnJlefwSsc-ni6FfKy05Yo-aWwxEWunJd8P" />www.example.comexample.com 82 | http_version: 83 | recorded_at: Fri, 30 Sep 2016 01:26:39 GMT 84 | recorded_with: VCR 3.0.3 85 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/url_verification_for_issue/failure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | xxxx123456789 20 | http://example.com 21 | 22 | 23 | 24 | 25 | headers: 26 | User-Agent: 27 | - Faraday v0.9.2 28 | Content-Type: 29 | - text/xml 30 | Accept-Encoding: 31 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 32 | Accept: 33 | - "*/*" 34 | response: 35 | status: 36 | code: 200 37 | message: OK 38 | headers: 39 | Date: 40 | - Thu, 06 Oct 2016 05:31:30 GMT 41 | Set-Cookie: 42 | - JSESSIONID=5244FA32FFA126355DF005354E6A234D; Path=/kb 43 | Content-Type: 44 | - text/xml;charset=UTF-8 45 | Content-Length: 46 | - '837' 47 | Strict-Transport-Security: 48 | - max-age=60 49 | body: 50 | encoding: UTF-8 51 | string: '-1-4147We were unable to verify the domain http://example.com. Please ensure: 1. The domain is publicly accessible. 2. The verification meta tag is located in an approved location (See API specification for details). 3. The meta tag exactly matches the one we have provided.2016-10-06T14:31:30.857+09:00' 52 | http_version: 53 | recorded_at: Thu, 06 Oct 2016 05:31:30 GMT 54 | recorded_with: VCR 3.0.3 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/url_verification_for_issue/success.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://test-gcc.globalsign.com/kb/ws/v1/ServerSSLService 6 | body: 7 | encoding: UTF-8 8 | string: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | [USER_NAME] 16 | [PASSWORD] 17 | 18 | 19 | xxxx123456789 20 | http://example.com 21 | 22 | 23 | 24 | 25 | headers: 26 | User-Agent: 27 | - Faraday v0.9.2 28 | Content-Type: 29 | - text/xml 30 | Accept-Encoding: 31 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 32 | Accept: 33 | - "*/*" 34 | response: 35 | status: 36 | code: 200 37 | message: OK 38 | headers: 39 | Date: 40 | - Thu, 06 Oct 2016 05:53:21 GMT 41 | Set-Cookie: 42 | - JSESSIONID=52921AE65629FCEB0A05B3300C55BAC2; Path=/kb 43 | Content-Type: 44 | - text/xml;charset=UTF-8 45 | Transfer-Encoding: 46 | - chunked 47 | Strict-Transport-Security: 48 | - max-age=60 49 | body: 50 | encoding: UTF-8 51 | string: |- 52 | 02016-10-06T14:53:27.191+09:0042016-10-06T14:53:23.000+09:002016-11-06T14:53:23.000+09:00example.comCN = example.com, O = null, OU = Domain Control Validated, L = null, ST = null, C = JPROOT-----BEGIN CERTIFICATE----- 53 | aaaaa 54 | -----END CERTIFICATE----- 55 | INTER-----BEGIN CERTIFICATE----- 56 | bbbbb 57 | -----END CERTIFICATE----- 58 | -----BEGIN CERTIFICATE----- 59 | ccccc 60 | -----END CERTIFICATE----- 61 | -----BEGIN PKCS7----- 62 | ddddd 63 | -----END PKCS7----- 64 | 65 | http_version: 66 | recorded_at: Thu, 06 Oct 2016 05:53:27 GMT 67 | recorded_with: VCR 3.0.3 68 | -------------------------------------------------------------------------------- /spec/global_sign/client_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::Client do 4 | let(:client) { GlobalSign::Client.new } 5 | 6 | describe '#initialize' do 7 | it 'has required object instances' do 8 | expect(client.instance_variable_get(:@configuration)).to be_a(GlobalSign::Configuration) 9 | expect(client.instance_variable_get(:@connection)).to be_a(Faraday::Connection) 10 | end 11 | 12 | context 'with "options" parameter' do 13 | context 'when timeout is specified' do 14 | let(:client) do 15 | GlobalSign::Client.new(options: {timeout: 999}) 16 | end 17 | 18 | it 'sets the value as a request option default' do 19 | expect(client.instance_variable_get(:@connection).options.timeout).to eq 999 20 | end 21 | end 22 | end 23 | end 24 | 25 | describe '#process' do 26 | context 'when received wrong parameter' do 27 | let(:wrong_class_request) { Class.new } 28 | 29 | it 'raises ArgumentError' do 30 | expect { 31 | client.process(wrong_class_request) 32 | }.to raise_error(ArgumentError) 33 | end 34 | end 35 | end 36 | 37 | describe '#find_response_class_for' do 38 | context 'when received url_verification' do 39 | let(:url_verification_request) do 40 | GlobalSign::UrlVerification::Request.new( 41 | product_code: 'DV_LOW_URL', 42 | order_kind: 'new', 43 | validity_period_months: 6, 44 | csr: 'xxxxx', 45 | ) 46 | end 47 | 48 | it 'returns the response class corresponding to the request class' do 49 | expect(client.find_response_class_for(url_verification_request)).to eq(GlobalSign::UrlVerification::Response) 50 | end 51 | end 52 | 53 | context 'when received wrong parameter' do 54 | let(:wrong_class_request) { Class.new } 55 | 56 | it 'raises ArgumentError' do 57 | expect { 58 | client.process(wrong_class_request) 59 | }.to raise_error(ArgumentError) 60 | end 61 | end 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /spec/global_sign/csr_decoder/response_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::CsrDecoder::Response do 4 | let(:client) { GlobalSign::Client.new } 5 | 6 | before do 7 | VCR.use_cassette('csr_decoder/' + cassette_title) do 8 | @response = client.process(request) 9 | end 10 | end 11 | 12 | context 'when returned success response' do 13 | let(:cassette_title) { 'success' } 14 | 15 | let(:request) do 16 | GlobalSign::CsrDecoder::Request.new(csr: example_csr, product_type: 'DV_LOW') 17 | end 18 | 19 | it 'succeeds' do 20 | expect(@response.success?).to be_truthy 21 | expect(@response.error_code).to be_nil 22 | expect(@response.error_field).to be_nil 23 | expect(@response.error_message).to be_nil 24 | end 25 | 26 | it 'response includes decode_csr params' do 27 | expect(@response.params[:csr_data]).to be_present 28 | expect(@response.params[:csr_data][:common_name]).not_to be_nil 29 | expect(@response.params[:csr_data][:organization]).not_to be_nil 30 | expect(@response.params[:csr_data][:organization_unit]).not_to be_nil 31 | expect(@response.params[:csr_data][:locality]).not_to be_nil 32 | expect(@response.params[:csr_data][:state]).not_to be_nil 33 | expect(@response.params[:csr_data][:country]).not_to be_nil 34 | expect(@response.params[:csr_data][:email_address]).not_to be_nil 35 | expect(@response.params[:csr_data][:key_length]).not_to be_nil 36 | expect(@response.params[:certificate_preview]).to be_present 37 | expect(@response.params[:certificate_preview][:common_name]).not_to be_nil 38 | expect(@response.params[:certificate_preview][:organization]).not_to be_nil 39 | expect(@response.params[:certificate_preview][:organization_unit]).not_to be_nil 40 | expect(@response.params[:certificate_preview][:locality]).not_to be_nil 41 | expect(@response.params[:certificate_preview][:state]).not_to be_nil 42 | expect(@response.params[:certificate_preview][:country]).not_to be_nil 43 | expect(@response.params[:certificate_preview][:email_address]).not_to be_nil 44 | expect(@response.params[:certificate_preview][:key_length]).not_to be_nil 45 | end 46 | end 47 | 48 | context 'when returned error response' do 49 | let(:cassette_title) { 'failure' } 50 | 51 | let(:request) do 52 | GlobalSign::CsrDecoder::Request.new(csr: example_csr, product_type: 'INVALID') 53 | end 54 | 55 | it 'fails' do 56 | expect(@response.error?).to be_truthy 57 | expect(@response.error_code).to eq('-1') 58 | expect(@response.error_message).to include('Internal system error.') 59 | end 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /spec/global_sign/dns_verification/response_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::DnsVerification::Response do 4 | let(:client) { GlobalSign::Client.new } 5 | let(:contract) do 6 | GlobalSign::Contract.new( 7 | first_name: 'Pepabo', 8 | last_name: 'Taro', 9 | phone_number: '090-1234-5678', 10 | email: 'pepabo.taro@example.com', 11 | ) 12 | end 13 | 14 | context 'when requested a new certificate' do 15 | before do 16 | VCR.use_cassette('dns_verification/new/' + cassette_title) do 17 | @response = client.process(request) 18 | end 19 | end 20 | 21 | context 'when returned success response' do 22 | let(:cassette_title) { 'success' } 23 | 24 | let(:request) do 25 | GlobalSign::DnsVerification::Request.new( 26 | product_code: 'DV_LOW_DNS', 27 | order_kind: 'new', 28 | validity_period_months: 6, 29 | csr: example_csr, 30 | contract_info: contract, 31 | ) 32 | end 33 | 34 | it 'succeeds' do 35 | expect(@response.success?).to be_truthy 36 | expect(@response.error_code).to be_nil 37 | expect(@response.error_field).to be_nil 38 | expect(@response.error_message).to be_nil 39 | end 40 | 41 | it 'returns response includes dns_verification params' do 42 | expect(@response.params[:order_id]).to be_present 43 | expect(@response.params[:dns_txt]).to be_present 44 | expect(@response.params[:verification_fqdn_list]).to be_present 45 | end 46 | end 47 | 48 | context 'when returned error response' do 49 | let(:cassette_title) { 'failure' } 50 | 51 | let(:request) do 52 | GlobalSign::DnsVerification::Request.new( 53 | product_code: 'DV_LOW_DNS', 54 | order_kind: 'invalid_kind', 55 | validity_period_months: 6, 56 | csr: example_csr, 57 | contract_info: contract, 58 | ) 59 | end 60 | 61 | it 'fails' do 62 | expect(@response.error?).to be_truthy 63 | expect(@response.error_code).to eq('-103') 64 | expect(@response.error_field).to eq('OrderRequestParameter.OrderKind') 65 | expect(@response.error_message).to include('Parameter length check error.') 66 | end 67 | end 68 | end 69 | 70 | context 'when requested a renewal certificate' do 71 | before do 72 | VCR.use_cassette('dns_verification/renewal/' + cassette_title) do 73 | @response = client.process(request) 74 | end 75 | end 76 | 77 | let(:order_id) { 'xxxx123456789' } 78 | 79 | context 'when returned success response' do 80 | let(:cassette_title) { 'success' } 81 | 82 | let(:request) do 83 | GlobalSign::DnsVerification::Request.new( 84 | product_code: 'DV_LOW_DNS', 85 | order_kind: 'renewal', 86 | validity_period_months: 6, 87 | csr: example_csr, 88 | renewal_target_order_id: order_id, 89 | contract_info: contract, 90 | ) 91 | end 92 | 93 | it 'succeeds' do 94 | expect(@response.success?).to be_truthy 95 | expect(@response.error_code).to be_nil 96 | expect(@response.error_field).to be_nil 97 | expect(@response.error_message).to be_nil 98 | end 99 | 100 | it 'returns response includes dns_verification params' do 101 | expect(@response.params[:order_id]).to be_present 102 | expect(@response.params[:dns_txt]).to be_present 103 | expect(@response.params[:verification_fqdn_list]).to be_present 104 | end 105 | end 106 | 107 | context 'when returned error response' do 108 | let(:cassette_title) { 'failure' } 109 | 110 | let(:request) do 111 | GlobalSign::DnsVerification::Request.new( 112 | product_code: 'DV_LOW_DNS', 113 | order_kind: 'renewal', 114 | validity_period_months: 6, 115 | csr: example_csr, 116 | renewal_target_order_id: order_id, 117 | contract_info: contract, 118 | ) 119 | end 120 | 121 | it 'fails' do 122 | expect(@response.error?).to be_truthy 123 | expect(@response.error_code).to eq('-6102') 124 | expect(@response.error_message).to include('The renewal of the certificate failed.') 125 | end 126 | end 127 | end 128 | end 129 | -------------------------------------------------------------------------------- /spec/global_sign/dns_verification_for_issue/response_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::DnsVerificationForIssue::Response do 4 | let(:client) { GlobalSign::Client.new } 5 | 6 | before do 7 | VCR.use_cassette('dns_verification_for_issue/' + cassette_title) do 8 | @response = client.process(request) 9 | end 10 | end 11 | 12 | context 'when returned success response' do 13 | let(:cassette_title) { 'success' } 14 | 15 | let(:request) do 16 | GlobalSign::DnsVerificationForIssue::Request.new( 17 | order_id: 'xxxx123456789', 18 | approver_fqdn: 'www.example.com', 19 | ) 20 | end 21 | 22 | it 'succeeds' do 23 | expect(@response.success?).to be_truthy 24 | expect(@response.error_code).to be_nil 25 | expect(@response.error_field).to be_nil 26 | expect(@response.error_message).to be_nil 27 | end 28 | 29 | it 'returns response includes dns_verification_for_issue params' do 30 | expect(@response.params[:certificate_info]).to be_present 31 | expect(@response.params[:fulfillment][:ca_certificates].first).to be_present 32 | end 33 | end 34 | 35 | context 'when returned error response' do 36 | let(:cassette_title) { 'failure' } 37 | 38 | let(:request) do 39 | GlobalSign::DnsVerificationForIssue::Request.new( 40 | order_id: 'xxxx123456789', 41 | approver_fqdn: 'www.example.com', 42 | ) 43 | end 44 | 45 | it 'fails' do 46 | expect(@response.error?).to be_truthy 47 | expect(@response.error_code).to eq('-4147') 48 | expect(@response.error_message).to include('We were unable to verify the domain http://example.com.') 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /spec/global_sign/dv_approver_list/response_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::DVApproverList::Response do 4 | let(:client) { GlobalSign::Client.new } 5 | let(:contract) do 6 | GlobalSign::Contract.new( 7 | first_name: 'Pepabo', 8 | last_name: 'Taro', 9 | phone_number: '090-1234-5678', 10 | email: 'pepabo.taro@example.com' 11 | ) 12 | end 13 | let(:approvers_suffix) do 14 | /admin|administrator|hostmaster|postmaster|webmaster/ 15 | end 16 | 17 | subject { GlobalSign::DVApproverList::Request.new(url) } 18 | 19 | before do 20 | VCR.use_cassette('dv_approver_list/' + cassette_title) do 21 | @response = client.process(subject) 22 | end 23 | end 24 | 25 | context 'when is a success response' do 26 | let(:url) { 'example.com' } 27 | let(:cassette_title) { 'success' } 28 | 29 | it 'succeeds' do 30 | expect(@response.success?).to be_truthy 31 | expect(@response.error_code).to be_nil 32 | expect(@response.error_field).to be_nil 33 | expect(@response.error_message).to be_nil 34 | end 35 | 36 | it 'includes orderID and list of approvers' do 37 | expect(@response.params[:order_id]).to be_present 38 | expect(@response.params[:order_id]).to eq 'xxxx123456789' 39 | expect(@response.params[:approvers]).to_not be_nil 40 | 41 | @response.params[:approvers].each do |approver| 42 | expect(approver[:email]).to end_with "@#{url}" 43 | expect(approver[:email]).to match approvers_suffix 44 | expect(approver[:type]).to eq 'GENERIC' 45 | end 46 | end 47 | end 48 | 49 | context 'when is a failure response' do 50 | let(:url) { nil } 51 | let(:cassette_title) { 'failure' } 52 | let(:error_message) do 53 | 'Mandatory parameter missing. Please check that the parameters match the'\ 54 | ' API specification. Please review the specific ErrorMessage returned in'\ 55 | ' the XML response for parameter details and consult the XML Field'\ 56 | ' definitions section of the applicable API document.' 57 | end 58 | 59 | it 'fails' do 60 | expect(@response.success?).to be_falsy 61 | expect(@response.error_code).to_not be_nil 62 | expect(@response.error_field).to_not be_nil 63 | expect(@response.error_message).to_not be_nil 64 | end 65 | 66 | it 'includes the errors' do 67 | expect(@response.error?).to be_truthy 68 | expect(@response.error_code).to eq('-102') 69 | expect(@response.error_message).to eq error_message 70 | end 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /spec/global_sign/dv_order/response_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::DVOrder::Response do 4 | let(:client) { GlobalSign::Client.new } 5 | let(:contract) do 6 | GlobalSign::Contract.new( 7 | first_name: 'Pepabo', 8 | last_name: 'Taro', 9 | phone_number: '090-1234-5678', 10 | email: 'pepabo.taro@example.com' 11 | ) 12 | end 13 | let(:csr) { example_csr } 14 | let(:id) { 'xxxx123456789' } 15 | let(:approver_email) { 'admin@example.com' } 16 | 17 | context 'when requested a new certificate' do 18 | let(:order_id) { id } 19 | let(:request) do 20 | GlobalSign::DVOrder::Request.new( 21 | product_code: 'DV_LOW', 22 | order_kind: 'new', 23 | validity_period_months: 6, 24 | csr: csr, 25 | approver_email: approver_email, 26 | order_id: order_id, 27 | contract_info: contract 28 | ) 29 | end 30 | 31 | subject do 32 | VCR.use_cassette('dv_order/new/' + cassette_title) do 33 | client.process(request) 34 | end 35 | end 36 | 37 | context 'when returned success response' do 38 | let(:cassette_title) { 'success' } 39 | 40 | it 'succeeds' do 41 | expect(subject.success?).to be_truthy 42 | expect(subject.error_code).to be_nil 43 | expect(subject.error_field).to be_nil 44 | expect(subject.error_message).to be_nil 45 | end 46 | 47 | it 'returns response with order id' do 48 | expect(subject.params[:order_id]).to be_present 49 | end 50 | end 51 | 52 | context 'when returned error response' do 53 | let(:cassette_title) { 'failure' } 54 | 55 | it 'specifies the error' do 56 | expect(subject.success?).to be_falsy 57 | expect(subject.error_code).to_not be_nil 58 | expect(subject.error_field).to_not be_nil 59 | expect(subject.error_message).to_not be_nil 60 | end 61 | 62 | it 'returns empty order id' do 63 | expect(subject.params[:order_id]).to be_empty 64 | end 65 | end 66 | end 67 | 68 | context 'when requested a renewal certificate' do 69 | let(:order_id) { 'xxxx123456780' } 70 | let(:renewal_target_order_id) { id } 71 | let(:request) do 72 | GlobalSign::DVOrder::Request.new( 73 | product_code: 'DV_LOW', 74 | order_kind: 'renewal', 75 | validity_period_months: 6, 76 | csr: csr, 77 | approver_email: approver_email, 78 | order_id: order_id, 79 | contract_info: contract, 80 | renewal_target_order_id: renewal_target_order_id 81 | ) 82 | end 83 | 84 | subject do 85 | VCR.use_cassette('dv_order/renewal/' + cassette_title) do 86 | @response = client.process(request) 87 | end 88 | end 89 | 90 | context 'when returned success response' do 91 | let(:cassette_title) { 'success' } 92 | 93 | it 'succeeds' do 94 | expect(subject.success?).to be_truthy 95 | expect(subject.error_code).to be_nil 96 | expect(subject.error_field).to be_nil 97 | expect(subject.error_message).to be_nil 98 | end 99 | 100 | it 'returns response with order id' do 101 | expect(subject.params[:order_id]).to be_present 102 | end 103 | end 104 | 105 | context 'when returned error response' do 106 | let(:cassette_title) { 'failure' } 107 | 108 | it 'specifies the error' do 109 | expect(subject.success?).to be_falsy 110 | expect(subject.error_code).to_not be_nil 111 | expect(subject.error_field).to be_nil 112 | expect(subject.error_message).to_not be_nil 113 | end 114 | 115 | it 'returns empty order id' do 116 | expect(subject.params[:order_id]).to be_empty 117 | end 118 | end 119 | end 120 | end 121 | -------------------------------------------------------------------------------- /spec/global_sign/ev_order/response_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::EVOrder::Response do 4 | let(:client) { GlobalSign::Client.new } 5 | let(:contract) do 6 | GlobalSign::Contract.new( 7 | first_name: 'Example', 8 | last_name: 'Taro', 9 | phone_number: '090-1234-5678', 10 | email: 'taro@example.com' 11 | ) 12 | end 13 | let(:organization_info_ev) do 14 | GlobalSign::OrganizationInfoEV.new( 15 | organization_code: '123456789', 16 | business_category_code: GlobalSign::OrganizationInfoEV::BusinessCategoryCode::PRIVATE_ORGANIZATION, 17 | organization_address: GlobalSign::OrganizationAddress.new( 18 | address_line1: '26-1', 19 | city: 'Shibuya', 20 | region: 'Tokyo', 21 | postal_code: '150-0031', 22 | country: 'JP', 23 | phone: '090-1234-5678' 24 | ) 25 | ) 26 | end 27 | let(:requestor_info) do 28 | GlobalSign::RequestorInfo.new( 29 | first_name: 'Example', 30 | last_name: 'Requestor', 31 | organization_name: 'CompanyName, Inc.', 32 | phone_number: '090-1234-5678', 33 | email: 'requestor@example.com' 34 | ) 35 | end 36 | let(:approver_info) do 37 | GlobalSign::ApproverInfo.new( 38 | first_name: 'Example', 39 | last_name: 'Approver', 40 | organization_name: 'CompanyName, Inc.', 41 | phone_number: '090-1234-5678', 42 | email: 'approver@example.com' 43 | ) 44 | end 45 | let(:authorized_signer_info) do 46 | GlobalSign::AuthorizedSignerInfo.new( 47 | first_name: 'Example', 48 | last_name: 'AuthorizedSigner', 49 | organization_name: 'CompanyName, Inc.', 50 | phone_number: '090-1234-5678', 51 | email: 'authorized_signer@example.com' 52 | ) 53 | end 54 | let(:jurisdiction_info) do 55 | GlobalSign::JurisdictionInfo.new( 56 | jurisdiction_country: 'JP', 57 | state_or_province: 'Tokyo', 58 | locality: 'Shibuya', 59 | incorporating_agency_registration_number: '1234-12-123456' 60 | ) 61 | end 62 | let(:csr) { example_csr } 63 | let(:id) { 'xxxx123456789' } 64 | 65 | context 'when requested a new certificate' do 66 | let(:request) do 67 | GlobalSign::EVOrder::Request.new( 68 | order_kind: 'new', 69 | validity_period_months: 12, 70 | csr: csr, 71 | contract_info: contract, 72 | organization_info_ev: organization_info_ev, 73 | requestor_info: requestor_info, 74 | approver_info: approver_info, 75 | authorized_signer_info: authorized_signer_info, 76 | jurisdiction_info: jurisdiction_info 77 | ) 78 | end 79 | 80 | subject do 81 | VCR.use_cassette('ev_order/new/' + cassette_title) do 82 | client.process(request) 83 | end 84 | end 85 | 86 | context 'when returned success response' do 87 | let(:cassette_title) { 'success' } 88 | 89 | it 'succeeds' do 90 | expect(subject.success?).to be_truthy 91 | expect(subject.error_code).to be_nil 92 | expect(subject.error_field).to be_nil 93 | expect(subject.error_message).to be_nil 94 | end 95 | 96 | it 'returns response with order id' do 97 | expect(subject.params[:order_id]).to be_present 98 | end 99 | end 100 | 101 | context 'when returned error response' do 102 | let(:cassette_title) { 'failure' } 103 | 104 | it 'specifies the error' do 105 | expect(subject.success?).to be_falsy 106 | expect(subject.error_code).to_not be_nil 107 | expect(subject.error_field).to_not be_nil 108 | expect(subject.error_message).to_not be_nil 109 | end 110 | 111 | it 'returns empty order id' do 112 | expect(subject.params[:order_id]).to be_empty 113 | end 114 | end 115 | end 116 | 117 | context 'when requested a renewal certificate' do 118 | let(:renewal_target_order_id) { id } 119 | let(:request) do 120 | GlobalSign::EVOrder::Request.new( 121 | order_kind: 'renewal', 122 | validity_period_months: 12, 123 | csr: csr, 124 | contract_info: contract, 125 | organization_info_ev: organization_info_ev, 126 | requestor_info: requestor_info, 127 | approver_info: approver_info, 128 | authorized_signer_info: authorized_signer_info, 129 | jurisdiction_info: jurisdiction_info, 130 | renewal_target_order_id: renewal_target_order_id 131 | ) 132 | end 133 | 134 | subject do 135 | VCR.use_cassette('ev_order/renewal/' + cassette_title) do 136 | @response = client.process(request) 137 | end 138 | end 139 | 140 | context 'when returned success response' do 141 | let(:cassette_title) { 'success' } 142 | 143 | it 'succeeds' do 144 | expect(subject.success?).to be_truthy 145 | expect(subject.error_code).to be_nil 146 | expect(subject.error_field).to be_nil 147 | expect(subject.error_message).to be_nil 148 | end 149 | 150 | it 'returns response with order id' do 151 | expect(subject.params[:order_id]).to be_present 152 | end 153 | end 154 | 155 | context 'when returned error response' do 156 | let(:cassette_title) { 'failure' } 157 | 158 | it 'specifies the error' do 159 | expect(subject.success?).to be_falsy 160 | expect(subject.error_code).to_not be_nil 161 | expect(subject.error_field).to_not be_nil 162 | expect(subject.error_message).to_not be_nil 163 | end 164 | 165 | it 'returns empty order id' do 166 | expect(subject.params[:order_id]).to be_empty 167 | end 168 | end 169 | end 170 | end 171 | -------------------------------------------------------------------------------- /spec/global_sign/order_getter_by_order_id/request_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::OrderGetterByOrderId::Request do 4 | 5 | describe '#params' do 6 | subject { GlobalSign::OrderGetterByOrderId::Request.new(order_id: 'xxxx123456789', options: options).params } 7 | 8 | context 'when no options' do 9 | let(:options) { {} } 10 | it do 11 | expect(subject).to eq( 12 | { 13 | OrderID: 'xxxx123456789' 14 | } 15 | ) 16 | end 17 | end 18 | 19 | context 'when adds certificate_info option' do 20 | let(:options) { { certificate_info: true } } 21 | it do 22 | expect(subject).to eq( 23 | { 24 | OrderID: 'xxxx123456789', 25 | OrderQueryOption: { 26 | ReturnCertificateInfo: true 27 | } 28 | } 29 | ) 30 | end 31 | end 32 | 33 | context 'when adds fulfillment option' do 34 | let(:options) { { fulfillment: true } } 35 | it do 36 | expect(subject).to eq( 37 | { 38 | OrderID: 'xxxx123456789', 39 | OrderQueryOption: { 40 | ReturnFulfillment: true 41 | } 42 | } 43 | ) 44 | end 45 | end 46 | 47 | context 'when adds multiple options' do 48 | let(:options) { { certificate_info: true, fulfillment: true } } 49 | it do 50 | expect(subject).to eq( 51 | { 52 | OrderID: 'xxxx123456789', 53 | OrderQueryOption: { 54 | ReturnCertificateInfo: true, 55 | ReturnFulfillment: true 56 | } 57 | } 58 | ) 59 | end 60 | end 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /spec/global_sign/order_getter_by_order_id/response_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::OrderGetterByOrderId::Response do 4 | let(:client) { GlobalSign::Client.new } 5 | 6 | before do 7 | VCR.use_cassette('order_getter_by_order_id/' + cassette_title) do 8 | @response = client.process(request) 9 | end 10 | end 11 | 12 | shared_examples_for 'succeeds' do 13 | it do 14 | expect(@response.success?).to be_truthy 15 | expect(@response.error_code).to be_nil 16 | expect(@response.error_field).to be_nil 17 | expect(@response.error_message).to be_nil 18 | end 19 | 20 | it 'response includes order_getter_by_order_id params' do 21 | expect(@response.params[:order_id]).to be_present 22 | expect(@response.params[:order_status]).to be_present 23 | expect(@response.params[:modification_events]).to be_present 24 | end 25 | 26 | it 'returns order_status text' do 27 | expect(@response.order_status_text).to eq(order_status) 28 | end 29 | end 30 | 31 | context 'when returned success response' do 32 | let(:cassette_title) { 'success' } 33 | let(:order_status) { 'initial' } 34 | 35 | let(:request) do 36 | GlobalSign::OrderGetterByOrderId::Request.new(order_id: 'xxxx123456789') 37 | end 38 | 39 | it_behaves_like 'succeeds' 40 | 41 | it 'not exists option responses' do 42 | expect(@response.params[:certificate_info]).to be_nil 43 | expect(@response.params[:fulfillment]).to be_nil 44 | end 45 | end 46 | 47 | context 'when returned success response with certificate_info option' do 48 | let(:request) do 49 | GlobalSign::OrderGetterByOrderId::Request.new(order_id: 'xxxx123456789', options: {certificate_info: true}) 50 | end 51 | 52 | context 'when order_status completed_issue' do 53 | let(:cassette_title) { 'with_certificate_info' } 54 | let(:order_status) { 'completed_issue' } 55 | 56 | it_behaves_like 'succeeds' 57 | 58 | it 'exists certificate_info option response' do 59 | expect(@response.params[:certificate_info]).to be_present 60 | expect(@response.params[:fulfillment]).to be_nil 61 | end 62 | end 63 | 64 | context 'when order_status initial' do 65 | let(:cassette_title) { 'with_certificate_info_order_status_initial' } 66 | let(:order_status) { 'initial' } 67 | 68 | it_behaves_like 'succeeds' 69 | 70 | it 'exists certificate_info option response' do 71 | expect(@response.params[:certificate_info]).to be_present 72 | end 73 | 74 | it 'start_date is nil' do 75 | expect(@response.params[:certificate_info][:start_date]).to be_nil 76 | end 77 | end 78 | end 79 | 80 | context 'when returned success response with fulfillment option' do 81 | let(:cassette_title) { 'with_fulfillment' } 82 | let(:order_status) { 'completed_issue' } 83 | 84 | let(:request) do 85 | GlobalSign::OrderGetterByOrderId::Request.new(order_id: 'xxxx123456789', options: {fulfillment: true}) 86 | end 87 | 88 | it_behaves_like 'succeeds' 89 | 90 | it 'exists fulfillment option response' do 91 | expect(@response.params[:certificate_info]).to be_nil 92 | expect(@response.params[:fulfillment]).to be_present 93 | end 94 | end 95 | 96 | context 'when returned error response' do 97 | let(:cassette_title) { 'failure' } 98 | 99 | let(:request) do 100 | GlobalSign::OrderGetterByOrderId::Request.new(order_id: 'invalid_order_id') 101 | end 102 | 103 | it 'fails' do 104 | expect(@response.error?).to be_truthy 105 | expect(@response.error_code).to eq('-1') 106 | expect(@response.error_message).to include('Internal system error.') 107 | end 108 | end 109 | end 110 | -------------------------------------------------------------------------------- /spec/global_sign/ov_order/response_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::OVOrder::Response do 4 | let(:client) { GlobalSign::Client.new } 5 | let(:contract) do 6 | GlobalSign::Contract.new( 7 | first_name: 'Pepabo', 8 | last_name: 'Taro', 9 | phone_number: '090-1234-5678', 10 | email: 'pepabo.taro@example.com' 11 | ) 12 | end 13 | let(:organization_info) do 14 | GlobalSign::OrganizationInfo.new( 15 | organization_name: 'CompanyName, Inc.', 16 | credit_agency: GlobalSign::OrganizationInfo::CreditAgency::TDB, 17 | organization_code: 111, 18 | organization_address: GlobalSign::OrganizationAddress.new( 19 | address_line1: '26-1', 20 | city: 'Shibuya', 21 | region: 'Tokyo', 22 | postal_code: '150-0031', 23 | country: 'JP', 24 | phone: '090-1234-5678' 25 | ) 26 | ) 27 | end 28 | let(:csr) { example_csr } 29 | let(:id) { 'xxxx123456789' } 30 | 31 | context 'when requested a new certificate' do 32 | let(:request) do 33 | GlobalSign::OVOrder::Request.new( 34 | order_kind: 'new', 35 | validity_period_months: 12, 36 | csr: csr, 37 | contract_info: contract, 38 | organization_info: organization_info 39 | ) 40 | end 41 | 42 | subject do 43 | VCR.use_cassette('ov_order/new/' + cassette_title) do 44 | client.process(request) 45 | end 46 | end 47 | 48 | context 'when returned success response' do 49 | let(:cassette_title) { 'success' } 50 | 51 | it 'succeeds' do 52 | expect(subject.success?).to be_truthy 53 | expect(subject.error_code).to be_nil 54 | expect(subject.error_field).to be_nil 55 | expect(subject.error_message).to be_nil 56 | end 57 | 58 | it 'returns response with order id' do 59 | expect(subject.params[:order_id]).to be_present 60 | end 61 | end 62 | 63 | context 'when returned error response' do 64 | let(:cassette_title) { 'failure' } 65 | 66 | it 'specifies the error' do 67 | expect(subject.success?).to be_falsy 68 | expect(subject.error_code).to_not be_nil 69 | expect(subject.error_field).to_not be_nil 70 | expect(subject.error_message).to_not be_nil 71 | end 72 | 73 | it 'returns empty order id' do 74 | expect(subject.params[:order_id]).to be_empty 75 | end 76 | end 77 | end 78 | 79 | context 'when requested a renewal certificate' do 80 | let(:renewal_target_order_id) { id } 81 | let(:request) do 82 | GlobalSign::OVOrder::Request.new( 83 | order_kind: 'renewal', 84 | validity_period_months: 12, 85 | csr: csr, 86 | contract_info: contract, 87 | organization_info: organization_info, 88 | renewal_target_order_id: renewal_target_order_id 89 | ) 90 | end 91 | 92 | subject do 93 | VCR.use_cassette('ov_order/renewal/' + cassette_title) do 94 | @response = client.process(request) 95 | end 96 | end 97 | 98 | context 'when returned success response' do 99 | let(:cassette_title) { 'success' } 100 | 101 | it 'succeeds' do 102 | expect(subject.success?).to be_truthy 103 | expect(subject.error_code).to be_nil 104 | expect(subject.error_field).to be_nil 105 | expect(subject.error_message).to be_nil 106 | end 107 | 108 | it 'returns response with order id' do 109 | expect(subject.params[:order_id]).to be_present 110 | end 111 | end 112 | 113 | context 'when returned error response' do 114 | let(:cassette_title) { 'failure' } 115 | 116 | it 'specifies the error' do 117 | expect(subject.success?).to be_falsy 118 | expect(subject.error_code).to_not be_nil 119 | expect(subject.error_field).to_not be_nil 120 | expect(subject.error_message).to_not be_nil 121 | end 122 | 123 | it 'returns empty order id' do 124 | expect(subject.params[:order_id]).to be_empty 125 | end 126 | end 127 | end 128 | end 129 | -------------------------------------------------------------------------------- /spec/global_sign/request_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::Request do 4 | let(:contract) do 5 | GlobalSign::Contract.new( 6 | first_name: 'Pepabo', 7 | last_name: 'Taro', 8 | phone_number: '090-1234-5678', 9 | email: 'pepabo.taro@example.com', 10 | ) 11 | end 12 | 13 | let(:request) do 14 | GlobalSign::UrlVerification::Request.new( 15 | product_code: 'DV_LOW_URL', 16 | order_kind: 'new', 17 | validity_period_months: 6, 18 | csr: 'xxxxx', 19 | contract_info: contract, 20 | ) 21 | end 22 | 23 | describe '#to_xml' do 24 | let(:action_name) { 'URLVerification' } 25 | let(:params) { request.auth_token_params.merge(request.params) } 26 | 27 | before do 28 | allow(request).to receive(:action).and_return(action_name) 29 | allow(request).to receive(:params).and_return({}) 30 | end 31 | 32 | it 'calls RequestXmlBuilder.build_xml' do 33 | expect(GlobalSign::RequestXmlBuilder).to receive(:build_xml). 34 | with(action: action_name, params: params) 35 | request.to_xml 36 | end 37 | end 38 | 39 | describe '#auth_token_params' do 40 | let(:user_name) { 'PAR12345_taro' } 41 | let(:password) { 'password' } 42 | 43 | before do 44 | GlobalSign.configure do |configuration| 45 | configuration.user_name = user_name 46 | configuration.password = password 47 | end 48 | end 49 | 50 | it 'returns hash' do 51 | expect(request.auth_token_params).to eq( 52 | { 53 | OrderRequestHeader: { 54 | AuthToken: { 55 | UserName: user_name, 56 | Password: password, 57 | } 58 | } 59 | } 60 | ) 61 | end 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /spec/global_sign/request_xml_builder_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::RequestXmlBuilder do 4 | describe '.build_xml' do 5 | let(:contract) do 6 | GlobalSign::Contract.new( 7 | first_name: 'Pepabo', 8 | last_name: 'Taro', 9 | phone_number: '090-1234-5678', 10 | email: 'pepabo.taro@example.com', 11 | ) 12 | end 13 | 14 | let(:request) do 15 | GlobalSign::UrlVerification::Request.new( 16 | product_code: 'DV_LOW_URL', 17 | order_kind: 'new', 18 | validity_period_months: 6, 19 | csr: 'xxxxx', 20 | contract_info: contract, 21 | ) 22 | end 23 | 24 | let(:xml) { File.read('spec/fixtures/global_sign_request.xml') } 25 | 26 | subject { GlobalSign::RequestXmlBuilder.build_xml(action: request.action, params: request.params) } 27 | 28 | it 'returns xml for GlobalSign API request' do 29 | is_expected.to eq(Nokogiri::XML(xml).root.to_xml) 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /spec/global_sign/url_verification/response_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::UrlVerification::Response do 4 | let(:client) { GlobalSign::Client.new } 5 | let(:contract) do 6 | GlobalSign::Contract.new( 7 | first_name: 'Pepabo', 8 | last_name: 'Taro', 9 | phone_number: '090-1234-5678', 10 | email: 'pepabo.taro@example.com', 11 | ) 12 | end 13 | 14 | let(:csr) do 15 | <<-EOS 16 | -----BEGIN CERTIFICATE REQUEST----- 17 | MIICuDCCAaACAQAwczELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD 18 | VQQHEwpTaGlidXlhLWt1MRkwFwYDVQQKExBHTU8gUGVwYWJvLCBJbmMuMQowCAYD 19 | VQQLEwEtMRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEB 20 | AQUAA4IBDwAwggEKAoIBAQCwKGVMbfx6owwrM2bgsWaQvoGCCSuxscq/PyGOMWuW 21 | whZ+Q6sPZJNNyb41jE1LgFgD4a3ku8JhdGjsjGVPi+9/OuGK9IISRMTwUsorwHKS 22 | C8hV6T2CBEKdayrZZ6695Mc9jLhn6tqLHRql1lAKXwTBbaDsdyftuMo73AhpjVBL 23 | 4M2c/lsJWaE0K1S1QORckNwZ1FyDYzX04Urz1IdnJ3wF+bRsN1xQUs2QjFlxA4Ot 24 | dqqvIN9oY9wVaNEBZMBAcX5bHPgq7s4BnkoyDh4/7HycNmzK2Z6HzcNvfic/Apvf 25 | 6+jkBJztEeRo7F1XDj8grOczFX1jUasazI+kn6IdMzTvAgMBAAGgADANBgkqhkiG 26 | 9w0BAQUFAAOCAQEAV66uWDxCpmvqpYU+ISG4kfxv74o1jxLpjrS07Owfvxt0/mik 27 | cFHR+nIDCaHKhgOfJIS9xCvMWIkmHyRih/XK9yCUpmbkOKj2704E0O2FUZiNDZ9x 28 | 02gufWbtYw8s4ReKewejPtQ6L8SY2QgE5kBvEW3W+ZLTK1EE3LsX6eRCabxOVgAJ 29 | ehacXTKnkLVndPImstQHq0iKM3ScUuIYpKodM7rVugjTiBt0cKe6dERoTQqWr+gH 30 | gUktKs5ENeEWEW4Gepr3XBUTV4ViP29i/pYCMZc294hhx9Y0ggXPceKNBaqeHsYt 31 | fTyAz1FGQxpdac76Jp9EO1xnzGCnPp9A3ACneg== 32 | -----END CERTIFICATE REQUEST----- 33 | EOS 34 | end 35 | 36 | context 'when requested a new certificate' do 37 | before do 38 | VCR.use_cassette('url_verification/new/' + cassette_title) do 39 | @response = client.process(request) 40 | end 41 | end 42 | 43 | context 'when returned success response' do 44 | let(:cassette_title) { 'success' } 45 | 46 | let(:request) do 47 | GlobalSign::UrlVerification::Request.new( 48 | product_code: 'DV_LOW_URL', 49 | order_kind: 'new', 50 | validity_period_months: 6, 51 | csr: csr, 52 | contract_info: contract, 53 | ) 54 | end 55 | 56 | it 'succeeds' do 57 | expect(@response.success?).to be_truthy 58 | expect(@response.error_code).to be_nil 59 | expect(@response.error_field).to be_nil 60 | expect(@response.error_message).to be_nil 61 | end 62 | 63 | it 'returns response includes url_verification params' do 64 | expect(@response.params[:order_id]).to be_present 65 | expect(@response.params[:meta_tag]).to be_present 66 | expect(@response.params[:verification_url_list]).to be_present 67 | end 68 | end 69 | 70 | context 'when returned error response' do 71 | let(:cassette_title) { 'failure' } 72 | 73 | let(:request) do 74 | GlobalSign::UrlVerification::Request.new( 75 | product_code: 'DV_LOW_URL', 76 | order_kind: 'invalid_kind', 77 | validity_period_months: 6, 78 | csr: csr, 79 | contract_info: contract, 80 | ) 81 | end 82 | 83 | it 'fails' do 84 | expect(@response.error?).to be_truthy 85 | expect(@response.error_code).to eq('-103') 86 | expect(@response.error_field).to eq('OrderRequestParameter.OrderKind') 87 | expect(@response.error_message).to include('Parameter length check error.') 88 | end 89 | end 90 | end 91 | 92 | context 'when requested a renewal certificate' do 93 | before do 94 | VCR.use_cassette('url_verification/renewal/' + cassette_title) do 95 | @response = client.process(request) 96 | end 97 | end 98 | 99 | let(:order_id) { 'xxxx123456789' } 100 | 101 | context 'when returned success response' do 102 | let(:cassette_title) { 'success' } 103 | 104 | let(:request) do 105 | GlobalSign::UrlVerification::Request.new( 106 | product_code: 'DV_LOW_URL', 107 | order_kind: 'renewal', 108 | validity_period_months: 6, 109 | csr: csr, 110 | renewal_target_order_id: order_id, 111 | contract_info: contract, 112 | ) 113 | end 114 | 115 | it 'succeeds' do 116 | expect(@response.success?).to be_truthy 117 | expect(@response.error_code).to be_nil 118 | expect(@response.error_field).to be_nil 119 | expect(@response.error_message).to be_nil 120 | end 121 | 122 | it 'returns response includes url_verification params' do 123 | expect(@response.params[:order_id]).to be_present 124 | expect(@response.params[:meta_tag]).to be_present 125 | expect(@response.params[:verification_url_list]).to be_present 126 | end 127 | end 128 | 129 | context 'when returned error response' do 130 | let(:cassette_title) { 'failure' } 131 | 132 | let(:request) do 133 | GlobalSign::UrlVerification::Request.new( 134 | product_code: 'DV_LOW_URL', 135 | order_kind: 'renewal', 136 | validity_period_months: 6, 137 | csr: csr, 138 | renewal_target_order_id: order_id, 139 | contract_info: contract, 140 | ) 141 | end 142 | 143 | it 'fails' do 144 | expect(@response.error?).to be_truthy 145 | expect(@response.error_code).to eq('-6102') 146 | expect(@response.error_message).to include('The renewal of the certificate failed.') 147 | end 148 | end 149 | end 150 | end 151 | -------------------------------------------------------------------------------- /spec/global_sign/url_verification_for_issue/response_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign::UrlVerificationForIssue::Response do 4 | let(:client) { GlobalSign::Client.new } 5 | 6 | before do 7 | VCR.use_cassette('url_verification_for_issue/' + cassette_title) do 8 | @response = client.process(request) 9 | end 10 | end 11 | 12 | context 'when returned success response' do 13 | let(:cassette_title) { 'success' } 14 | 15 | let(:request) do 16 | GlobalSign::UrlVerificationForIssue::Request.new( 17 | order_id: 'xxxx123456789', 18 | approver_url: 'http://example.com', 19 | ) 20 | end 21 | 22 | it 'succeeds' do 23 | expect(@response.success?).to be_truthy 24 | expect(@response.error_code).to be_nil 25 | expect(@response.error_field).to be_nil 26 | expect(@response.error_message).to be_nil 27 | end 28 | 29 | it 'returns response includes url_verification_for_issue params' do 30 | expect(@response.params[:certificate_info]).to be_present 31 | expect(@response.params[:fulfillment][:ca_certificates].first).to be_present 32 | end 33 | end 34 | 35 | context 'when returned error response' do 36 | let(:cassette_title) { 'failure' } 37 | 38 | let(:request) do 39 | GlobalSign::UrlVerificationForIssue::Request.new( 40 | order_id: 'xxxx123456789', 41 | approver_url: 'http://example.com', 42 | ) 43 | end 44 | 45 | it 'fails' do 46 | expect(@response.error?).to be_truthy 47 | expect(@response.error_code).to eq('-4147') 48 | expect(@response.error_message).to include('We were unable to verify the domain http://example.com.') 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /spec/global_sign_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe GlobalSign do 4 | it 'has a version number' do 5 | expect(GlobalSign::VERSION).to be_present 6 | end 7 | 8 | describe '.configure' do 9 | before do 10 | GlobalSign.configure { |configuration| configuration.user_name = 'PAR12345_taro' } 11 | end 12 | 13 | it 'proxies to GlobalSign configuration' do 14 | expect(GlobalSign.configuration.user_name).to eq('PAR12345_taro') 15 | end 16 | end 17 | 18 | describe '.contract' do 19 | before do 20 | GlobalSign.set_contract do |contract| 21 | contract.first_name = 'Pepabo' 22 | contract.last_name = 'Taro' 23 | contract.phone_number = '090-1234-5678' 24 | contract.email = 'pepabo.taro@example.com' 25 | end 26 | end 27 | 28 | it 'proxies to GlobalSign contract information' do 29 | expect(GlobalSign.contract.first_name).to eq('Pepabo') 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 2 | 3 | require 'global_sign' 4 | 5 | require 'dotenv' 6 | require 'vcr' 7 | require 'pry' 8 | require_relative 'support/csr_helper' 9 | 10 | Dotenv.load 11 | 12 | GlobalSign.configure do |configuration| 13 | configuration.user_name = ENV['USER_NAME'] 14 | configuration.password = ENV['PASSWORD'] 15 | configuration.endpoint = 'https://test-gcc.globalsign.com/kb/ws/v1' 16 | end 17 | 18 | VCR.configure do |configuration| 19 | configuration.cassette_library_dir = 'spec/fixtures/vcr_cassettes' 20 | configuration.hook_into :webmock 21 | configuration.filter_sensitive_data('[USER_NAME]') { ENV['USER_NAME'] } 22 | configuration.filter_sensitive_data('[PASSWORD]') { ENV['PASSWORD'] } 23 | end 24 | 25 | RSpec.configure do |c| 26 | c.include CSRHelper 27 | end 28 | -------------------------------------------------------------------------------- /spec/support/csr_helper.rb: -------------------------------------------------------------------------------- 1 | module CSRHelper 2 | def example_csr 3 | @valid_csr ||= File.read('spec/fixtures/csrs/valid.csr').strip 4 | end 5 | 6 | def invalid_csr 7 | @invalid_csr ||= File.read('spec/fixtures/csrs/invalid.csr').strip 8 | end 9 | end 10 | --------------------------------------------------------------------------------