Sha256: dab33b025397493b8feddef662bdab8670dccaa196a392433dd8bac37ecd8d9a

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

module Fog
  module Storage
    class Aliyun
      class Real
        # Get details for object
        #
        # ==== Parameters
        # * object<~String> - Name of object to look for
        #
        def get_object(object, range = nil, options = {})
          options = options.reject { |_key, value| value.nil? }
          bucket = options[:bucket]
          bucket ||= @aliyun_oss_bucket
          endpoint = options[:endpoint]
          if nil == endpoint
            location = get_bucket_location(bucket)
            endpoint = 'http://' + location + '.aliyuncs.com'
          end
          resource = bucket + '/' + object
          para = {
            expects: [200, 206, 404],
            method: 'GET',
            path: object,
            bucket: bucket,
            resource: resource,
            endpoint: endpoint
          }

          if range
            rangeStr = 'bytes=' + range
            para[:headers] = { 'Range' => rangeStr }
          end

          response = request(para)
          response.data
        end
      end

      class Mock
        def get_object(object, range = nil, options = {})
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
fog-aliyun-0.3.0 lib/fog/aliyun/requests/storage/get_object.rb
fog-aliyun-0.2.2 lib/fog/aliyun/requests/storage/get_object.rb
fog-xiaozhu-0.2.2 lib/fog/aliyun/requests/storage/get_object.rb
fog-xiaozhu-0.2.1 lib/fog/aliyun/requests/storage/get_object.rb
fog-aliyun-0.2.1 lib/fog/aliyun/requests/storage/get_object.rb
fog-aliyun-0.2.0 lib/fog/aliyun/requests/storage/get_object.rb