Sha256: 3f040117d3b284f30f545d7b7629255f2a0381fd5b661b9c123aca85b2e0586c

Contents?: true

Size: 1.48 KB

Versions: 22

Compression:

Stored size: 1.48 KB

Contents

module Fog
  module AWS
    class Storage
      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 https://docs.aws.amazon.com/AmazonS3/latest/API/RESTServiceGET.html
        #
        def get_service
          request({
            :expects  => 200,
            :headers  => {},
            :host     => 's3.amazonaws.com',
            :idempotent => true,
            :method   => 'GET',
            :parser   => Fog::Parsers::AWS::Storage::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

22 entries across 22 versions & 1 rubygems

Version Path
fog-aws-3.18.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.17.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.16.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.15.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.14.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.13.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.12.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.11.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.10.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.9.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.8.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.7.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.6.7 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.6.6 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.6.5 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.6.4 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.6.3 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.6.2 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.5.2 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.5.1 lib/fog/aws/requests/storage/get_service.rb