global_sign 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 84af7ff572f96ab29ffd4afe338dc508162d7f52
4
+ data.tar.gz: c4dfa41c3d53f261631d92827e76bc0c74fb514f
5
+ SHA512:
6
+ metadata.gz: 13a1d366b9c0f6ebac2db39fbb4c440eb72c35c8d28de7fb6c7ed98e0d7d0d54082f2eb04d0604a477d647622c40e63b1b6eb6265fc7bad86cc2272f1a92d604
7
+ data.tar.gz: 2295e6dab6536d59d6fba5200398364ded71eb10d26c7d2c2a875ec6e19b73e5e1d8d75faae81fe07f0be54e366c928d138ffd3b0626f922c925eed7a2e19628
data/.env.sample ADDED
@@ -0,0 +1,2 @@
1
+ USER_NAME='PAR12345_taro'
2
+ PASSWORD='password'
data/.gitignore ADDED
@@ -0,0 +1,11 @@
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
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## 1.0.0
2
+
3
+ - Support GlobalSign API: URLVerification & URLVerificationForIssue
4
+ - Support GlobalSign API: GetOrderByOrderID
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in global_sign.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
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.
data/README.md ADDED
@@ -0,0 +1,161 @@
1
+ # GlobalSign
2
+
3
+ [![wercker status](https://app.wercker.com/status/8cf8771f0da8bc4f1ea0adc8eb65b295/s/master "wercker status")](https://app.wercker.com/project/byKey/8cf8771f0da8bc4f1ea0adc8eb65b295)
4
+
5
+ A Ruby interface to the [GlobalSign](https://www.globalsign.com/) API.
6
+
7
+ For more information and detailed documentation about the API visit [this page](https://www.globalsign.com/en/resources/apis/api-documentation/) .
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'global_sign'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ ```
20
+ $ bundle
21
+ ```
22
+
23
+ Or install it yourself as:
24
+
25
+ ```
26
+ $ gem install global_sign
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### Configuration
32
+
33
+ An example initializer would look something like this:
34
+
35
+ ```ruby
36
+ GlobalSign.configure do |configuration|
37
+ configuration.user_name = 'PAR12345_taro'
38
+ configuration.password = 'password'
39
+ configuration.endpoint = 'https://test-gcc.globalsign.com/kb/ws/v1'
40
+ end
41
+ ```
42
+
43
+ ### URL Verification
44
+
45
+ ```ruby
46
+ require 'global_sign'
47
+
48
+ client = GlobalSign::Client.new
49
+
50
+ # Prepare CSR beforehand
51
+ csr = <<-EOS
52
+ -----BEGIN CERTIFICATE REQUEST-----
53
+ ...
54
+ -----END CERTIFICATE REQUEST-----
55
+ EOS
56
+
57
+ contract = GlobalSign::Contract.new(
58
+ first_name: 'Pepabo',
59
+ last_name: 'Taro',
60
+ phone_number: '090-1234-5678',
61
+ email: 'pepabo.taro@example.com',
62
+ )
63
+
64
+ request = GlobalSign::UrlVerification::Request.new(
65
+ order_kind: 'new', # If you request a new certificate
66
+ validity_period_months: 6,
67
+ csr: csr,
68
+ contract_info: contract,
69
+ )
70
+
71
+ response = client.process(request)
72
+
73
+ if response.success?
74
+ puts "Successfully URL Verification"
75
+ puts response.params # => { meta_tag: "xxxxx", ... }
76
+ else
77
+ raise StandardError, "#{response.error_code}: #{response.error_message}"
78
+ end
79
+ ```
80
+
81
+ It's also possible to set contract within your configure block.
82
+
83
+ ```ruby
84
+ GlobalSign.set_contract do |contract|
85
+ contract.first_name = 'Pepabo'
86
+ contract.last_name = 'Taro'
87
+ contract.phone_number = '090-1234-5678'
88
+ contract.email = 'pepabo.taro@example.com'
89
+ end
90
+
91
+ # Not need to give the argument 'contract_info'
92
+ request = GlobalSign::UrlVerification::Request.new(
93
+ order_kind: 'new',
94
+ validity_period_months: 6,
95
+ csr: csr,
96
+ )
97
+ ```
98
+
99
+ If you request a renewal certificate, you should set `renewal` to the value of argument `order_kind`.
100
+ And you should give the argument `renewal_target_order_id` .
101
+
102
+ ```ruby
103
+ request = GlobalSign::UrlVerification::Request.new(
104
+ order_kind: 'renewal',
105
+ validity_period_months: 6,
106
+ csr: csr,
107
+ renewal_target_order_id: 'xxxx123456789',
108
+ contract_info: contract,
109
+ )
110
+ ```
111
+
112
+ ### URL Verification for Issue
113
+
114
+ ```ruby
115
+ client = GlobalSign::Client.new
116
+
117
+ # You can use ApproverURL value such as:
118
+ # - http://example.com
119
+ # - https://example.com
120
+ # - http://www.example.com
121
+ # - https://www.example.com
122
+
123
+ request = GlobalSign::UrlVerificationForIssue::Request.new(
124
+ order_id: 'xxxx123456789',
125
+ approver_url: 'http://example.com',
126
+ )
127
+
128
+ response = client.process(request)
129
+
130
+ if response.success?
131
+ puts "Successfully URL Verification for Issue"
132
+ puts response.params # => { fulfillment: { ca_certificates: [{ ca_cert: "xxxxx" }, ...]}, ... }
133
+ else
134
+ raise StandardError, "#{response.error_code}: #{response.error_message}"
135
+ end
136
+ ```
137
+
138
+ ### Get Order by OrderID
139
+
140
+ ```ruby
141
+ request = GlobalSign::OrderGetterByOrderId::Request.new(order_id: 'xxxx123456789')
142
+ response = client.process(request)
143
+
144
+ puts response.params # => { order_id: "xxxx123456789", order_status: "2", ... }
145
+
146
+ # You can get order_status explanation
147
+ puts response.order_status_text # => "phishing_checking"
148
+ ```
149
+
150
+ ## Contributing
151
+
152
+ 1. Create your feature branch (git checkout -b my-new-feature)
153
+ 2. Commit your changes (git commit -am 'Add some feature')
154
+ 3. Push to the branch (git push origin my-new-feature)
155
+ 4. Create a new Pull Request
156
+
157
+ ## License
158
+
159
+ The MIT License (MIT)
160
+
161
+ Copyright (c) 2016- GMO Pepabo, Inc.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
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
data/bin/setup ADDED
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,36 @@
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{^(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', '~> 1.13'
30
+ spec.add_development_dependency 'rake', '~> 10.0'
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
@@ -0,0 +1,39 @@
1
+ require 'faraday'
2
+
3
+ module GlobalSign
4
+ class Client
5
+ def initialize
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
+ end
12
+ end
13
+
14
+ def process(request)
15
+ response_class = find_response_class_for(request)
16
+
17
+ response = @connection.post do |req|
18
+ req.url request.path
19
+ req.headers['Content-Type'] = 'text/xml'
20
+ req.body = request.to_xml
21
+ end
22
+
23
+ response_class.new(response.body)
24
+ end
25
+
26
+ def find_response_class_for(request)
27
+ case request
28
+ when GlobalSign::UrlVerification::Request
29
+ GlobalSign::UrlVerification::Response
30
+ when GlobalSign::UrlVerificationForIssue::Request
31
+ GlobalSign::UrlVerificationForIssue::Response
32
+ when GlobalSign::OrderGetterByOrderId::Request
33
+ GlobalSign::OrderGetterByOrderId::Response
34
+ else
35
+ raise ArgumentError, 'invalid request argument'
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,12 @@
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
@@ -0,0 +1,25 @@
1
+ module GlobalSign
2
+ module OrderGetterByOrderId
3
+ class Request < GlobalSign::Request
4
+ def initialize(order_id:)
5
+ @order_id = order_id
6
+ end
7
+
8
+ def path
9
+ 'GASService'
10
+ end
11
+
12
+ def action
13
+ 'GetOrderByOrderID'
14
+ end
15
+
16
+ def request_header
17
+ :QueryRequestHeader
18
+ end
19
+
20
+ def params
21
+ { OrderID: @order_id }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,34 @@
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
+ end
9
+
10
+ def params
11
+ @params ||= {
12
+ order_id: @xml.xpath(XPath::ORDER_ID).text,
13
+ order_status: @xml.xpath(XPath::ORDER_STATUS).text,
14
+ modification_events: modification_events_list
15
+ }
16
+ end
17
+
18
+ def order_status_text
19
+ OrderStatus::STATUS_MAPPING[params[:order_status]]
20
+ end
21
+
22
+ private
23
+
24
+ def modification_events_list
25
+ @xml.xpath(XPath::MODIFICATION_EVENTS).children.map do |element|
26
+ {
27
+ name: element.at('ModificationEventName').text,
28
+ timestamp: element.at('ModificationEventTimestamp').text,
29
+ }
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,2 @@
1
+ require 'global_sign/order_getter_by_order_id/request'
2
+ require 'global_sign/order_getter_by_order_id/response'
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,23 @@
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
@@ -0,0 +1,41 @@
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
+ <soap:Envelope xmlns:soap=\"#{XmlNamespace::BODY}\" xmlns:ns2=\"#{XmlNamespace::ACTION}\">
22
+ <soap:Body>
23
+ <ns2:#{action}>
24
+ <Request/>
25
+ </ns2:#{action}>
26
+ </soap:Body>
27
+ </soap:Envelope>
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
@@ -0,0 +1,47 @@
1
+ require 'nokogiri'
2
+
3
+ module GlobalSign
4
+ class Response
5
+ SUCCESS_CODE = '0'.freeze
6
+ WARNING_CODE = '1'.freeze
7
+
8
+ module XPath
9
+ RESULT = '//Response/OrderResponseHeader/SuccessCode'
10
+ ERRORS = '//Response/OrderResponseHeader/Errors'
11
+ end
12
+
13
+ def initialize(body)
14
+ @xml = Nokogiri::XML(body)
15
+ end
16
+
17
+ def success?
18
+ @xml.xpath(XPath::RESULT).text == SUCCESS_CODE
19
+ end
20
+
21
+ def warning?
22
+ @xml.xpath(XPath::RESULT).text == WARNING_CODE
23
+ end
24
+
25
+ def error?
26
+ !success? && !warning?
27
+ end
28
+
29
+ def error_code
30
+ errors.at('ErrorCode').try(:text)
31
+ end
32
+
33
+ def error_field
34
+ errors.at('ErrorField').try(:text)
35
+ end
36
+
37
+ def error_message
38
+ errors.at('ErrorMessage').try(:text)
39
+ end
40
+
41
+ private
42
+
43
+ def errors
44
+ @xml.xpath(XPath::ERRORS)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,54 @@
1
+ module GlobalSign
2
+ module UrlVerification
3
+ class Request < GlobalSign::Request
4
+ def initialize(order_kind:, validity_period_months:, csr:, renewal_target_order_id: nil, contract_info: nil)
5
+ @order_kind = order_kind
6
+ @validity_period_months = validity_period_months
7
+ @csr = csr
8
+ @renewal_target_order_id = renewal_target_order_id
9
+ @contract_info = contract_info || GlobalSign.contract
10
+ end
11
+
12
+ def path
13
+ 'ServerSSLService'
14
+ end
15
+
16
+ def action
17
+ 'URLVerification'
18
+ end
19
+
20
+ def request_header
21
+ :OrderRequestHeader
22
+ end
23
+
24
+ def params
25
+ _params = {
26
+ OrderRequestParameter: {
27
+ ProductCode: 'DV_LOW_URL',
28
+ OrderKind: @order_kind,
29
+ Licenses: 1,
30
+ ValidityPeriod: {
31
+ Months: @validity_period_months
32
+ },
33
+ CSR: @csr,
34
+ },
35
+ ContactInfo: {
36
+ FirstName: @contract_info.first_name,
37
+ LastName: @contract_info.last_name,
38
+ Phone: @contract_info.phone_number,
39
+ Email: @contract_info.email
40
+ }
41
+ }
42
+
43
+ # require `RenewalTargetOrderID` to request a renewal certificate
44
+ if @order_kind == 'renewal'
45
+ _params[:OrderRequestParameter].merge!(
46
+ { RenewalTargetOrderID: @renewal_target_order_id }
47
+ )
48
+ end
49
+
50
+ _params
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,25 @@
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 params
11
+ @params ||= {
12
+ order_id: @xml.xpath(XPath::ORDER_ID).text,
13
+ meta_tag: @xml.xpath(XPath::META_TAG).text,
14
+ verification_url_list: verification_url_list,
15
+ }
16
+ end
17
+
18
+ private
19
+
20
+ def verification_url_list
21
+ @xml.xpath(XPath::VERIFICATION_URL_LIST).children.map(&:text)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,2 @@
1
+ require 'global_sign/url_verification/request'
2
+ require 'global_sign/url_verification/response'
@@ -0,0 +1,29 @@
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
@@ -0,0 +1,49 @@
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 params
11
+ @params ||= {
12
+ certificate_info: {
13
+ certificate_status: certificate_info.at('CertificateStatus').text,
14
+ start_date: certificate_info.at('StartDate').text,
15
+ end_date: certificate_info.at('EndDate').text,
16
+ common_name: certificate_info.at('CommonName').text,
17
+ subject_name: certificate_info.at('SubjectName').text,
18
+ },
19
+ fulfillment: {
20
+ ca_certificates: ca_certificates_list,
21
+ server_certificate: {
22
+ x509_cert: server_certificate.at('X509Cert').text,
23
+ pkcs7_cert: server_certificate.at('PKCS7Cert').text,
24
+ }
25
+ }
26
+ }
27
+ end
28
+
29
+ private
30
+
31
+ def certificate_info
32
+ @xml.xpath(XPath::Certificate_Info)
33
+ end
34
+
35
+ def ca_certificates_list
36
+ @xml.xpath(XPath::CA_Certificates).children.map do |c|
37
+ {
38
+ ca_cert_type: c.at('CACertType').text,
39
+ ca_cert: c.at('CACert').text,
40
+ }
41
+ end
42
+ end
43
+
44
+ def server_certificate
45
+ @xml.xpath(XPath::Server_Certificate)
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,2 @@
1
+ require 'global_sign/url_verification_for_issue/request'
2
+ require 'global_sign/url_verification_for_issue/response'
@@ -0,0 +1,3 @@
1
+ module GlobalSign
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,34 @@
1
+ require 'active_support/core_ext/hash/conversions'
2
+
3
+ require 'global_sign/version'
4
+ require 'global_sign/client'
5
+ require 'global_sign/contract'
6
+ require 'global_sign/request_xml_builder'
7
+ require 'global_sign/request'
8
+ require 'global_sign/response'
9
+ require 'global_sign/order_status'
10
+
11
+ require 'global_sign/url_verification'
12
+ require 'global_sign/url_verification_for_issue'
13
+ require 'global_sign/order_getter_by_order_id'
14
+
15
+ module GlobalSign
16
+ class << self
17
+ attr_accessor :configuration, :contract
18
+
19
+ def configure
20
+ @configuration ||= Configuration.new
21
+ yield @configuration if block_given?
22
+ end
23
+
24
+ def set_contract
25
+ # initialize with nil, because the initialize method requires keyword args
26
+ @contract ||= Contract.new(first_name: nil, last_name: nil, phone_number: nil, email: nil)
27
+ yield @contract if block_given?
28
+ end
29
+ end
30
+
31
+ class Configuration
32
+ attr_accessor :user_name, :password, :endpoint
33
+ end
34
+ end
data/wercker.yml ADDED
@@ -0,0 +1,16 @@
1
+ box: ruby:2.3
2
+ build:
3
+ steps:
4
+ - bundle-install
5
+ - script:
6
+ name: echo ruby information
7
+ code: |
8
+ echo "ruby version $(ruby --version) running"
9
+ echo "from location $(which ruby)"
10
+ echo -p "gem list: $(gem list)"
11
+ - script:
12
+ name: rspec
13
+ code: bundle exec rspec
14
+ after-steps:
15
+ - wantedly/pretty-slack-notify:
16
+ webhook_url: $SLACK_WEBHOOK_URL
metadata ADDED
@@ -0,0 +1,227 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: global_sign
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - ku00
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-10-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: builder
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.13'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.13'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: vcr
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry-byebug
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: dotenv
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: A Ruby interface to the GlobalSign API.
168
+ email:
169
+ - skentaro36@gmail.com
170
+ executables: []
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - ".env.sample"
175
+ - ".gitignore"
176
+ - ".rspec"
177
+ - 'CHANGELOG.md '
178
+ - Gemfile
179
+ - LICENSE
180
+ - README.md
181
+ - Rakefile
182
+ - bin/console
183
+ - bin/setup
184
+ - global_sign.gemspec
185
+ - lib/global_sign.rb
186
+ - lib/global_sign/client.rb
187
+ - lib/global_sign/contract.rb
188
+ - lib/global_sign/order_getter_by_order_id.rb
189
+ - lib/global_sign/order_getter_by_order_id/request.rb
190
+ - lib/global_sign/order_getter_by_order_id/response.rb
191
+ - lib/global_sign/order_status.rb
192
+ - lib/global_sign/request.rb
193
+ - lib/global_sign/request_xml_builder.rb
194
+ - lib/global_sign/response.rb
195
+ - lib/global_sign/url_verification.rb
196
+ - lib/global_sign/url_verification/request.rb
197
+ - lib/global_sign/url_verification/response.rb
198
+ - lib/global_sign/url_verification_for_issue.rb
199
+ - lib/global_sign/url_verification_for_issue/request.rb
200
+ - lib/global_sign/url_verification_for_issue/response.rb
201
+ - lib/global_sign/version.rb
202
+ - wercker.yml
203
+ homepage: https://github.com/pepabo/global_sign
204
+ licenses:
205
+ - MIT
206
+ metadata: {}
207
+ post_install_message:
208
+ rdoc_options: []
209
+ require_paths:
210
+ - lib
211
+ required_ruby_version: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ required_rubygems_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
221
+ requirements: []
222
+ rubyforge_project:
223
+ rubygems_version: 2.6.7
224
+ signing_key:
225
+ specification_version: 4
226
+ summary: A Ruby interface to the GlobalSign API.
227
+ test_files: []