rubiii-apricoteatsgorilla 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.4
|
data/apricoteatsgorilla.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{apricoteatsgorilla}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.4"
|
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-
|
12
|
+
s.date = %q{2009-09-01}
|
13
13
|
s.description = %q{SOAP communication helper.}
|
14
14
|
s.email = %q{me@d-harrington.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -30,23 +30,22 @@ Gem::Specification.new do |s|
|
|
30
30
|
"spec/apricoteatsgorilla/xml_node_spec.rb",
|
31
31
|
"spec/spec_helper.rb"
|
32
32
|
]
|
33
|
-
s.has_rdoc = true
|
34
33
|
s.homepage = %q{http://github.com/rubiii/apricoteatsgorilla}
|
35
34
|
s.rdoc_options = ["--charset=UTF-8", "--title", "Apricot eats Gorilla", "--main", "README.rdoc", "--line-numbers", "--inline-source"]
|
36
35
|
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = %q{1.3.
|
36
|
+
s.rubygems_version = %q{1.3.4}
|
38
37
|
s.summary = %q{SOAP communication helper.}
|
39
38
|
s.test_files = [
|
40
|
-
"spec/
|
41
|
-
"spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb",
|
39
|
+
"spec/spec_helper.rb",
|
42
40
|
"spec/apricoteatsgorilla/apricoteatsgorilla_xml_to_hash_spec.rb",
|
43
41
|
"spec/apricoteatsgorilla/xml_node_spec.rb",
|
44
|
-
"spec/
|
42
|
+
"spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb",
|
43
|
+
"spec/apricoteatsgorilla/apricoteatsgorilla_hash_to_xml_spec.rb"
|
45
44
|
]
|
46
45
|
|
47
46
|
if s.respond_to? :specification_version then
|
48
47
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
-
s.specification_version =
|
48
|
+
s.specification_version = 3
|
50
49
|
|
51
50
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
52
51
|
s.add_runtime_dependency(%q<hpricot>, ["= 0.8.241"])
|
@@ -214,12 +214,12 @@ class ApricotEatsGorilla
|
|
214
214
|
when Hash
|
215
215
|
nested_data_to_xml(subkey, subvalue)
|
216
216
|
else
|
217
|
-
xml_node(subkey) { subvalue
|
217
|
+
xml_node(subkey) { map_hash_value(subvalue) } if map_hash_value(subvalue)
|
218
218
|
end
|
219
219
|
end.join
|
220
220
|
end
|
221
221
|
else
|
222
|
-
xml_node(key) { value
|
222
|
+
xml_node(key) { map_hash_value(value) } if map_hash_value(value)
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
@@ -249,6 +249,17 @@ class ApricotEatsGorilla
|
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
|
+
# Converts Hash values into valid XML values.
|
253
|
+
def map_hash_value(value)
|
254
|
+
if value.kind_of? DateTime
|
255
|
+
value.strftime("%Y-%m-%dT%H:%M:%S")
|
256
|
+
elsif value.respond_to? :to_s
|
257
|
+
value.to_s
|
258
|
+
else
|
259
|
+
nil
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
252
263
|
# Returns a sorted version of a given +hash+ if +sort_keys+ is enabled.
|
253
264
|
def sort_hash_keys(hash)
|
254
265
|
return hash unless sort_keys
|
@@ -27,18 +27,19 @@ describe ApricotEatsGorilla do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "converts values responding to to_s into Strings" do
|
30
|
-
|
31
|
-
hash = { :apricot => {
|
32
|
-
:at => date_time,
|
33
|
-
:with => 100.01,
|
34
|
-
:when => nil,
|
35
|
-
:what => :gorillas
|
36
|
-
}}
|
30
|
+
hash = { :apricot => { :with => 100.01, :when => nil, :what => :gorillas } }
|
37
31
|
ApricotEatsGorilla.hash_to_xml(hash).should ==
|
38
|
-
"<apricot><
|
32
|
+
"<apricot><what>gorillas</what>" <<
|
39
33
|
"<when></when><with>100.01</with></apricot>"
|
40
34
|
end
|
41
35
|
|
36
|
+
it "converts DateTime objects into Strings matching the SOAP date format" do
|
37
|
+
date = DateTime.new(y=2009,m=9,d=1, h=12,min=0,s=8)
|
38
|
+
hash = { :apricot => { :eats => { :at => date } } }
|
39
|
+
ApricotEatsGorilla.hash_to_xml(hash).should ==
|
40
|
+
"<apricot><eats><at>2009-09-01T12:00:08</at></eats></apricot>"
|
41
|
+
end
|
42
|
+
|
42
43
|
it "applies namespaces nodes defined via nodes_to_namespace" do
|
43
44
|
ApricotEatsGorilla.nodes_to_namespace = { :wsdl => [ :apricot ] }
|
44
45
|
hash = { :apricot => { :eats => "Gorilla" } }
|
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
|
+
version: 0.5.4
|
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-
|
12
|
+
date: 2009-09-01 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -54,9 +54,8 @@ files:
|
|
54
54
|
- spec/apricoteatsgorilla/apricoteatsgorilla_xml_to_hash_spec.rb
|
55
55
|
- spec/apricoteatsgorilla/xml_node_spec.rb
|
56
56
|
- spec/spec_helper.rb
|
57
|
-
has_rdoc:
|
57
|
+
has_rdoc: false
|
58
58
|
homepage: http://github.com/rubiii/apricoteatsgorilla
|
59
|
-
licenses:
|
60
59
|
post_install_message:
|
61
60
|
rdoc_options:
|
62
61
|
- --charset=UTF-8
|
@@ -83,13 +82,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
82
|
requirements: []
|
84
83
|
|
85
84
|
rubyforge_project:
|
86
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.2.0
|
87
86
|
signing_key:
|
88
|
-
specification_version:
|
87
|
+
specification_version: 3
|
89
88
|
summary: SOAP communication helper.
|
90
89
|
test_files:
|
91
|
-
- spec/
|
92
|
-
- spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb
|
90
|
+
- spec/spec_helper.rb
|
93
91
|
- spec/apricoteatsgorilla/apricoteatsgorilla_xml_to_hash_spec.rb
|
94
92
|
- spec/apricoteatsgorilla/xml_node_spec.rb
|
95
|
-
- spec/
|
93
|
+
- spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb
|
94
|
+
- spec/apricoteatsgorilla/apricoteatsgorilla_hash_to_xml_spec.rb
|