Class: RightAws::S3Interface::S3ImprovedListBucketParser

Inherits:
RightAWSParser
  • Object
show all
Defined in:
lib/s3/right_s3_interface.rb

Overview

:nodoc:

Constant Summary

Constants inherited from RightAWSParser

RightAWSParser::DEFAULT_XML_LIBRARY

Instance Attribute Summary

Attributes inherited from RightAWSParser

#full_tag_name, #result, #tag, #xml_lib, #xmlpath

Instance Method Summary collapse

Methods inherited from RightAWSParser

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

Constructor Details

This class inherits a constructor from RightAws::RightAWSParser

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightAws::RightAWSParser

Instance Method Details

#resetObject



1261
1262
1263
1264
1265
1266
1267
1268
1269
# File 'lib/s3/right_s3_interface.rb', line 1261

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

#tagend(name) ⇒ Object



1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
# File 'lib/s3/right_s3_interface.rb', line 1274

def tagend(name)
  case name
      # service info
    when 'Name'        then @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'      then @in_common_prefixes ? @common_prefixes << @text : @result[:prefix] = @text
    when 'Marker'      then @result[:marker]       = @text
    when 'MaxKeys'     then @result[:max_keys]     = @text
    when 'Delimiter'   then @result[:delimiter]    = @text
    when 'IsTruncated' then @result[:is_truncated] = (@text =~ /false/ ? false : true)
    when 'NextMarker'  then @result[:next_marker]  = @text
      # key data
    when 'Key'         then @current_key[:key]                = @text
    when 'LastModified'then @current_key[:last_modified]      = @text
    when 'ETag'        then @current_key[:e_tag]              = @text
    when 'Size'        then @current_key[:size]               = @text.to_i
    when 'StorageClass'then @current_key[:storage_class]      = @text
    when 'ID'          then @current_key[:owner_id]           = @text
    when 'DisplayName' then @current_key[:owner_display_name] = @text
    when 'Contents'    then @result[:contents] << @current_key
      # Common Prefix stuff
    when 'CommonPrefixes' 
      @result[:common_prefixes] = @common_prefixes
      @in_common_prefixes = false
  end
end

#tagstart(name, attributes) ⇒ Object



1270
1271
1272
1273
# File 'lib/s3/right_s3_interface.rb', line 1270

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