Sha256: 3822f97587c83c44476a4527f1930b6fc2e407571b9f4047041740ea732583ee

Contents?: true

Size: 696 Bytes

Versions: 3

Compression:

Stored size: 696 Bytes

Contents

# service.rb
require File.join(File.dirname(__FILE__), 's3_authenticator')
require 'rexml/document'

module S3Lib
  
  class Service
    
    def self.buckets
      response = S3Lib.request(:get, '')
      xml = REXML::Document.new(response).root

      REXML::XPath.match(xml, '//Buckets/Bucket').collect do |bucket_xml|
        Bucket.new(bucket_xml)
      end
    end
        
  end
  
  # This is a stub of the Bucket class that will be replaced with
  # a full-blown class in the following recipes.  
  class Bucket
    
    attr_reader :name
    
    def initialize(doc)
      @name = doc.elements['Name'].text      
    end
    
  end
  
end

if __FILE__ == $0
  S3Lib::Service.buckets
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
spatten-s3lib-0.0.1 lib/service_dev.rb
s3lib-0.1.1 lib/service_dev.rb
s3lib-0.1.0 lib/service_dev.rb