Sha256: ad860049c2a38767377eb33dc7647280ff8af68bd1073bd851d2b34b05cc72ee

Contents?: true

Size: 994 Bytes

Versions: 7

Compression:

Stored size: 994 Bytes

Contents

# GET request
get '/sample14' do
  haml :sample14
end

# POST request
post '/sample14' do
  # set variables
  set :client_id, params[:client_id]
  set :private_key, params[:private_key]
  set :folder, params[:folder]

  begin
    # check required variables
    raise 'Please enter all required parameters' if settings.client_id.empty? or settings.private_key.empty? or settings.folder.empty?

    # make a request to API using client_id and private_key
    files_list = GroupDocs::Storage::Folder.list!(settings.folder, {}, {:client_id => settings.client_id, :private_key => settings.private_key})

    # get list of shares for a folder
    shares = files_list.first.sharers!({:client_id => settings.client_id, :private_key => settings.private_key})

  rescue Exception => e
    err = e.message
  end

  # set variables for template
  haml :sample14, :locals => {:userId => settings.client_id, :privateKey => settings.private_key, :folder => settings.folder, :shares => shares, :err => err}
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
groupdocs-1.5.7 examples/api-samples/samples/sample14.rb
groupdocs-1.5.6 examples/api-samples/samples/sample14.rb
groupdocs-1.5.5 examples/api-samples/samples/sample14.rb
groupdocs-1.5.4 examples/api-samples/samples/sample14.rb
groupdocs-1.5.3 examples/api-samples/samples/sample14.rb
groupdocs-1.5.2 examples/api-samples/samples/sample14.rb
groupdocs-1.5.1 examples/api-samples/samples/sample14.rb