rubiii-apricoteatsgorilla 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.5.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{apricoteatsgorilla}
8
- s.version = "0.5.4"
8
+ s.version = "0.5.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Daniel Harrington"]
12
- s.date = %q{2009-09-01}
12
+ s.date = %q{2009-09-02}
13
13
  s.description = %q{SOAP communication helper.}
14
14
  s.email = %q{me@d-harrington.com}
15
15
  s.extra_rdoc_files = [
@@ -243,9 +243,14 @@ class ApricotEatsGorilla
243
243
  # Converts XML values to more natural Ruby objects.
244
244
  def map_xml_value(value)
245
245
  case value
246
- when "true" then true
247
- when "false" then false
248
- else value
246
+ when /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/
247
+ DateTime.parse(value)
248
+ when "true"
249
+ true
250
+ when "false"
251
+ false
252
+ else
253
+ value
249
254
  end
250
255
  end
251
256
 
@@ -23,6 +23,14 @@ describe ApricotEatsGorilla do
23
23
  ApricotEatsGorilla.xml_to_hash(xml).should == { :yes => true, :no => false }
24
24
  end
25
25
 
26
+ it "converts String values matching the SOAP dateTime format to DateTime objects" do
27
+ date = "2009-08-05T11:22:08"
28
+ date_with_offset = "2009-08-05T11:22:08+02:00"
29
+ xml = "<root><date>#{date}</date><dateWithOffset>#{date_with_offset}</dateWithOffset></root>"
30
+ ApricotEatsGorilla.xml_to_hash(xml).should ==
31
+ { :date => DateTime.parse(date), :date_with_offset => DateTime.parse(date_with_offset) }
32
+ end
33
+
26
34
  it "converts empty-element tags to 'nil'" do
27
35
  xml = "<contact><name>Jungle Julia</name><email /></contact>"
28
36
  ApricotEatsGorilla.xml_to_hash(xml).should == { :name => "Jungle Julia", :email => nil }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubiii-apricoteatsgorilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-01 00:00:00 -07:00
12
+ date: 2009-09-02 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency