aws 2.3.29 → 2.3.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -384,6 +384,27 @@ module Aws
384
384
  on_exception
385
385
  end
386
386
 
387
+ #
388
+ # items is an array item_name's or Aws::SdbInterface::Item.new(o.id, o.attributes, true)
389
+ def batch_delete_attributes(domain_name, items)
390
+ params = { 'DomainName' => domain_name }
391
+ i = 0
392
+ items.each do |item|
393
+ prefix = "Item." + i.to_s + "."
394
+ if item.is_a?(String)
395
+ params[prefix + "ItemName"] = item
396
+ else
397
+ params[prefix + "ItemName"] = item.item_name
398
+ params.merge!(pack_attributes(item.attributes, item.replace, prefix))
399
+ end
400
+ i += 1
401
+ end
402
+ link = generate_request("BatchDeleteAttributes", params)
403
+ request_info( link, QSdbSimpleParser.new )
404
+ rescue Exception
405
+ on_exception
406
+ end
407
+
387
408
  # Retrieve SDB item's attribute(s).
388
409
  #
389
410
  # Returns a hash:
@@ -6,11 +6,11 @@ class TestSdb < Test::Unit::TestCase
6
6
  def setup
7
7
  TestCredentials.get_credentials
8
8
  STDOUT.sync = true
9
- @domain = 'right_sdb_awesome_test_domain'
10
- @item = 'toys'
11
- @attr = { 'Jon' => %w{beer car} }
9
+ @domain = 'right_sdb_awesome_test_domain'
10
+ @item = 'toys'
11
+ @attr = {'Jon' => %w{beer car}}
12
12
  # Interface instance
13
- @sdb = Aws::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
13
+ @sdb = Aws::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
14
14
  end
15
15
 
16
16
  SDB_DELAY = 2
@@ -112,8 +112,20 @@ class TestSdb < Test::Unit::TestCase
112
112
  assert_nil values
113
113
  end
114
114
 
115
+ def test_08_batch_put_and_delete_attributes
116
+ items = []
117
+ 10.times do |i|
118
+ items << Aws::SdbInterface::Item.new("#{@item}_#{i}", {:name=>"name_#{i}"}, true)
119
+ end
120
+ @sdb.batch_put_attributes @domain, items
121
+ sleep 1
122
+
123
+ @sdb.batch_delete_attributes @domain, items.collect {|x| x.item_name }
124
+ end
125
+
126
+
115
127
  def test_11_signature_version_2
116
- sdb = Aws::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '2')
128
+ sdb = Aws::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '2')
117
129
  domains = nil
118
130
  assert_nothing_thrown "Failed to use signature V2" do
119
131
  domains = sdb.list_domains
@@ -157,7 +169,7 @@ class TestSdb < Test::Unit::TestCase
157
169
 
158
170
  def test_17_nil_attrs
159
171
  item = 'nils'
160
- res = nil
172
+ res = nil
161
173
  assert_nothing_thrown do
162
174
  @sdb.put_attributes(@domain, item, {:one=>nil, :two=>nil, :three=>'chunder'})
163
175
  end
@@ -171,7 +183,7 @@ class TestSdb < Test::Unit::TestCase
171
183
  end
172
184
 
173
185
  def test_18_url_escape
174
- item = 'urlescapes'
186
+ item = 'urlescapes'
175
187
  content = {:a=>"one & two & three",
176
188
  :b=>"one ? two / three"}
177
189
  @sdb.put_attributes(@domain, item, content)
@@ -183,11 +195,11 @@ class TestSdb < Test::Unit::TestCase
183
195
 
184
196
  def test_19_put_attrs_by_post
185
197
  item = 'reqgirth'
186
- i = 0
187
- sa = ""
198
+ i = 0
199
+ sa = ""
188
200
  while (i < 64) do
189
201
  sa += "aaaaaaaa"
190
- i += 1
202
+ i += 1
191
203
  end
192
204
  @sdb.put_attributes(@domain, item, {:a => sa, :b => sa, :c => sa, :d => sa, :e => sa})
193
205
  end
@@ -204,4 +216,5 @@ class TestSdb < Test::Unit::TestCase
204
216
  assert !@sdb.list_domains[:domains].include?(@domain)
205
217
  end
206
218
 
219
+
207
220
  end
@@ -39,7 +39,7 @@ class TestCredentials
39
39
  #Dir.chdir do
40
40
  begin
41
41
 
42
- Dir.chdir(File.expand_path("~/.test-configs")) do
42
+ Dir.chdir(File.expand_path("~/.test_configs")) do
43
43
  credentials = YAML::load(File.open("aws.yml"))
44
44
  @@config = credentials
45
45
  self.aws_access_key_id = credentials["amazon"]["access_key"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 3
8
- - 29
9
- version: 2.3.29
8
+ - 30
9
+ version: 2.3.30
10
10
  platform: ruby
11
11
  authors:
12
12
  - Travis Reeder
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-12-13 00:00:00 -08:00
19
+ date: 2010-12-16 00:00:00 -08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency