You asked a long time ago... So this is just in case my answer will help somebody else who opened this page looking for the same solution.
let's say you you list files in this way:
def google_files
client = Google::APIClient.new
client.authorization.access_token = Token.last.fresh_token
drive_api = client.discovered_api('drive', 'v2')
@result = Array.new
page_token = nil
begin
parameters = {:orderBy => 'folder'}
if page_token.to_s != ''
parameters['pageToken'] = page_token
end
api_result = client.execute(
:api_method => drive_api.files.list,
:parameters => parameters)
if api_result.status == 200
files = api_result.data
@result.concat(files.items)
page_token = files.next_page_token
else
puts "An error occurred: #{result.data['error']['message']}"
page_token = nil
end
end while page_token.to_s != ''
@result
end
In your some_page.html.erb this code:
<% @result.each do |f| %>
<% if f.mimeType == 'application/vnd.google-apps.folder' %>
<% if f.parents.any? %>
<% f.parents.each do |parent_root| %>
<% if parent_root.is_root %>
<!-- these are your folder in the root of your disk - 'My Disk' -->
<%= image_tag f.icon_link %> <%= link_to f.title, f.alternate_link, class: 'btn btn-default btn-sm', :target => "_blank" %>
<% end %>
<% end %>
<% else %>
<!-- these are your folder in the root of the 'Shared with me' -->
<%= image_tag f.icon_link %> <%= link_to f.title, f.alternate_link, class: 'btn btn-default btn-sm', :target => "_blank" %>
<% end %>
<% else %>
<% if f.parents.any? %>
<% f.parents.each do |parent| %>
<% if parent.isRoot %>
<!-- these are your Files in the root of your disk - 'My Disk' -->
<%= image_tag f.icon_link %> <%= link_to f.title, f.alternate_link, class: 'btn btn-default btn-sm', :target => "_blank" %>
<% end %>
<% end %>
<% else %>
<!-- these are your Files in the root of the 'Shared with me' -->
<%= image_tag f.icon_link %> <%= link_to f.title, f.alternate_link, class: 'btn btn-default btn-sm', :target => "_blank" %>
<% end %>
<% end %>
<% end %>