2016-10-21 3 views
0

안녕하세요. 내 앱에서 google-api-client gem을 사용하고 있습니다. 폴더 내의 모든 이미지 목록을 가져 오려면 어떻게해야합니까? 를 성취하다. 여기 내 코드는 첫 번째 페이지의 모든 파일 목록을 얻는 것입니다.Google 드라이브의 폴더에있는 모든 파일의 목록을 Ruby의 Google 드라이브 API를 사용하여 가져 오는 방법

require 'google/apis/drive_v2' 
require 'signet/oauth_2/client' 
require 'googleauth' 

Drive = Google::Apis::DriveV2 # Alias the module 
drive = Drive::DriveService.new 
drive.authorization = authorization 
files = drive.list_files 

폴더 안에있는 모든 파일의 목록을 어떻게 얻을 수 있는지 알려 주시기 바랍니다. 'test_folder'라는 폴더가 있고 그 폴더 안에 일부 파일이 있습니다. 이제는 모든 파일의 목록을 가져오고 싶습니다. 도와주세요.

답변

1

다음은이 사진입니다. PAGE_SIZE :

service = Google::Apis::DriveV2::DriveService.new 
service.client_options.application_name = APPLICATION_NAME 
service.authorization = authorize 
# List the 10 most recently modified files. 
response = service.list_files() 
puts 'Files:' 
puts 'No files found' if response.items.empty? 
response.items.each do |file| 
    puts "#{file.title} (#{file.id})" 
end 

자세한 내용은 제안하지만 던지는 예외 알 수없는 키워드에 대한 documentation

+0

고맙습니다을 참조하십시오. list_files 메서드는 파일 만 나열하지만 폴더 안의 모든 이미지 목록을 가져 오려면 어떻게 구현하는지 알려주십시오. –

+0

답변을 업데이트했습니다. –

관련 문제