Sha256: ffff98522fd12fb26bf306f2780c0690fd3715bdbb3a3c0398cfa4883a6cf475
Contents?: true
Size: 1.83 KB
Versions: 6
Compression:
Stored size: 1.83 KB
Contents
module Fog module Storage class Aliyun class Real # List existing storage containers # # ==== Parameters # * options<~Hash>: # * 'maxKeys'<~Integer> - Upper limit to number of results returned # * 'marker'<~String> - Only return objects with name greater than this value # # ==== Returns # def get_containers(options = {}) options = options.reject { |_key, value| value.nil? } bucket = options[:bucket] bucket ||= @aliyun_oss_bucket prefix = options[:prefix] marker = options[:marker] maxKeys = options[:maxKeys] delimiter = '/' path = '' 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_containers(options = {}) end end end end end
Version data entries
6 entries across 6 versions & 2 rubygems