Sha256: da33f826def83427d35d7c3b322e41cf1aa2b2856d8248da9a8634f347cab81a

Contents?: true

Size: 794 Bytes

Versions: 8

Compression:

Stored size: 794 Bytes

Contents

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

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

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

    # check the number of document's views. Make a request to API using client_id and private_key
    views = GroupDocs::Document.views!({}, { :client_id => settings.client_id, :private_key => settings.private_key})
    total = views.count()

  rescue Exception => e
    err = e.message
  end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
groupdocs-1.5.0 examples/api-samples/samples/sample15.rb
groupdocs-1.4.2 examples/api-samples/samples/sample15.rb
groupdocs-1.4.1 examples/api-samples/samples/sample15.rb
groupdocs-1.4.0 examples/api-samples/samples/sample15.rb
groupdocs-1.3.0 examples/api-samples/samples/sample15.rb
groupdocs-1.2.11 examples/api-samples/samples/sample15.rb
groupdocs-1.2.10 examples/api-samples/samples/sample15.rb
groupdocs-1.2.9 examples/api-samples/samples/sample15.rb