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
data/CHANGELOG.md CHANGED
@@ -1,3 +1,54 @@
1
+ ## v1.5.8
2
+
3
+ **Changes**
4
+
5
+ * `Api::Helpers::REST#send_request!` new functionality for request type :DELETE
6
+ * `Document#access_mode_set!` updates in request path
7
+ * `Document#details!` updates in request path
8
+ * `Document#compare!` updates in request path
9
+ * `Document#update_changes!` updates in request path
10
+ * `Document#changes` updates in request path
11
+ * `Document#download!` updates in request path. Fixed bugs
12
+ * `Signature#get_document_fields!` renamed to `Document#public_fields!`
13
+ * `Signature#sign_document!` renamed to `Document#public_sign_document!`
14
+ * `Document::Annotation.remove!` renamed to `Document::Annotation#remove!`
15
+ * Fixed bugs `Document::Annotation#move_marker!`
16
+ * Fixed bugs `Document::Annotation#resize!`
17
+ * Fixed bugs `Questionnaire#collectors!`
18
+ * Fixed bugs `Questionnaire#copy_to_templates!`
19
+ * Fixed bugs `Signature.verify!`
20
+ * Fixed bugs `Signature.sign_document_status!`
21
+ * `Signature::Envelope#add_recipient!` returns GroupDosc::Signature::Recipient
22
+ * `Signature#get_sign_envelope!` renamed to `Signature::Envelope#public_get!`
23
+ * `Signature#get_signed_documents!` renamed to `Signature::Envelope#public_signed_documents! `
24
+ * `Signature#field_envelope_date!` renamed to `Signature::Envelope#date!`
25
+ * `Signature::Form#fields!` updated
26
+ * Fixed bugs `Signature::Form#assign_field!`
27
+ * `Subscription.self.list!` updated
28
+
29
+ **New**
30
+
31
+ * Added `Document#hyperlinks!`
32
+ * Added `Document::Annotation` attributes
33
+ * Added `Document::Annotation::MarkerPosition` class
34
+ * Added `Document::Annotation::Reply` attributes
35
+ * Added `Document::Field` attributes
36
+ * Added `Questionnaire` attributes
37
+ * Added `Questionnaire#get_document!`
38
+ * Added `Questionnaire.get_by_name!`
39
+ * Added `Questionnaire#delete_list!`
40
+ * Added `Questionnaire#delete_collectors_list!`
41
+ * Added `Questionnaire#delete_executions_list!`
42
+ * Added `Questionnaire#delete_datasources_list!`
43
+ * Added `Questionnaire::Collector#get_questionnaire!`
44
+ * Added `Questionnaire::Question` attributes
45
+ * Added `Questionnaire::Question::Conditions` class
46
+ * Added `Questionnaire::Question::Answer` attribute
47
+ * Added `Signature::Field` attributes
48
+ * Added `Signature::Field::Location` attributes
49
+ * Added `Storage::File#upload_cancel!`
50
+ * Added `User` attributes
51
+
1
52
  ## v1.5.3
2
53
 
3
54
  **Changes**
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'sinatra', '1.3.6'
4
- gem 'groupdocs', "1.2.10"
4
+ gem 'groupdocs', "1.5.7"
5
5
  gem 'haml'
@@ -0,0 +1,43 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (4.0.0)
5
+ i18n (~> 0.6, >= 0.6.4)
6
+ minitest (~> 4.2)
7
+ multi_json (~> 1.3)
8
+ thread_safe (~> 0.1)
9
+ tzinfo (~> 0.3.37)
10
+ atomic (1.1.14)
11
+ groupdocs (1.5.7)
12
+ activesupport (>= 3.0)
13
+ json (~> 1.7)
14
+ mime-types (~> 1.19)
15
+ rest-client (~> 1.6)
16
+ haml (4.0.3)
17
+ tilt
18
+ i18n (0.6.5)
19
+ json (1.8.1)
20
+ mime-types (1.25)
21
+ minitest (4.7.5)
22
+ multi_json (1.8.2)
23
+ rack (1.5.2)
24
+ rack-protection (1.5.1)
25
+ rack
26
+ rest-client (1.6.7)
27
+ mime-types (>= 1.16)
28
+ sinatra (1.3.6)
29
+ rack (~> 1.4)
30
+ rack-protection (~> 1.3)
31
+ tilt (~> 1.3, >= 1.3.3)
32
+ thread_safe (0.1.3)
33
+ atomic
34
+ tilt (1.4.1)
35
+ tzinfo (0.3.38)
36
+
37
+ PLATFORMS
38
+ x86-mingw32
39
+
40
+ DEPENDENCIES
41
+ groupdocs (= 1.5.7)
42
+ haml
43
+ sinatra (= 1.3.6)
@@ -2,7 +2,7 @@
2
2
 
3
3
  <html>
4
4
  <head>
5
- <title>sample2.rb</title>
5
+ <title>sample01.rb</title>
6
6
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
7
7
  <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
8
8
  <link rel="stylesheet" media="all" href="docco.css" />
@@ -15,7 +15,7 @@
15
15
 
16
16
  <li id="title">
17
17
  <div class="annotation">
18
- <h1>sample2.rb</h1>
18
+ <h1>sample01.rb</h1>
19
19
  </div>
20
20
  </li>
21
21
 
@@ -31,8 +31,8 @@
31
31
 
32
32
  </div>
33
33
 
34
- <div class="content"><div class='highlight'><pre>get <span class="string">'/sample2'</span> <span class="keyword">do</span>
35
- haml <span class="symbol">:sample2</span>
34
+ <div class="content"><div class='highlight'><pre>get <span class="string">'/sample01'</span> <span class="keyword">do</span>
35
+ haml <span class="symbol">:sample01</span>
36
36
  <span class="keyword">end</span></pre></div></div>
37
37
 
38
38
  </li>
@@ -48,7 +48,7 @@
48
48
 
49
49
  </div>
50
50
 
51
- <div class="content"><div class='highlight'><pre>post <span class="string">'/sample2'</span> <span class="keyword">do</span></pre></div></div>
51
+ <div class="content"><div class='highlight'><pre>post <span class="string">'/sample01'</span> <span class="keyword">do</span></pre></div></div>
52
52
 
53
53
  </li>
54
54
 
@@ -59,14 +59,17 @@
59
59
  <div class="pilwrap ">
60
60
  <a class="pilcrow" href="#section-3">&#182;</a>
61
61
  </div>
62
- <p>set variables</p>
62
+ <p>Set variables</p>
63
63
 
64
64
  </div>
65
65
 
66
- <div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:client_id</span>]
67
- set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</span>]
66
+ <div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>]
67
+ set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
68
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
68
69
 
69
- <span class="keyword">begin</span></pre></div></div>
70
+ <span class="keyword">begin</span>
71
+
72
+ <span class="keyword">if</span> settings.base_path.empty? <span class="keyword">then</span> settings.base_path = <span class="string">'https://api.groupdocs.com'</span> <span class="keyword">end</span></pre></div></div>
70
73
 
71
74
  </li>
72
75
 
@@ -77,11 +80,13 @@
77
80
  <div class="pilwrap ">
78
81
  <a class="pilcrow" href="#section-4">&#182;</a>
79
82
  </div>
80
- <p>check required variables</p>
83
+ <p>Configure your access to API server</p>
81
84
 
82
85
  </div>
83
86
 
84
- <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?</pre></div></div>
87
+ <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
88
+ groupdocs.client_id = settings.client_id
89
+ groupdocs.private_key = settings.private_key</pre></div></div>
85
90
 
86
91
  </li>
87
92
 
@@ -92,11 +97,12 @@
92
97
  <div class="pilwrap ">
93
98
  <a class="pilcrow" href="#section-5">&#182;</a>
94
99
  </div>
95
- <p>make a request to API using client_id and private_key</p>
100
+ <p>Optionally specify API server and version</p>
96
101
 
97
102
  </div>
98
103
 
99
- <div class="content"><div class='highlight'><pre> files_list = <span class="constant">GroupDocs::Storage::Folder</span>.list!(<span class="string">'/'</span>, {}, {<span class="symbol">:client_id</span> =&gt; settings.client_id, <span class="symbol">:private_key</span> =&gt; settings.private_key})</pre></div></div>
104
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
105
+ <span class="keyword">end</span></pre></div></div>
100
106
 
101
107
  </li>
102
108
 
@@ -107,12 +113,26 @@
107
113
  <div class="pilwrap ">
108
114
  <a class="pilcrow" href="#section-6">&#182;</a>
109
115
  </div>
110
- <p>construct list of files</p>
116
+ <p>check required variables</p>
117
+
118
+ </div>
119
+
120
+ <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?</pre></div></div>
121
+
122
+ </li>
123
+
124
+
125
+ <li id="section-7">
126
+ <div class="annotation">
127
+
128
+ <div class="pilwrap ">
129
+ <a class="pilcrow" href="#section-7">&#182;</a>
130
+ </div>
131
+ <p>make a request to API using client_id and private_key</p>
111
132
 
112
133
  </div>
113
134
 
114
- <div class="content"><div class='highlight'><pre> filelist = <span class="string">''</span>
115
- files_list.each { |element| filelist &lt;&lt; <span class="string">"<span class="subst">#{element.name}</span>&lt;br /&gt;"</span> }
135
+ <div class="content"><div class='highlight'><pre> user = <span class="constant">GroupDocs::User</span>.get!()
116
136
 
117
137
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
118
138
  err = e.message
@@ -121,17 +141,17 @@
121
141
  </li>
122
142
 
123
143
 
124
- <li id="section-7">
144
+ <li id="section-8">
125
145
  <div class="annotation">
126
146
 
127
147
  <div class="pilwrap ">
128
- <a class="pilcrow" href="#section-7">&#182;</a>
148
+ <a class="pilcrow" href="#section-8">&#182;</a>
129
149
  </div>
130
150
  <p>set variables for template</p>
131
151
 
132
152
  </div>
133
153
 
134
- <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample2</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:filelist</span> =&gt; filelist, <span class="symbol">:err</span> =&gt; err}
154
+ <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample01</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:user</span> =&gt; user, <span class="symbol">:err</span> =&gt; err}
135
155
  <span class="keyword">end</span></pre></div></div>
136
156
 
137
157
  </li>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <html>
4
4
  <head>
5
- <title>sample3.rb</title>
5
+ <title>sample02.rb</title>
6
6
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
7
7
  <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
8
8
  <link rel="stylesheet" media="all" href="docco.css" />
@@ -15,7 +15,7 @@
15
15
 
16
16
  <li id="title">
17
17
  <div class="annotation">
18
- <h1>sample3.rb</h1>
18
+ <h1>sample02.rb</h1>
19
19
  </div>
20
20
  </li>
21
21
 
@@ -31,8 +31,8 @@
31
31
 
32
32
  </div>
33
33
 
34
- <div class="content"><div class='highlight'><pre>get <span class="string">'/sample3'</span> <span class="keyword">do</span>
35
- haml <span class="symbol">:sample3</span>
34
+ <div class="content"><div class='highlight'><pre>get <span class="string">'/sample02'</span> <span class="keyword">do</span>
35
+ haml <span class="symbol">:sample02</span>
36
36
  <span class="keyword">end</span></pre></div></div>
37
37
 
38
38
  </li>
@@ -48,7 +48,7 @@
48
48
 
49
49
  </div>
50
50
 
51
- <div class="content"><div class='highlight'><pre>post <span class="string">'/sample3'</span> <span class="keyword">do</span></pre></div></div>
51
+ <div class="content"><div class='highlight'><pre>post <span class="string">'/sample02'</span> <span class="keyword">do</span></pre></div></div>
52
52
 
53
53
  </li>
54
54
 
@@ -59,14 +59,17 @@
59
59
  <div class="pilwrap ">
60
60
  <a class="pilcrow" href="#section-3">&#182;</a>
61
61
  </div>
62
- <p>set variables</p>
62
+ <p>Set variables</p>
63
63
 
64
64
  </div>
65
65
 
66
- <div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:client_id</span>]
67
- set <span class="symbol">:private_key</span>, params[<span class="symbol">:private_key</span>]
66
+ <div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>]
67
+ set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
68
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
68
69
 
69
- <span class="keyword">begin</span></pre></div></div>
70
+ <span class="keyword">begin</span>
71
+
72
+ <span class="keyword">if</span> settings.base_path.empty? <span class="keyword">then</span> settings.base_path = <span class="string">'https://api.groupdocs.com'</span> <span class="keyword">end</span></pre></div></div>
70
73
 
71
74
  </li>
72
75
 
@@ -77,11 +80,13 @@
77
80
  <div class="pilwrap ">
78
81
  <a class="pilcrow" href="#section-4">&#182;</a>
79
82
  </div>
80
- <p>check required variables</p>
83
+ <p>Configure your access to API server</p>
81
84
 
82
85
  </div>
83
86
 
84
- <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?</pre></div></div>
87
+ <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
88
+ groupdocs.client_id = settings.client_id
89
+ groupdocs.private_key = settings.private_key</pre></div></div>
85
90
 
86
91
  </li>
87
92
 
@@ -92,11 +97,12 @@
92
97
  <div class="pilwrap ">
93
98
  <a class="pilcrow" href="#section-5">&#182;</a>
94
99
  </div>
95
- <p>construct path</p>
100
+ <p>Optionally specify API server and version</p>
96
101
 
97
102
  </div>
98
103
 
99
- <div class="content"><div class='highlight'><pre> filepath = <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>
104
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
105
+ <span class="keyword">end</span></pre></div></div>
100
106
 
101
107
  </li>
102
108
 
@@ -107,11 +113,11 @@
107
113
  <div class="pilwrap ">
108
114
  <a class="pilcrow" href="#section-6">&#182;</a>
109
115
  </div>
110
- <p>open file</p>
116
+ <p>Check required variables</p>
111
117
 
112
118
  </div>
113
119
 
114
- <div class="content"><div class='highlight'><pre> <span class="constant">File</span>.open(filepath, <span class="string">'wb'</span>) { |f| f.write(params[<span class="symbol">:file</span>][<span class="symbol">:tempfile</span>].read) }</pre></div></div>
120
+ <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?</pre></div></div>
115
121
 
116
122
  </li>
117
123
 
@@ -122,11 +128,11 @@
122
128
  <div class="pilwrap ">
123
129
  <a class="pilcrow" href="#section-7">&#182;</a>
124
130
  </div>
125
- <p>make a request to API using client_id and private_key</p>
131
+ <p>Make a request to API using client_id and private_key</p>
126
132
 
127
133
  </div>
128
134
 
129
- <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(filepath, {}, <span class="symbol">client_id:</span> settings.client_id, <span class="symbol">private_key:</span> settings.private_key)</pre></div></div>
135
+ <div class="content"><div class='highlight'><pre> files_list = <span class="constant">GroupDocs::Storage::Folder</span>.list!(<span class="string">'/'</span>, {})</pre></div></div>
130
136
 
131
137
  </li>
132
138
 
@@ -137,12 +143,12 @@
137
143
  <div class="pilwrap ">
138
144
  <a class="pilcrow" href="#section-8">&#182;</a>
139
145
  </div>
140
- <p>result massages</p>
146
+ <p>Construct list of files</p>
141
147
 
142
148
  </div>
143
149
 
144
- <div class="content"><div class='highlight'><pre> massage = <span class="string">"&lt;p&gt;File was uploaded to GroupDocs. Here you can see your &lt;strong&gt;<span class="subst">#{params[<span class="symbol">:file</span>][<span class="symbol">:filename</span>]}</span>&lt;/strong&gt; file in the GroupDocs Embedded Viewer.&lt;/p&gt;"</span>
145
- iframe = <span class="string">"&lt;iframe src='https://apps.groupdocs.com/document-viewer/Embed/<span class="subst">#{file.guid}</span>' frameborder='0' width='720' height='600'&gt;&lt;/iframe&gt;"</span>
150
+ <div class="content"><div class='highlight'><pre> filelist = <span class="string">''</span>
151
+ files_list.each { |element| filelist &lt;&lt; <span class="string">"<span class="subst">#{element.name}</span>&lt;br /&gt;"</span> }
146
152
 
147
153
  <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
148
154
  err = e.message
@@ -157,11 +163,11 @@
157
163
  <div class="pilwrap ">
158
164
  <a class="pilcrow" href="#section-9">&#182;</a>
159
165
  </div>
160
- <p>set variables for template</p>
166
+ <p>Set variables for template</p>
161
167
 
162
168
  </div>
163
169
 
164
- <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample3</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:iframe</span> =&gt; iframe, <span class="symbol">:massage</span> =&gt; massage, <span class="symbol">:err</span> =&gt; err}
170
+ <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample02</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:filelist</span> =&gt; filelist, <span class="symbol">:err</span> =&gt; err}
165
171
  <span class="keyword">end</span></pre></div></div>
166
172
 
167
173
  </li>
@@ -0,0 +1,285 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <title>sample03.rb</title>
6
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
7
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
8
+ <link rel="stylesheet" media="all" href="docco.css" />
9
+ </head>
10
+ <body>
11
+ <div id="container">
12
+ <div id="background"></div>
13
+
14
+ <ul class="sections">
15
+
16
+ <li id="title">
17
+ <div class="annotation">
18
+ <h1>sample03.rb</h1>
19
+ </div>
20
+ </li>
21
+
22
+
23
+
24
+ <li id="section-1">
25
+ <div class="annotation">
26
+
27
+ <div class="pilwrap ">
28
+ <a class="pilcrow" href="#section-1">&#182;</a>
29
+ </div>
30
+ <p>GET request</p>
31
+
32
+ </div>
33
+
34
+ <div class="content"><div class='highlight'><pre>get <span class="string">'/sample03'</span> <span class="keyword">do</span>
35
+ haml <span class="symbol">:sample03</span>
36
+ <span class="keyword">end</span></pre></div></div>
37
+
38
+ </li>
39
+
40
+
41
+ <li id="section-2">
42
+ <div class="annotation">
43
+
44
+ <div class="pilwrap ">
45
+ <a class="pilcrow" href="#section-2">&#182;</a>
46
+ </div>
47
+ <p>POST request</p>
48
+
49
+ </div>
50
+
51
+ <div class="content"><div class='highlight'><pre>post <span class="string">'/sample03'</span> <span class="keyword">do</span></pre></div></div>
52
+
53
+ </li>
54
+
55
+
56
+ <li id="section-3">
57
+ <div class="annotation">
58
+
59
+ <div class="pilwrap ">
60
+ <a class="pilcrow" href="#section-3">&#182;</a>
61
+ </div>
62
+ <p>Set variables</p>
63
+
64
+ </div>
65
+
66
+ <div class="content"><div class='highlight'><pre> set <span class="symbol">:client_id</span>, params[<span class="symbol">:clientId</span>]
67
+ set <span class="symbol">:private_key</span>, params[<span class="symbol">:privateKey</span>]
68
+ set <span class="symbol">:source</span>, params[<span class="symbol">:source</span>]
69
+ set <span class="symbol">:url</span>, params[<span class="symbol">:url</span>]
70
+ set <span class="symbol">:folder_path</span>, params[<span class="symbol">:folderPath</span>]
71
+ set <span class="symbol">:callback</span>, params[<span class="symbol">:callback</span>]
72
+ set <span class="symbol">:base_path</span>, params[<span class="symbol">:basePath</span>]
73
+
74
+ <span class="keyword">begin</span></pre></div></div>
75
+
76
+ </li>
77
+
78
+
79
+ <li id="section-4">
80
+ <div class="annotation">
81
+
82
+ <div class="pilwrap ">
83
+ <a class="pilcrow" href="#section-4">&#182;</a>
84
+ </div>
85
+ <p>Check required variables</p>
86
+
87
+ </div>
88
+
89
+ <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?
90
+
91
+ <span class="keyword">if</span> settings.base_path.empty? <span class="keyword">then</span> settings.base_path = <span class="string">'https://api.groupdocs.com'</span> <span class="keyword">end</span></pre></div></div>
92
+
93
+ </li>
94
+
95
+
96
+ <li id="section-5">
97
+ <div class="annotation">
98
+
99
+ <div class="pilwrap ">
100
+ <a class="pilcrow" href="#section-5">&#182;</a>
101
+ </div>
102
+ <p>Configure your access to API server</p>
103
+
104
+ </div>
105
+
106
+ <div class="content"><div class='highlight'><pre> <span class="constant">GroupDocs</span>.configure <span class="keyword">do</span> |groupdocs|
107
+ groupdocs.client_id = settings.client_id
108
+ groupdocs.private_key = settings.private_key</pre></div></div>
109
+
110
+ </li>
111
+
112
+
113
+ <li id="section-6">
114
+ <div class="annotation">
115
+
116
+ <div class="pilwrap ">
117
+ <a class="pilcrow" href="#section-6">&#182;</a>
118
+ </div>
119
+ <p>Optionally specify API server and version</p>
120
+
121
+ </div>
122
+
123
+ <div class="content"><div class='highlight'><pre> groupdocs.api_server = settings.base_path <span class="comment"># default is 'https://api.groupdocs.com'</span>
124
+ <span class="keyword">end</span></pre></div></div>
125
+
126
+ </li>
127
+
128
+
129
+ <li id="section-7">
130
+ <div class="annotation">
131
+
132
+ <div class="pilwrap ">
133
+ <a class="pilcrow" href="#section-7">&#182;</a>
134
+ </div>
135
+ <p>Get document by file GUID</p>
136
+
137
+ </div>
138
+
139
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.source
140
+
141
+ <span class="keyword">when</span> <span class="string">'file'</span></pre></div></div>
142
+
143
+ </li>
144
+
145
+
146
+ <li id="section-8">
147
+ <div class="annotation">
148
+
149
+ <div class="pilwrap ">
150
+ <a class="pilcrow" href="#section-8">&#182;</a>
151
+ </div>
152
+ <p>Construct path</p>
153
+
154
+ </div>
155
+
156
+ <div class="content"><div class='highlight'><pre> filepath = <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>
157
+
158
+ </li>
159
+
160
+
161
+ <li id="section-9">
162
+ <div class="annotation">
163
+
164
+ <div class="pilwrap ">
165
+ <a class="pilcrow" href="#section-9">&#182;</a>
166
+ </div>
167
+ <p>Open file</p>
168
+
169
+ </div>
170
+
171
+ <div class="content"><div class='highlight'><pre> <span class="constant">File</span>.open(filepath, <span class="string">'wb'</span>) { |f| f.write(params[<span class="symbol">:file</span>][<span class="symbol">:tempfile</span>].read) }</pre></div></div>
172
+
173
+ </li>
174
+
175
+
176
+ <li id="section-10">
177
+ <div class="annotation">
178
+
179
+ <div class="pilwrap ">
180
+ <a class="pilcrow" href="#section-10">&#182;</a>
181
+ </div>
182
+ <p>Make a request to API using client_id and private_key</p>
183
+
184
+ </div>
185
+
186
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload!(filepath, {<span class="symbol">path:</span> settings.folder_path, <span class="symbol">callbackUrl:</span> settings.callback})
187
+
188
+ <span class="keyword">when</span> <span class="string">'url'</span></pre></div></div>
189
+
190
+ </li>
191
+
192
+
193
+ <li id="section-11">
194
+ <div class="annotation">
195
+
196
+ <div class="pilwrap ">
197
+ <a class="pilcrow" href="#section-11">&#182;</a>
198
+ </div>
199
+ <p>Upload file from defined url</p>
200
+
201
+ </div>
202
+
203
+ <div class="content"><div class='highlight'><pre> file = <span class="constant">GroupDocs::Storage::File</span>.upload_web!(settings.url)
204
+ <span class="keyword">else</span> raise <span class="string">'Wrong GUID source.'</span>
205
+ <span class="keyword">end</span></pre></div></div>
206
+
207
+ </li>
208
+
209
+
210
+ <li id="section-12">
211
+ <div class="annotation">
212
+
213
+ <div class="pilwrap ">
214
+ <a class="pilcrow" href="#section-12">&#182;</a>
215
+ </div>
216
+ <p>Get url from request</p>
217
+
218
+ </div>
219
+
220
+ <div class="content"><div class='highlight'><pre> <span class="keyword">case</span> settings.base_path
221
+
222
+ <span class="keyword">when</span> <span class="string">'https://stage-api-groupdocs.dynabic.com'</span>
223
+ url = <span class="string">"http://stage-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{file.guid}</span>"</span>
224
+ <span class="keyword">when</span> <span class="string">'https://dev-api-groupdocs.dynabic.com'</span>
225
+ url = <span class="string">"http://dev-apps-groupdocs.dynabic.com/document-viewer/embed/<span class="subst">#{file.guid}</span>"</span>
226
+ <span class="keyword">else</span>
227
+ url = <span class="string">"https://apps.groupdocs.com/document-viewer/embed/<span class="subst">#{file.guid}</span>"</span>
228
+ <span class="keyword">end</span></pre></div></div>
229
+
230
+ </li>
231
+
232
+
233
+ <li id="section-13">
234
+ <div class="annotation">
235
+
236
+ <div class="pilwrap ">
237
+ <a class="pilcrow" href="#section-13">&#182;</a>
238
+ </div>
239
+ <p>Add the signature in url</p>
240
+
241
+ </div>
242
+
243
+ <div class="content"><div class='highlight'><pre> url = <span class="constant">GroupDocs::Api::Request</span>.new(<span class="symbol">:path</span> =&gt; url).prepare_and_sign_url</pre></div></div>
244
+
245
+ </li>
246
+
247
+
248
+ <li id="section-14">
249
+ <div class="annotation">
250
+
251
+ <div class="pilwrap ">
252
+ <a class="pilcrow" href="#section-14">&#182;</a>
253
+ </div>
254
+ <p>Set iframe with document GUID</p>
255
+
256
+ </div>
257
+
258
+ <div class="content"><div class='highlight'><pre> iframe = <span class="string">"&lt;iframe src='<span class="subst">#{url}</span>' frameborder='0' width='720' height='600'&gt;&lt;/iframe&gt;"</span>
259
+
260
+ <span class="keyword">rescue</span> <span class="constant">Exception</span> =&gt; e
261
+ err = e.message
262
+ <span class="keyword">end</span></pre></div></div>
263
+
264
+ </li>
265
+
266
+
267
+ <li id="section-15">
268
+ <div class="annotation">
269
+
270
+ <div class="pilwrap ">
271
+ <a class="pilcrow" href="#section-15">&#182;</a>
272
+ </div>
273
+ <p>set variables for template</p>
274
+
275
+ </div>
276
+
277
+ <div class="content"><div class='highlight'><pre> haml <span class="symbol">:sample03</span>, <span class="symbol">:locals</span> =&gt; {<span class="symbol">:userId</span> =&gt; settings.client_id, <span class="symbol">:privateKey</span> =&gt; settings.private_key, <span class="symbol">:iframe</span> =&gt; iframe, <span class="symbol">:err</span> =&gt; err}
278
+ <span class="keyword">end</span></pre></div></div>
279
+
280
+ </li>
281
+
282
+ </ul>
283
+ </div>
284
+ </body>
285
+ </html>