Class: Aws::S3Interface::S3ImprovedListBucketParser

Inherits:
AwsParser
  • Object
show all
Defined in:
lib/s3/s3_interface.rb

Overview

:nodoc:

Constant Summary

Constants inherited from AwsParser

AwsParser::DEFAULT_XML_LIBRARY

Instance Attribute Summary

Attributes inherited from AwsParser

#result, #xml_lib, #xmlpath

Instance Method Summary collapse

Methods inherited from AwsParser

#initialize, #method_missing, #parse, #tag_end, #tag_start, #tagtext, #text, xml_lib, xml_lib=

Constructor Details

This class inherits a constructor from Aws::AwsParser

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Aws::AwsParser

Instance Method Details

#resetObject



1210
1211
1212
1213
1214
1215
1216
1217
1218
# File 'lib/s3/s3_interface.rb', line 1210

def reset
  @result                   = {}
  @result[:contents]        = []
  @result[:common_prefixes] = []
  @contents                 = []
  @current_key              = {}
  @common_prefixes          = []
  @in_common_prefixes       = false
end

#tagend(name) ⇒ Object



1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
# File 'lib/s3/s3_interface.rb', line 1225

def tagend(name)
  case name
    # service info
    when 'Name';
      @result[:name] = @text
    # Amazon uses the same tag for the search prefix and for the entries
    # in common prefix...so use our simple flag to see which element
    # we are parsing
    when 'Prefix';
      @in_common_prefixes ? @common_prefixes << @text : @result[:prefix] = @text
    when 'Marker';
      @result[:marker] = @text
    when 'MaxKeys';
      @result[:max_keys] = @text
    when 'Delimiter';
      @result[:delimiter] = @text
    when 'IsTruncated';
      @result[:is_truncated] = (@text =~ /false/ ? false : true)
    when 'NextMarker';
      @result[:next_marker] = @text
    # key data
    when 'Key';
      @current_key[:key] = @text
    when 'LastModified';
      @current_key[:last_modified] = @text
    when 'ETag';
      @current_key[:e_tag] = @text
    when 'Size';
      @current_key[:size] = @text.to_i
    when 'StorageClass';
      @current_key[:storage_class] = @text
    when 'ID';
      @current_key[:owner_id] = @text
    when 'DisplayName';
      @current_key[:owner_display_name] = @text
    when 'Contents';
      @result[:contents] << @current_key
    # Common Prefix stuff
    when 'CommonPrefixes';
      @result[:common_prefixes] = @common_prefixes; @in_common_prefixes = false
  end
end

#tagstart(name, attributes) ⇒ Object



1220
1221
1222
1223
# File 'lib/s3/s3_interface.rb', line 1220

def tagstart(name, attributes)
  @current_key = {} if name == 'Contents'
  @in_common_prefixes = true if name == 'CommonPrefixes'
end