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-3.1.0 lib/fog/aws/requests/storage/get_service.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/storage/get_service.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/storage/get_service.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.0.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-2.0.1 lib/fog/aws/requests/storage/get_service.rb
fog-aws-2.0.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-1.4.1 lib/fog/aws/requests/storage/get_service.rb
fog-aws-1.4.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-1.3.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-1.2.1 lib/fog/aws/requests/storage/get_service.rb
fog-aws-1.2.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-1.1.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-1.0.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.13.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.12.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.11.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.10.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.9.4 lib/fog/aws/requests/storage/get_service.rb
fog-aws-0.9.3 lib/fog/aws/requests/storage/get_service.rb