Sha256: 08fd4c512266025d7fc70965cde3dbdd4bd2c5bb6becd8d2019281ee6821e08c
Contents?: true
Size: 1.71 KB
Versions: 1
Compression:
Stored size: 1.71 KB
Contents
# frozen_string_literal: true module Fog module Storage class Aliyun class Real def get_container(container, options = {}) options = options.reject { |_key, value| value.nil? } bucket = options[:bucket] bucket ||= @aliyun_oss_bucket marker = options[:marker] maxKeys = options[:maxKeys] delimiter = '/' path = '' prefix = if container == '' || container == '.' || container.nil? nil else container + '/' end if prefix path += '?prefix=' + prefix path += '&marker=' + marker if marker path += '&max-keys=' + maxKeys if maxKeys path += '&delimiter=' + delimiter if delimiter elsif marker path += '?marker=' + marker path += '&max-keys=' + maxKeys if maxKeys path += '&delimiter=' + delimiter if delimiter elsif maxKeys path += '?max-keys=' + maxKeys path += '&delimiter=' + delimiter if delimiter elsif delimiter path += '?delimiter=' + delimiter end location = get_bucket_location(bucket) endpoint = 'http://' + location + '.aliyuncs.com' resource = bucket + '/' ret = request( expects: [200, 203, 400], method: 'GET', path: path, resource: resource, bucket: bucket ) xml = ret.data[:body] result = XmlSimple.xml_in(xml)['CommonPrefixes'] end end class Mock def get_container(container, options = {}); end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-aliyun-0.3.1 | lib/fog/aliyun/requests/storage/get_container.rb |