geocerts 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +6 -0
- data/LICENSE +20 -0
- data/README.rdoc +71 -0
- data/Rakefile +70 -0
- data/VERSION +1 -0
- data/autotest/discover.rb +39 -0
- data/geocerts.gemspec +144 -0
- data/lib/geo_certs.rb +57 -0
- data/lib/geo_certs/agreement.rb +18 -0
- data/lib/geo_certs/api.rb +29 -0
- data/lib/geo_certs/api_object.rb +111 -0
- data/lib/geo_certs/certificate.rb +88 -0
- data/lib/geo_certs/collection.rb +12 -0
- data/lib/geo_certs/csr.rb +31 -0
- data/lib/geo_certs/email.rb +8 -0
- data/lib/geo_certs/endpoints/agreements.rb +23 -0
- data/lib/geo_certs/endpoints/certificates.rb +73 -0
- data/lib/geo_certs/endpoints/events.rb +56 -0
- data/lib/geo_certs/endpoints/orders.rb +181 -0
- data/lib/geo_certs/endpoints/products.rb +30 -0
- data/lib/geo_certs/errors.rb +30 -0
- data/lib/geo_certs/event.rb +67 -0
- data/lib/geo_certs/exceptions.rb +124 -0
- data/lib/geo_certs/hash_extension.rb +50 -0
- data/lib/geo_certs/order.rb +369 -0
- data/lib/geo_certs/order/administrator.rb +23 -0
- data/lib/geo_certs/order/contact.rb +30 -0
- data/lib/geo_certs/order/extended_validation_approver.rb +23 -0
- data/lib/geo_certs/order/organization.rb +39 -0
- data/lib/geo_certs/order/renewal_information.rb +31 -0
- data/lib/geo_certs/parsers/order_parser.rb +8 -0
- data/lib/geo_certs/product.rb +67 -0
- data/test/config/initializers/_remote_tests.rb +15 -0
- data/test/config/initializers/fakeweb.rb +2 -0
- data/test/config/initializers/geocerts.rb +13 -0
- data/test/config/initializers/responses.rb +3 -0
- data/test/config/test_credentials.example.yml +2 -0
- data/test/factories.rb +15 -0
- data/test/fixtures/responses.rb +80 -0
- data/test/fixtures/responses/agreement.rb +136 -0
- data/test/fixtures/responses/certificate.rb +227 -0
- data/test/fixtures/responses/event.rb +60 -0
- data/test/fixtures/responses/order.rb +272 -0
- data/test/fixtures/responses/product.rb +77 -0
- data/test/integrations/agreement_test.rb +40 -0
- data/test/integrations/api_test.rb +33 -0
- data/test/integrations/certificate_test.rb +195 -0
- data/test/integrations/event_test.rb +167 -0
- data/test/integrations/order_test.rb +510 -0
- data/test/integrations/product_test.rb +72 -0
- data/test/test_helper.rb +68 -0
- data/test/units/certificate_test.rb +21 -0
- data/test/units/collection_test.rb +27 -0
- data/test/units/csr_test.rb +27 -0
- data/test/units/geo_certs_test.rb +19 -0
- data/test/units/order/administrator_test.rb +24 -0
- data/test/units/order/extended_validation_approver_test.rb +24 -0
- data/test/units/order/organization_test.rb +0 -0
- data/test/units/order/renewal_information_test.rb +36 -0
- data/test/units/order_test.rb +59 -0
- data/test/units/product_test.rb +21 -0
- metadata +220 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
module GeoCerts
|
2
|
+
|
3
|
+
class ApiObject # :nodoc:
|
4
|
+
|
5
|
+
def initialize(attributes = {}, &block)
|
6
|
+
update_attributes(attributes)
|
7
|
+
yield(self) if block_given?
|
8
|
+
end
|
9
|
+
|
10
|
+
def errors
|
11
|
+
@errors ||= []
|
12
|
+
end
|
13
|
+
|
14
|
+
def warnings
|
15
|
+
@warnings ||= []
|
16
|
+
end
|
17
|
+
|
18
|
+
def warnings=(input) # :nodoc:
|
19
|
+
@warnings = case input
|
20
|
+
when Hash
|
21
|
+
case input[:warning]
|
22
|
+
when Array
|
23
|
+
input[:warning].collect { |warning| GeoCerts::Warning.new(warning) }
|
24
|
+
end
|
25
|
+
when Array
|
26
|
+
input if input.all? { |item| item.kind_of?(GeoCerts::Warning) }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def errors=(input) # :nodoc:
|
31
|
+
@errors = case input
|
32
|
+
when Hash
|
33
|
+
case input[:error]
|
34
|
+
when Array
|
35
|
+
input[:error].collect { |error| GeoCerts::Error.new(error) }
|
36
|
+
end
|
37
|
+
when Array
|
38
|
+
input if input.all? { |item| item.kind_of?(GeoCerts::Error) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
|
46
|
+
def self.call_api # :nodoc:
|
47
|
+
yield if block_given?
|
48
|
+
rescue RestClient::ResourceNotFound
|
49
|
+
raise GeoCerts::ResourceNotFound.new($!)
|
50
|
+
rescue RestClient::Unauthorized
|
51
|
+
raise GeoCerts::Unauthorized.new($!)
|
52
|
+
rescue RestClient::RequestFailed
|
53
|
+
case $!.http_code
|
54
|
+
when 422
|
55
|
+
raise GeoCerts::UnprocessableEntity.new($!)
|
56
|
+
when 400
|
57
|
+
raise GeoCerts::BadRequest.new($!)
|
58
|
+
else
|
59
|
+
raise GeoCerts::RequestFailed.new($!)
|
60
|
+
end
|
61
|
+
rescue RestClient::RequestTimeout
|
62
|
+
raise GeoCerts::RequestTimeout.new($!.message)
|
63
|
+
rescue *GeoCerts::HTTP_ERRORS
|
64
|
+
raise GeoCerts::ConnectionError.new($!.message)
|
65
|
+
# rescue
|
66
|
+
# raise GeoCerts::Exception.from($!)
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.force_boolean(*attributes) # :nodoc:
|
70
|
+
attributes.each do |attribute|
|
71
|
+
define_method("#{attribute}=") do |input| # def trial=(input)
|
72
|
+
instance_variable_set("@#{attribute}", # @trial =
|
73
|
+
!!(input =~ /true/i)) # !!(input =~ /true/i)
|
74
|
+
end # end
|
75
|
+
|
76
|
+
define_method("#{attribute}?") do # def trial?
|
77
|
+
send(attribute.to_sym) # send(:trial)
|
78
|
+
end # end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.build_collection(response) # :nodoc:
|
83
|
+
raise(ArgumentError, "Missing block") unless block_given?
|
84
|
+
collection = Collection.new
|
85
|
+
collection.start_at = response[:start_at]
|
86
|
+
collection.end_at = response[:end_at]
|
87
|
+
yield(response).each { |order| collection << new(order) }
|
88
|
+
collection
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.prep_date_ranges!(options)
|
92
|
+
options[:start_at] = options[:start_at].xmlschema if options.has_key?(:start_at) && options[:start_at].respond_to?(:xmlschema)
|
93
|
+
options[:end_at] = options[:end_at].xmlschema if options.has_key?(:end_at) && options[:start_at].respond_to?(:xmlschema)
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
def store_exception_errors_and_warnings(exception)
|
98
|
+
self.warnings = exception.warnings if exception.respond_to?(:warnings)
|
99
|
+
self.errors = exception.errors if exception.respond_to?(:errors)
|
100
|
+
end
|
101
|
+
|
102
|
+
def update_attributes(attributes) # :nodoc:
|
103
|
+
attributes.each_pair do |name, value|
|
104
|
+
send("#{name}=", value) if respond_to?(name)
|
105
|
+
end
|
106
|
+
self
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'geo_certs/api_object'
|
2
|
+
|
3
|
+
module GeoCerts
|
4
|
+
|
5
|
+
##
|
6
|
+
# Contains the information for a secure server certificate. Generally, these objects would
|
7
|
+
# be created and populated via GeoCerts::Order.certificate, unless you are looking for a
|
8
|
+
# listing of certificates in your account (see GeoCerts::Certificate.all).
|
9
|
+
#
|
10
|
+
class Certificate < ApiObject
|
11
|
+
|
12
|
+
attr_accessor :order_id,
|
13
|
+
:geotrust_order_id,
|
14
|
+
:status,
|
15
|
+
:certificate,
|
16
|
+
:ca_root,
|
17
|
+
:common_name,
|
18
|
+
:serial_number,
|
19
|
+
:start_at,
|
20
|
+
:end_at,
|
21
|
+
:city,
|
22
|
+
:state,
|
23
|
+
:country,
|
24
|
+
:organization,
|
25
|
+
:organizational_unit,
|
26
|
+
:approver_email,
|
27
|
+
:reissue_email,
|
28
|
+
:trial,
|
29
|
+
:url
|
30
|
+
|
31
|
+
force_boolean :trial
|
32
|
+
|
33
|
+
##
|
34
|
+
# Returns all certificates for a given window of time. The server defaults to a 1 month
|
35
|
+
# window.
|
36
|
+
#
|
37
|
+
# === Options
|
38
|
+
#
|
39
|
+
# :start_at:: The starting DateTime for the date range
|
40
|
+
# :end_at:: The ending DateTime for the date range
|
41
|
+
#
|
42
|
+
def self.all(options = {})
|
43
|
+
prep_date_ranges!(options)
|
44
|
+
response = call_api { GeoCerts.api.certificates(options) }
|
45
|
+
build_collection(response) { |response| response[:certificates][:certificate] }
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Returns the certificate for the given GeoCerts::Order
|
50
|
+
#
|
51
|
+
# === Exceptions
|
52
|
+
#
|
53
|
+
# This method will raise exceptions if the given +order_id+ cannot be found in the GeoCerts
|
54
|
+
# system.
|
55
|
+
#
|
56
|
+
def self.find(order_id)
|
57
|
+
order_id = order_id.id if order_id.kind_of?(GeoCerts::Order)
|
58
|
+
new(call_api { GeoCerts.api.find_certificate(:order_id => order_id)[:certificate] })
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# Returns the certificate for the given GeoCerts::Order by ID.
|
63
|
+
#
|
64
|
+
# If the +order_id+ cannot be found in the GeoCerts system, this method will return +nil+.
|
65
|
+
#
|
66
|
+
def self.find_by_order_id(order_id)
|
67
|
+
find(order_id)
|
68
|
+
rescue GeoCerts::AllowableExceptionWithResponse
|
69
|
+
nil
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
##
|
74
|
+
# Reissues the certificate given a proper CSR.
|
75
|
+
#
|
76
|
+
def reissue!(csr)
|
77
|
+
csr = csr.body if csr.kind_of?(GeoCerts::CSR)
|
78
|
+
update_attributes(self.class.call_api {
|
79
|
+
GeoCerts.api.reissue_certificate({
|
80
|
+
:order_id => self.order_id,
|
81
|
+
:csr_body => GeoCerts.escape(csr || '')
|
82
|
+
})
|
83
|
+
})
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module GeoCerts
|
2
|
+
|
3
|
+
##
|
4
|
+
# A GeoCerts::Collection is used whenever a collection of GeoCerts objects is returned from
|
5
|
+
# this library. It adds the additional attributes of +end_at+ and +start_at+, representing
|
6
|
+
# the DateTime range from which the collection contains data.
|
7
|
+
#
|
8
|
+
class Collection < Array
|
9
|
+
attr_accessor :end_at, :start_at
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
3
|
+
module GeoCerts
|
4
|
+
|
5
|
+
##
|
6
|
+
# Wraps information required by or received from GeoCerts about a
|
7
|
+
# Certificate Signing Request (CSR).
|
8
|
+
#
|
9
|
+
class CSR
|
10
|
+
|
11
|
+
attr_accessor :body,
|
12
|
+
:common_name,
|
13
|
+
:city,
|
14
|
+
:state,
|
15
|
+
:country,
|
16
|
+
:organization,
|
17
|
+
:organizational_unit
|
18
|
+
|
19
|
+
def initialize(attributes = {})
|
20
|
+
attributes.each_pair do |name, value|
|
21
|
+
send("#{name}=", value) if respond_to?(name)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_geocerts_hash
|
26
|
+
{ :csr_body => GeoCerts.escape(self.body) }
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module GeoCerts
|
2
|
+
module Endpoints # :nodoc:
|
3
|
+
|
4
|
+
module Agreements # :nodoc:
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.class_eval do
|
8
|
+
endpoint GeoCerts::API::ENDPOINT do
|
9
|
+
|
10
|
+
action :agreement, :url => '/products/:product_id/agreement.xml' do
|
11
|
+
parser Parsers::OrderParser do
|
12
|
+
element :agreement
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module GeoCerts
|
2
|
+
module Endpoints # :nodoc:
|
3
|
+
|
4
|
+
module Certificates # :nodoc:
|
5
|
+
|
6
|
+
ELEMENTS = <<-CERTIFICATE
|
7
|
+
element 'order-id', :as => :order_id, :type => Integer
|
8
|
+
element 'geotrust-order-id', :as => :geotrust_order_id
|
9
|
+
element :status
|
10
|
+
element :certificate
|
11
|
+
element 'ca-root', :as => :ca_root
|
12
|
+
element 'common-name', :as => :common_name
|
13
|
+
element 'serial-number', :as => :serial_number
|
14
|
+
element 'start-date', :as => :start_at, :type => DateTime
|
15
|
+
element 'end-date', :as => :end_at, :type => DateTime
|
16
|
+
element :locality, :as => :city
|
17
|
+
element :state
|
18
|
+
element :organization
|
19
|
+
element 'organizational-unit', :as => :organizational_unit
|
20
|
+
element :country
|
21
|
+
element 'approver-email', :as => :approver_email
|
22
|
+
element 'reissue-email', :as => :reissue_email
|
23
|
+
element :trial
|
24
|
+
element :url
|
25
|
+
element 'dns-names', :as => :sans
|
26
|
+
CERTIFICATE
|
27
|
+
|
28
|
+
def self.included(base)
|
29
|
+
base.class_eval do
|
30
|
+
endpoint GeoCerts::API::ENDPOINT do
|
31
|
+
|
32
|
+
action :certificates, :url => '/certificates.xml' do
|
33
|
+
parameter :start_at
|
34
|
+
parameter :end_at
|
35
|
+
|
36
|
+
parser Parsers::OrderParser do
|
37
|
+
attribute 'start_at', :as => :start_at, :type => DateTime
|
38
|
+
attribute 'end_at', :as => :end_at, :type => DateTime
|
39
|
+
|
40
|
+
element :certificates do
|
41
|
+
elements :certificate, :xpath => 'certificates/certificate' do
|
42
|
+
eval(ELEMENTS)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
action :find_certificate, :url => '/orders/:order_id/certificate.xml' do
|
49
|
+
parser Parsers::OrderParser do
|
50
|
+
element :certificate, :xpath => '/certificate' do
|
51
|
+
eval(ELEMENTS)
|
52
|
+
element :certificate, :xpath => '/certificate/certificate/text()'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
action :reissue_certificate, :url => '/orders/:order_id/certificate/reissue.xml', :method => :post do
|
58
|
+
parameter 'order[csr][body]', :as => :csr_body
|
59
|
+
parser Parsers::OrderParser do
|
60
|
+
element :certificate, :xpath => '/certificate' do
|
61
|
+
eval(ELEMENTS)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module GeoCerts
|
2
|
+
module Endpoints # :nodoc:
|
3
|
+
|
4
|
+
module Events # :nodoc:
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.class_eval do
|
8
|
+
endpoint GeoCerts::API::ENDPOINT do
|
9
|
+
|
10
|
+
action :events, :url => '/events.xml' do
|
11
|
+
parameter :start_at
|
12
|
+
parameter :end_at
|
13
|
+
|
14
|
+
parser Parsers::OrderParser do
|
15
|
+
element :events do
|
16
|
+
attribute 'start_at', :as => :start_at, :type => DateTime
|
17
|
+
attribute 'end_at', :as => :end_at, :type => DateTime
|
18
|
+
|
19
|
+
elements :event do
|
20
|
+
element 'event-id', :as => :id, :type => Integer
|
21
|
+
element 'order-id', :as => :order_id, :type => Integer
|
22
|
+
element :name
|
23
|
+
element 'created-at', :as => :created_at, :type => DateTime
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
action :order_events, :url => '/orders/:order_id/events.xml' do
|
30
|
+
parameter :start_at
|
31
|
+
parameter :end_at
|
32
|
+
|
33
|
+
parser Parsers::OrderParser do
|
34
|
+
element :events do
|
35
|
+
attribute 'start_at', :as => :start_at, :type => DateTime
|
36
|
+
attribute 'end_at', :as => :end_at, :type => DateTime
|
37
|
+
|
38
|
+
elements :event do
|
39
|
+
element 'event-id', :as => :id, :type => Integer
|
40
|
+
element 'order-id', :as => :order_id, :type => Integer
|
41
|
+
element :name
|
42
|
+
element 'created-at', :as => :created_at, :type => DateTime
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
require 'geo_certs/parsers/order_parser'
|
2
|
+
|
3
|
+
module GeoCerts
|
4
|
+
module Endpoints # :nodoc:
|
5
|
+
|
6
|
+
module Orders # :nodoc:
|
7
|
+
|
8
|
+
ELEMENTS = <<-ORDER
|
9
|
+
element :id, :type => Integer
|
10
|
+
element 'geotrust-order-id', :as => :geotrust_order_id
|
11
|
+
element :domain
|
12
|
+
element "status-major", :as => :status_major
|
13
|
+
element "status-minor", :as => :status_minor
|
14
|
+
element :years, :type => Integer
|
15
|
+
element :licenses, :type => Integer
|
16
|
+
element 'created-at', :as => :created_at, :type => DateTime
|
17
|
+
element 'completed-at', :as => :completed_at, :type => DateTime
|
18
|
+
element :trial
|
19
|
+
element :renewal
|
20
|
+
element :sans
|
21
|
+
element :state
|
22
|
+
element 'total-price', :as => :total_price, :type => Float
|
23
|
+
element 'pending-audit', :as => :pending_audit
|
24
|
+
|
25
|
+
element :product do
|
26
|
+
element :sku
|
27
|
+
end
|
28
|
+
|
29
|
+
element :warnings do
|
30
|
+
elements :warning do
|
31
|
+
element :code, :type => Float
|
32
|
+
element :message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
ORDER
|
36
|
+
|
37
|
+
def self.included(base)
|
38
|
+
base.class_eval do
|
39
|
+
endpoint GeoCerts::API::ENDPOINT do
|
40
|
+
|
41
|
+
action :orders, :url => '/orders.xml' do
|
42
|
+
parameter :start_at
|
43
|
+
parameter :end_at
|
44
|
+
|
45
|
+
parser Parsers::OrderParser do
|
46
|
+
attribute 'start_at', :as => :start_at, :type => DateTime
|
47
|
+
attribute 'end_at', :as => :end_at, :type => DateTime
|
48
|
+
|
49
|
+
element :orders do
|
50
|
+
elements :order do
|
51
|
+
eval(ELEMENTS)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
action :find_order, :url => '/orders/:id.xml' do
|
58
|
+
parser Parsers::OrderParser do
|
59
|
+
element :order do
|
60
|
+
eval(ELEMENTS)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
action :modify_order, :url => '/orders/:id/modify.xml', :method => :put do
|
66
|
+
parameter 'order[state]', :as => :state, :required => true
|
67
|
+
parser Parsers::OrderParser do
|
68
|
+
element :order do
|
69
|
+
eval(ELEMENTS)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
action :domain_approvers, :url => '/orders/approvers.xml' do
|
75
|
+
parameter :domain, :required => true
|
76
|
+
parser :emails do
|
77
|
+
element :emails do
|
78
|
+
elements :email
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
action :resend_approval_email, :url => '/orders/:id/resend.xml', :method => :post do
|
84
|
+
parser Parsers::OrderParser do
|
85
|
+
element :order do
|
86
|
+
eval(ELEMENTS)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
action :change_order_approval_email, :url => '/orders/:id/email.xml', :method => :put do
|
92
|
+
parameter 'order[approver_email]', :as => :approver_email, :required => true
|
93
|
+
parser Parsers::OrderParser do
|
94
|
+
element :order do
|
95
|
+
eval(ELEMENTS)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
action :create_order, :url => '/orders.xml', :method => :post do
|
101
|
+
parameter 'order[years]', :as => :years
|
102
|
+
parameter 'order[licenses]', :as => :licenses
|
103
|
+
parameter 'order[dns_names]', :as => :sans
|
104
|
+
parameter 'order[approver_email]', :as => :approver_email
|
105
|
+
|
106
|
+
parameter 'order[product][sku]', :as => :product_sku
|
107
|
+
parameter 'order[csr][body]', :as => :csr_body
|
108
|
+
|
109
|
+
parameter 'order[ev_approver][first_name]', :as => :ev_approver_first_name
|
110
|
+
parameter 'order[ev_approver][last_name]', :as => :ev_approver_last_name
|
111
|
+
parameter 'order[ev_approver][title]', :as => :ev_approver_title
|
112
|
+
parameter 'order[ev_approver][phone]', :as => :ev_approver_phone
|
113
|
+
parameter 'order[ev_approver][email]', :as => :ev_approver_email
|
114
|
+
|
115
|
+
parameter 'order[admin][first_name]', :as => :administrator_first_name
|
116
|
+
parameter 'order[admin][last_name]', :as => :administrator_last_name
|
117
|
+
parameter 'order[admin][phone]', :as => :administrator_phone
|
118
|
+
parameter 'order[admin][email]', :as => :administrator_email
|
119
|
+
|
120
|
+
parameter 'order[organization][organization_name]', :as => :organization_name
|
121
|
+
parameter 'order[organization][address]', :as => :organization_address
|
122
|
+
parameter 'order[organization][city]', :as => :organization_city
|
123
|
+
parameter 'order[organization][state]', :as => :organization_state
|
124
|
+
parameter 'order[organization][postal_code]', :as => :organization_postal_code
|
125
|
+
parameter 'order[organization][phone]', :as => :organization_phone
|
126
|
+
|
127
|
+
parser Parsers::OrderParser do
|
128
|
+
element :order do
|
129
|
+
eval(ELEMENTS)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
action :validate_order, :url => '/orders/validate.xml', :method => :post do
|
135
|
+
parameter 'order[product][sku]', :as => :product_sku
|
136
|
+
parameter 'order[csr][body]', :as => :csr_body
|
137
|
+
parameter 'order[years]', :as => :years
|
138
|
+
parameter 'order[licenses]', :as => :licenses
|
139
|
+
parameter 'order[dns_names]', :as => :sans
|
140
|
+
|
141
|
+
parser Parsers::OrderParser do
|
142
|
+
element :order do
|
143
|
+
element 'total-price', :as => :total_price, :type => Float
|
144
|
+
|
145
|
+
element :csr do
|
146
|
+
element 'common-name', :as => :common_name
|
147
|
+
element :city
|
148
|
+
element :state
|
149
|
+
element :country
|
150
|
+
element :organization
|
151
|
+
element 'org-unit', :as => :organizational_unit
|
152
|
+
element :body
|
153
|
+
end
|
154
|
+
|
155
|
+
element 'renewal-info', :as => :renewal_information do
|
156
|
+
element :indicator
|
157
|
+
element :months, :type => Integer
|
158
|
+
element 'serial-number', :as => :serial_number
|
159
|
+
element 'order-id', :as => :order_id
|
160
|
+
element 'expiration-date', :as => :expires_at, :type => DateTime
|
161
|
+
end
|
162
|
+
|
163
|
+
element :warnings do
|
164
|
+
elements :warning do
|
165
|
+
element :code, :type => Float
|
166
|
+
element :message
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
end
|
179
|
+
|
180
|
+
end
|
181
|
+
end
|