Sha256: 22fa5e03557c15431e9febae903cc2ccf0a36cbfe293af3f21f201232e59f787

Contents?: true

Size: 1.48 KB

Versions: 61

Compression:

Stored size: 1.48 KB

Contents

module Fog
  module Storage
    class AWS
      class Real

        require 'fog/aws/parsers/storage/get_service'

        # List information about S3 buckets for authorized user
        #
        # @return [Excon::Response] response:
        #   * body [Hash]:
        #     * Buckets [Hash]:
        #       * Name [String] - Name of bucket
        #       * CreationTime [Time] - Timestamp of bucket creation
        #     * Owner [Hash]:
        #       * DisplayName [String] - Display name of bucket owner
        #       * ID [String] - Id of bucket owner
        #
        # @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTServiceGET.html
        #
        def get_service
          request({
            :expects  => 200,
            :headers  => {},
            :host     => @host,
            :idempotent => true,
            :method   => 'GET',
            :parser   => Fog::Parsers::Storage::AWS::GetService.new
          })
        end

      end

      class Mock # :nodoc:all

        def get_service
          response = Excon::Response.new
          response.headers['Status'] = 200
          buckets = self.data[:buckets].values.map do |bucket|
            bucket.reject do |key, value|
              !['CreationDate', 'Name'].include?(key)
            end
          end
          response.body = {
            'Buckets' => buckets,
            'Owner'   => { 'DisplayName' => 'owner', 'ID' => 'some_id'}
          }
          response
        end

      end
    end
  end
end

Version data entries

61 entries across 61 versions & 6 rubygems

Version Path
fog-1.22.0 lib/fog/aws/requests/storage/get_service.rb
fog-1.21.0 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/storage/get_service.rb
fog-1.20.0 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/storage/get_service.rb
fog-1.19.0 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/storage/get_service.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/storage/get_service.rb