aws-sdb 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/aws_sdb/service.rb +10 -10
- metadata +2 -2
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ Spec::Rake::SpecTask.new
|
|
7
7
|
gem_spec = Gem::Specification.new do |s|
|
8
8
|
s.name = "aws-sdb"
|
9
9
|
s.rubyforge_project = s.name
|
10
|
-
s.version = "0.1.
|
10
|
+
s.version = "0.1.3"
|
11
11
|
s.platform = Gem::Platform::RUBY
|
12
12
|
s.has_rdoc = true
|
13
13
|
s.extra_rdoc_files = ["README", "LICENSE"]
|
data/lib/aws_sdb/service.rb
CHANGED
@@ -20,16 +20,16 @@ module AwsSdb
|
|
20
20
|
|
21
21
|
def list_domains(max = nil, token = nil)
|
22
22
|
params = { 'Action' => 'ListDomains' }
|
23
|
-
params['
|
23
|
+
params['NextToken'] =
|
24
24
|
token unless token.nil? || token.empty?
|
25
|
-
params['
|
25
|
+
params['MaxNumberOfDomains'] =
|
26
26
|
max.to_s unless max.nil? || max.to_i == 0
|
27
27
|
doc = call(:get, params)
|
28
28
|
results = []
|
29
29
|
REXML::XPath.each(doc, '//DomainName/text()') do |domain|
|
30
30
|
results << domain.to_s
|
31
31
|
end
|
32
|
-
return results, REXML::XPath.
|
32
|
+
return results, REXML::XPath.first(doc, '//NextToken/text()').to_s
|
33
33
|
end
|
34
34
|
|
35
35
|
def create_domain(domain)
|
@@ -45,23 +45,22 @@ module AwsSdb
|
|
45
45
|
nil
|
46
46
|
end
|
47
47
|
|
48
|
-
def query(domain, query,
|
48
|
+
def query(domain, query, max = nil, token = nil)
|
49
49
|
params = {
|
50
50
|
'Action' => 'Query',
|
51
51
|
'QueryExpression' => query,
|
52
52
|
'DomainName' => domain.to_s
|
53
53
|
}
|
54
|
-
params['
|
55
|
-
params['MoreToken'] =
|
54
|
+
params['NextToken'] =
|
56
55
|
token unless token.nil? || token.empty?
|
57
|
-
params['
|
58
|
-
max.to_s unless max.nil? || max.to_i
|
56
|
+
params['MaxNumberOfItems'] =
|
57
|
+
max.to_s unless max.nil? || max.to_i == 0
|
59
58
|
doc = call(:get, params)
|
60
59
|
results = []
|
61
60
|
REXML::XPath.each(doc, '//ItemName/text()') do |item|
|
62
61
|
results << item.to_s
|
63
62
|
end
|
64
|
-
return results, REXML::XPath.
|
63
|
+
return results, REXML::XPath.first(doc, '//NextToken/text()').to_s
|
65
64
|
end
|
66
65
|
|
67
66
|
def put_attributes(domain, item, attributes, replace = true)
|
@@ -136,9 +135,10 @@ module AwsSdb
|
|
136
135
|
query = query.join('&')
|
137
136
|
url = "http://sds.amazonaws.com?#{query}"
|
138
137
|
uri = URI.parse(url)
|
138
|
+
@logger.debug("#{url}") if @logger
|
139
139
|
response =
|
140
140
|
Net::HTTP.new(uri.host, uri.port).send_request(method, url)
|
141
|
-
@logger.debug("#{
|
141
|
+
@logger.debug("#{response.code}\n#{response.body}") if @logger
|
142
142
|
raise(ConnectionError.new(response)) unless (200..400).include?(
|
143
143
|
response.code.to_i
|
144
144
|
)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Dysinger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-02-20 00:00:00 -10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|