groupdocs 1.5.7 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/CHANGELOG.md +51 -0
  2. data/examples/api-samples/Gemfile +1 -1
  3. data/examples/api-samples/Gemfile.lock +43 -0
  4. data/examples/api-samples/public/docs/{sample2.html → sample01.html} +39 -19
  5. data/examples/api-samples/public/docs/{sample3.html → sample02.html} +28 -22
  6. data/examples/api-samples/public/docs/sample03.html +285 -0
  7. data/examples/api-samples/public/docs/{sample4.html → sample04.html} +30 -36
  8. data/examples/api-samples/public/docs/{sample5.html → sample05.html} +68 -31
  9. data/examples/api-samples/public/docs/sample06.html +299 -0
  10. data/examples/api-samples/public/docs/{sample7.html → sample07.html} +53 -18
  11. data/examples/api-samples/public/docs/{sample8.html → sample08.html} +64 -41
  12. data/examples/api-samples/public/docs/sample09.html +260 -0
  13. data/examples/api-samples/public/docs/sample10.html +67 -28
  14. data/examples/api-samples/public/docs/sample11.html +171 -55
  15. data/examples/api-samples/public/docs/sample12.html +53 -17
  16. data/examples/api-samples/public/docs/sample13.html +52 -16
  17. data/examples/api-samples/public/docs/sample14.html +51 -8
  18. data/examples/api-samples/public/docs/sample15.html +46 -10
  19. data/examples/api-samples/public/docs/sample16.html +81 -7
  20. data/examples/api-samples/public/docs/sample17.html +103 -15
  21. data/examples/api-samples/public/docs/sample18.html +117 -41
  22. data/examples/api-samples/public/docs/sample19.html +410 -36
  23. data/examples/api-samples/public/docs/sample20.html +46 -10
  24. data/examples/api-samples/public/docs/sample21.html +504 -45
  25. data/examples/api-samples/public/docs/sample22.html +166 -28
  26. data/examples/api-samples/public/docs/sample23.html +61 -25
  27. data/examples/api-samples/public/docs/sample24.html +100 -12
  28. data/examples/api-samples/public/docs/sample25.html +123 -49
  29. data/examples/api-samples/public/docs/sample26.html +41 -8
  30. data/examples/api-samples/public/docs/sample27.html +125 -50
  31. data/examples/api-samples/public/docs/sample28.html +27 -9
  32. data/examples/api-samples/public/docs/sample29.html +10 -10
  33. data/examples/api-samples/public/docs/sample30.html +70 -14
  34. data/examples/api-samples/public/docs/sample31.html +108 -67
  35. data/examples/api-samples/public/docs/sample32.html +71 -99
  36. data/examples/api-samples/public/docs/sample33.html +107 -32
  37. data/examples/api-samples/public/docs/{sample1.html → sample34.html} +58 -18
  38. data/examples/api-samples/public/docs/sample35.html +666 -0
  39. data/examples/api-samples/public/docs/{sample6.html → sample36.html} +56 -37
  40. data/examples/api-samples/public/docs/sample37.html +815 -0
  41. data/examples/api-samples/public/docs/sample38.html +508 -0
  42. data/examples/api-samples/public/docs/sample39.html +921 -0
  43. data/examples/api-samples/public/docs/sample40.html +510 -0
  44. data/examples/api-samples/public/docs/sample41.html +452 -0
  45. data/examples/api-samples/public/docs/sample42.html +311 -0
  46. data/examples/api-samples/public/templates/test_all_fields2.pdf +0 -0
  47. data/examples/api-samples/samples/sample01.rb +37 -0
  48. data/examples/api-samples/samples/sample02.rb +41 -0
  49. data/examples/api-samples/samples/sample03.rb +73 -0
  50. data/examples/api-samples/samples/sample04.rb +47 -0
  51. data/examples/api-samples/samples/{sample5.rb → sample05.rb} +26 -14
  52. data/examples/api-samples/samples/sample06.rb +80 -0
  53. data/examples/api-samples/samples/sample07.rb +52 -0
  54. data/examples/api-samples/samples/sample08.rb +69 -0
  55. data/examples/api-samples/samples/sample09.rb +83 -0
  56. data/examples/api-samples/samples/sample10.rb +29 -15
  57. data/examples/api-samples/samples/sample11.rb +89 -37
  58. data/examples/api-samples/samples/sample12.rb +22 -11
  59. data/examples/api-samples/samples/sample13.rb +22 -10
  60. data/examples/api-samples/samples/sample14.rb +23 -5
  61. data/examples/api-samples/samples/sample15.rb +18 -7
  62. data/examples/api-samples/samples/sample16.rb +28 -4
  63. data/examples/api-samples/samples/sample17.rb +31 -5
  64. data/examples/api-samples/samples/sample18.rb +36 -8
  65. data/examples/api-samples/samples/sample19.rb +138 -18
  66. data/examples/api-samples/samples/sample20.rb +14 -3
  67. data/examples/api-samples/samples/sample21.rb +162 -23
  68. data/examples/api-samples/samples/sample22.rb +73 -22
  69. data/examples/api-samples/samples/sample23.rb +17 -6
  70. data/examples/api-samples/samples/sample24.rb +34 -7
  71. data/examples/api-samples/samples/sample25.rb +37 -12
  72. data/examples/api-samples/samples/sample26.rb +12 -5
  73. data/examples/api-samples/samples/sample27.rb +38 -12
  74. data/examples/api-samples/samples/sample28.rb +25 -6
  75. data/examples/api-samples/samples/sample29.rb +12 -12
  76. data/examples/api-samples/samples/sample30.rb +27 -15
  77. data/examples/api-samples/samples/sample31.rb +44 -33
  78. data/examples/api-samples/samples/sample32.rb +43 -41
  79. data/examples/api-samples/samples/sample33.rb +42 -14
  80. data/examples/api-samples/samples/sample34.rb +40 -0
  81. data/examples/api-samples/samples/sample35.rb +224 -0
  82. data/examples/api-samples/samples/sample36.rb +58 -0
  83. data/examples/api-samples/samples/sample37.rb +229 -0
  84. data/examples/api-samples/samples/sample38.rb +128 -0
  85. data/examples/api-samples/samples/sample39.rb +252 -0
  86. data/examples/api-samples/samples/sample40.rb +164 -0
  87. data/examples/api-samples/samples/sample41.rb +118 -0
  88. data/examples/api-samples/samples/sample42.rb +97 -0
  89. data/examples/api-samples/views/_others_samples.haml +25 -11
  90. data/examples/api-samples/views/index.haml +23 -11
  91. data/examples/api-samples/views/popup.haml +32 -0
  92. data/examples/api-samples/views/{sample1.haml → sample01.haml} +12 -7
  93. data/examples/api-samples/views/{sample2.haml → sample02.haml} +20 -15
  94. data/examples/api-samples/views/sample03.haml +83 -0
  95. data/examples/api-samples/views/sample04.haml +49 -0
  96. data/examples/api-samples/views/{sample5.haml → sample05.haml} +19 -14
  97. data/examples/api-samples/views/sample06.haml +53 -0
  98. data/examples/api-samples/views/sample07.haml +47 -0
  99. data/examples/api-samples/views/{sample8.haml → sample08.haml} +17 -12
  100. data/examples/api-samples/views/{sample9.haml → sample09.haml} +19 -4
  101. data/examples/api-samples/views/sample10.haml +18 -13
  102. data/examples/api-samples/views/sample11.haml +48 -19
  103. data/examples/api-samples/views/sample12.haml +26 -21
  104. data/examples/api-samples/views/sample13.haml +18 -12
  105. data/examples/api-samples/views/sample14.haml +21 -15
  106. data/examples/api-samples/views/sample15.haml +16 -9
  107. data/examples/api-samples/views/sample16.haml +18 -5
  108. data/examples/api-samples/views/sample17.haml +14 -9
  109. data/examples/api-samples/views/sample18.haml +13 -7
  110. data/examples/api-samples/views/sample19.haml +37 -8
  111. data/examples/api-samples/views/sample20.haml +13 -8
  112. data/examples/api-samples/views/sample21.haml +71 -13
  113. data/examples/api-samples/views/sample22.haml +53 -16
  114. data/examples/api-samples/views/sample23.haml +9 -4
  115. data/examples/api-samples/views/sample24.haml +9 -4
  116. data/examples/api-samples/views/sample25.haml +18 -13
  117. data/examples/api-samples/views/sample26.haml +8 -3
  118. data/examples/api-samples/views/sample27.haml +20 -14
  119. data/examples/api-samples/views/sample28.haml +16 -10
  120. data/examples/api-samples/views/sample29.haml +4 -4
  121. data/examples/api-samples/views/sample30.haml +16 -10
  122. data/examples/api-samples/views/sample31.haml +39 -32
  123. data/examples/api-samples/views/sample32.haml +25 -36
  124. data/examples/api-samples/views/sample33.haml +14 -17
  125. data/examples/api-samples/views/sample34.haml +48 -0
  126. data/examples/api-samples/views/sample35.haml +95 -0
  127. data/examples/api-samples/views/sample36.haml +64 -0
  128. data/examples/api-samples/views/sample37.haml +124 -0
  129. data/examples/api-samples/views/sample38.haml +115 -0
  130. data/examples/api-samples/views/sample39.haml +236 -0
  131. data/examples/api-samples/views/sample40.haml +95 -0
  132. data/examples/api-samples/views/{sample4.haml → sample41.haml} +90 -72
  133. data/examples/api-samples/views/sample42.haml +59 -0
  134. data/lib/groupdocs/api/helpers/rest_helper.rb +13 -1
  135. data/lib/groupdocs/datasource.rb +2 -1
  136. data/lib/groupdocs/document.rb +101 -13
  137. data/lib/groupdocs/document/annotation.rb +28 -13
  138. data/lib/groupdocs/document/annotation/marker.rb +18 -0
  139. data/lib/groupdocs/document/annotation/reply.rb +9 -2
  140. data/lib/groupdocs/document/field.rb +5 -1
  141. data/lib/groupdocs/job.rb +12 -2
  142. data/lib/groupdocs/questionnaire.rb +174 -4
  143. data/lib/groupdocs/questionnaire/collector.rb +21 -0
  144. data/lib/groupdocs/questionnaire/question.rb +19 -0
  145. data/lib/groupdocs/questionnaire/question/answer.rb +5 -0
  146. data/lib/groupdocs/questionnaire/question/conditions.rb +20 -0
  147. data/lib/groupdocs/signature.rb +36 -308
  148. data/lib/groupdocs/signature/envelope.rb +146 -4
  149. data/lib/groupdocs/signature/field.rb +20 -1
  150. data/lib/groupdocs/signature/field/location.rb +18 -7
  151. data/lib/groupdocs/signature/form.rb +199 -10
  152. data/lib/groupdocs/signature/shared/document_methods.rb +38 -0
  153. data/lib/groupdocs/signature/shared/entity_methods.rb +0 -1
  154. data/lib/groupdocs/signature/shared/field_methods.rb +13 -38
  155. data/lib/groupdocs/signature/shared/recipient_methods.rb +8 -0
  156. data/lib/groupdocs/signature/template.rb +3 -1
  157. data/lib/groupdocs/storage.rb +4 -1
  158. data/lib/groupdocs/storage/file.rb +18 -1
  159. data/lib/groupdocs/subscription.rb +8 -3
  160. data/lib/groupdocs/user.rb +8 -0
  161. data/lib/groupdocs/version.rb +1 -1
  162. data/spec/groupdocs/document/annotation_spec.rb +1 -14
  163. data/spec/groupdocs/subscription_spec.rb +2 -2
  164. metadata +86 -32
  165. checksums.yaml +0 -15
  166. data/examples/api-samples/public/docs/sample9.html +0 -200
  167. data/examples/api-samples/samples/sample1.rb +0 -25
  168. data/examples/api-samples/samples/sample2.rb +0 -29
  169. data/examples/api-samples/samples/sample3.rb +0 -33
  170. data/examples/api-samples/samples/sample4.rb +0 -51
  171. data/examples/api-samples/samples/sample6.rb +0 -49
  172. data/examples/api-samples/samples/sample7.rb +0 -42
  173. data/examples/api-samples/samples/sample8.rb +0 -61
  174. data/examples/api-samples/samples/sample9.rb +0 -48
  175. data/examples/api-samples/views/sample3.haml +0 -44
  176. data/examples/api-samples/views/sample6.haml +0 -49
  177. data/examples/api-samples/views/sample7.haml +0 -42
@@ -0,0 +1,164 @@
1
+ # GET request
2
+ get '/sample40' do
3
+ haml :sample40
4
+ end
5
+
6
+ # POST request
7
+ post '/sample40/check_guid' do
8
+ begin
9
+ result = nil
10
+ i = 0
11
+ for i in 1..10
12
+ i +=1
13
+ # Check is downloads folder exist
14
+ if File.exist?("#{File.dirname(__FILE__)}/../public/callback_info.txt")
15
+ result = File.read("#{File.dirname(__FILE__)}/../public/callback_info.txt")
16
+ if result != '' then break end
17
+ end
18
+ sleep(5)
19
+ end
20
+
21
+ # Check result
22
+ if result == 'Error'
23
+ result = "File was not found. Looks like something went wrong."
24
+ else
25
+ result
26
+ end
27
+
28
+ rescue Exception => e
29
+ err = e.message
30
+ end
31
+ end
32
+
33
+
34
+ # POST request
35
+ post '/sample40/callback' do
36
+
37
+ source_id = ''
38
+ client_id = ''
39
+ private_key = ''
40
+
41
+ # Get callback request
42
+ data = JSON.parse(request.body.read)
43
+ begin
44
+ participant = nil
45
+ raise 'Empty params!' if data.empty?
46
+
47
+ # Get value of SourceId
48
+ data.each do |key, value|
49
+ if key == 'SourceId'
50
+ source_id = value
51
+ end
52
+ if key == 'SerializedData'
53
+ data = JSON.parse(value)
54
+ data.each do |key, value|
55
+ if key == 'ParticipantGuid'
56
+ participant = value
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ # Get private key and client_id from file user_info.txt
63
+ if File.exist?("#{File.dirname(__FILE__)}/../public/user_info.txt")
64
+ contents = File.read("#{File.dirname(__FILE__)}/../public/user_info.txt")
65
+ contents = contents.split(' ')
66
+ client_id = contents[0]
67
+ private_key = contents[1]
68
+ end
69
+
70
+ # Create new Form
71
+ form = GroupDocs::Signature::Form.new({:id => source_id})
72
+ # Create new Signature
73
+ signature = GroupDocs::Signature.new()
74
+ doc_info = signature.get_sign_form_participant!(form.id , participant, {:client_id => client_id, :private_key => private_key} )
75
+
76
+ guid = doc_info[:documentGuid]
77
+
78
+ out_file = File.new("#{File.dirname(__FILE__)}/../public/callback_info.txt", 'w')
79
+ # white space is required
80
+ out_file.write(guid)
81
+ out_file.close
82
+
83
+ rescue Exception => e
84
+ err = e.message
85
+ end
86
+ end
87
+
88
+
89
+
90
+ # POST request
91
+ post '/sample40' do
92
+ # set variables
93
+ set :client_id, params[:clientId]
94
+ set :private_key, params[:privateKey]
95
+ set :form_guid, params[:formGuid]
96
+ set :callback, params[:callbackUrl]
97
+ set :base_path, params[:basePath]
98
+
99
+ begin
100
+
101
+ # Check required variables
102
+ raise 'Please enter all required parameters' if settings.client_id.empty? or settings.private_key.empty? or settings.form_guid.empty?
103
+
104
+ if settings.base_path.empty? then settings.base_path = 'https://api.groupdocs.com' end
105
+
106
+ # Configure your access to API server
107
+ GroupDocs.configure do |groupdocs|
108
+ groupdocs.client_id = settings.client_id
109
+ groupdocs.private_key = settings.private_key
110
+ # Optionally specify API server and version
111
+ groupdocs.api_server = settings.base_path # default is 'https://api.groupdocs.com'
112
+ end
113
+
114
+ # Write client and private key to the file for callback job
115
+ if settings.callback
116
+ out_file = File.new("#{File.dirname(__FILE__)}/../public/user_info.txt", 'w')
117
+ # white space is required
118
+ out_file.write("#{settings.client_id} ")
119
+ out_file.write("#{settings.private_key} ")
120
+ out_file.close
121
+ end
122
+
123
+ guid = settings.form_guid
124
+
125
+ # Create new Form with guid
126
+ form = GroupDocs::Signature::Form.new()
127
+ form.name = "Test Form"
128
+ # Get id with new Form
129
+ id = form.create!({:formId => guid})
130
+ # Get Form
131
+ form = GroupDocs::Signature::Form.get!(id)
132
+ # Publish the Form
133
+ form.publish!({:callbackUrl => settings.callback})
134
+
135
+ # Get url from request
136
+ case settings.base_path
137
+
138
+ when 'https://stage-api-groupdocs.dynabic.com'
139
+ url = "http://stage-apps-groupdocs.dynabic.com/signature2/forms/signembed/ #{guid}"
140
+ when 'https://dev-api-groupdocs.dynabic.com'
141
+ url = "http://dev-apps-groupdocs.dynabic.com/signature2/forms/signembed/ #{guid}"
142
+ else
143
+ url = "https://apps.groupdocs.com/signature2/forms/signembed/ #{guid}"
144
+ end
145
+ # Delete file callback_info.txt
146
+ if File.exist?("#{File.dirname(__FILE__)}/../public/callback_info.txt")
147
+ File.delete("#{File.dirname(__FILE__)}/../public/callback_info.txt")
148
+ end
149
+
150
+ # Add the signature to url the request
151
+ iframe = GroupDocs::Api::Request.new(:path => url).prepare_and_sign_url
152
+ iframe = "<iframe width='100%' id='downloadframe' height='600' src='#{iframe}'></iframe>"
153
+
154
+ rescue Exception => e
155
+ err = e.message
156
+ end
157
+
158
+ # Set variables for template
159
+ haml :sample40, :locals => {:userId => settings.client_id,
160
+ :privateKey => settings.private_key,
161
+ :callback => settings.callback,
162
+ :iframe => iframe,
163
+ :err => err}
164
+ end
@@ -0,0 +1,118 @@
1
+ # GET request
2
+ get '/sample41' do
3
+ haml :sample41
4
+ end
5
+
6
+ # POST request
7
+ post '/sample41' do
8
+ # set variables
9
+ set :client_id, params[:clientId]
10
+ set :private_key, params[:privateKey]
11
+ set :source, params[:source]
12
+ set :file_id, params[:fileId]
13
+ set :url, params[:url]
14
+ set :base_path, params[:basePath]
15
+
16
+ # Set download path
17
+ downloads_path = "#{File.dirname(__FILE__)}/../public/downloads"
18
+
19
+ # Remove all files from download directory or create folder if it not there
20
+ if File.directory?(downloads_path)
21
+ Dir.foreach(downloads_path) { |f| fn = File.join(downloads_path, f); File.delete(fn) if f != '.' && f != '..' }
22
+ else
23
+ Dir::mkdir(downloads_path)
24
+ end
25
+
26
+ begin
27
+ # Check required variables
28
+ raise 'Please enter all required parameters' if settings.client_id.empty? or settings.private_key.empty?
29
+
30
+ if settings.base_path.empty? then settings.base_path = 'https://api.groupdocs.com' end
31
+
32
+ # Configure your access to API server
33
+ GroupDocs.configure do |groupdocs|
34
+ groupdocs.client_id = settings.client_id
35
+ groupdocs.private_key = settings.private_key
36
+ # Optionally specify API server and version
37
+ groupdocs.api_server = settings.base_path # default is 'https://api.groupdocs.com'
38
+ end
39
+
40
+ # Get document by file GUID
41
+ case settings.source
42
+ when 'guid'
43
+ # Create instance of File
44
+ file = GroupDocs::Storage::File.new({:guid => settings.file_id})
45
+ when 'local'
46
+ # Construct path
47
+ file_path = "#{Dir.tmpdir}/#{params[:file][:filename]}"
48
+ # Open file
49
+ File.open(file_path, 'wb') { |f| f.write(params[:file][:tempfile].read) }
50
+ # Make a request to API using client_id and private_key
51
+ file = GroupDocs::Storage::File.upload!(file_path, {})
52
+ when 'url'
53
+ # Upload file from defined url
54
+ file = GroupDocs::Storage::File.upload_web!(settings.url)
55
+ else
56
+ raise 'Wrong GUID source.'
57
+ end
58
+
59
+ # Raise exception if something went wrong
60
+ raise 'No such file' unless file.is_a?(GroupDocs::Storage::File)
61
+
62
+ # Make GroupDocs::Storage::Document instance
63
+ document = file.to_document
64
+
65
+ # Create Hash with the options for job. :status=> -1 means the Draft status of the job
66
+ options = {:actions => [:convert, :number_lines], :out_formats => ['doc'], :name => 'sample'}
67
+
68
+ # Create Job with provided options with Draft status (Sheduled job)
69
+ job = GroupDocs::Job.create!(options)
70
+
71
+ # Add the documents to previously created Job
72
+ job.add_document!(document, {:check_ownership => false})
73
+
74
+
75
+ # Update the Job with new status. :status => '0' mean Active status of the job (Start the job)
76
+ id = job.update!({:status => 'pending'})
77
+
78
+ i = 1
79
+
80
+ while i<5 do
81
+ sleep(5)
82
+ job = GroupDocs::Job.get!(id[:job_id])
83
+ break if job.status == :archived
84
+ i = i + 1
85
+ end
86
+
87
+ # Get the document into Pdf format
88
+ file = job.documents!()
89
+
90
+ document = file[:inputs][0].outputs[0]
91
+
92
+ # Set iframe with document GUID or raise an error
93
+ if document
94
+
95
+ #Get url from request
96
+ case settings.base_path
97
+
98
+ when 'https://stage-api-groupdocs.dynabic.com'
99
+ url = "http://stage-apps-groupdocs.dynabic.com/document-viewer/embed/#{document.guid}"
100
+ when 'https://dev-api-groupdocs.dynabic.com'
101
+ url = "http://dev-apps-groupdocs.dynabic.com/document-viewer/embed/#{document.guid}"
102
+ else
103
+ url = "https://apps.groupdocs.com/document-viewer/embed/#{document.guid}"
104
+ end
105
+
106
+ # Add the signature in url
107
+ iframe = GroupDocs::Api::Request.new(:path => url).prepare_and_sign_url
108
+ iframe = "<iframe width='100%' height='600' frameborder='0' src='#{iframe}'></iframe>"
109
+ else
110
+ raise 'File was not converted'
111
+ end
112
+ rescue Exception => e
113
+ err = e.message
114
+ end
115
+
116
+ # Set variables for template
117
+ haml :sample41, :locals => {:userId => settings.client_id, :privateKey => settings.private_key, :err => err, :iframe => iframe}
118
+ end
@@ -0,0 +1,97 @@
1
+ # GET request
2
+ get '/sample42' do
3
+ haml :sample42
4
+ end
5
+
6
+ # POST request
7
+ post '/sample42' do
8
+ # set variables
9
+ set :client_id, params[:clientId]
10
+ set :private_key, params[:privateKey]
11
+ set :file_id, params[:fileId]
12
+ set :base_path, params[:basePath]
13
+
14
+ begin
15
+ # Check required variables
16
+ raise 'Please enter all required parameters' if settings.client_id.empty? or settings.private_key.empty?
17
+
18
+ if settings.base_path.empty? then settings.base_path = 'https://api.groupdocs.com' end
19
+
20
+ # Configure your access to API server
21
+ GroupDocs.configure do |groupdocs|
22
+ groupdocs.client_id = settings.client_id
23
+ groupdocs.private_key = settings.private_key
24
+ # Optionally specify API server and version
25
+ groupdocs.api_server = settings.base_path # default is 'https://api.groupdocs.com'
26
+ end
27
+
28
+ document = GroupDocs::Storage::File.new(:guid => settings.file_id).to_document
29
+
30
+ # Check, has document the annotations?
31
+ raise 'Your document has no annotations' if document.annotations!.empty?
32
+
33
+ # Create Hash with the options for job. :status=> -1 means the Draft status of the job
34
+ options = {:actions => [:import_annotations], :name => 'sample'}
35
+
36
+ # Create Job with provided options with Draft status (Sheduled job)
37
+ job = GroupDocs::Job.create!(options)
38
+
39
+ # Add the documents to previously created Job
40
+ job.add_document!(document, {:check_ownership => false})
41
+
42
+
43
+ # Update the Job with new status. :status => '0' mean Active status of the job (Start the job)
44
+ id = job.update!({:status => '0'})
45
+
46
+ i = 1
47
+
48
+ while i<5 do
49
+ sleep(5)
50
+ job = GroupDocs::Job.get!(id[:job_id])
51
+ break if job.status == :archived
52
+ i = i + 1
53
+ end
54
+
55
+ # Get the document into Pdf format
56
+ file = job.documents!()
57
+
58
+ document = file[:inputs]
59
+
60
+ # Set iframe with document GUID or raise an error
61
+ if document
62
+
63
+ #Get url from request
64
+ case settings.base_path
65
+
66
+ when 'https://stage-api-groupdocs.dynabic.com'
67
+ url = "http://stage-apps-groupdocs.dynabic.com/document-annotation/embed/#{document[0].guid}"
68
+ when 'https://dev-api-groupdocs.dynabic.com'
69
+ url = "http://dev-apps-groupdocs.dynabic.com/document-annotation/embed/#{document[0].guid}"
70
+ else
71
+ url = "https://apps.groupdocs.com/document-annotation/embed/#{document[0].guid}"
72
+ end
73
+
74
+ # Add the signature in url
75
+ iframe = GroupDocs::Api::Request.new(:path => url).prepare_and_sign_url
76
+ iframe = "<iframe width='100%' height='600' frameborder='0' src='#{iframe}'></iframe>"
77
+
78
+ path = "#{File.dirname(__FILE__)}/../public/downloads"
79
+ # Remove all files from download directory or create folder if it not there
80
+ if File.directory?(path)
81
+ Dir.foreach(path) { |f| fn = File.join(downloads_path, f); File.delete(fn) if f != '.' && f != '..' }
82
+ else
83
+ Dir::mkdir(path)
84
+ end
85
+
86
+ GroupDocs::User.download!(path, document[0].outputs[0].name, document[0].outputs[0].guid)
87
+ message = "<span style=\"color:green\">File with annotations was downloaded to server's local folder. You can check them <a href=\"/downloads/#{document[0].outputs[0].name}\">here</a></span>"
88
+ else
89
+ raise 'File was not converted'
90
+ end
91
+ rescue Exception => e
92
+ err = e.message
93
+ end
94
+
95
+ # Set variables for template
96
+ haml :sample42, :locals => {:userId => settings.client_id, :privateKey => settings.private_key, :err => err, :iframe => iframe, :message => message}
97
+ end
@@ -2,23 +2,23 @@
2
2
  Choose another one sample:
3
3
  %ul
4
4
  %li
5
- %a{:href => '/sample1'} Sample1 - How to login to GroupDocs using the API
5
+ %a{:href => '/sample01'} Sample01 - How to login to GroupDocs using the API
6
6
  %li
7
- %a{:href => '/sample2'} Sample2 - How to list files within GroupDocs Storage using the Storage API
7
+ %a{:href => '/sample02'} Sample02 - How to list files within GroupDocs Storage using the Storage API
8
8
  %li
9
- %a{:href => '/sample3'} Sample3 - How to upload a file to GroupDocs using the Storage API
9
+ %a{:href => '/sample03'} Sample03 - How to upload a file to GroupDocs using the Storage API
10
10
  %li
11
- %a{:href => '/sample4'} Sample4 - How to download a file from GroupDocs Storage using the Storage API
11
+ %a{:href => '/sample04'} Sample04 - How to download a file from GroupDocs Storage using the Storage API
12
12
  %li
13
- %a{:href => '/sample5'} Sample5 - How to copy / move a file using the GroupDocs Storage API
13
+ %a{:href => '/sample05'} Sample05 - How to copy / move a file using the GroupDocs Storage API
14
14
  %li
15
- %a{:href => '/sample6'} Sample6 - How to add a Signature to a document in GroupDocs Signature
15
+ %a{:href => '/sample06'} Sample06 - How to add a Signature to a document in GroupDocs Signature
16
16
  %li
17
- %a{:href => '/sample7'} Sample7 - How to create a list of thumbnails for a document
17
+ %a{:href => '/sample07'} Sample07 - How to create a list of thumbnails for a document
18
18
  %li
19
- %a{:href => '/sample8'} Sample8 - How to return a URL representing a single page of a Document
19
+ %a{:href => '/sample08'} Sample08 - How to return a URL representing a single page of a Document
20
20
  %li
21
- %a{:href => '/sample9'} Sample9 - How to generate an embedded Viewer URL for a Document
21
+ %a{:href => '/sample09'} Sample09 - How to generate an embedded Viewer URL for a Document
22
22
  %li
23
23
  %a{:href => '/sample10'} Sample10 - How to share a document to other users
24
24
  %li
@@ -68,6 +68,20 @@
68
68
  %li
69
69
  %a{:href => '/sample33'} Sample33 - How to convert and merge/combine several HTML documents into one PDF Document
70
70
  %li
71
- %a{:href => '/annotation-sample'} Annotation sample
71
+ %a{:href => '/sample34'} Sample34 - How to create folder in the GroupDocs account
72
72
  %li
73
- %a{:href => '/envelope-sample'} Envelop sample
73
+ %a{:href => '/sample35'} Sample35 - How to get fields and their data from PDF file
74
+ %li
75
+ %a{:href => '/sample36'} Sample36 - How to download signed documents when envelope was signed using Ruby SDK
76
+ %li
77
+ %a{:href => '/sample37'} Sample37 - How to create envelop and download signed document when envelop was signed using callback
78
+ %li
79
+ %a{:href => '/sample38'} Sample38 - How to create new user and add him as collaborator to doc with annotations
80
+ %li
81
+ %a{:href => '/sample39'} Sample39 - How to add a Signature to a document and redirect after signing with GroupDocs widget
82
+ %li
83
+ %a{:href => '/sample40'} Sample40 - How to set callback for signature form and re-direct when it was signed
84
+ %li
85
+ %a{:href => '/sample41'} Sample41 - How to add numeration in the doc file using GroupDocs Ruby SDK
86
+ %li
87
+ %a{:href => '/sample42'} Sample42 - How to download document with annotations using GroupDocs Ruby SDK
@@ -2,23 +2,23 @@
2
2
  %div{:style => 'padding:10px;'}
3
3
  %ul
4
4
  %li
5
- %a{:href => '/sample1'} Sample1 - How to login to GroupDocs using the API
5
+ %a{:href => '/sample01'} Sample01 - How to login to GroupDocs using the API
6
6
  %li
7
- %a{:href => '/sample2'} Sample2 - How to list files within GroupDocs Storage using the Storage API
7
+ %a{:href => '/sample02'} Sample02 - How to list files within GroupDocs Storage using the Storage API
8
8
  %li
9
- %a{:href => '/sample3'} Sample3 - How to upload a file to GroupDocs using the Storage API
9
+ %a{:href => '/sample03'} Sample03 - How to upload a file to GroupDocs using the Storage API
10
10
  %li
11
- %a{:href => '/sample4'} Sample4 - How to download a file from GroupDocs Storage using the Storage API
11
+ %a{:href => '/sample04'} Sample04 - How to download a file from GroupDocs Storage using the Storage API
12
12
  %li
13
- %a{:href => '/sample5'} Sample5 - How to copy / move a file using the GroupDocs Storage API
13
+ %a{:href => '/sample05'} Sample05 - How to copy / move a file using the GroupDocs Storage API
14
14
  %li
15
- %a{:href => '/sample6'} Sample6 - How to add a Signature to a document in GroupDocs Signature
15
+ %a{:href => '/sample06'} Sample06 - How to add a Signature to a document in GroupDocs Signature
16
16
  %li
17
- %a{:href => '/sample7'} Sample7 - How to create a list of thumbnails for a document
17
+ %a{:href => '/sample07'} Sample07 - How to create a list of thumbnails for a document
18
18
  %li
19
- %a{:href => '/sample8'} Sample8 - How to return a URL representing a single page of a Document
19
+ %a{:href => '/sample08'} Sample08 - How to return a URL representing a single page of a Document
20
20
  %li
21
- %a{:href => '/sample9'} Sample9 - How to generate an embedded Viewer URL for a Document
21
+ %a{:href => '/sample09'} Sample09 - How to generate an embedded Viewer URL for a Document
22
22
  %li
23
23
  %a{:href => '/sample10'} Sample10 - How to share a document to other users
24
24
  %li
@@ -68,6 +68,18 @@
68
68
  %li
69
69
  %a{:href => '/sample33'} Sample33 - How to convert and merge/combine several HTML documents into one PDF Document
70
70
  %li
71
- %a{:href => '/annotation-sample'} Annotation sample
71
+ %a{:href => '/sample34'} Sample34 - How to create folder in the GroupDocs account
72
72
  %li
73
- %a{:href => '/envelope-sample'} Envelop sample
73
+ %a{:href => '/sample35'} Sample35 - How to get fields and their data from PDF file
74
+ %li
75
+ %a{:href => '/sample36'} Sample36 - How to download signed documents when envelope was signed using Ruby SDK
76
+ %li
77
+ %a{:href => '/sample37'} Sample37 - How to create envelop and download signed document when envelop was signed using callback
78
+ %li
79
+ %a{:href => '/sample38'} Sample38 - How to create new user and add him as collaborator to doc with annotations
80
+ %li
81
+ %a{:href => '/sample39'} Sample39 - How to add a Signature to a document and re-direct after signing with GroupDocs widget
82
+ %li
83
+ %a{:href => '/sample41'} Sample41 - How to add numeration in the doc file using GroupDocs Ruby SDK
84
+ %li
85
+ %a{:href => '/sample42'} Sample42 - How to download document with annotations using GroupDocs Ruby SDK