Sha256: c3a0d144772463c6e0edb98f279943c1e033e529cad45a17ace2e615f831660e

Contents?: true

Size: 1.5 KB

Versions: 13

Compression:

Stored size: 1.5 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     => @host || region_to_host(DEFAULT_REGION),
            :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

13 entries across 13 versions & 1 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.29.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.28.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.27.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.26.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.25.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.24.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.23.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.22.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.21.1 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.21.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.20.0 lib/fog/aws/requests/storage/get_service.rb
fog-aws-3.19.0 lib/fog/aws/requests/storage/get_service.rb