Sha256: feeb53edd8be02b83d86f0ee822958cbfeef5d1aa7ec92b3980f3b8e3cdcecde

Contents?: true

Size: 1019 Bytes

Versions: 7

Compression:

Stored size: 1019 Bytes

Contents

get '/sample7' do
  haml :sample7
end

post '/sample7' do
  set :client_id, params[:client_id]
  set :private_key, params[:private_key]
   
  begin
    raise "Please enter all required parameters" if settings.client_id.empty? or settings.private_key.empty?
    files_list = GroupDocs::Storage::Folder.list!('/', {:extended => true}, { :client_id => settings.client_id, :private_key => settings.private_key})

    thumbnails = ''
    files_list.each do |element|
      if element.class.name.split('::').last == 'Folder'
        next
      end
      
      if element.thumbnail
        name = element.name 
        thumbnails += "<p><img src='data:image/png;base64,#{element.thumbnail}', width='40px', height='40px'> #{name}</p>"
      end
    end
    
    unless thumbnails.empty?
      set :thumbnails, thumbnails
    end
  rescue Exception => e
    err = e.message
  end

  haml :sample7, :locals => { :userId => settings.client_id, :privateKey => settings.private_key, :thumbnailList => thumbnails, :err => err }
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
groupdocs-1.2.8 examples/api-samples/samples/sample7.rb
groupdocs-1.2.7 examples/api-samples/samples/sample7.rb
groupdocs-1.2.6 examples/api-samples/samples/sample7.rb
groupdocs-1.2.3 examples/api-samples/samples/sample7.rb
groupdocs-1.2.2 examples/api-samples/samples/sample7.rb
groupdocs-1.2.1 examples/api-samples/samples/sample7.rb
groupdocs-1.2.0 examples/api-samples/samples/sample7.rb