Take the 2008 Git User's Survey and help out! [ hide ]

public
Description: Amazon Web Services SimpleDB for Ruby
Homepage: http://rubyforge.org/projects/aws-sdb/
Clone URL: git://github.com/dysinger/aws-sdb.git
Search Repo:
Updated the name of the cursor token to match amazon's new api
Updated the max number of domains attribute to match amazon's new api
Corrected an error where I was calling "each" on the token that 
only comes once
Removed the "sort" on query.  Looks like the new api has no sort 
on query.


git-svn-id: svn+ssh://rubyforge.org/var/svn/aws-sdb/trunk/aws-sdb@18 
b47d895a-97fd-408b-8300-45b572025c09
dysinger (author)
Thu Feb 21 00:34:01 -0800 2008
commit  bdd5f51363bb9cc825d2c1a793a102dfb0fc9ac8
tree    133c25f7eef4e4f35da40ed2b116694807210866
parent  95c45cdeeb538c706e272f43be8720ca544e2031
...
20
21
22
23
 
24
25
 
26
27
28
29
30
31
32
 
33
34
35
...
45
46
47
48
 
49
50
51
52
53
54
55
 
56
57
58
 
 
59
60
61
62
63
64
 
65
66
67
...
136
137
138
 
139
140
141
 
142
143
144
...
20
21
22
 
23
24
 
25
26
27
28
29
30
31
 
32
33
34
35
...
45
46
47
 
48
49
50
51
52
53
 
 
54
55
 
 
56
57
58
59
60
61
62
 
63
64
65
66
...
135
136
137
138
139
140
 
141
142
143
144
0
@@ -20,16 +20,16 @@ module AwsSdb
0
     
0
     def list_domains(max = nil, token = nil)
0
       params = { 'Action' => 'ListDomains' }
0
- params['MoreToken'] =
0
+ params['NextToken'] =
0
         token unless token.nil? || token.empty?
0
- params['MaxResults'] =
0
+ params['MaxNumberOfDomains'] =
0
         max.to_s unless max.nil? || max.to_i == 0
0
       doc = call(:get, params)
0
       results = []
0
       REXML::XPath.each(doc, '//DomainName/text()') do |domain|
0
         results << domain.to_s
0
       end
0
- return results, REXML::XPath.each(doc, '/MoreToken/text()').to_s
0
+ return results, REXML::XPath.first(doc, '//NextToken/text()').to_s
0
     end
0
         
0
     def create_domain(domain)
0
@@ -45,23 +45,22 @@ module AwsSdb
0
       nil
0
     end
0
     
0
- def query(domain, query, sort = nil, max = nil, token = nil)
0
+ def query(domain, query, max = nil, token = nil)
0
       params = {
0
         'Action' => 'Query',
0
         'QueryExpression' => query,
0
         'DomainName' => domain.to_s
0
       }
0
- params['Sort'] = sort unless sort.nil? || sort.empty?
0
- params['MoreToken'] =
0
+ params['NextToken'] =
0
         token unless token.nil? || token.empty?
0
- params['MaxResults'] =
0
- max.to_s unless max.nil? || max.to_i != 0
0
+ params['MaxNumberOfItems'] =
0
+ max.to_s unless max.nil? || max.to_i == 0
0
       doc = call(:get, params)
0
       results = []
0
       REXML::XPath.each(doc, '//ItemName/text()') do |item|
0
         results << item.to_s
0
       end
0
- return results, REXML::XPath.each(doc, '/MoreToken/text()').to_s
0
+ return results, REXML::XPath.first(doc, '//NextToken/text()').to_s
0
     end
0
     
0
     def put_attributes(domain, item, attributes, replace = true)
0
@@ -136,9 +135,10 @@ module AwsSdb
0
       query = query.join('&')
0
       url = "http://sds.amazonaws.com?#{query}"
0
       uri = URI.parse(url)
0
+ @logger.debug("#{url}") if @logger
0
       response =
0
         Net::HTTP.new(uri.host, uri.port).send_request(method, url)
0
- @logger.debug("#{url} #{response.code} #{response.body}")
0
+ @logger.debug("#{response.code}\n#{response.body}") if @logger
0
       raise(ConnectionError.new(response)) unless (200..400).include?(
0
         response.code.to_i
0
       )

Comments

    No one has commented yet.