如何从谷歌硬盘中的特定文件夹中获取随机图像?

时间:2016-06-02 08:14:09

标签: ruby google-drive-api

我正在使用Ruby Sinatra进行开发,目前正在使用:

gem 'google_drive'
gem 'google-api-client' , '~> 0.9'


@service = Google::Apis::DriveV3::DriveService.new
@service.client_options.application_name = APPLICATION_NAME
@service.authorization = authorize

get_images = @service.list_files(q: "'xxxx' in parents and trashed = false",
  order_by: 'createdTime desc',
  spaces: 'drive',
  fields:'nextPageToken, files(id, name)',
  page_size: 10)

get_images.files.each do |file|
 ......
end

我想随机显示图片,但

如何在包含许多图像的文件夹中获取随机图像?

0 个答案:

没有答案