groupdocs 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -31,9 +31,9 @@
|
|
31
31
|
|
32
32
|
</div>
|
33
33
|
|
34
|
-
<div class="content"><div class='highlight'><pre>get <span class="string">'/
|
35
|
-
haml <span class="symbol">:sample40</span>
|
36
|
-
<span class="keyword">end</span></pre></div></div>
|
34
|
+
<div class="content"><div class='highlight'><pre>get <span class="hljs-string">'/sample-40-how-to-set-callback-for-signature-form-and-re-direct-when-it-was-signed'</span> <span class="hljs-keyword">do</span>
|
35
|
+
haml <span class="hljs-symbol">:sample40</span>
|
36
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
37
37
|
|
38
38
|
</li>
|
39
39
|
|
@@ -48,12 +48,12 @@
|
|
48
48
|
|
49
49
|
</div>
|
50
50
|
|
51
|
-
<div class="content"><div class='highlight'><pre>post <span class="string">'/sample40/check_guid'</span> <span class="keyword">do</span>
|
52
|
-
<span class="keyword">begin</span>
|
53
|
-
result = <span class="keyword">nil</span>
|
54
|
-
i = <span class="number">0</span>
|
55
|
-
<span class="keyword">for</span> i <span class="keyword">in</span> <span class="number">1</span>..<span class="number">10</span>
|
56
|
-
i +=<span class="number">1</span></pre></div></div>
|
51
|
+
<div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample40/check_guid'</span> <span class="hljs-keyword">do</span>
|
52
|
+
<span class="hljs-keyword">begin</span>
|
53
|
+
result = <span class="hljs-keyword">nil</span>
|
54
|
+
i = <span class="hljs-number">0</span>
|
55
|
+
<span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-number">1</span>..<span class="hljs-number">10</span>
|
56
|
+
i +=<span class="hljs-number">1</span></pre></div></div>
|
57
57
|
|
58
58
|
</li>
|
59
59
|
|
@@ -68,12 +68,12 @@
|
|
68
68
|
|
69
69
|
</div>
|
70
70
|
|
71
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.exist?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
72
|
-
result = <span class="constant">File</span>.read(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
73
|
-
<span class="keyword">if</span> result != <span class="string">''</span> <span class="keyword">then</span> <span class="keyword">break</span> <span class="keyword">end</span>
|
74
|
-
<span class="keyword">end</span>
|
75
|
-
sleep(<span class="number">5</span>)
|
76
|
-
<span class="keyword">end</span></pre></div></div>
|
71
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-constant">File</span>.exist?(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
72
|
+
result = <span class="hljs-constant">File</span>.read(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
73
|
+
<span class="hljs-keyword">if</span> result != <span class="hljs-string">''</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">break</span> <span class="hljs-keyword">end</span>
|
74
|
+
<span class="hljs-keyword">end</span>
|
75
|
+
sleep(<span class="hljs-number">5</span>)
|
76
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
77
77
|
|
78
78
|
</li>
|
79
79
|
|
@@ -88,16 +88,16 @@
|
|
88
88
|
|
89
89
|
</div>
|
90
90
|
|
91
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> result == <span class="string">'Error'</span>
|
92
|
-
result = <span class="string">"File was not found. Looks like something went wrong."</span>
|
93
|
-
<span class="keyword">else</span>
|
91
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> result == <span class="hljs-string">'Error'</span>
|
92
|
+
result = <span class="hljs-string">"File was not found. Looks like something went wrong."</span>
|
93
|
+
<span class="hljs-keyword">else</span>
|
94
94
|
result
|
95
|
-
<span class="keyword">end</span>
|
95
|
+
<span class="hljs-keyword">end</span>
|
96
96
|
|
97
|
-
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
97
|
+
<span class="hljs-keyword">rescue</span> <span class="hljs-constant">Exception</span> => e
|
98
98
|
err = e.message
|
99
|
-
<span class="keyword">end</span>
|
100
|
-
<span class="keyword">end</span></pre></div></div>
|
99
|
+
<span class="hljs-keyword">end</span>
|
100
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
101
101
|
|
102
102
|
</li>
|
103
103
|
|
@@ -112,11 +112,11 @@
|
|
112
112
|
|
113
113
|
</div>
|
114
114
|
|
115
|
-
<div class="content"><div class='highlight'><pre>post <span class="string">'/sample40/callback'</span> <span class="keyword">do</span>
|
115
|
+
<div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample40/callback'</span> <span class="hljs-keyword">do</span>
|
116
116
|
|
117
|
-
source_id = <span class="string">''</span>
|
118
|
-
client_id = <span class="string">''</span>
|
119
|
-
private_key = <span class="string">''</span></pre></div></div>
|
117
|
+
source_id = <span class="hljs-string">''</span>
|
118
|
+
client_id = <span class="hljs-string">''</span>
|
119
|
+
private_key = <span class="hljs-string">''</span></pre></div></div>
|
120
120
|
|
121
121
|
</li>
|
122
122
|
|
@@ -131,10 +131,10 @@
|
|
131
131
|
|
132
132
|
</div>
|
133
133
|
|
134
|
-
<div class="content"><div class='highlight'><pre> data = <span class="constant">JSON</span>.parse(request.body.read)
|
135
|
-
<span class="keyword">begin</span>
|
136
|
-
participant = <span class="keyword">nil</span>
|
137
|
-
raise <span class="string">'Empty params!'</span> <span class="keyword">if</span> data.empty?</pre></div></div>
|
134
|
+
<div class="content"><div class='highlight'><pre> data = <span class="hljs-constant">JSON</span>.parse(request.body.read)
|
135
|
+
<span class="hljs-keyword">begin</span>
|
136
|
+
participant = <span class="hljs-keyword">nil</span>
|
137
|
+
raise <span class="hljs-string">'Empty params!'</span> <span class="hljs-keyword">if</span> data.empty?</pre></div></div>
|
138
138
|
|
139
139
|
</li>
|
140
140
|
|
@@ -149,19 +149,19 @@
|
|
149
149
|
|
150
150
|
</div>
|
151
151
|
|
152
|
-
<div class="content"><div class='highlight'><pre> data.each <span class="keyword">do</span> |key, value|
|
153
|
-
<span class="keyword">if</span> key == <span class="string">'SourceId'</span>
|
152
|
+
<div class="content"><div class='highlight'><pre> data.each <span class="hljs-keyword">do</span> |key, value|
|
153
|
+
<span class="hljs-keyword">if</span> key == <span class="hljs-string">'SourceId'</span>
|
154
154
|
source_id = value
|
155
|
-
<span class="keyword">end</span>
|
156
|
-
<span class="keyword">if</span> key == <span class="string">'SerializedData'</span>
|
157
|
-
data = <span class="constant">JSON</span>.parse(value)
|
158
|
-
data.each <span class="keyword">do</span> |key, value|
|
159
|
-
<span class="keyword">if</span> key == <span class="string">'ParticipantGuid'</span>
|
155
|
+
<span class="hljs-keyword">end</span>
|
156
|
+
<span class="hljs-keyword">if</span> key == <span class="hljs-string">'SerializedData'</span>
|
157
|
+
data = <span class="hljs-constant">JSON</span>.parse(value)
|
158
|
+
data.each <span class="hljs-keyword">do</span> |key, value|
|
159
|
+
<span class="hljs-keyword">if</span> key == <span class="hljs-string">'ParticipantGuid'</span>
|
160
160
|
participant = value
|
161
|
-
<span class="keyword">end</span>
|
162
|
-
<span class="keyword">end</span>
|
163
|
-
<span class="keyword">end</span>
|
164
|
-
<span class="keyword">end</span></pre></div></div>
|
161
|
+
<span class="hljs-keyword">end</span>
|
162
|
+
<span class="hljs-keyword">end</span>
|
163
|
+
<span class="hljs-keyword">end</span>
|
164
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
165
165
|
|
166
166
|
</li>
|
167
167
|
|
@@ -176,12 +176,12 @@
|
|
176
176
|
|
177
177
|
</div>
|
178
178
|
|
179
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.exist?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>)
|
180
|
-
contents = <span class="constant">File</span>.read(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>)
|
181
|
-
contents = contents.split(<span class="string">' '</span>)
|
182
|
-
client_id = contents[<span class="number">0</span>]
|
183
|
-
private_key = contents[<span class="number">1</span>]
|
184
|
-
<span class="keyword">end</span></pre></div></div>
|
179
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-constant">File</span>.exist?(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/user_info.txt"</span>)
|
180
|
+
contents = <span class="hljs-constant">File</span>.read(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/user_info.txt"</span>)
|
181
|
+
contents = contents.split(<span class="hljs-string">' '</span>)
|
182
|
+
client_id = contents[<span class="hljs-number">0</span>]
|
183
|
+
private_key = contents[<span class="hljs-number">1</span>]
|
184
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
185
185
|
|
186
186
|
</li>
|
187
187
|
|
@@ -196,7 +196,7 @@
|
|
196
196
|
|
197
197
|
</div>
|
198
198
|
|
199
|
-
<div class="content"><div class='highlight'><pre> form = <span class="constant">GroupDocs::Signature::Form</span>.new({<span class="symbol">:id</span> => source_id})</pre></div></div>
|
199
|
+
<div class="content"><div class='highlight'><pre> form = <span class="hljs-constant">GroupDocs::Signature::Form</span>.new({<span class="hljs-symbol">:id</span> => source_id})</pre></div></div>
|
200
200
|
|
201
201
|
</li>
|
202
202
|
|
@@ -211,12 +211,12 @@
|
|
211
211
|
|
212
212
|
</div>
|
213
213
|
|
214
|
-
<div class="content"><div class='highlight'><pre> signature = <span class="constant">GroupDocs::Signature</span>.new()
|
215
|
-
doc_info = signature.get_sign_form_participant!(form.id , participant, {<span class="symbol">:client_id</span> => client_id, <span class="symbol">:private_key</span> => private_key} )
|
214
|
+
<div class="content"><div class='highlight'><pre> signature = <span class="hljs-constant">GroupDocs::Signature</span>.new()
|
215
|
+
doc_info = signature.get_sign_form_participant!(form.id , participant, {<span class="hljs-symbol">:client_id</span> => client_id, <span class="hljs-symbol">:private_key</span> => private_key} )
|
216
216
|
|
217
|
-
guid = doc_info[<span class="symbol">:documentGuid</span>]
|
217
|
+
guid = doc_info[<span class="hljs-symbol">:documentGuid</span>]
|
218
218
|
|
219
|
-
out_file = <span class="constant">File</span>.new(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/callback_info.txt"</span>, <span class="string">'w'</span>)</pre></div></div>
|
219
|
+
out_file = <span class="hljs-constant">File</span>.new(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/callback_info.txt"</span>, <span class="hljs-string">'w'</span>)</pre></div></div>
|
220
220
|
|
221
221
|
</li>
|
222
222
|
|
@@ -234,10 +234,10 @@
|
|
234
234
|
<div class="content"><div class='highlight'><pre> out_file.write(guid)
|
235
235
|
out_file.close
|
236
236
|
|
237
|
-
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
237
|
+
<span class="hljs-keyword">rescue</span> <span class="hljs-constant">Exception</span> => e
|
238
238
|
err = e.message
|
239
|
-
<span class="keyword">end</span>
|
240
|
-
<span class="keyword">end</span></pre></div></div>
|
239
|
+
<span class="hljs-keyword">end</span>
|
240
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
241
241
|
|
242
242
|
</li>
|
243
243
|
|
@@ -252,7 +252,7 @@
|
|
252
252
|
|
253
253
|
</div>
|
254
254
|
|
255
|
-
<div class="content"><div class='highlight'><pre>post <span class="string">'/
|
255
|
+
<div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample-40-how-to-set-callback-for-signature-form-and-re-direct-when-it-was-signed'</span> <span class="hljs-keyword">do</span></pre></div></div>
|
256
256
|
|
257
257
|
</li>
|
258
258
|
|
@@ -267,13 +267,13 @@
|
|
267
267
|
|
268
268
|
</div>
|
269
269
|
|
270
|
-
<div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>]
|
271
|
-
set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
|
272
|
-
set <span class="symbol">:form_guid</span>, params[<span class="symbol">:formGuid</span>]
|
273
|
-
set <span class="symbol">:callback</span>, params[<span class="symbol">:callbackUrl</span>]
|
274
|
-
set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
|
270
|
+
<div class="content"><div class='highlight'><pre> set <span class="hljs-symbol">:client_id</span>, params[<span class="hljs-symbol">:clientId</span>]
|
271
|
+
set <span class="hljs-symbol">:private_key</span>, params[<span class="hljs-symbol">:privateKey</span>]
|
272
|
+
set <span class="hljs-symbol">:form_guid</span>, params[<span class="hljs-symbol">:formGuid</span>]
|
273
|
+
set <span class="hljs-symbol">:callback</span>, params[<span class="hljs-symbol">:callbackUrl</span>]
|
274
|
+
set <span class="hljs-symbol">:base_path</span>, params[<span class="hljs-symbol">:basePath</span>]
|
275
275
|
|
276
|
-
<span class="keyword">begin</span></pre></div></div>
|
276
|
+
<span class="hljs-keyword">begin</span></pre></div></div>
|
277
277
|
|
278
278
|
</li>
|
279
279
|
|
@@ -288,7 +288,7 @@
|
|
288
288
|
|
289
289
|
</div>
|
290
290
|
|
291
|
-
<div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.form_guid.empty?</pre></div></div>
|
291
|
+
<div class="content"><div class='highlight'><pre> raise <span class="hljs-string">'Please enter all required parameters'</span> <span class="hljs-keyword">if</span> settings.client_id.empty? <span class="hljs-keyword">or</span> settings.private_key.empty? <span class="hljs-keyword">or</span> settings.form_guid.empty?</pre></div></div>
|
292
292
|
|
293
293
|
</li>
|
294
294
|
|
@@ -303,9 +303,9 @@
|
|
303
303
|
|
304
304
|
</div>
|
305
305
|
|
306
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.exist?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
307
|
-
<span class="constant">File</span>.delete(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
308
|
-
<span class="keyword">end</span></pre></div></div>
|
306
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-constant">File</span>.exist?(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
307
|
+
<span class="hljs-constant">File</span>.delete(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
308
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
309
309
|
|
310
310
|
</li>
|
311
311
|
|
@@ -320,13 +320,13 @@
|
|
320
320
|
|
321
321
|
</div>
|
322
322
|
|
323
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
|
324
|
-
base_path = <span class="string">'https://api.groupdocs.com'</span>
|
325
|
-
<span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
|
326
|
-
base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
|
327
|
-
<span class="keyword">else</span>
|
323
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.base_path.empty?
|
324
|
+
base_path = <span class="hljs-string">'https://api.groupdocs.com'</span>
|
325
|
+
<span class="hljs-keyword">elsif</span> settings.base_path.match(<span class="hljs-string">'/v2.0'</span>)
|
326
|
+
base_path = settings.base_path.split(<span class="hljs-string">'/v2.0'</span>)[<span class="hljs-number">0</span>]
|
327
|
+
<span class="hljs-keyword">else</span>
|
328
328
|
base_path = settings.base_path
|
329
|
-
<span class="keyword">end</span></pre></div></div>
|
329
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
330
330
|
|
331
331
|
</li>
|
332
332
|
|
@@ -341,7 +341,7 @@
|
|
341
341
|
|
342
342
|
</div>
|
343
343
|
|
344
|
-
<div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
|
344
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-constant">GroupDocs</span>.configure <span class="hljs-keyword">do</span> |groupdocs|
|
345
345
|
groupdocs.client_id = settings.client_id
|
346
346
|
groupdocs.private_key = settings.private_key</pre></div></div>
|
347
347
|
|
@@ -358,9 +358,9 @@
|
|
358
358
|
|
359
359
|
</div>
|
360
360
|
|
361
|
-
<div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
|
361
|
+
<div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="hljs-comment"># default is 'https://api.groupdocs.com'</span>
|
362
362
|
|
363
|
-
<span class="keyword">end</span></pre></div></div>
|
363
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
364
364
|
|
365
365
|
</li>
|
366
366
|
|
@@ -375,8 +375,8 @@
|
|
375
375
|
|
376
376
|
</div>
|
377
377
|
|
378
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.callback
|
379
|
-
out_file = <span class="constant">File</span>.new(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>, <span class="string">'w'</span>)</pre></div></div>
|
378
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.callback
|
379
|
+
out_file = <span class="hljs-constant">File</span>.new(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/user_info.txt"</span>, <span class="hljs-string">'w'</span>)</pre></div></div>
|
380
380
|
|
381
381
|
</li>
|
382
382
|
|
@@ -391,10 +391,10 @@
|
|
391
391
|
|
392
392
|
</div>
|
393
393
|
|
394
|
-
<div class="content"><div class='highlight'><pre> out_file.write(<span class="string">"<span class="subst">#{settings.client_id}</span> "</span>)
|
395
|
-
out_file.write(<span class="string">"<span class="subst">#{settings.private_key}</span> "</span>)
|
394
|
+
<div class="content"><div class='highlight'><pre> out_file.write(<span class="hljs-string">"<span class="hljs-subst">#{settings.client_id}</span> "</span>)
|
395
|
+
out_file.write(<span class="hljs-string">"<span class="hljs-subst">#{settings.private_key}</span> "</span>)
|
396
396
|
out_file.close
|
397
|
-
<span class="keyword">end</span>
|
397
|
+
<span class="hljs-keyword">end</span>
|
398
398
|
|
399
399
|
guid = settings.form_guid</pre></div></div>
|
400
400
|
|
@@ -411,8 +411,8 @@
|
|
411
411
|
|
412
412
|
</div>
|
413
413
|
|
414
|
-
<div class="content"><div class='highlight'><pre> form = <span class="constant">GroupDocs::Signature::Form</span>.new()
|
415
|
-
form.name = <span class="string">"Test Form"</span></pre></div></div>
|
414
|
+
<div class="content"><div class='highlight'><pre> form = <span class="hljs-constant">GroupDocs::Signature::Form</span>.new()
|
415
|
+
form.name = <span class="hljs-string">"Test Form"</span></pre></div></div>
|
416
416
|
|
417
417
|
</li>
|
418
418
|
|
@@ -427,7 +427,7 @@
|
|
427
427
|
|
428
428
|
</div>
|
429
429
|
|
430
|
-
<div class="content"><div class='highlight'><pre> id = form.create!({<span class="symbol">:formId</span> => guid})</pre></div></div>
|
430
|
+
<div class="content"><div class='highlight'><pre> id = form.create!({<span class="hljs-symbol">:formId</span> => guid})</pre></div></div>
|
431
431
|
|
432
432
|
</li>
|
433
433
|
|
@@ -442,7 +442,7 @@
|
|
442
442
|
|
443
443
|
</div>
|
444
444
|
|
445
|
-
<div class="content"><div class='highlight'><pre> form = <span class="constant">GroupDocs::Signature::Form</span>.get!(id)</pre></div></div>
|
445
|
+
<div class="content"><div class='highlight'><pre> form = <span class="hljs-constant">GroupDocs::Signature::Form</span>.get!(id)</pre></div></div>
|
446
446
|
|
447
447
|
</li>
|
448
448
|
|
@@ -457,7 +457,7 @@
|
|
457
457
|
|
458
458
|
</div>
|
459
459
|
|
460
|
-
<div class="content"><div class='highlight'><pre> form.publish!({<span class="symbol">:callbackUrl</span> => settings.callback})</pre></div></div>
|
460
|
+
<div class="content"><div class='highlight'><pre> form.publish!({<span class="hljs-symbol">:callbackUrl</span> => settings.callback})</pre></div></div>
|
461
461
|
|
462
462
|
</li>
|
463
463
|
|
@@ -472,7 +472,7 @@
|
|
472
472
|
|
473
473
|
</div>
|
474
474
|
|
475
|
-
<div class="content"><div class='highlight'><pre> iframe = <span class="string">"//signature2/forms/signembed/<span class="subst">#{guid}</span>"</span></pre></div></div>
|
475
|
+
<div class="content"><div class='highlight'><pre> iframe = <span class="hljs-string">"//signature2/forms/signembed/<span class="hljs-subst">#{guid}</span>"</span></pre></div></div>
|
476
476
|
|
477
477
|
</li>
|
478
478
|
|
@@ -487,7 +487,7 @@
|
|
487
487
|
|
488
488
|
</div>
|
489
489
|
|
490
|
-
<div class="content"><div class='highlight'><pre> url = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> => iframe).prepare_and_sign_url</pre></div></div>
|
490
|
+
<div class="content"><div class='highlight'><pre> url = <span class="hljs-constant">GroupDocs::Api::Request</span>.new(<span class="hljs-symbol">:path</span> => iframe).prepare_and_sign_url</pre></div></div>
|
491
491
|
|
492
492
|
</li>
|
493
493
|
|
@@ -502,20 +502,20 @@
|
|
502
502
|
|
503
503
|
</div>
|
504
504
|
|
505
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">case</span> base_path
|
506
|
-
<span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
|
507
|
-
iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com<span class="subst">#{url}</span>"</span>
|
508
|
-
<span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
|
509
|
-
iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
|
510
|
-
<span class="keyword">else</span>
|
511
|
-
iframe = <span class="string">"https://apps.groupdocs.com<span class="subst">#{url}</span>"</span>
|
512
|
-
<span class="keyword">end</span>
|
505
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">case</span> base_path
|
506
|
+
<span class="hljs-keyword">when</span> <span class="hljs-string">'https://stage-api-groupdocs.dynabic.com'</span>
|
507
|
+
iframe = <span class="hljs-string">"https://stage-api-groupdocs.dynabic.com<span class="hljs-subst">#{url}</span>"</span>
|
508
|
+
<span class="hljs-keyword">when</span> <span class="hljs-string">'https://dev-api-groupdocs.dynabic.com'</span>
|
509
|
+
iframe = <span class="hljs-string">"https://dev-apps.groupdocs.com<span class="hljs-subst">#{url}</span>"</span>
|
510
|
+
<span class="hljs-keyword">else</span>
|
511
|
+
iframe = <span class="hljs-string">"https://apps.groupdocs.com<span class="hljs-subst">#{url}</span>"</span>
|
512
|
+
<span class="hljs-keyword">end</span>
|
513
513
|
|
514
|
-
iframe = <span class="string">"<iframe src='<span class="subst">#{iframe}</span>' id='downloadframe' width='800' height='1000'></iframe>"</span>
|
514
|
+
iframe = <span class="hljs-string">"<iframe src='<span class="hljs-subst">#{iframe}</span>' id='downloadframe' width='800' height='1000'></iframe>"</span>
|
515
515
|
|
516
|
-
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
516
|
+
<span class="hljs-keyword">rescue</span> <span class="hljs-constant">Exception</span> => e
|
517
517
|
err = e.message
|
518
|
-
<span class="keyword">end</span></pre></div></div>
|
518
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
519
519
|
|
520
520
|
</li>
|
521
521
|
|
@@ -530,12 +530,12 @@
|
|
530
530
|
|
531
531
|
</div>
|
532
532
|
|
533
|
-
<div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample40</span>, <span class="symbol">:locals</span> => {<span class="symbol">:userId</span> => settings.client_id,
|
534
|
-
<span class="symbol">:privateKey</span> => settings.private_key,
|
535
|
-
<span class="symbol">:callback</span> => settings.callback,
|
536
|
-
<span class="symbol">:iframe</span> => iframe,
|
537
|
-
<span class="symbol">:err</span> => err}
|
538
|
-
<span class="keyword">end</span></pre></div></div>
|
533
|
+
<div class="content"><div class='highlight'><pre> haml <span class="hljs-symbol">:sample40</span>, <span class="hljs-symbol">:locals</span> => {<span class="hljs-symbol">:userId</span> => settings.client_id,
|
534
|
+
<span class="hljs-symbol">:privateKey</span> => settings.private_key,
|
535
|
+
<span class="hljs-symbol">:callback</span> => settings.callback,
|
536
|
+
<span class="hljs-symbol">:iframe</span> => iframe,
|
537
|
+
<span class="hljs-symbol">:err</span> => err}
|
538
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
539
539
|
|
540
540
|
</li>
|
541
541
|
|
@@ -31,9 +31,9 @@
|
|
31
31
|
|
32
32
|
</div>
|
33
33
|
|
34
|
-
<div class="content"><div class='highlight'><pre>get <span class="string">'/
|
35
|
-
haml <span class="symbol">:sample41</span>
|
36
|
-
<span class="keyword">end</span></pre></div></div>
|
34
|
+
<div class="content"><div class='highlight'><pre>get <span class="hljs-string">'/sample-41-how-to-set-callback-for-annotation-and-manage-user-rights'</span> <span class="hljs-keyword">do</span>
|
35
|
+
haml <span class="hljs-symbol">:sample41</span>
|
36
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
37
37
|
|
38
38
|
</li>
|
39
39
|
|
@@ -48,8 +48,8 @@
|
|
48
48
|
|
49
49
|
</div>
|
50
50
|
|
51
|
-
<div class="content"><div class='highlight'><pre>post <span class="string">'/sample41/callback'</span> <span class="keyword">do</span>
|
52
|
-
<span class="keyword">begin</span></pre></div></div>
|
51
|
+
<div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample41/callback'</span> <span class="hljs-keyword">do</span>
|
52
|
+
<span class="hljs-keyword">begin</span></pre></div></div>
|
53
53
|
|
54
54
|
</li>
|
55
55
|
|
@@ -64,15 +64,15 @@
|
|
64
64
|
|
65
65
|
</div>
|
66
66
|
|
67
|
-
<div class="content"><div class='highlight'><pre> data = <span class="constant">JSON</span>.parse(request.body.read)
|
68
|
-
serialized_data = <span class="constant">JSON</span>.parse(data[<span class="string">'SerializedData'</span>])
|
67
|
+
<div class="content"><div class='highlight'><pre> data = <span class="hljs-constant">JSON</span>.parse(request.body.read)
|
68
|
+
serialized_data = <span class="hljs-constant">JSON</span>.parse(data[<span class="hljs-string">'SerializedData'</span>])
|
69
69
|
|
70
|
-
raise <span class="string">'Empty params!'</span> <span class="keyword">if</span> data.empty?
|
70
|
+
raise <span class="hljs-string">'Empty params!'</span> <span class="hljs-keyword">if</span> data.empty?
|
71
71
|
|
72
|
-
file_guid = serialized_data[<span class="string">'DocumentGuid'</span>]
|
73
|
-
collaborator_guid = serialized_data[<span class="string">'UserGuid'</span>]
|
74
|
-
client_id = <span class="keyword">nil</span>
|
75
|
-
private_key = <span class="keyword">nil</span></pre></div></div>
|
72
|
+
file_guid = serialized_data[<span class="hljs-string">'DocumentGuid'</span>]
|
73
|
+
collaborator_guid = serialized_data[<span class="hljs-string">'UserGuid'</span>]
|
74
|
+
client_id = <span class="hljs-keyword">nil</span>
|
75
|
+
private_key = <span class="hljs-keyword">nil</span></pre></div></div>
|
76
76
|
|
77
77
|
</li>
|
78
78
|
|
@@ -87,15 +87,15 @@
|
|
87
87
|
|
88
88
|
</div>
|
89
89
|
|
90
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.exist?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>)
|
91
|
-
contents = <span class="constant">File</span>.read(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>)
|
92
|
-
contents = contents.split(<span class="string">' '</span>)
|
90
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-constant">File</span>.exist?(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/user_info.txt"</span>)
|
91
|
+
contents = <span class="hljs-constant">File</span>.read(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/user_info.txt"</span>)
|
92
|
+
contents = contents.split(<span class="hljs-string">' '</span>)
|
93
93
|
client_id = contents.first
|
94
94
|
private_key = contents.last
|
95
|
-
<span class="keyword">end</span>
|
96
|
-
status = <span class="keyword">nil</span>
|
97
|
-
<span class="keyword">if</span> file_guid != <span class="string">''</span> <span class="keyword">and</span> collaborator_guid != <span class="string">''</span>
|
98
|
-
document = <span class="constant">GroupDocs::Storage::File</span>.new(<span class="symbol">:guid</span> => file_guid).to_document</pre></div></div>
|
95
|
+
<span class="hljs-keyword">end</span>
|
96
|
+
status = <span class="hljs-keyword">nil</span>
|
97
|
+
<span class="hljs-keyword">if</span> file_guid != <span class="hljs-string">''</span> <span class="hljs-keyword">and</span> collaborator_guid != <span class="hljs-string">''</span>
|
98
|
+
document = <span class="hljs-constant">GroupDocs::Storage::File</span>.new(<span class="hljs-symbol">:guid</span> => file_guid).to_document</pre></div></div>
|
99
99
|
|
100
100
|
</li>
|
101
101
|
|
@@ -111,7 +111,7 @@
|
|
111
111
|
</div>
|
112
112
|
|
113
113
|
<div class="content"><div class='highlight'><pre> get_collaborator = document.collaborators!
|
114
|
-
get_collaborator.each <span class="keyword">do</span> |reviewer|</pre></div></div>
|
114
|
+
get_collaborator.each <span class="hljs-keyword">do</span> |reviewer|</pre></div></div>
|
115
115
|
|
116
116
|
</li>
|
117
117
|
|
@@ -126,8 +126,8 @@
|
|
126
126
|
|
127
127
|
</div>
|
128
128
|
|
129
|
-
<div class="content"><div class='highlight'><pre> reviewer.access_rights = <span class="string">%w(view)</span>
|
130
|
-
<span class="keyword">end</span></pre></div></div>
|
129
|
+
<div class="content"><div class='highlight'><pre> reviewer.access_rights = <span class="hljs-string">%w(view)</span>
|
130
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
131
131
|
|
132
132
|
</li>
|
133
133
|
|
@@ -143,7 +143,7 @@
|
|
143
143
|
</div>
|
144
144
|
|
145
145
|
<div class="content"><div class='highlight'><pre> status = document.set_reviewers! get_collaborator
|
146
|
-
<span class="keyword">end</span></pre></div></div>
|
146
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
147
147
|
|
148
148
|
</li>
|
149
149
|
|
@@ -158,7 +158,7 @@
|
|
158
158
|
|
159
159
|
</div>
|
160
160
|
|
161
|
-
<div class="content"><div class='highlight'><pre> out_file = <span class="constant">File</span>.new(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/callback_info.txt"</span>, <span class="string">'w'</span>)</pre></div></div>
|
161
|
+
<div class="content"><div class='highlight'><pre> out_file = <span class="hljs-constant">File</span>.new(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/callback_info.txt"</span>, <span class="hljs-string">'w'</span>)</pre></div></div>
|
162
162
|
|
163
163
|
</li>
|
164
164
|
|
@@ -173,13 +173,13 @@
|
|
173
173
|
|
174
174
|
</div>
|
175
175
|
|
176
|
-
<div class="content"><div class='highlight'><pre> out_file.write(status.<span class="keyword">nil</span>? ? <span class="string">"Error"</span> <span class="symbol">:</span> <span class="string">"User rights was set to view only"</span>)
|
176
|
+
<div class="content"><div class='highlight'><pre> out_file.write(status.<span class="hljs-keyword">nil</span>? ? <span class="hljs-string">"Error"</span> <span class="hljs-symbol">:</span> <span class="hljs-string">"User rights was set to view only"</span>)
|
177
177
|
out_file.close
|
178
178
|
|
179
|
-
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
179
|
+
<span class="hljs-keyword">rescue</span> <span class="hljs-constant">Exception</span> => e
|
180
180
|
err = e.message
|
181
|
-
<span class="keyword">end</span>
|
182
|
-
<span class="keyword">end</span></pre></div></div>
|
181
|
+
<span class="hljs-keyword">end</span>
|
182
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
183
183
|
|
184
184
|
</li>
|
185
185
|
|
@@ -194,13 +194,13 @@
|
|
194
194
|
|
195
195
|
</div>
|
196
196
|
|
197
|
-
<div class="content"><div class='highlight'><pre>post <span class="string">'/sample41/check_guid'</span> <span class="keyword">do</span>
|
198
|
-
pp <span class="string">'test'</span>
|
199
|
-
<span class="keyword">begin</span>
|
200
|
-
result = <span class="keyword">nil</span>
|
201
|
-
i = <span class="number">0</span>
|
202
|
-
<span class="keyword">for</span> i <span class="keyword">in</span> <span class="number">1</span>..<span class="number">10</span>
|
203
|
-
i +=<span class="number">1</span></pre></div></div>
|
197
|
+
<div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample41/check_guid'</span> <span class="hljs-keyword">do</span>
|
198
|
+
pp <span class="hljs-string">'test'</span>
|
199
|
+
<span class="hljs-keyword">begin</span>
|
200
|
+
result = <span class="hljs-keyword">nil</span>
|
201
|
+
i = <span class="hljs-number">0</span>
|
202
|
+
<span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-number">1</span>..<span class="hljs-number">10</span>
|
203
|
+
i +=<span class="hljs-number">1</span></pre></div></div>
|
204
204
|
|
205
205
|
</li>
|
206
206
|
|
@@ -215,14 +215,14 @@
|
|
215
215
|
|
216
216
|
</div>
|
217
217
|
|
218
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.exist?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
219
|
-
result = <span class="constant">File</span>.read(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
220
|
-
<span class="keyword">if</span> result != <span class="string">''</span>
|
221
|
-
<span class="keyword">break</span>
|
222
|
-
<span class="keyword">end</span>
|
223
|
-
<span class="keyword">end</span>
|
224
|
-
sleep(<span class="number">3</span>)
|
225
|
-
<span class="keyword">end</span></pre></div></div>
|
218
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-constant">File</span>.exist?(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
219
|
+
result = <span class="hljs-constant">File</span>.read(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
220
|
+
<span class="hljs-keyword">if</span> result != <span class="hljs-string">''</span>
|
221
|
+
<span class="hljs-keyword">break</span>
|
222
|
+
<span class="hljs-keyword">end</span>
|
223
|
+
<span class="hljs-keyword">end</span>
|
224
|
+
sleep(<span class="hljs-number">3</span>)
|
225
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
226
226
|
|
227
227
|
</li>
|
228
228
|
|
@@ -237,16 +237,16 @@
|
|
237
237
|
|
238
238
|
</div>
|
239
239
|
|
240
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> result == <span class="string">'Error'</span>
|
241
|
-
result = <span class="string">"File was not found. Looks like something went wrong."</span>
|
242
|
-
<span class="keyword">else</span>
|
240
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> result == <span class="hljs-string">'Error'</span>
|
241
|
+
result = <span class="hljs-string">"File was not found. Looks like something went wrong."</span>
|
242
|
+
<span class="hljs-keyword">else</span>
|
243
243
|
result
|
244
|
-
<span class="keyword">end</span>
|
244
|
+
<span class="hljs-keyword">end</span>
|
245
245
|
|
246
|
-
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
246
|
+
<span class="hljs-keyword">rescue</span> <span class="hljs-constant">Exception</span> => e
|
247
247
|
err = e.message
|
248
|
-
<span class="keyword">end</span>
|
249
|
-
<span class="keyword">end</span></pre></div></div>
|
248
|
+
<span class="hljs-keyword">end</span>
|
249
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
250
250
|
|
251
251
|
</li>
|
252
252
|
|
@@ -261,7 +261,7 @@
|
|
261
261
|
|
262
262
|
</div>
|
263
263
|
|
264
|
-
<div class="content"><div class='highlight'><pre>post <span class="string">'/
|
264
|
+
<div class="content"><div class='highlight'><pre>post <span class="hljs-string">'/sample-41-how-to-set-callback-for-annotation-and-manage-user-rights'</span> <span class="hljs-keyword">do</span></pre></div></div>
|
265
265
|
|
266
266
|
</li>
|
267
267
|
|
@@ -276,14 +276,14 @@
|
|
276
276
|
|
277
277
|
</div>
|
278
278
|
|
279
|
-
<div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>]
|
280
|
-
set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
|
281
|
-
set <span class="symbol">:email</span>, params[<span class="symbol">:email</span>]
|
282
|
-
set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]
|
283
|
-
set <span class="symbol">:file_id</span>, params[<span class="symbol">:fileId</span>]
|
284
|
-
set <span class="symbol">:url</span>, params[<span class="symbol">:url</span>]
|
285
|
-
set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
|
286
|
-
set <span class="symbol">:callback</span>, params[<span class="symbol">:callbackUrl</span>]</pre></div></div>
|
279
|
+
<div class="content"><div class='highlight'><pre> set <span class="hljs-symbol">:client_id</span>, params[<span class="hljs-symbol">:clientId</span>]
|
280
|
+
set <span class="hljs-symbol">:private_key</span>, params[<span class="hljs-symbol">:privateKey</span>]
|
281
|
+
set <span class="hljs-symbol">:email</span>, params[<span class="hljs-symbol">:email</span>]
|
282
|
+
set <span class="hljs-symbol">:source</span>, params[<span class="hljs-symbol">:source</span>]
|
283
|
+
set <span class="hljs-symbol">:file_id</span>, params[<span class="hljs-symbol">:fileId</span>]
|
284
|
+
set <span class="hljs-symbol">:url</span>, params[<span class="hljs-symbol">:url</span>]
|
285
|
+
set <span class="hljs-symbol">:base_path</span>, params[<span class="hljs-symbol">:basePath</span>]
|
286
|
+
set <span class="hljs-symbol">:callback</span>, params[<span class="hljs-symbol">:callbackUrl</span>]</pre></div></div>
|
287
287
|
|
288
288
|
</li>
|
289
289
|
|
@@ -298,7 +298,7 @@
|
|
298
298
|
|
299
299
|
</div>
|
300
300
|
|
301
|
-
<div class="content"><div class='highlight'><pre> downloads_path = <span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/downloads"</span></pre></div></div>
|
301
|
+
<div class="content"><div class='highlight'><pre> downloads_path = <span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/downloads"</span></pre></div></div>
|
302
302
|
|
303
303
|
</li>
|
304
304
|
|
@@ -313,17 +313,17 @@
|
|
313
313
|
|
314
314
|
</div>
|
315
315
|
|
316
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> <span class="constant">File</span>.directory?(downloads_path)
|
317
|
-
<span class="constant">Dir</span>.foreach(downloads_path) { |f| fn = <span class="constant">File</span>.join(downloads_path, f); <span class="constant">File</span>.delete(fn) <span class="keyword">if</span> f != <span class="string">'.'</span> && f != <span class="string">'..'</span> }
|
318
|
-
<span class="keyword">if</span> <span class="constant">File</span>.exist?(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
319
|
-
<span class="constant">File</span>.delete(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
320
|
-
<span class="keyword">end</span>
|
321
|
-
<span class="keyword">else</span>
|
322
|
-
<span class="constant">Dir::</span>mkdir(downloads_path)
|
323
|
-
<span class="keyword">end</span>
|
316
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-constant">File</span>.directory?(downloads_path)
|
317
|
+
<span class="hljs-constant">Dir</span>.foreach(downloads_path) { |f| fn = <span class="hljs-constant">File</span>.join(downloads_path, f); <span class="hljs-constant">File</span>.delete(fn) <span class="hljs-keyword">if</span> f != <span class="hljs-string">'.'</span> && f != <span class="hljs-string">'..'</span> }
|
318
|
+
<span class="hljs-keyword">if</span> <span class="hljs-constant">File</span>.exist?(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
319
|
+
<span class="hljs-constant">File</span>.delete(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/callback_info.txt"</span>)
|
320
|
+
<span class="hljs-keyword">end</span>
|
321
|
+
<span class="hljs-keyword">else</span>
|
322
|
+
<span class="hljs-constant">Dir::</span>mkdir(downloads_path)
|
323
|
+
<span class="hljs-keyword">end</span>
|
324
324
|
|
325
325
|
|
326
|
-
<span class="keyword">begin</span></pre></div></div>
|
326
|
+
<span class="hljs-keyword">begin</span></pre></div></div>
|
327
327
|
|
328
328
|
</li>
|
329
329
|
|
@@ -338,7 +338,7 @@
|
|
338
338
|
|
339
339
|
</div>
|
340
340
|
|
341
|
-
<div class="content"><div class='highlight'><pre> raise <span class="string">'Please enter all required parameters'</span> <span class="keyword">if</span> settings.client_id.empty? <span class="keyword">or</span> settings.private_key.empty? <span class="keyword">or</span> settings.email.empty?</pre></div></div>
|
341
|
+
<div class="content"><div class='highlight'><pre> raise <span class="hljs-string">'Please enter all required parameters'</span> <span class="hljs-keyword">if</span> settings.client_id.empty? <span class="hljs-keyword">or</span> settings.private_key.empty? <span class="hljs-keyword">or</span> settings.email.empty?</pre></div></div>
|
342
342
|
|
343
343
|
</li>
|
344
344
|
|
@@ -353,13 +353,13 @@
|
|
353
353
|
|
354
354
|
</div>
|
355
355
|
|
356
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.base_path.empty?
|
357
|
-
base_path = <span class="string">'https://api.groupdocs.com'</span>
|
358
|
-
<span class="keyword">elsif</span> settings.base_path.match(<span class="string">'/v2.0'</span>)
|
359
|
-
base_path = settings.base_path.split(<span class="string">'/v2.0'</span>)[<span class="number">0</span>]
|
360
|
-
<span class="keyword">else</span>
|
356
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.base_path.empty?
|
357
|
+
base_path = <span class="hljs-string">'https://api.groupdocs.com'</span>
|
358
|
+
<span class="hljs-keyword">elsif</span> settings.base_path.match(<span class="hljs-string">'/v2.0'</span>)
|
359
|
+
base_path = settings.base_path.split(<span class="hljs-string">'/v2.0'</span>)[<span class="hljs-number">0</span>]
|
360
|
+
<span class="hljs-keyword">else</span>
|
361
361
|
base_path = settings.base_path
|
362
|
-
<span class="keyword">end</span></pre></div></div>
|
362
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
363
363
|
|
364
364
|
</li>
|
365
365
|
|
@@ -374,7 +374,7 @@
|
|
374
374
|
|
375
375
|
</div>
|
376
376
|
|
377
|
-
<div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
|
377
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-constant">GroupDocs</span>.configure <span class="hljs-keyword">do</span> |groupdocs|
|
378
378
|
groupdocs.client_id = settings.client_id
|
379
379
|
groupdocs.private_key = settings.private_key</pre></div></div>
|
380
380
|
|
@@ -391,9 +391,9 @@
|
|
391
391
|
|
392
392
|
</div>
|
393
393
|
|
394
|
-
<div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
|
394
|
+
<div class="content"><div class='highlight'><pre> groupdocs.api_server = base_path <span class="hljs-comment"># default is 'https://api.groupdocs.com'</span>
|
395
395
|
|
396
|
-
<span class="keyword">end</span></pre></div></div>
|
396
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
397
397
|
|
398
398
|
</li>
|
399
399
|
|
@@ -408,8 +408,8 @@
|
|
408
408
|
|
409
409
|
</div>
|
410
410
|
|
411
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.callback
|
412
|
-
out_file = <span class="constant">File</span>.new(<span class="string">"<span class="subst">#{<span class="constant">File</span>.dirname(__FILE_<span class="number">_</span>)}</span>/../public/user_info.txt"</span>, <span class="string">'w'</span>)</pre></div></div>
|
411
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.callback
|
412
|
+
out_file = <span class="hljs-constant">File</span>.new(<span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">File</span>.dirname(__FILE_<span class="hljs-number">_</span>)}</span>/../public/user_info.txt"</span>, <span class="hljs-string">'w'</span>)</pre></div></div>
|
413
413
|
|
414
414
|
</li>
|
415
415
|
|
@@ -424,10 +424,10 @@
|
|
424
424
|
|
425
425
|
</div>
|
426
426
|
|
427
|
-
<div class="content"><div class='highlight'><pre> out_file.write(<span class="string">"<span class="subst">#{settings.client_id}</span> "</span>)
|
428
|
-
out_file.write(<span class="string">"<span class="subst">#{settings.private_key}</span>"</span>)
|
427
|
+
<div class="content"><div class='highlight'><pre> out_file.write(<span class="hljs-string">"<span class="hljs-subst">#{settings.client_id}</span> "</span>)
|
428
|
+
out_file.write(<span class="hljs-string">"<span class="hljs-subst">#{settings.private_key}</span>"</span>)
|
429
429
|
out_file.close
|
430
|
-
<span class="keyword">end</span></pre></div></div>
|
430
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
431
431
|
|
432
432
|
</li>
|
433
433
|
|
@@ -442,8 +442,8 @@
|
|
442
442
|
|
443
443
|
</div>
|
444
444
|
|
445
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.source
|
446
|
-
<span class="keyword">when</span> <span class="string">'guid'</span></pre></div></div>
|
445
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">case</span> settings.source
|
446
|
+
<span class="hljs-keyword">when</span> <span class="hljs-string">'guid'</span></pre></div></div>
|
447
447
|
|
448
448
|
</li>
|
449
449
|
|
@@ -458,8 +458,8 @@
|
|
458
458
|
|
459
459
|
</div>
|
460
460
|
|
461
|
-
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.new({<span class="symbol">:guid</span> => settings.file_id})
|
462
|
-
<span class="keyword">when</span> <span class="string">'local'</span></pre></div></div>
|
461
|
+
<div class="content"><div class='highlight'><pre> file = <span class="hljs-constant">GroupDocs::Storage::File</span>.new({<span class="hljs-symbol">:guid</span> => settings.file_id})
|
462
|
+
<span class="hljs-keyword">when</span> <span class="hljs-string">'local'</span></pre></div></div>
|
463
463
|
|
464
464
|
</li>
|
465
465
|
|
@@ -474,7 +474,7 @@
|
|
474
474
|
|
475
475
|
</div>
|
476
476
|
|
477
|
-
<div class="content"><div class='highlight'><pre> file_path = <span class="string">"<span class="subst">#{<span class="constant">Dir</span>.tmpdir}</span>/<span class="subst">#{params[<span class="symbol">:file</span>][<span class="symbol">:filename</span>]}</span>"</span></pre></div></div>
|
477
|
+
<div class="content"><div class='highlight'><pre> file_path = <span class="hljs-string">"<span class="hljs-subst">#{<span class="hljs-constant">Dir</span>.tmpdir}</span>/<span class="hljs-subst">#{params[<span class="hljs-symbol">:file</span>][<span class="hljs-symbol">:filename</span>]}</span>"</span></pre></div></div>
|
478
478
|
|
479
479
|
</li>
|
480
480
|
|
@@ -489,7 +489,7 @@
|
|
489
489
|
|
490
490
|
</div>
|
491
491
|
|
492
|
-
<div class="content"><div class='highlight'><pre> <span class="constant">File</span>.open(file_path, <span class="string">'wb'</span>) { |f| f.write(params[<span class="symbol">:file</span>][<span class="symbol">:tempfile</span>].read) }</pre></div></div>
|
492
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-constant">File</span>.open(file_path, <span class="hljs-string">'wb'</span>) { |f| f.write(params[<span class="hljs-symbol">:file</span>][<span class="hljs-symbol">:tempfile</span>].read) }</pre></div></div>
|
493
493
|
|
494
494
|
</li>
|
495
495
|
|
@@ -504,8 +504,8 @@
|
|
504
504
|
|
505
505
|
</div>
|
506
506
|
|
507
|
-
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(file_path, {})
|
508
|
-
<span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
|
507
|
+
<div class="content"><div class='highlight'><pre> file = <span class="hljs-constant">GroupDocs::Storage::File</span>.upload!(file_path, {})
|
508
|
+
<span class="hljs-keyword">when</span> <span class="hljs-string">'url'</span></pre></div></div>
|
509
509
|
|
510
510
|
</li>
|
511
511
|
|
@@ -520,10 +520,10 @@
|
|
520
520
|
|
521
521
|
</div>
|
522
522
|
|
523
|
-
<div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
|
524
|
-
<span class="keyword">else</span>
|
525
|
-
raise <span class="string">'Wrong GUID source.'</span>
|
526
|
-
<span class="keyword">end</span>
|
523
|
+
<div class="content"><div class='highlight'><pre> file = <span class="hljs-constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
|
524
|
+
<span class="hljs-keyword">else</span>
|
525
|
+
raise <span class="hljs-string">'Wrong GUID source.'</span>
|
526
|
+
<span class="hljs-keyword">end</span>
|
527
527
|
guid = file.guid</pre></div></div>
|
528
528
|
|
529
529
|
</li>
|
@@ -569,8 +569,8 @@
|
|
569
569
|
|
570
570
|
</div>
|
571
571
|
|
572
|
-
<div class="content"><div class='highlight'><pre> users = <span class="constant">GroupDocs::User</span>.new.users!
|
573
|
-
user_guid = <span class="keyword">nil</span></pre></div></div>
|
572
|
+
<div class="content"><div class='highlight'><pre> users = <span class="hljs-constant">GroupDocs::User</span>.new.users!
|
573
|
+
user_guid = <span class="hljs-keyword">nil</span></pre></div></div>
|
574
574
|
|
575
575
|
</li>
|
576
576
|
|
@@ -585,8 +585,8 @@
|
|
585
585
|
|
586
586
|
</div>
|
587
587
|
|
588
|
-
<div class="content"><div class='highlight'><pre> number = <span class="constant">Array</span>.new
|
589
|
-
<span class="keyword">if</span> users</pre></div></div>
|
588
|
+
<div class="content"><div class='highlight'><pre> number = <span class="hljs-constant">Array</span>.new
|
589
|
+
<span class="hljs-keyword">if</span> users</pre></div></div>
|
590
590
|
|
591
591
|
</li>
|
592
592
|
|
@@ -601,7 +601,7 @@
|
|
601
601
|
|
602
602
|
</div>
|
603
603
|
|
604
|
-
<div class="content"><div class='highlight'><pre> settings.email.each <span class="keyword">do</span> |email|</pre></div></div>
|
604
|
+
<div class="content"><div class='highlight'><pre> settings.email.each <span class="hljs-keyword">do</span> |email|</pre></div></div>
|
605
605
|
|
606
606
|
</li>
|
607
607
|
|
@@ -616,8 +616,8 @@
|
|
616
616
|
|
617
617
|
</div>
|
618
618
|
|
619
|
-
<div class="content"><div class='highlight'><pre> users.map <span class="keyword">do</span> |user|
|
620
|
-
<span class="keyword">if</span> user.primary_email == email</pre></div></div>
|
619
|
+
<div class="content"><div class='highlight'><pre> users.map <span class="hljs-keyword">do</span> |user|
|
620
|
+
<span class="hljs-keyword">if</span> user.primary_email == email</pre></div></div>
|
621
621
|
|
622
622
|
</li>
|
623
623
|
|
@@ -633,9 +633,9 @@
|
|
633
633
|
</div>
|
634
634
|
|
635
635
|
<div class="content"><div class='highlight'><pre> user_guid = user.guid
|
636
|
-
<span class="keyword">break</span>
|
637
|
-
<span class="keyword">end</span>
|
638
|
-
<span class="keyword">end</span></pre></div></div>
|
636
|
+
<span class="hljs-keyword">break</span>
|
637
|
+
<span class="hljs-keyword">end</span>
|
638
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
639
639
|
|
640
640
|
</li>
|
641
641
|
|
@@ -650,7 +650,7 @@
|
|
650
650
|
|
651
651
|
</div>
|
652
652
|
|
653
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> user_guid.<span class="keyword">nil</span>?</pre></div></div>
|
653
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> user_guid.<span class="hljs-keyword">nil</span>?</pre></div></div>
|
654
654
|
|
655
655
|
</li>
|
656
656
|
|
@@ -665,7 +665,7 @@
|
|
665
665
|
|
666
666
|
</div>
|
667
667
|
|
668
|
-
<div class="content"><div class='highlight'><pre> userNew = <span class="constant">GroupDocs::User</span>.new</pre></div></div>
|
668
|
+
<div class="content"><div class='highlight'><pre> userNew = <span class="hljs-constant">GroupDocs::User</span>.new</pre></div></div>
|
669
669
|
|
670
670
|
</li>
|
671
671
|
|
@@ -725,7 +725,7 @@
|
|
725
725
|
|
726
726
|
</div>
|
727
727
|
|
728
|
-
<div class="content"><div class='highlight'><pre> userNew.roles = [{<span class="symbol">:id</span> => <span class="string">'3'</span>, <span class="symbol">:name</span> => <span class="string">'User'</span>}]</pre></div></div>
|
728
|
+
<div class="content"><div class='highlight'><pre> userNew.roles = [{<span class="hljs-symbol">:id</span> => <span class="hljs-string">'3'</span>, <span class="hljs-symbol">:name</span> => <span class="hljs-string">'User'</span>}]</pre></div></div>
|
729
729
|
|
730
730
|
</li>
|
731
731
|
|
@@ -740,7 +740,7 @@
|
|
740
740
|
|
741
741
|
</div>
|
742
742
|
|
743
|
-
<div class="content"><div class='highlight'><pre> new_user = <span class="constant">GroupDocs::User</span>.update_account!(userNew)</pre></div></div>
|
743
|
+
<div class="content"><div class='highlight'><pre> new_user = <span class="hljs-constant">GroupDocs::User</span>.update_account!(userNew)</pre></div></div>
|
744
744
|
|
745
745
|
</li>
|
746
746
|
|
@@ -756,7 +756,7 @@
|
|
756
756
|
</div>
|
757
757
|
|
758
758
|
<div class="content"><div class='highlight'><pre> user_guid = new_user.guid
|
759
|
-
<span class="keyword">end</span></pre></div></div>
|
759
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
760
760
|
|
761
761
|
</li>
|
762
762
|
|
@@ -773,7 +773,7 @@
|
|
773
773
|
|
774
774
|
<div class="content"><div class='highlight'><pre> collaborators = document.collaborators!
|
775
775
|
|
776
|
-
<span class="keyword">if</span> collaborators</pre></div></div>
|
776
|
+
<span class="hljs-keyword">if</span> collaborators</pre></div></div>
|
777
777
|
|
778
778
|
</li>
|
779
779
|
|
@@ -788,7 +788,7 @@
|
|
788
788
|
|
789
789
|
</div>
|
790
790
|
|
791
|
-
<div class="content"><div class='highlight'><pre> collaborators.map <span class="keyword">do</span> |collaborator|</pre></div></div>
|
791
|
+
<div class="content"><div class='highlight'><pre> collaborators.map <span class="hljs-keyword">do</span> |collaborator|</pre></div></div>
|
792
792
|
|
793
793
|
</li>
|
794
794
|
|
@@ -803,12 +803,12 @@
|
|
803
803
|
|
804
804
|
</div>
|
805
805
|
|
806
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> collaborator.primary_email == email
|
806
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> collaborator.primary_email == email
|
807
807
|
number << collaborator.guid
|
808
|
-
<span class="keyword">end</span>
|
809
|
-
<span class="keyword">end</span>
|
810
|
-
<span class="keyword">end</span>
|
811
|
-
<span class="keyword">end</span></pre></div></div>
|
808
|
+
<span class="hljs-keyword">end</span>
|
809
|
+
<span class="hljs-keyword">end</span>
|
810
|
+
<span class="hljs-keyword">end</span>
|
811
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
812
812
|
|
813
813
|
</li>
|
814
814
|
|
@@ -823,7 +823,7 @@
|
|
823
823
|
|
824
824
|
</div>
|
825
825
|
|
826
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">if</span> settings.email[<span class="number">1</span>].empty? <span class="keyword">then</span> settings.email.delete(<span class="string">""</span>) <span class="keyword">end</span></pre></div></div>
|
826
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> settings.email[<span class="hljs-number">1</span>].empty? <span class="hljs-keyword">then</span> settings.email.delete(<span class="hljs-string">""</span>) <span class="hljs-keyword">end</span></pre></div></div>
|
827
827
|
|
828
828
|
</li>
|
829
829
|
|
@@ -838,7 +838,7 @@
|
|
838
838
|
|
839
839
|
</div>
|
840
840
|
|
841
|
-
<div class="content"><div class='highlight'><pre> document.set_collaborators! settings.email <span class="keyword">if</span> number.size < <span class="number">2</span></pre></div></div>
|
841
|
+
<div class="content"><div class='highlight'><pre> document.set_collaborators! settings.email <span class="hljs-keyword">if</span> number.size < <span class="hljs-number">2</span></pre></div></div>
|
842
842
|
|
843
843
|
</li>
|
844
844
|
|
@@ -849,11 +849,11 @@
|
|
849
849
|
<div class="pilwrap ">
|
850
850
|
<a class="pilcrow" href="#section-49">¶</a>
|
851
851
|
</div>
|
852
|
-
<p>Add user GUID as
|
852
|
+
<p>Add user GUID as “uid” parameter to the iframe URL</p>
|
853
853
|
|
854
854
|
</div>
|
855
855
|
|
856
|
-
<div class="content"><div class='highlight'><pre> iframe = <span class="string">"/document-annotation2/embed/<span class="subst">#{file.guid}</span>?uid=<span class="subst">#{user_guid}</span>"</span></pre></div></div>
|
856
|
+
<div class="content"><div class='highlight'><pre> iframe = <span class="hljs-string">"/document-annotation2/embed/<span class="hljs-subst">#{file.guid}</span>?uid=<span class="hljs-subst">#{user_guid}</span>"</span></pre></div></div>
|
857
857
|
|
858
858
|
</li>
|
859
859
|
|
@@ -868,7 +868,7 @@
|
|
868
868
|
|
869
869
|
</div>
|
870
870
|
|
871
|
-
<div class="content"><div class='highlight'><pre> url = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> => iframe).prepare_and_sign_url</pre></div></div>
|
871
|
+
<div class="content"><div class='highlight'><pre> url = <span class="hljs-constant">GroupDocs::Api::Request</span>.new(<span class="hljs-symbol">:path</span> => iframe).prepare_and_sign_url</pre></div></div>
|
872
872
|
|
873
873
|
</li>
|
874
874
|
|
@@ -883,22 +883,22 @@
|
|
883
883
|
|
884
884
|
</div>
|
885
885
|
|
886
|
-
<div class="content"><div class='highlight'><pre> <span class="keyword">case</span> base_path
|
887
|
-
<span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
|
888
|
-
iframe = <span class="string">"https://stage-api-groupdocs.dynabic.com<span class="subst">#{url}</span>"</span>
|
889
|
-
<span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
|
890
|
-
iframe = <span class="string">"https://dev-apps.groupdocs.com<span class="subst">#{url}</span>"</span>
|
891
|
-
<span class="keyword">else</span>
|
892
|
-
iframe = <span class="string">"https://apps.groupdocs.com<span class="subst">#{url}</span>"</span>
|
893
|
-
<span class="keyword">end</span>
|
886
|
+
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">case</span> base_path
|
887
|
+
<span class="hljs-keyword">when</span> <span class="hljs-string">'https://stage-api-groupdocs.dynabic.com'</span>
|
888
|
+
iframe = <span class="hljs-string">"https://stage-api-groupdocs.dynabic.com<span class="hljs-subst">#{url}</span>"</span>
|
889
|
+
<span class="hljs-keyword">when</span> <span class="hljs-string">'https://dev-api-groupdocs.dynabic.com'</span>
|
890
|
+
iframe = <span class="hljs-string">"https://dev-apps.groupdocs.com<span class="hljs-subst">#{url}</span>"</span>
|
891
|
+
<span class="hljs-keyword">else</span>
|
892
|
+
iframe = <span class="hljs-string">"https://apps.groupdocs.com<span class="hljs-subst">#{url}</span>"</span>
|
893
|
+
<span class="hljs-keyword">end</span>
|
894
894
|
|
895
|
-
iframe = <span class="string">"<iframe src='<span class="subst">#{iframe}</span>' id='downloadframe' width='800' height='1000'></iframe>"</span>
|
896
|
-
<span class="keyword">end</span>
|
895
|
+
iframe = <span class="hljs-string">"<iframe src='<span class="hljs-subst">#{iframe}</span>' id='downloadframe' width='800' height='1000'></iframe>"</span>
|
896
|
+
<span class="hljs-keyword">end</span>
|
897
897
|
|
898
898
|
|
899
|
-
<span class="keyword">rescue</span> <span class="constant">Exception</span> => e
|
899
|
+
<span class="hljs-keyword">rescue</span> <span class="hljs-constant">Exception</span> => e
|
900
900
|
err = e.message
|
901
|
-
<span class="keyword">end</span></pre></div></div>
|
901
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
902
902
|
|
903
903
|
</li>
|
904
904
|
|
@@ -913,8 +913,8 @@
|
|
913
913
|
|
914
914
|
</div>
|
915
915
|
|
916
|
-
<div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample41</span>, <span class="symbol">:locals</span> => {<span class="symbol">:userId</span> => settings.client_id, <span class="symbol">:fileId</span> => settings.file_id, <span class="symbol">:privateKey</span> => settings.private_key, <span class="symbol">:iframe</span> => iframe, <span class="symbol">:callbackUrl</span> => settings.callback, <span class="symbol">:err</span> => err}
|
917
|
-
<span class="keyword">end</span></pre></div></div>
|
916
|
+
<div class="content"><div class='highlight'><pre> haml <span class="hljs-symbol">:sample41</span>, <span class="hljs-symbol">:locals</span> => {<span class="hljs-symbol">:userId</span> => settings.client_id, <span class="hljs-symbol">:fileId</span> => settings.file_id, <span class="hljs-symbol">:privateKey</span> => settings.private_key, <span class="hljs-symbol">:iframe</span> => iframe, <span class="hljs-symbol">:callbackUrl</span> => settings.callback, <span class="hljs-symbol">:err</span> => err}
|
917
|
+
<span class="hljs-keyword">end</span></pre></div></div>
|
918
918
|
|
919
919
|
</li>
|
920
920
|
|