ruby-aws 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.md +5 -0
- data/Manifest.txt +0 -28
- data/Rakefile +3 -4
- data/lib/ruby-aws.rb +2 -1
- data/lib/ruby-aws/version.rb +2 -2
- metadata +7 -49
- metadata.gz.sig +0 -0
- data/lib/amazon/util.rb +0 -10
- data/lib/amazon/util/binder.rb +0 -48
- data/lib/amazon/util/data_reader.rb +0 -169
- data/lib/amazon/util/filter_chain.rb +0 -79
- data/lib/amazon/util/hash_nesting.rb +0 -93
- data/lib/amazon/util/lazy_results.rb +0 -59
- data/lib/amazon/util/logging.rb +0 -23
- data/lib/amazon/util/paginated_iterator.rb +0 -70
- data/lib/amazon/util/proactive_results.rb +0 -116
- data/lib/amazon/util/threadpool.rb +0 -129
- data/lib/amazon/util/user_data_store.rb +0 -100
- data/lib/amazon/webservices/mechanical_turk.rb +0 -123
- data/lib/amazon/webservices/mechanical_turk_requester.rb +0 -285
- data/lib/amazon/webservices/mturk/mechanical_turk_error_handler.rb +0 -153
- data/lib/amazon/webservices/mturk/question_generator.rb +0 -58
- data/lib/amazon/webservices/util/amazon_authentication_relay.rb +0 -72
- data/lib/amazon/webservices/util/command_line.rb +0 -157
- data/lib/amazon/webservices/util/convenience_wrapper.rb +0 -90
- data/lib/amazon/webservices/util/filter_proxy.rb +0 -45
- data/lib/amazon/webservices/util/mock_transport.rb +0 -70
- data/lib/amazon/webservices/util/request_signer.rb +0 -42
- data/lib/amazon/webservices/util/rest_transport.rb +0 -120
- data/lib/amazon/webservices/util/soap_simplifier.rb +0 -48
- data/lib/amazon/webservices/util/soap_transport.rb +0 -20
- data/lib/amazon/webservices/util/soap_transport_header_handler.rb +0 -27
- data/lib/amazon/webservices/util/unknown_result_exception.rb +0 -27
- data/lib/amazon/webservices/util/validation_exception.rb +0 -55
- data/lib/amazon/webservices/util/xml_simplifier.rb +0 -61
@@ -1,61 +0,0 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
|
2
|
-
# License:: Apache License, Version 2.0
|
3
|
-
|
4
|
-
require 'rexml/document'
|
5
|
-
|
6
|
-
module Amazon
|
7
|
-
module WebServices
|
8
|
-
module Util
|
9
|
-
|
10
|
-
class XMLSimplifier
|
11
|
-
|
12
|
-
# simplify(xml) -- convert an xml document into a simple nested hash
|
13
|
-
def self.simplify(xml)
|
14
|
-
case xml.class.to_s
|
15
|
-
when /Text/
|
16
|
-
{}
|
17
|
-
when /Document/
|
18
|
-
xml.root.children.inject({}) {|data,child| self.merge( data, simplify(child) ) }
|
19
|
-
when /Element/
|
20
|
-
if xml.children.size > 1 || xml.children.first.class.to_s !~ /Text/
|
21
|
-
value = xml.children.inject({}) { |data,child| self.merge( data, simplify(child) ) }
|
22
|
-
{ xml.name.to_sym => value }
|
23
|
-
else
|
24
|
-
str = xml.text
|
25
|
-
value = case str
|
26
|
-
when /^(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)Z$/
|
27
|
-
Time.gm($1,$2,$3,$4,$5,$6)
|
28
|
-
when /^-?\d+$/
|
29
|
-
if str.to_i.to_s == str
|
30
|
-
str.to_i
|
31
|
-
else
|
32
|
-
str
|
33
|
-
end
|
34
|
-
when /^-?\d+\.\d+$/
|
35
|
-
str.to_f
|
36
|
-
else
|
37
|
-
str
|
38
|
-
end
|
39
|
-
{ xml.name.to_sym => value }
|
40
|
-
end
|
41
|
-
else
|
42
|
-
raise "XMLSimplifier -- failed to simplify: #{xml.inspect}"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.merge(hash1, hash2)
|
47
|
-
hash2.each_key { |key|
|
48
|
-
if hash1[key]
|
49
|
-
hash1[key] = [hash1[key], hash2[key]].flatten
|
50
|
-
else
|
51
|
-
hash1[key] = hash2[key]
|
52
|
-
end
|
53
|
-
}
|
54
|
-
hash1
|
55
|
-
end
|
56
|
-
|
57
|
-
end # Amazon::WebServices::Util::XMLSimplifier
|
58
|
-
|
59
|
-
end # Amazon::WebServices::Util
|
60
|
-
end # Amazon::WebServices
|
61
|
-
end # Amazon
|