aws 2.3.30 → 2.3.31
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sdb/right_sdb_interface.rb +145 -126
- metadata +3 -3
@@ -29,14 +29,14 @@ module Aws
|
|
29
29
|
|
30
30
|
include AwsBaseInterface
|
31
31
|
|
32
|
-
DEFAULT_HOST
|
33
|
-
DEFAULT_PORT
|
34
|
-
DEFAULT_PROTOCOL
|
35
|
-
DEFAULT_SERVICE
|
36
|
-
API_VERSION
|
32
|
+
DEFAULT_HOST = 'sdb.amazonaws.com'
|
33
|
+
DEFAULT_PORT = 443
|
34
|
+
DEFAULT_PROTOCOL = 'https'
|
35
|
+
DEFAULT_SERVICE = '/'
|
36
|
+
API_VERSION = '2009-04-15'
|
37
37
|
DEFAULT_NIL_REPRESENTATION = 'nil'
|
38
38
|
|
39
|
-
@@bench
|
39
|
+
@@bench = AwsBenchmarkingBlock.new
|
40
40
|
|
41
41
|
def self.bench_xml;
|
42
42
|
@@bench.xml;
|
@@ -74,13 +74,13 @@ module Aws
|
|
74
74
|
def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})
|
75
75
|
@nil_rep = params[:nil_representation] ? params[:nil_representation] : DEFAULT_NIL_REPRESENTATION
|
76
76
|
params.delete(:nil_representation)
|
77
|
-
init({
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
init({:name => 'SDB',
|
78
|
+
:default_host => ENV['SDB_URL'] ? URI.parse(ENV['SDB_URL']).host : DEFAULT_HOST,
|
79
|
+
:default_port => ENV['SDB_URL'] ? URI.parse(ENV['SDB_URL']).port : DEFAULT_PORT,
|
80
|
+
:default_protocol => ENV['SDB_URL'] ? URI.parse(ENV['SDB_URL']).scheme : DEFAULT_PROTOCOL,
|
81
|
+
:default_service => ENV['SDB_URL'] ? URI.parse(ENV['SDB_URL']).path : DEFAULT_SERVICE},
|
82
82
|
# :service_endpoint => ENV['SDB_URL'] ? URI.parse(ENV['SDB_URL']).path : DEFAULT_ENDPOINT },
|
83
|
-
aws_access_key_id
|
83
|
+
aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'],
|
84
84
|
aws_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY'],
|
85
85
|
params)
|
86
86
|
end
|
@@ -95,7 +95,7 @@ module Aws
|
|
95
95
|
|
96
96
|
# Sends request to Amazon and parses the response
|
97
97
|
# Raises AwsError if any banana happened
|
98
|
-
def request_info(request, parser, options={})
|
98
|
+
def request_info(request, parser, options={}) #:nodoc:
|
99
99
|
# request_info2(request, parser, :sdb_connection)
|
100
100
|
request_info2(request, parser, @params, :sdb_connection, @logger, @@bench, options)
|
101
101
|
|
@@ -110,7 +110,7 @@ module Aws
|
|
110
110
|
def pack_attributes(attributes, replace = false, key_prefix = "") #:nodoc:
|
111
111
|
result = {}
|
112
112
|
if attributes
|
113
|
-
idx
|
113
|
+
idx = 0
|
114
114
|
skip_values = attributes.is_a?(Array)
|
115
115
|
attributes.each do |attribute, values|
|
116
116
|
# set replacement attribute
|
@@ -118,7 +118,7 @@ module Aws
|
|
118
118
|
# pack Name/Value
|
119
119
|
unless values.nil?
|
120
120
|
Array(values).each do |value|
|
121
|
-
result["#{key_prefix}Attribute.#{idx}.Name"]
|
121
|
+
result["#{key_prefix}Attribute.#{idx}.Name"] = attribute
|
122
122
|
result["#{key_prefix}Attribute.#{idx}.Value"] = ruby_to_sdb(value) unless skip_values
|
123
123
|
idx += 1
|
124
124
|
end
|
@@ -139,7 +139,7 @@ module Aws
|
|
139
139
|
# see: http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API.html
|
140
140
|
#
|
141
141
|
def escape(value)
|
142
|
-
%Q{'#{value.to_s.gsub(/(['\\])/){ "\\#{$1}" }}'} if value
|
142
|
+
%Q{'#{value.to_s.gsub(/(['\\])/) { "\\#{$1}" }}'} if value
|
143
143
|
end
|
144
144
|
|
145
145
|
# Convert a Ruby language value to a SDB value by replacing Ruby nil with the user's chosen string representation of nil.
|
@@ -175,13 +175,13 @@ module Aws
|
|
175
175
|
def query_expression_from_array(params) #:nodoc:
|
176
176
|
return '' if params.blank?
|
177
177
|
query = params[0].to_s
|
178
|
-
i
|
178
|
+
i = 1
|
179
179
|
query.gsub(/(\\)?(\?)/) do
|
180
180
|
if $1 # if escaped '\?' is found - replace it by '?' without backslash
|
181
181
|
"?"
|
182
|
-
else
|
182
|
+
else # well, if no backslash precedes '?' then replace it by next param from the list
|
183
183
|
ret = escape(params[i])
|
184
|
-
i+=1
|
184
|
+
i +=1
|
185
185
|
ret
|
186
186
|
end
|
187
187
|
end
|
@@ -221,11 +221,11 @@ module Aws
|
|
221
221
|
#
|
222
222
|
# see: http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_ListDomains.html
|
223
223
|
#
|
224
|
-
def list_domains(max_number_of_domains = nil, next_token = nil
|
225
|
-
request_params = {
|
226
|
-
|
227
|
-
link
|
228
|
-
result
|
224
|
+
def list_domains(max_number_of_domains = nil, next_token = nil)
|
225
|
+
request_params = {'MaxNumberOfDomains' => max_number_of_domains,
|
226
|
+
'NextToken' => next_token}
|
227
|
+
link = generate_request("ListDomains", request_params)
|
228
|
+
result = request_info(link, QSdbListDomainParser.new)
|
229
229
|
# return result if no block given
|
230
230
|
return result unless block_given?
|
231
231
|
# loop if block if given
|
@@ -234,8 +234,8 @@ module Aws
|
|
234
234
|
break unless yield(result) && result[:next_token]
|
235
235
|
# make new request
|
236
236
|
request_params['NextToken'] = result[:next_token]
|
237
|
-
link
|
238
|
-
result
|
237
|
+
link = generate_request("ListDomains", request_params)
|
238
|
+
result = request_info(link, QSdbListDomainParser.new)
|
239
239
|
end while true
|
240
240
|
rescue Exception
|
241
241
|
on_exception
|
@@ -327,6 +327,8 @@ module Aws
|
|
327
327
|
# 'nameZ' => [valueZ1,..., valueZN]
|
328
328
|
# }
|
329
329
|
# replace = :replace | any other value to skip replacement
|
330
|
+
# options:
|
331
|
+
# :create_domain => If true and domain does not exist, it will be created. Default is false.
|
330
332
|
#
|
331
333
|
# Returns a hash: { :box_usage, :request_id } on success or an exception on error.
|
332
334
|
# (Amazon raises no errors if the attribute was not overridden, as when the :replace param is unset).
|
@@ -357,42 +359,59 @@ module Aws
|
|
357
359
|
#
|
358
360
|
# see: http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_PutAttributes.html
|
359
361
|
#
|
360
|
-
def put_attributes(domain_name, item_name, attributes, replace = false)
|
361
|
-
params = {
|
362
|
-
|
363
|
-
|
362
|
+
def put_attributes(domain_name, item_name, attributes, replace = false, options={})
|
363
|
+
params = {'DomainName' => domain_name,
|
364
|
+
'ItemName' => item_name}.merge(pack_attributes(attributes, replace))
|
365
|
+
logger.debug 'PUT=' + params.inspect
|
364
366
|
link = generate_request("PutAttributes", params)
|
365
|
-
|
367
|
+
begin
|
368
|
+
request_info(link, QSdbSimpleParser.new, options)
|
369
|
+
rescue Aws::AwsError => ex
|
370
|
+
# puts "RESCUED in put_attributes: " + $!
|
371
|
+
if options[:create_domain] && create_domain_if_not_exist(ex, domain_name)
|
372
|
+
save(options)
|
373
|
+
else
|
374
|
+
raise ex
|
375
|
+
end
|
376
|
+
end
|
366
377
|
rescue Exception
|
367
378
|
on_exception
|
368
379
|
end
|
369
380
|
|
381
|
+
def create_domain_if_not_exist(ex, domain_name)
|
382
|
+
if ex.message().index("NoSuchDomain")
|
383
|
+
create_domain(domain_name)
|
384
|
+
return true
|
385
|
+
end
|
386
|
+
return false
|
387
|
+
end
|
388
|
+
|
370
389
|
#
|
371
390
|
# items is an array of Aws::SdbInterface::Item.new(o.id, o.attributes, true)
|
372
391
|
def batch_put_attributes(domain_name, items)
|
373
|
-
params = {
|
374
|
-
i
|
392
|
+
params = {'DomainName' => domain_name}
|
393
|
+
i = 0
|
375
394
|
items.each do |item|
|
376
|
-
prefix
|
395
|
+
prefix = "Item." + i.to_s + "."
|
377
396
|
params[prefix + "ItemName"] = item.item_name
|
378
397
|
params.merge!(pack_attributes(item.attributes, item.replace, prefix))
|
379
398
|
i += 1
|
380
399
|
end
|
381
400
|
link = generate_request("BatchPutAttributes", params)
|
382
|
-
request_info(
|
401
|
+
request_info(link, QSdbSimpleParser.new)
|
383
402
|
rescue Exception
|
384
403
|
on_exception
|
385
404
|
end
|
386
405
|
|
387
|
-
|
406
|
+
#
|
388
407
|
# items is an array item_name's or Aws::SdbInterface::Item.new(o.id, o.attributes, true)
|
389
408
|
def batch_delete_attributes(domain_name, items)
|
390
|
-
params = {
|
391
|
-
i
|
409
|
+
params = {'DomainName' => domain_name}
|
410
|
+
i = 0
|
392
411
|
items.each do |item|
|
393
412
|
prefix = "Item." + i.to_s + "."
|
394
413
|
if item.is_a?(String)
|
395
|
-
|
414
|
+
params[prefix + "ItemName"] = item
|
396
415
|
else
|
397
416
|
params[prefix + "ItemName"] = item.item_name
|
398
417
|
params.merge!(pack_attributes(item.attributes, item.replace, prefix))
|
@@ -400,7 +419,7 @@ module Aws
|
|
400
419
|
i += 1
|
401
420
|
end
|
402
421
|
link = generate_request("BatchDeleteAttributes", params)
|
403
|
-
request_info(
|
422
|
+
request_info(link, QSdbSimpleParser.new)
|
404
423
|
rescue Exception
|
405
424
|
on_exception
|
406
425
|
end
|
@@ -430,11 +449,11 @@ module Aws
|
|
430
449
|
# see: http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_GetAttributes.html
|
431
450
|
#
|
432
451
|
def get_attributes(domain_name, item_name, attribute_name=nil, consistent_read = nil)
|
433
|
-
link = generate_request("GetAttributes", 'DomainName'
|
434
|
-
'ItemName'
|
435
|
-
'AttributeName'
|
436
|
-
'ConsistentRead'
|
437
|
-
res
|
452
|
+
link = generate_request("GetAttributes", 'DomainName' => domain_name,
|
453
|
+
'ItemName' => item_name,
|
454
|
+
'AttributeName' => attribute_name,
|
455
|
+
'ConsistentRead' => consistent_read)
|
456
|
+
res = request_info(link, QSdbGetAttributesParser.new)
|
438
457
|
res[:attributes].each_value do |values|
|
439
458
|
values.collect! { |e| sdb_to_ruby(e) }
|
440
459
|
end
|
@@ -460,10 +479,10 @@ module Aws
|
|
460
479
|
# see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_DeleteAttributes.html
|
461
480
|
#
|
462
481
|
def delete_attributes(domain_name, item_name, attributes = nil)
|
463
|
-
params = {
|
464
|
-
|
465
|
-
link
|
466
|
-
request_info(
|
482
|
+
params = {'DomainName' => domain_name,
|
483
|
+
'ItemName' => item_name}.merge(pack_attributes(attributes))
|
484
|
+
link = generate_request("DeleteAttributes", params)
|
485
|
+
request_info(link, QSdbSimpleParser.new)
|
467
486
|
rescue Exception
|
468
487
|
on_exception
|
469
488
|
end
|
@@ -509,13 +528,13 @@ module Aws
|
|
509
528
|
query_expression = query_expression_from_array(query_expression) if query_expression.is_a?(Array)
|
510
529
|
@last_query_expression = query_expression
|
511
530
|
#
|
512
|
-
request_params
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
link
|
518
|
-
result
|
531
|
+
request_params = {'DomainName' => domain_name,
|
532
|
+
'QueryExpression' => query_expression,
|
533
|
+
'MaxNumberOfItems' => max_number_of_items,
|
534
|
+
'NextToken' => next_token,
|
535
|
+
'ConsistentRead' => consistent_read}
|
536
|
+
link = generate_request("Query", request_params)
|
537
|
+
result = request_info(link, QSdbQueryParser.new)
|
519
538
|
# return result if no block given
|
520
539
|
return result unless block_given?
|
521
540
|
# loop if block if given
|
@@ -524,8 +543,8 @@ module Aws
|
|
524
543
|
break unless yield(result) && result[:next_token]
|
525
544
|
# make new request
|
526
545
|
request_params['NextToken'] = result[:next_token]
|
527
|
-
link
|
528
|
-
result
|
546
|
+
link = generate_request("Query", request_params)
|
547
|
+
result = request_info(link, QSdbQueryParser.new)
|
529
548
|
end while true
|
530
549
|
rescue Exception
|
531
550
|
on_exception
|
@@ -579,16 +598,16 @@ module Aws
|
|
579
598
|
query_expression = query_expression_from_array(query_expression) if query_expression.is_a?(Array)
|
580
599
|
@last_query_expression = query_expression
|
581
600
|
#
|
582
|
-
request_params
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
601
|
+
request_params = {'DomainName' => domain_name,
|
602
|
+
'QueryExpression' => query_expression,
|
603
|
+
'MaxNumberOfItems' => max_number_of_items,
|
604
|
+
'NextToken' => next_token,
|
605
|
+
'ConsistentRead' => consistent_read}
|
587
606
|
attributes.each_with_index do |attribute, idx|
|
588
607
|
request_params["AttributeName.#{idx+1}"] = attribute
|
589
608
|
end
|
590
609
|
link = generate_request("QueryWithAttributes", request_params)
|
591
|
-
result = select_response_to_ruby(request_info(
|
610
|
+
result = select_response_to_ruby(request_info(link, QSdbQueryWithAttributesParser.new))
|
592
611
|
# return result if no block given
|
593
612
|
return result unless block_given?
|
594
613
|
# loop if block if given
|
@@ -597,8 +616,8 @@ module Aws
|
|
597
616
|
break unless yield(result) && result[:next_token]
|
598
617
|
# make new request
|
599
618
|
request_params['NextToken'] = result[:next_token]
|
600
|
-
link
|
601
|
-
result
|
619
|
+
link = generate_request("QueryWithAttributes", request_params)
|
620
|
+
result = select_response_to_ruby(request_info(link, QSdbQueryWithAttributesParser.new))
|
602
621
|
end while true
|
603
622
|
rescue Exception
|
604
623
|
on_exception
|
@@ -647,22 +666,22 @@ module Aws
|
|
647
666
|
# http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?SDBLimits.html
|
648
667
|
#
|
649
668
|
def select(select_expression, next_token = nil, consistent_read = nil)
|
650
|
-
select_expression
|
669
|
+
select_expression = query_expression_from_array(select_expression) if select_expression.is_a?(Array)
|
651
670
|
@last_query_expression = select_expression
|
652
671
|
|
653
|
-
options
|
672
|
+
options = {}
|
654
673
|
if next_token.is_a?(Hash)
|
655
|
-
options
|
656
|
-
next_token
|
674
|
+
options = next_token
|
675
|
+
next_token = options[:next_token]
|
657
676
|
consistent_read = options[:consistent_read]
|
658
677
|
end
|
659
678
|
|
660
679
|
#
|
661
|
-
request_params = {
|
662
|
-
|
663
|
-
|
664
|
-
link
|
665
|
-
result
|
680
|
+
request_params = {'SelectExpression' => select_expression,
|
681
|
+
'NextToken' => next_token,
|
682
|
+
'ConsistentRead' => consistent_read}
|
683
|
+
link = generate_request("Select", request_params, options)
|
684
|
+
result = select_response_to_ruby(request_info(link, QSdbSelectParser.new, options))
|
666
685
|
return result unless block_given?
|
667
686
|
# loop if block if given
|
668
687
|
begin
|
@@ -670,8 +689,8 @@ module Aws
|
|
670
689
|
break unless yield(result) && result[:next_token]
|
671
690
|
# make new request
|
672
691
|
request_params['NextToken'] = result[:next_token]
|
673
|
-
link
|
674
|
-
result
|
692
|
+
link = generate_request("Select", request_params)
|
693
|
+
result = select_response_to_ruby(request_info(link, QSdbSelectParser.new, options))
|
675
694
|
end while true
|
676
695
|
rescue Exception
|
677
696
|
on_exception
|
@@ -681,9 +700,9 @@ module Aws
|
|
681
700
|
attr_accessor :item_name, :attributes, :replace
|
682
701
|
|
683
702
|
def initialize(item_name, attributes, replace = false)
|
684
|
-
@item_name
|
703
|
+
@item_name = item_name
|
685
704
|
@attributes = attributes
|
686
|
-
@replace
|
705
|
+
@replace = replace
|
687
706
|
end
|
688
707
|
end
|
689
708
|
|
@@ -692,19 +711,19 @@ module Aws
|
|
692
711
|
#-----------------------------------------------------------------
|
693
712
|
class QSdbListDomainParser < AwsParser #:nodoc:
|
694
713
|
def reset
|
695
|
-
@result = {
|
714
|
+
@result = {:domains => []}
|
696
715
|
end
|
697
716
|
|
698
717
|
def tagend(name)
|
699
718
|
case name
|
700
|
-
when 'NextToken'
|
701
|
-
@result[:next_token] =
|
719
|
+
when 'NextToken' then
|
720
|
+
@result[:next_token] = @text
|
702
721
|
when 'DomainName' then
|
703
|
-
@result[:domains]
|
704
|
-
when 'BoxUsage'
|
705
|
-
@result[:box_usage]
|
706
|
-
when 'RequestId'
|
707
|
-
@result[:request_id] =
|
722
|
+
@result[:domains] << @text
|
723
|
+
when 'BoxUsage' then
|
724
|
+
@result[:box_usage] = @text
|
725
|
+
when 'RequestId' then
|
726
|
+
@result[:request_id] = @text
|
708
727
|
end
|
709
728
|
end
|
710
729
|
end
|
@@ -716,20 +735,20 @@ module Aws
|
|
716
735
|
|
717
736
|
def tagend(name)
|
718
737
|
case name
|
719
|
-
when 'Timestamp'
|
738
|
+
when 'Timestamp' then
|
720
739
|
@result[:timestamp] = @text
|
721
740
|
when 'ItemCount' then
|
722
741
|
@result[:item_count] = @text.to_i
|
723
|
-
when 'AttributeValueCount'
|
724
|
-
@result[:attribute_value_count]
|
725
|
-
when 'AttributeNameCount'
|
726
|
-
@result[:attribute_name_acount] =
|
727
|
-
when 'ItemNamesSizeBytes'
|
728
|
-
@result[:item_names_size_bytes] =
|
729
|
-
when 'AttributeValuesSizeBytes'
|
730
|
-
@result[:attributes_values_size_bytes] =
|
731
|
-
when 'AttributeNamesSizeBytes'
|
732
|
-
@result[:attributes_names_size_bytes] =
|
742
|
+
when 'AttributeValueCount' then
|
743
|
+
@result[:attribute_value_count] = @text.to_i
|
744
|
+
when 'AttributeNameCount' then
|
745
|
+
@result[:attribute_name_acount] = @text.to_i
|
746
|
+
when 'ItemNamesSizeBytes' then
|
747
|
+
@result[:item_names_size_bytes] = @text.to_i
|
748
|
+
when 'AttributeValuesSizeBytes' then
|
749
|
+
@result[:attributes_values_size_bytes] = @text.to_i
|
750
|
+
when 'AttributeNamesSizeBytes' then
|
751
|
+
@result[:attributes_names_size_bytes] = @text.to_i
|
733
752
|
|
734
753
|
end
|
735
754
|
end
|
@@ -743,10 +762,10 @@ module Aws
|
|
743
762
|
|
744
763
|
def tagend(name)
|
745
764
|
case name
|
746
|
-
when 'BoxUsage'
|
747
|
-
@result[:box_usage]
|
765
|
+
when 'BoxUsage' then
|
766
|
+
@result[:box_usage] = @text
|
748
767
|
when 'RequestId' then
|
749
|
-
@result[:request_id] =
|
768
|
+
@result[:request_id] = @text
|
750
769
|
end
|
751
770
|
end
|
752
771
|
end
|
@@ -754,45 +773,45 @@ module Aws
|
|
754
773
|
class QSdbGetAttributesParser < AwsParser #:nodoc:
|
755
774
|
def reset
|
756
775
|
@last_attribute_name = nil
|
757
|
-
@result
|
776
|
+
@result = {:attributes => {}}
|
758
777
|
end
|
759
778
|
|
760
779
|
def tagend(name)
|
761
780
|
case name
|
762
|
-
when 'Name'
|
781
|
+
when 'Name' then
|
763
782
|
@last_attribute_name = @text
|
764
|
-
when 'Value'
|
783
|
+
when 'Value' then
|
765
784
|
(@result[:attributes][@last_attribute_name] ||= []) << @text
|
766
|
-
when 'BoxUsage'
|
767
|
-
@result[:box_usage]
|
785
|
+
when 'BoxUsage' then
|
786
|
+
@result[:box_usage] = @text
|
768
787
|
when 'RequestId' then
|
769
|
-
@result[:request_id] =
|
788
|
+
@result[:request_id] = @text
|
770
789
|
end
|
771
790
|
end
|
772
791
|
end
|
773
792
|
|
774
793
|
class QSdbQueryParser < AwsParser #:nodoc:
|
775
794
|
def reset
|
776
|
-
@result = {
|
795
|
+
@result = {:items => []}
|
777
796
|
end
|
778
797
|
|
779
798
|
def tagend(name)
|
780
799
|
case name
|
781
|
-
when 'ItemName'
|
782
|
-
@result[:items]
|
783
|
-
when 'BoxUsage'
|
784
|
-
@result[:box_usage]
|
800
|
+
when 'ItemName' then
|
801
|
+
@result[:items] << @text
|
802
|
+
when 'BoxUsage' then
|
803
|
+
@result[:box_usage] = @text
|
785
804
|
when 'RequestId' then
|
786
|
-
@result[:request_id] =
|
805
|
+
@result[:request_id] = @text
|
787
806
|
when 'NextToken' then
|
788
|
-
@result[:next_token] =
|
807
|
+
@result[:next_token] = @text
|
789
808
|
end
|
790
809
|
end
|
791
810
|
end
|
792
811
|
|
793
812
|
class QSdbQueryWithAttributesParser < AwsParser #:nodoc:
|
794
813
|
def reset
|
795
|
-
@result = {
|
814
|
+
@result = {:items => []}
|
796
815
|
end
|
797
816
|
|
798
817
|
def tagend(name)
|
@@ -801,18 +820,18 @@ module Aws
|
|
801
820
|
case @xmlpath
|
802
821
|
when 'QueryWithAttributesResponse/QueryWithAttributesResult/Item'
|
803
822
|
@item = @text
|
804
|
-
@result[:items] << {
|
823
|
+
@result[:items] << {@item => {}}
|
805
824
|
when 'QueryWithAttributesResponse/QueryWithAttributesResult/Item/Attribute'
|
806
|
-
@attribute
|
825
|
+
@attribute = @text
|
807
826
|
@result[:items].last[@item][@attribute] ||= []
|
808
827
|
end
|
809
828
|
when 'RequestId' then
|
810
829
|
@result[:request_id] = @text
|
811
|
-
when 'BoxUsage'
|
812
|
-
@result[:box_usage]
|
830
|
+
when 'BoxUsage' then
|
831
|
+
@result[:box_usage] = @text
|
813
832
|
when 'NextToken' then
|
814
833
|
@result[:next_token] = @text
|
815
|
-
when 'Value'
|
834
|
+
when 'Value' then
|
816
835
|
@result[:items].last[@item][@attribute] << @text
|
817
836
|
end
|
818
837
|
end
|
@@ -820,7 +839,7 @@ module Aws
|
|
820
839
|
|
821
840
|
class QSdbSelectParser < AwsParser #:nodoc:
|
822
841
|
def reset
|
823
|
-
@result = {
|
842
|
+
@result = {:items => []}
|
824
843
|
end
|
825
844
|
|
826
845
|
def tagend(name)
|
@@ -829,18 +848,18 @@ module Aws
|
|
829
848
|
case @xmlpath
|
830
849
|
when 'SelectResponse/SelectResult/Item'
|
831
850
|
@item = @text
|
832
|
-
@result[:items] << {
|
851
|
+
@result[:items] << {@item => {}}
|
833
852
|
when 'SelectResponse/SelectResult/Item/Attribute'
|
834
|
-
@attribute
|
853
|
+
@attribute = @text
|
835
854
|
@result[:items].last[@item][@attribute] ||= []
|
836
855
|
end
|
837
856
|
when 'RequestId' then
|
838
857
|
@result[:request_id] = @text
|
839
|
-
when 'BoxUsage'
|
840
|
-
@result[:box_usage]
|
858
|
+
when 'BoxUsage' then
|
859
|
+
@result[:box_usage] = @text
|
841
860
|
when 'NextToken' then
|
842
861
|
@result[:next_token] = @text
|
843
|
-
when 'Value'
|
862
|
+
when 'Value' then
|
844
863
|
@result[:items].last[@item][@attribute] << @text
|
845
864
|
end
|
846
865
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 2.3.
|
8
|
+
- 31
|
9
|
+
version: 2.3.31
|
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-
|
19
|
+
date: 2010-12-19 00:00:00 -08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|