Sha256: a1911f4811e594c419b94deed726271ed7b767caacc792b006ef6d23749ae035

Contents?: true

Size: 1.47 KB

Versions: 61

Compression:

Stored size: 1.47 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 59 versions & 6 rubygems

Version Path
fog-aws-0.1.1 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.1.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.0.8 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.0.7 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.0.6 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.0.5 lib/fog/aws/requests/storage/get_service.rb
fog-1.26.0 lib/fog/aws/requests/storage/get_service.rb
fog-1.25.0 lib/fog/aws/requests/storage/get_service.rb
nsidc-fog-1.24.1 lib/fog/aws/requests/storage/get_service.rb
fog-1.24.0 lib/fog/aws/requests/storage/get_service.rb
ns-fog-1.22.11 lib/fog/aws/requests/storage/get_service.rb
ns-fog-1.22.10 lib/fog/aws/requests/storage/get_service.rb
ns-fog-1.22.9 lib/fog/aws/requests/storage/get_service.rb
ns-fog-1.22.8 lib/fog/aws/requests/storage/get_service.rb
ns-fog-1.22.7 lib/fog/aws/requests/storage/get_service.rb
ns-fog-1.22.6 lib/fog/aws/requests/storage/get_service.rb
fog-1.23.0 lib/fog/aws/requests/storage/get_service.rb
ns-fog-1.22.4 lib/fog/aws/requests/storage/get_service.rb
ns-fog-1.22.3 lib/fog/aws/requests/storage/get_service.rb
ns-fog-1.22.2 lib/fog/aws/requests/storage/get_service.rb