groupdocs 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +34 -0
- data/LICENSE.txt +21 -0
- data/README.md +3 -0
- data/examples/api-samples/public/docs/sample01.html +23 -23
- data/examples/api-samples/public/docs/sample02.html +27 -27
- data/examples/api-samples/public/docs/sample03.html +81 -69
- data/examples/api-samples/public/docs/sample04.html +29 -29
- data/examples/api-samples/public/docs/sample05.html +48 -48
- data/examples/api-samples/public/docs/sample06.html +47 -46
- data/examples/api-samples/public/docs/sample07.html +35 -35
- data/examples/api-samples/public/docs/sample08.html +45 -45
- data/examples/api-samples/public/docs/sample09.html +57 -57
- data/examples/api-samples/public/docs/sample10.html +41 -41
- data/examples/api-samples/public/docs/sample11.html +96 -118
- data/examples/api-samples/public/docs/sample12.html +29 -50
- data/examples/api-samples/public/docs/sample13.html +36 -44
- data/examples/api-samples/public/docs/sample14.html +29 -29
- data/examples/api-samples/public/docs/sample15.html +24 -24
- data/examples/api-samples/public/docs/sample16.html +32 -32
- data/examples/api-samples/public/docs/sample17.html +38 -38
- data/examples/api-samples/public/docs/sample18.html +105 -101
- data/examples/api-samples/public/docs/sample19.html +101 -101
- data/examples/api-samples/public/docs/sample20.html +42 -42
- data/examples/api-samples/public/docs/sample21.html +109 -109
- data/examples/api-samples/public/docs/sample22.html +56 -56
- data/examples/api-samples/public/docs/sample23.html +39 -39
- data/examples/api-samples/public/docs/sample24.html +36 -36
- data/examples/api-samples/public/docs/sample25.html +67 -67
- data/examples/api-samples/public/docs/sample26.html +23 -23
- data/examples/api-samples/public/docs/sample27.html +72 -72
- data/examples/api-samples/public/docs/sample28.html +46 -45
- data/examples/api-samples/public/docs/sample29.html +30 -30
- data/examples/api-samples/public/docs/sample30.html +30 -30
- data/examples/api-samples/public/docs/sample31.html +114 -114
- data/examples/api-samples/public/docs/sample32.html +96 -96
- data/examples/api-samples/public/docs/sample33.html +56 -56
- data/examples/api-samples/public/docs/sample34.html +27 -27
- data/examples/api-samples/public/docs/sample35.html +134 -135
- data/examples/api-samples/public/docs/sample36.html +32 -32
- data/examples/api-samples/public/docs/sample37.html +103 -103
- data/examples/api-samples/public/docs/sample38.html +76 -76
- data/examples/api-samples/public/docs/sample39.html +136 -136
- data/examples/api-samples/public/docs/sample40.html +104 -104
- data/examples/api-samples/public/docs/sample41.html +137 -137
- data/examples/api-samples/public/docs/sample42.html +61 -61
- data/examples/api-samples/public/docs/sample43.html +72 -72
- data/examples/api-samples/public/docs/sample44.html +751 -0
- data/examples/api-samples/public/docs/sample45.html +236 -0
- data/examples/api-samples/public/templates/merge_field3_doc.docx +0 -0
- data/examples/api-samples/samples/sample01.rb +2 -2
- data/examples/api-samples/samples/sample02.rb +2 -2
- data/examples/api-samples/samples/sample03.rb +2 -2
- data/examples/api-samples/samples/sample04.rb +2 -2
- data/examples/api-samples/samples/sample05.rb +2 -2
- data/examples/api-samples/samples/sample06.rb +2 -2
- data/examples/api-samples/samples/sample07.rb +2 -2
- data/examples/api-samples/samples/sample08.rb +2 -2
- data/examples/api-samples/samples/sample09.rb +2 -2
- data/examples/api-samples/samples/sample10.rb +2 -2
- data/examples/api-samples/samples/sample11.rb +2 -2
- data/examples/api-samples/samples/sample12.rb +2 -2
- data/examples/api-samples/samples/sample13.rb +2 -2
- data/examples/api-samples/samples/sample14.rb +2 -2
- data/examples/api-samples/samples/sample15.rb +2 -2
- data/examples/api-samples/samples/sample16.rb +2 -2
- data/examples/api-samples/samples/sample17.rb +2 -2
- data/examples/api-samples/samples/sample18.rb +2 -2
- data/examples/api-samples/samples/sample19.rb +2 -2
- data/examples/api-samples/samples/sample20.rb +2 -2
- data/examples/api-samples/samples/sample21.rb +2 -2
- data/examples/api-samples/samples/sample22.rb +2 -2
- data/examples/api-samples/samples/sample23.rb +2 -2
- data/examples/api-samples/samples/sample24.rb +2 -2
- data/examples/api-samples/samples/sample25.rb +2 -2
- data/examples/api-samples/samples/sample26.rb +2 -2
- data/examples/api-samples/samples/sample27.rb +2 -2
- data/examples/api-samples/samples/sample28.rb +2 -2
- data/examples/api-samples/samples/sample29.rb +2 -2
- data/examples/api-samples/samples/sample30.rb +2 -2
- data/examples/api-samples/samples/sample31.rb +2 -2
- data/examples/api-samples/samples/sample32.rb +2 -2
- data/examples/api-samples/samples/sample33.rb +2 -2
- data/examples/api-samples/samples/sample34.rb +2 -2
- data/examples/api-samples/samples/sample35.rb +4 -4
- data/examples/api-samples/samples/sample36.rb +2 -2
- data/examples/api-samples/samples/sample37.rb +2 -2
- data/examples/api-samples/samples/sample38.rb +2 -2
- data/examples/api-samples/samples/sample39.rb +2 -2
- data/examples/api-samples/samples/sample40.rb +2 -2
- data/examples/api-samples/samples/sample41.rb +2 -2
- data/examples/api-samples/samples/sample42.rb +2 -2
- data/examples/api-samples/samples/sample43.rb +2 -2
- data/examples/api-samples/samples/sample44.rb +188 -0
- data/examples/api-samples/samples/sample45.rb +74 -0
- data/examples/api-samples/views/_others_samples.haml +47 -43
- data/examples/api-samples/views/index.haml +55 -44
- data/examples/api-samples/views/layout.haml +1 -6
- data/examples/api-samples/views/sample01.haml +62 -57
- data/examples/api-samples/views/sample02.haml +52 -46
- data/examples/api-samples/views/sample03.haml +78 -73
- data/examples/api-samples/views/sample04.haml +51 -45
- data/examples/api-samples/views/sample05.haml +77 -71
- data/examples/api-samples/views/sample06.haml +58 -52
- data/examples/api-samples/views/sample07.haml +51 -45
- data/examples/api-samples/views/sample08.haml +90 -84
- data/examples/api-samples/views/sample09.haml +86 -80
- data/examples/api-samples/views/sample10.haml +83 -77
- data/examples/api-samples/views/sample11.haml +124 -120
- data/examples/api-samples/views/sample12.haml +65 -59
- data/examples/api-samples/views/sample13.haml +62 -56
- data/examples/api-samples/views/sample14.haml +57 -51
- data/examples/api-samples/views/sample15.haml +49 -43
- data/examples/api-samples/views/sample16.haml +49 -43
- data/examples/api-samples/views/sample17.haml +53 -47
- data/examples/api-samples/views/sample18.haml +140 -134
- data/examples/api-samples/views/sample19.haml +87 -81
- data/examples/api-samples/views/sample20.haml +53 -47
- data/examples/api-samples/views/sample21.haml +115 -111
- data/examples/api-samples/views/sample22.haml +94 -88
- data/examples/api-samples/views/sample23.haml +83 -78
- data/examples/api-samples/views/sample24.haml +54 -48
- data/examples/api-samples/views/sample25.haml +89 -83
- data/examples/api-samples/views/sample26.haml +62 -57
- data/examples/api-samples/views/sample27.haml +114 -109
- data/examples/api-samples/views/sample28.haml +55 -49
- data/examples/api-samples/views/sample29.haml +67 -69
- data/examples/api-samples/views/sample30.haml +54 -48
- data/examples/api-samples/views/sample31.haml +106 -100
- data/examples/api-samples/views/sample32.haml +90 -84
- data/examples/api-samples/views/sample33.haml +60 -54
- data/examples/api-samples/views/sample34.haml +51 -46
- data/examples/api-samples/views/sample35.haml +84 -78
- data/examples/api-samples/views/sample36.haml +63 -58
- data/examples/api-samples/views/sample37.haml +122 -116
- data/examples/api-samples/views/sample38.haml +104 -98
- data/examples/api-samples/views/sample39.haml +6 -2
- data/examples/api-samples/views/sample40.haml +94 -89
- data/examples/api-samples/views/sample41.haml +127 -123
- data/examples/api-samples/views/sample42.haml +60 -54
- data/examples/api-samples/views/sample43.haml +81 -77
- data/examples/api-samples/views/sample44.haml +85 -0
- data/examples/api-samples/views/sample45.haml +85 -0
- data/groupdocs.gemspec +2 -0
- data/lib/groupdocs/datasource/field.rb +9 -0
- data/lib/groupdocs/document.rb +66 -4
- data/lib/groupdocs/document/annotation.rb +11 -6
- data/lib/groupdocs/document/editor.rb +53 -0
- data/lib/groupdocs/document/field.rb +16 -0
- data/lib/groupdocs/document/style.rb +30 -0
- data/lib/groupdocs/job.rb +24 -0
- data/lib/groupdocs/questionnaire.rb +2 -0
- data/lib/groupdocs/questionnaire/collector.rb +52 -0
- data/lib/groupdocs/questionnaire/collector_style.rb +54 -0
- data/lib/groupdocs/questionnaire/question.rb +9 -0
- data/lib/groupdocs/questionnaire/style/base_font.rb +17 -0
- data/lib/groupdocs/questionnaire/style/question_title.rb +17 -0
- data/lib/groupdocs/questionnaire/style/title.rb +17 -0
- data/lib/groupdocs/signature/envelope.rb +43 -8
- data/lib/groupdocs/signature/form.rb +113 -12
- data/lib/groupdocs/signature/recipient.rb +38 -3
- data/lib/groupdocs/signature/shared/field_methods.rb +4 -2
- data/lib/groupdocs/signature/template.rb +20 -1
- data/lib/groupdocs/storage/file.rb +3 -2
- data/lib/groupdocs/user.rb +148 -0
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/api/helpers/access_rights_helper_spec.rb +5 -5
- data/spec/groupdocs/document/annotation_spec.rb +1 -1
- data/spec/groupdocs/signature/envelope_spec.rb +1 -1
- data/spec/groupdocs/user_spec.rb +4 -4
- data/spec/support/shared_examples/signature/shared/field_methods.rb +5 -4
- metadata +18 -3
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-16-how-to-insert-assembly-questionnaire-into-webpage' do
|
3
3
|
haml :sample16
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-16-how-to-insert-assembly-questionnaire-into-webpage' do
|
8
8
|
#Set variables
|
9
9
|
set :fileId, params[:fileId]
|
10
10
|
set :base_path, params[:basePath]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-17-how-to-upload-a-file-into-the-storage-and-compress-it-into-zip-archive' do
|
3
3
|
haml :sample17
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-17-how-to-upload-a-file-into-the-storage-and-compress-it-into-zip-archive' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-18-how-to-convert-doc-to-docx-docx-to-doc-docx-to-pdf-ppt-to-pdf' do
|
3
3
|
haml :sample18
|
4
4
|
end
|
5
5
|
|
@@ -71,7 +71,7 @@ end
|
|
71
71
|
|
72
72
|
|
73
73
|
#POST request
|
74
|
-
post '/
|
74
|
+
post '/sample-18-how-to-convert-doc-to-docx-docx-to-doc-docx-to-pdf-ppt-to-pdf' do
|
75
75
|
#Set variables
|
76
76
|
set :client_id, params[:clientId]
|
77
77
|
set :private_key, params[:privateKey]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-19-how-to-compare-documents' do
|
3
3
|
haml :sample19
|
4
4
|
end
|
5
5
|
|
@@ -69,7 +69,7 @@ get '/sample19/downloads/:filename' do |filename|
|
|
69
69
|
end
|
70
70
|
|
71
71
|
#POST request
|
72
|
-
post '/
|
72
|
+
post '/sample-19-how-to-compare-documents' do
|
73
73
|
#Set variables
|
74
74
|
set :client_id, params[:clientId]
|
75
75
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-20-how-to-get-compare-change-list-for-document' do
|
3
3
|
haml :sample20
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-20-how-to-get-compare-change-list-for-document' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-21-how-to-create-and-upload-envelop-to-groupdocs-account' do
|
3
3
|
haml :sample21
|
4
4
|
end
|
5
5
|
|
@@ -70,7 +70,7 @@ get '/sample21/downloads/:filename' do |filename|
|
|
70
70
|
end
|
71
71
|
|
72
72
|
#POST request
|
73
|
-
post '/
|
73
|
+
post '/sample-21-how-to-create-and-upload-envelop-to-groupdocs-account' do
|
74
74
|
#Set variables
|
75
75
|
set :client_id, params[:clientId]
|
76
76
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-22-how-to-create-or-update-user-and-add-him-to-collaborators' do
|
3
3
|
haml :sample22
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-22-how-to-create-or-update-user-and-add-him-to-collaborators' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-23-how-to-view-document-pages-as-images' do
|
3
3
|
haml :sample23
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-23-how-to-view-document-pages-as-images' do
|
8
8
|
|
9
9
|
#Set variables
|
10
10
|
set :client_id, params[:clientId]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-24-how-to-use-storageapi-to-upload-fil-from-url-to-groupdocs-account' do
|
3
3
|
haml :sample24
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-24-how-to-use-storageapi-to-upload-fil-from-url-to-groupdocs-account' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-25-how-to-merge-assemble-and-convert-document' do
|
3
3
|
haml :sample25
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-25-how-to-merge-assemble-and-convert-document' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-26-how-to-use-login-method-in-the-api' do
|
3
3
|
haml :sample26
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-26-how-to-use-login-method-in-the-api' do
|
8
8
|
set :email, params[:login]
|
9
9
|
set :password, params[:password]
|
10
10
|
set :base_path, params[:basePath]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-27-how-to-create-your-own-questionnaire-using-forms-and-show-the-result-document' do
|
3
3
|
haml :sample27
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-27-how-to-create-your-own-questionnaire-using-forms-and-show-the-result-document' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-28-how-to-delete-all-annotations-from-document' do
|
3
3
|
haml :sample28
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-28-how-to-delete-all-annotations-from-document' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-29-how-to-use-filepicker-io-to-upload-document-and-get-it\'s-url' do
|
3
3
|
haml :sample29
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-29-how-to-use-filepicker-io-to-upload-document-and-get-it\'s-url' do
|
8
8
|
|
9
9
|
#Set variables
|
10
10
|
set :client_id, params[:clientId]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-30-how-to-delete-file-from-groupdocs-storage' do
|
3
3
|
haml :sample30
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-30-how-to-delete-file-from-groupdocs-storage' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-31-how-to-dynamically-create-signature-form-using-data-from-html-form' do
|
3
3
|
haml :sample31
|
4
4
|
end
|
5
5
|
|
@@ -71,7 +71,7 @@ end
|
|
71
71
|
|
72
72
|
|
73
73
|
#POST request
|
74
|
-
post '/
|
74
|
+
post '/sample-31-how-to-dynamically-create-signature-form-using-data-from-html-form' do
|
75
75
|
#Set variables
|
76
76
|
set :client_id, params[:clientId]
|
77
77
|
set :private_key, params[:privateKey]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-32-how-to-create-signature-form-publish-it-and-configure-notification-via-callback' do
|
3
3
|
haml :sample32
|
4
4
|
end
|
5
5
|
|
@@ -67,7 +67,7 @@ post '/sample32/callback' do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
#POST request
|
70
|
-
post '/
|
70
|
+
post '/sample-32-how-to-create-signature-form-publish-it-and-configure-notification-via-callback' do
|
71
71
|
#Set variables
|
72
72
|
set :client_id, params[:clientId]
|
73
73
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-33-how-to-convert-several-html-documents-into-one-pdf-document' do
|
3
3
|
haml :sample33
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-33-how-to-convert-several-html-documents-into-one-pdf-document' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-34-how-to-create-folder-in-the-groupdocs-account' do
|
3
3
|
haml :sample34
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-34-how-to-create-folder-in-the-groupdocs-account' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,11 +1,11 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-35-how-to-get-fields-and-their-data-from-pdf-file' do
|
3
3
|
haml :sample35
|
4
4
|
end
|
5
5
|
|
6
6
|
|
7
7
|
#POST request
|
8
|
-
post '/
|
8
|
+
post '/sample-35-how-to-get-fields-and-their-data-from-pdf-file' do
|
9
9
|
#Set variables
|
10
10
|
set :client_id, params[:clientId]
|
11
11
|
set :private_key, params[:privateKey]
|
@@ -104,12 +104,12 @@ post '/sample35' do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
#GET request
|
107
|
-
get '/
|
107
|
+
get '//sample-35-how-to-get-fields-and-their-data-from-pdf-file/check' do
|
108
108
|
haml :sample35
|
109
109
|
end
|
110
110
|
|
111
111
|
#POST request
|
112
|
-
post '/
|
112
|
+
post '//sample-35-how-to-get-fields-and-their-data-from-pdf-file/check' do
|
113
113
|
set :client_id, params[:clientId]
|
114
114
|
set :private_key, params[:privateKey]
|
115
115
|
set :base_path, params[:basePath]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-36-how-to-download-signed-documents-when-envelope-was-signed' do
|
3
3
|
haml :sample36
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-36-how-to-download-signed-documents-when-envelope-was-signed' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#Route the handler url "/sample37"
|
2
|
-
get '/
|
2
|
+
get '/sample-37-how-to-create-envelop-and-download-signed-document-when-envelop-was-signed-using-callback' do
|
3
3
|
haml :sample37
|
4
4
|
end
|
5
5
|
|
@@ -36,7 +36,7 @@ get '/sample37/downloads/:filename' do |filename|
|
|
36
36
|
end
|
37
37
|
|
38
38
|
#Route the handler url "/sample37". The function block creates new envelope
|
39
|
-
post '/
|
39
|
+
post '/sample-37-how-to-create-envelop-and-download-signed-document-when-envelop-was-signed-using-callback' do
|
40
40
|
#Set variables from form
|
41
41
|
set :client_id, params[:clientId]
|
42
42
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-38-how-to-create-new-user-and-add-him-as-collaborator-to-doc-with-annotations' do
|
3
3
|
haml :sample38
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-38-how-to-create-new-user-and-add-him-as-collaborator-to-doc-with-annotations' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-39-how-to-add-a-signature-to-a-document-and-re-direct-after-signing-with-groupdocs-widget' do
|
3
3
|
haml :sample39
|
4
4
|
end
|
5
5
|
|
@@ -136,7 +136,7 @@ end
|
|
136
136
|
|
137
137
|
|
138
138
|
#POST request
|
139
|
-
post '/
|
139
|
+
post '/sample-39-how-to-add-a-signature-to-a-document-and-re-direct-after-signing-with-groupdocs-widget' do
|
140
140
|
#Set variables
|
141
141
|
set :client_id, params[:clientId]
|
142
142
|
set :private_key, params[:privateKey]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-40-how-to-set-callback-for-signature-form-and-re-direct-when-it-was-signed' do
|
3
3
|
haml :sample40
|
4
4
|
end
|
5
5
|
|
@@ -88,7 +88,7 @@ end
|
|
88
88
|
|
89
89
|
|
90
90
|
#POST request
|
91
|
-
post '/
|
91
|
+
post '/sample-40-how-to-set-callback-for-signature-form-and-re-direct-when-it-was-signed' do
|
92
92
|
#Set variables
|
93
93
|
set :client_id, params[:clientId]
|
94
94
|
set :private_key, params[:privateKey]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-41-how-to-set-callback-for-annotation-and-manage-user-rights' do
|
3
3
|
haml :sample41
|
4
4
|
end
|
5
5
|
|
@@ -80,7 +80,7 @@ end
|
|
80
80
|
|
81
81
|
|
82
82
|
#POST request
|
83
|
-
post '/
|
83
|
+
post '/sample-41-how-to-set-callback-for-annotation-and-manage-user-rights' do
|
84
84
|
#Set variables
|
85
85
|
set :client_id, params[:clientId]
|
86
86
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-42-how-to-download-document-with-annotations-using-groupdocs' do
|
3
3
|
haml :sample42
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-42-how-to-download-document-with-annotations-using-groupdocs' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#GET request
|
2
|
-
get '/
|
2
|
+
get '/sample-43-how-to-add-numeration-in-the-doc-file' do
|
3
3
|
haml :sample43
|
4
4
|
end
|
5
5
|
|
6
6
|
#POST request
|
7
|
-
post '/
|
7
|
+
post '/sample-43-how-to-add-numeration-in-the-doc-file' do
|
8
8
|
#Set variables
|
9
9
|
set :client_id, params[:clientId]
|
10
10
|
set :private_key, params[:privateKey]
|
@@ -0,0 +1,188 @@
|
|
1
|
+
#GET request
|
2
|
+
get '/sample-44-how-to-assemble-document-and-add-multiple-signatures-and-signers-to-a-document' do
|
3
|
+
haml :sample44
|
4
|
+
end
|
5
|
+
|
6
|
+
#POST request
|
7
|
+
post '/sample-44-how-to-assemble-document-and-add-multiple-signatures-and-signers-to-a-document' do
|
8
|
+
#Set variables
|
9
|
+
set :client_id, params[:clientId]
|
10
|
+
set :private_key, params[:privateKey]
|
11
|
+
set :file_id, params[:fileId]
|
12
|
+
set :first_name, params[:firstName]
|
13
|
+
set :last_name, params[:lastName]
|
14
|
+
set :first_email, params[:firstEmail]
|
15
|
+
set :second_email, params[:secondEmail]
|
16
|
+
set :gender, params[:gender]
|
17
|
+
set :base_path, params[:basePath]
|
18
|
+
|
19
|
+
#Set download path
|
20
|
+
downloads_path = "#{File.dirname(__FILE__)}/../public/downloads"
|
21
|
+
|
22
|
+
#Remove all files from download directory or create folder if it not there
|
23
|
+
if File.directory?(downloads_path)
|
24
|
+
Dir.foreach(downloads_path) { |f| fn = File.join(downloads_path, f); File.delete(fn) if f != '.' && f != '..' }
|
25
|
+
else
|
26
|
+
Dir::mkdir(downloads_path)
|
27
|
+
end
|
28
|
+
|
29
|
+
begin
|
30
|
+
#Check required variables
|
31
|
+
raise 'Please enter all required parameters' if settings.client_id.empty? or settings.private_key.empty? or settings.first_email.empty? or settings.second_email.empty? or settings.first_name.empty?
|
32
|
+
|
33
|
+
#Prepare base path
|
34
|
+
if settings.base_path.empty?
|
35
|
+
base_path = 'https://api.groupdocs.com'
|
36
|
+
elsif settings.base_path.match('/v2.0')
|
37
|
+
base_path = settings.base_path.split('/v2.0')[0]
|
38
|
+
else
|
39
|
+
base_path = settings.base_path
|
40
|
+
end
|
41
|
+
|
42
|
+
#Configure your access to API server
|
43
|
+
GroupDocs.configure do |groupdocs|
|
44
|
+
groupdocs.client_id = settings.client_id
|
45
|
+
groupdocs.private_key = settings.private_key
|
46
|
+
#Optionally specify API server and version
|
47
|
+
groupdocs.api_server = base_path # default is 'https://api.groupdocs.com'
|
48
|
+
end
|
49
|
+
|
50
|
+
(settings.last_name.nil? or settings.last_name.empty?) ? settings.last_name = settings.first_name : settings.last_name
|
51
|
+
|
52
|
+
second_signer_name = settings.first_name + "2"
|
53
|
+
second_signer_last_name = settings.last_name + "2"
|
54
|
+
#Construct path
|
55
|
+
|
56
|
+
file_path = "#{Dir.tmpdir}/#{params[:file][:filename]}"
|
57
|
+
#Open file
|
58
|
+
File.open(file_path, 'wb') { |f| f.write(params[:file][:tempfile].read) }
|
59
|
+
# Make a request to API using client_id and private_key
|
60
|
+
file = GroupDocs::Storage::File.upload!(file_path, {})
|
61
|
+
|
62
|
+
#Raise exception if something went wrong
|
63
|
+
raise 'No such file' unless file.is_a?(GroupDocs::Storage::File)
|
64
|
+
|
65
|
+
#Make GroupDocs::Storage::Document instance
|
66
|
+
document = file.to_document
|
67
|
+
|
68
|
+
#Create datasource with fields
|
69
|
+
datasource = GroupDocs::DataSource.new
|
70
|
+
|
71
|
+
#Get arry of document's fields
|
72
|
+
enteredData = {"name" => settings.first_name, "gender" => settings.gender}
|
73
|
+
|
74
|
+
#Create Field instance and fill the fields
|
75
|
+
datasource.fields = enteredData.map { |key, value| GroupDocs::DataSource::Field.new(name: key, type: :text, values: Array.new() << value) }
|
76
|
+
|
77
|
+
|
78
|
+
#Adds datasource.
|
79
|
+
datasource.add!()
|
80
|
+
|
81
|
+
#Creates new job to merge datasource into document.
|
82
|
+
job = document.datasource!(datasource)
|
83
|
+
sleep 10 #Wait for merge and convert
|
84
|
+
|
85
|
+
#Returns an hash of input and output documents associated to job.
|
86
|
+
document = job.documents!()
|
87
|
+
|
88
|
+
#Set converted document GUID
|
89
|
+
guid = document[:inputs][0].outputs[0].guid
|
90
|
+
file = GroupDocs::Storage::File.new({:guid => guid})
|
91
|
+
|
92
|
+
#Set converted document Name
|
93
|
+
file_name = document[:inputs][0].outputs[0].name
|
94
|
+
|
95
|
+
#Create envelope using user id and entered by user name
|
96
|
+
envelope = GroupDocs::Signature::Envelope.new
|
97
|
+
envelope.name = file_name
|
98
|
+
envelope.create!({})
|
99
|
+
|
100
|
+
#Add uploaded document to envelope
|
101
|
+
envelope.add_document!(file.to_document, {})
|
102
|
+
|
103
|
+
#Get role list for current user
|
104
|
+
roles = GroupDocs::Signature::Role.get!({})
|
105
|
+
|
106
|
+
#Create new first recipient
|
107
|
+
first_recipient = GroupDocs::Signature::Recipient.new
|
108
|
+
first_recipient.email = settings.first_email
|
109
|
+
first_recipient.first_name = settings.first_name
|
110
|
+
first_recipient.last_name = settings.last_name
|
111
|
+
first_recipient.role_id = roles.detect { |role| role.name == 'Signer' }.id
|
112
|
+
|
113
|
+
#Create new second recipient
|
114
|
+
second_recipient = GroupDocs::Signature::Recipient.new
|
115
|
+
second_recipient.email = settings.second_email
|
116
|
+
second_recipient.first_name = second_signer_name
|
117
|
+
second_recipient.last_name = second_signer_last_name
|
118
|
+
second_recipient.role_id = roles.detect { |role| role.name == 'Signer' }.id
|
119
|
+
|
120
|
+
#Add first recipient to envelope
|
121
|
+
first_recipient = envelope.add_recipient!(first_recipient)
|
122
|
+
|
123
|
+
#Add second recipient to envelope
|
124
|
+
second_recipient = envelope.add_recipient!(second_recipient)
|
125
|
+
|
126
|
+
#Get document id
|
127
|
+
document = envelope.documents!({})
|
128
|
+
|
129
|
+
|
130
|
+
#Get field and add the location to field
|
131
|
+
field1 = GroupDocs::Signature::Field.get!({}).detect { |f| f.type == :signature }
|
132
|
+
field1.location = {:location_x => 0.15, :location_y => 0.23, :location_w => 150, :location_h => 50, :page => 1}
|
133
|
+
field1.name = 'singlIndex1'
|
134
|
+
|
135
|
+
#Add field to envelope
|
136
|
+
envelope.add_field!(field1, document[0], first_recipient, {})
|
137
|
+
|
138
|
+
#Get field and add the location to field
|
139
|
+
field2 = GroupDocs::Signature::Field.get!({}).detect { |f| f.type == :signature }
|
140
|
+
field2.location = {:location_x => 0.35, :location_y => 0.23, :location_w => 150, :location_h => 50, :page => 1}
|
141
|
+
field2.name = 'singlIndex2'
|
142
|
+
|
143
|
+
#Add field to envelope
|
144
|
+
envelope.add_field!(field2, document[0], second_recipient, {})
|
145
|
+
|
146
|
+
#Send envelop
|
147
|
+
envelope.send!()
|
148
|
+
|
149
|
+
#Prepare to sign first url
|
150
|
+
first_iframe = "/signature2/signembed/#{envelope.id}/#{first_recipient.id}"
|
151
|
+
#Construct result string
|
152
|
+
first_url = GroupDocs::Api::Request.new(:path => first_iframe).prepare_and_sign_url
|
153
|
+
|
154
|
+
#Prepare to sign second url
|
155
|
+
second_iframe = "/signature2/signembed/#{envelope.id}/#{second_recipient.id}"
|
156
|
+
#Construct result string
|
157
|
+
second_url = GroupDocs::Api::Request.new(:path => second_iframe).prepare_and_sign_url
|
158
|
+
|
159
|
+
#Generate iframes URL
|
160
|
+
case base_path
|
161
|
+
when 'https://stage-api-groupdocs.dynabic.com'
|
162
|
+
first_iframe = "https://stage-api-groupdocs.dynabic.com#{first_url}"
|
163
|
+
second_iframe = "https://stage-api-groupdocs.dynabic.com#{second_url}"
|
164
|
+
when 'https://dev-api-groupdocs.dynabic.com'
|
165
|
+
first_iframe = "https://dev-apps.groupdocs.com#{first_url}"
|
166
|
+
second_iframe = "https://dev-apps.groupdocs.com#{second_url}"
|
167
|
+
else
|
168
|
+
first_iframe = "https://apps.groupdocs.com#{first_url}"
|
169
|
+
second_iframe = "https://apps.groupdocs.com#{second_url}"
|
170
|
+
end
|
171
|
+
|
172
|
+
#Set iframe with document GUID or raise an error
|
173
|
+
if guid
|
174
|
+
#Make first iframe
|
175
|
+
first_iframe = "<p><span style=\"color: green\">Document for first signer</span></p><iframe id='downloadframe' src='#{first_iframe}' width='800' height='1000'></iframe><br>"
|
176
|
+
#Make second iframe
|
177
|
+
second_iframe = "<p><span style=\"color: green\">Document for second signer</span></p><iframe id='downloadframe' src='#{second_iframe}' width='800' height='1000'></iframe>"
|
178
|
+
else
|
179
|
+
raise 'File was not converted'
|
180
|
+
end
|
181
|
+
|
182
|
+
rescue Exception => e
|
183
|
+
err = e.message
|
184
|
+
end
|
185
|
+
|
186
|
+
#Set variables for template
|
187
|
+
haml :sample44, :locals => {:userId => settings.client_id, :privateKey => settings.private_key, :first_iframe => first_iframe, :second_iframe => second_iframe, :err => err}
|
188
|
+
end
|