geocerts 0.0.23 → 0.0.24

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.23
1
+ 0.0.24
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{geocerts}
8
- s.version = "0.0.23"
8
+ s.version = "0.0.24"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["GeoCerts, Inc."]
12
- s.date = %q{2010-05-03}
12
+ s.date = %q{2010-05-13}
13
13
  s.description = %q{A Ruby library for interfacing with the GeoCerts REST API}
14
14
  s.email = %q{sslsupport@geocerts.com}
15
15
  s.extra_rdoc_files = [
@@ -49,8 +49,23 @@ module GeoCerts
49
49
  @sandbox
50
50
  end
51
51
 
52
+ def self.sandbox
53
+ @sandbox
54
+ end
55
+
56
+ def self.host=(value) #:nodoc:
57
+ @_host = value
58
+ end
59
+
52
60
  def self.host
53
- sandbox? ? 'sandbox.geocerts.com' : 'www.geocerts.com'
61
+ case
62
+ when @_host
63
+ @_host
64
+ when sandbox?
65
+ 'sandbox.geocerts.com'
66
+ else
67
+ 'www.geocerts.com'
68
+ end
54
69
  end
55
70
 
56
71
  end
@@ -196,7 +196,7 @@ module GeoCerts
196
196
  parameters[:sans] = GeoCerts.escape(self.sans) if self.sans
197
197
  parameters.merge!(self.csr.to_geocerts_hash) if self.csr
198
198
  parameters.merge!(self.product.to_geocerts_hash) if self.product
199
-
199
+
200
200
  update_attributes(self.class.call_api {GeoCerts.api.validate_order(parameters)[:order]})
201
201
  rescue GeoCerts::AllowableExceptionWithResponse
202
202
  store_exception_errors_and_warnings($!)
@@ -236,7 +236,7 @@ module GeoCerts
236
236
  # Returns +true+ if the Order has not been saved.
237
237
  #
238
238
  def new_record?
239
- self.id.nil?
239
+ self.id.nil? || self.id == ''
240
240
  end
241
241
 
242
242
  ##
@@ -371,7 +371,7 @@ module GeoCerts
371
371
  parameters.merge!(self.ev_approver.to_geocerts_hash) if self.ev_approver
372
372
  parameters.merge!(self.administrator.to_geocerts_hash) if self.administrator
373
373
  parameters.merge!(self.organization.to_geocerts_hash) if self.organization
374
-
374
+
375
375
  update_attributes(self.class.call_api {GeoCerts.api.create_order(parameters)[:order]})
376
376
  self
377
377
  rescue GeoCerts::AllowableExceptionWithResponse
@@ -65,4 +65,12 @@ class Test::Unit::TestCase
65
65
  end
66
66
  end
67
67
 
68
+ def setting(object, method, options = {})
69
+ original_value = object.send(method)
70
+ object.send("#{method}=", options[:to])
71
+ yield if block_given?
72
+ ensure
73
+ object.send("#{method}=", options.has_key?(:back) ? options[:back] : original_value)
74
+ end
75
+
68
76
  end
@@ -5,13 +5,25 @@ class GeoCertsTest < Test::Unit::TestCase
5
5
  context 'GeoCerts' do
6
6
 
7
7
  should 'use the sandbox host' do
8
- GeoCerts.sandbox = true
9
- assert_equal('sandbox.geocerts.com', GeoCerts.host)
8
+ setting(GeoCerts, :sandbox, :to => true) do
9
+ assert_equal('sandbox.geocerts.com', GeoCerts.host)
10
+ end
10
11
  end
11
12
 
12
13
  should 'use the production host' do
13
- GeoCerts.sandbox = false
14
- assert_equal('www.geocerts.com', GeoCerts.host)
14
+ setting(GeoCerts, :sandbox, :to => false) do
15
+ assert_equal('www.geocerts.com', GeoCerts.host)
16
+ end
17
+ end
18
+
19
+ should 'use the given host' do
20
+ setting(GeoCerts, :host, :to => 'test.com', :back => nil) do
21
+ assert_equal('test.com', GeoCerts.host)
22
+ end
23
+
24
+ setting(GeoCerts, :host, :to => 'test.com:8000', :back => nil) do
25
+ assert_equal('test.com:8000', GeoCerts.host)
26
+ end
15
27
  end
16
28
 
17
29
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 23
9
- version: 0.0.23
8
+ - 24
9
+ version: 0.0.24
10
10
  platform: ruby
11
11
  authors:
12
12
  - GeoCerts, Inc.
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-03 00:00:00 -04:00
17
+ date: 2010-05-13 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency