groupdocs 1.9.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/CHANGELOG.md +13 -0
  2. data/README.md +1 -1
  3. data/examples/api-samples/Gemfile +1 -1
  4. data/examples/api-samples/Gemfile.lock +29 -23
  5. data/examples/api-samples/public/css/style.css +10 -2
  6. data/examples/api-samples/public/docs/sample11.html +11 -7
  7. data/examples/api-samples/samples/sample11.rb +4 -6
  8. data/examples/api-samples/views/_others_samples.haml +231 -91
  9. data/examples/api-samples/views/index.haml +230 -92
  10. data/examples/api-samples/views/sample07.haml +1 -1
  11. data/examples/api-samples/web.rb +1 -0
  12. data/groupdocs.gemspec +2 -2
  13. data/lib/groupdocs/api.rb +1 -0
  14. data/lib/groupdocs/document.rb +12 -0
  15. data/lib/groupdocs/document/annotation.rb +5 -0
  16. data/lib/groupdocs/document/annotation/marker.rb +1 -1
  17. data/lib/groupdocs/document/editor.rb +13 -1
  18. data/lib/groupdocs/document/metadata.rb +6 -0
  19. data/lib/groupdocs/document/option.rb +9 -0
  20. data/lib/groupdocs/signature/form.rb +4 -6
  21. data/lib/groupdocs/storage/file.rb +1 -2
  22. data/lib/groupdocs/version.rb +1 -1
  23. data/spec/groupdocs/api/helpers/access_rights_helper_spec.rb +3 -3
  24. data/spec/groupdocs/api/helpers/byte_flag_helper_spec.rb +2 -2
  25. data/spec/groupdocs/datasource_spec.rb +5 -46
  26. data/spec/groupdocs/document/annotation/reply_spec.rb +5 -5
  27. data/spec/groupdocs/document/annotation/reviewer_spec.rb +2 -2
  28. data/spec/groupdocs/document/annotation_spec.rb +11 -43
  29. data/spec/groupdocs/document_spec.rb +61 -298
  30. data/spec/groupdocs/job_spec.rb +20 -74
  31. data/spec/groupdocs/questionnaire/collector_spec.rb +8 -8
  32. data/spec/groupdocs/questionnaire/execution_spec.rb +6 -6
  33. data/spec/groupdocs/questionnaire_spec.rb +28 -58
  34. data/spec/groupdocs/signature/contact_spec.rb +7 -7
  35. data/spec/groupdocs/signature/envelope_spec.rb +30 -34
  36. data/spec/groupdocs/signature/field_spec.rb +5 -5
  37. data/spec/groupdocs/signature/form_spec.rb +28 -16
  38. data/spec/groupdocs/signature/list_spec.rb +3 -3
  39. data/spec/groupdocs/signature/role_spec.rb +2 -2
  40. data/spec/groupdocs/signature/template_spec.rb +4 -4
  41. data/spec/groupdocs/signature_spec.rb +7 -20
  42. data/spec/groupdocs/storage/file_spec.rb +24 -80
  43. data/spec/groupdocs/storage/folder_spec.rb +14 -14
  44. data/spec/groupdocs/storage/package_spec.rb +2 -2
  45. data/spec/groupdocs/storage_spec.rb +1 -1
  46. data/spec/groupdocs/subscription_spec.rb +4 -123
  47. data/spec/groupdocs/user_spec.rb +14 -243
  48. data/spec/spec_helper.rb +4 -0
  49. data/spec/support/json/annotation_marker_move.json +11 -0
  50. data/spec/support/json/envelope_recipient_add.json +27 -0
  51. data/spec/support/json/job_documents.json +35 -103
  52. data/spec/support/shared_examples/signature/shared/document_methods.rb +4 -4
  53. data/spec/support/shared_examples/signature/shared/entity_methods.rb +10 -10
  54. data/spec/support/shared_examples/signature/shared/field_methods.rb +14 -18
  55. data/spec/support/shared_examples/signature/shared/recipient_methods.rb +3 -3
  56. data/spec/support/shared_examples/signature/shared/resource_methods.rb +2 -2
  57. metadata +13 -7
@@ -12,7 +12,7 @@ describe GroupDocs::User do
12
12
  it 'accepts access credentials hash' do
13
13
  lambda do
14
14
  described_class.get!(:client_id => 'client_id', :private_key => 'private_key')
15
- end.should_not raise_error(ArgumentError)
15
+ end.should_not raise_error()
16
16
  end
17
17
 
18
18
  it 'returns GroupDocs::User object' do
@@ -30,7 +30,7 @@ describe GroupDocs::User do
30
30
  it 'accepts access credentials hash' do
31
31
  lambda do
32
32
  described_class.update_account!(user, :client_id => 'client_id', :private_key => 'private_key')
33
- end.should_not raise_error(ArgumentError)
33
+ end.should_not raise_error()
34
34
  end
35
35
 
36
36
  it 'raises error if user is not an instance of GroupDocs::User' do
@@ -52,7 +52,7 @@ describe GroupDocs::User do
52
52
  it 'accepts access credentials hash' do
53
53
  lambda do
54
54
  described_class.delete!(user, :client_id => 'client_id', :private_key => 'private_key')
55
- end.should_not raise_error(ArgumentError)
55
+ end.should_not raise_error()
56
56
  end
57
57
 
58
58
  it 'raises error if user is not an instance of GroupDocs::User' do
@@ -72,7 +72,7 @@ describe GroupDocs::User do
72
72
  it 'accepts access credentials hash' do
73
73
  lambda do
74
74
  described_class.generate_embed_key!('test-area', :client_id => 'client_id', :private_key => 'private_key')
75
- end.should_not raise_error(ArgumentError)
75
+ end.should_not raise_error()
76
76
  end
77
77
 
78
78
  it 'returns new user embed key for defined area' do
@@ -88,7 +88,7 @@ describe GroupDocs::User do
88
88
  it 'accepts access credentials hash' do
89
89
  lambda do
90
90
  described_class.get_embed_key!('test-area', :client_id => 'client_id', :private_key => 'private_key')
91
- end.should_not raise_error(ArgumentError)
91
+ end.should_not raise_error()
92
92
  end
93
93
 
94
94
  it 'returns user embed key for defined area' do
@@ -104,7 +104,7 @@ describe GroupDocs::User do
104
104
  it 'accepts access credentials hash' do
105
105
  lambda do
106
106
  described_class.area!('60a06eg8f23a49cf807977f1444fbdd8', :client_id => 'client_id', :private_key => 'private_key')
107
- end.should_not raise_error(ArgumentError)
107
+ end.should_not raise_error()
108
108
  end
109
109
 
110
110
  it 'returns area name by defined embed key' do
@@ -120,7 +120,7 @@ describe GroupDocs::User do
120
120
  it 'accepts access credentials hash' do
121
121
  lambda do
122
122
  described_class.providers!(:client_id => 'client_id', :private_key => 'private_key')
123
- end.should_not raise_error(ArgumentError)
123
+ end.should_not raise_error()
124
124
  end
125
125
 
126
126
  it 'returns array of GroupDocs::Storage::Provider' do
@@ -140,7 +140,7 @@ describe GroupDocs::User do
140
140
  it 'works without access credentials hash' do
141
141
  lambda do
142
142
  described_class.login!('doe@john.com', 'password')
143
- end.should_not raise_error(ArgumentError)
143
+ end.should_not raise_error()
144
144
  end
145
145
 
146
146
  it 'returns GroupDocs::User object' do
@@ -177,7 +177,7 @@ describe GroupDocs::User do
177
177
  describe '#access_rights' do
178
178
  it 'returns rights in human-readable format' do
179
179
  subject.instance_variable_set(:@access_rights, 46)
180
- subject.access_rights.should =~ [ :view, :annotate, :download, :export, :all]
180
+ subject.access_rights.should =~ [:view, :annotate, :download, :export, :all]
181
181
  end
182
182
  end
183
183
 
@@ -188,8 +188,8 @@ describe GroupDocs::User do
188
188
  end
189
189
 
190
190
  it 'does nothing if not array is passed' do
191
- subject.access_rights = 15
192
- subject.instance_variable_get(:@access_rights).should == 15
191
+ subject.access_rights = 46
192
+ subject.instance_variable_get(:@access_rights).should == 46
193
193
  end
194
194
  end
195
195
 
@@ -208,7 +208,7 @@ describe GroupDocs::User do
208
208
  it 'accepts access credentials hash' do
209
209
  lambda do
210
210
  subject.update!(:client_id => 'client_id', :private_key => 'private_key')
211
- end.should_not raise_error(ArgumentError)
211
+ end.should_not raise_error()
212
212
  end
213
213
 
214
214
  it 'uses hashed version of self as request body' do
@@ -225,7 +225,7 @@ describe GroupDocs::User do
225
225
  it 'accepts access credentials hash' do
226
226
  lambda do
227
227
  subject.users!(:client_id => 'client_id', :private_key => 'private_key')
228
- end.should_not raise_error(ArgumentError)
228
+ end.should_not raise_error()
229
229
  end
230
230
 
231
231
  it 'returns array of GroupDocs::User objects' do
@@ -245,7 +245,7 @@ describe GroupDocs::User do
245
245
  it 'accepts access credentials hash' do
246
246
  lambda do
247
247
  subject.roles!(:client_id => 'client_id', :private_key => 'private_key')
248
- end.should_not raise_error(ArgumentError)
248
+ end.should_not raise_error()
249
249
  end
250
250
 
251
251
  it 'returns array' do
@@ -254,233 +254,4 @@ describe GroupDocs::User do
254
254
  end
255
255
  end
256
256
 
257
- describe '.update_password!' do
258
- before(:each) do
259
- mock_api_server('{ "result": { "user_guid": "s8dfts8" }, "status": "Ok" }')
260
- end
261
-
262
- it 'accepts access credentials hash' do
263
- lambda do
264
- subject.update_password!(:client_id => 'client_id', :private_key => 'private_key')
265
- end.should_not raise_error(ArgumentError)
266
- end
267
-
268
- it 'works without access credentials hash' do
269
- lambda do
270
- described_class.update_password!('doe@john.com', 'password')
271
- end.should_not raise_error(ArgumentError)
272
- end
273
- end
274
-
275
- describe '.reset_token!' do
276
- before(:each) do
277
- mock_api_server('{ "result": { "user": "s8dfts8" }, "status": "Ok" }')
278
- end
279
-
280
- it 'accepts access credentials hash' do
281
- lambda do
282
- subject.reset_token!(:client_id => 'client_id', :private_key => 'private_key')
283
- end.should_not raise_error(ArgumentError)
284
- end
285
-
286
- it 'accepts options credentials hash' do
287
- lambda do
288
- subject.reset_token!(:token => 'test')
289
- end.should_not raise_error(ArgumentError)
290
- end
291
- end
292
-
293
- describe '.verif_token!' do
294
- before(:each) do
295
- mock_api_server('{ "result": { "user": "s8dfts8" }, "status": "Ok" }')
296
- end
297
-
298
- it 'accepts access credentials hash' do
299
- lambda do
300
- subject.verif_token!(:client_id => 'client_id', :private_key => 'private_key')
301
- end.should_not raise_error(ArgumentError)
302
- end
303
-
304
- it 'accepts options credentials hash' do
305
- lambda do
306
- subject.verif_token!(:token => 'test')
307
- end.should_not raise_error(ArgumentError)
308
- end
309
- end
310
-
311
- describe '.claimed_token!' do
312
- before(:each) do
313
- mock_api_server('{ "result": { "user": "s8dfts8" }, "status": "Ok" }')
314
- end
315
-
316
- it 'accepts access credentials hash' do
317
- lambda do
318
- subject.claimed_token!(:client_id => 'client_id', :private_key => 'private_key')
319
- end.should_not raise_error(ArgumentError)
320
- end
321
-
322
- it 'accepts options credentials hash' do
323
- lambda do
324
- subject.claimed_token!(:token => 'test')
325
- end.should_not raise_error(ArgumentError)
326
- end
327
- end
328
-
329
- describe '.get_profile!' do
330
- before(:each) do
331
- mock_api_server(load_json('user_get_profile'))
332
- end
333
-
334
- it 'accepts access credentials hash' do
335
- lambda do
336
- subject.get_profile!(:client_id => 'client_id', :private_key => 'private_key')
337
- end.should_not raise_error(ArgumentError)
338
- end
339
-
340
- end
341
-
342
- describe '#update_profile!' do
343
- before(:each) do
344
- mock_api_server(load_json('user_get_profile'))
345
- end
346
-
347
- it 'accepts access credentials hash' do
348
- lambda do
349
- subject.update_profile!(:client_id => 'client_id', :private_key => 'private_key')
350
- end.should_not raise_error(ArgumentError)
351
- end
352
- end
353
-
354
- describe '#create_user!' do
355
- before(:each) do
356
- mock_api_server(load_json('user_get_profile'))
357
- end
358
-
359
- it 'accepts access credentials hash' do
360
- lambda do
361
- subject.users!(:client_id => 'client_id', :private_key => 'private_key')
362
- end.should_not raise_error(ArgumentError)
363
- end
364
- end
365
-
366
- describe '.create_login!' do
367
- before(:each) do
368
- mock_api_server(load_json('user_get_profile'))
369
- end
370
-
371
- it 'accepts access credentials hash' do
372
- lambda do
373
- subject.users!(:client_id => 'client_id', :private_key => 'private_key')
374
- end.should_not raise_error(ArgumentError)
375
- end
376
- end
377
-
378
- describe '.update_alien_password!' do
379
- before(:each) do
380
- mock_api_server('{ "result": { "user_guid": "s8dfts8" }, "status": "Ok" }')
381
- end
382
-
383
- it 'accepts access credentials hash' do
384
- lambda do
385
- subject.update_alien_password!(:client_id => 'client_id', :private_key => 'private_key')
386
- end.should_not raise_error(ArgumentError)
387
- end
388
- end
389
-
390
- describe '.reset_alien_password!' do
391
- before(:each) do
392
- mock_api_server('{ "result": { "user_name": "s8dfts8" }, "status": "Ok" }')
393
- end
394
-
395
- it 'accepts access credentials hash' do
396
- lambda do
397
- subject.reset_alien_password!(:client_id => 'client_id', :private_key => 'private_key')
398
- end.should_not raise_error(ArgumentError)
399
- end
400
- end
401
-
402
- describe '#update_provider!' do
403
- before(:each) do
404
- mock_api_server(load_json('user_providers'))
405
- end
406
-
407
- it 'accepts access credentials hash' do
408
- lambda do
409
- subject.update_provider!(:client_id => 'client_id', :private_key => 'private_key')
410
- end.should_not raise_error(ArgumentError)
411
- end
412
- end
413
-
414
- describe '#add_provider!' do
415
- before(:each) do
416
- mock_api_server(load_json('user_providers'))
417
- end
418
-
419
- it 'accepts access credentials hash' do
420
- lambda do
421
- subject.add_provider!(:client_id => 'client_id', :private_key => 'private_key')
422
- end.should_not raise_error(ArgumentError)
423
- end
424
- end
425
-
426
- describe '#user_roles!' do
427
- before(:each) do
428
- mock_api_server(load_json('user_roles'))
429
- end
430
-
431
- it 'accepts access credentials hash' do
432
- lambda do
433
- subject.user_roles!(:client_id => 'client_id', :private_key => 'private_key')
434
- end.should_not raise_error(ArgumentError)
435
- end
436
- end
437
-
438
- describe '#set_user_roles!' do
439
- before(:each) do
440
- mock_api_server('{ "result": {}, "status": "Ok" }')
441
- end
442
-
443
- it 'accepts access credentials hash' do
444
- lambda do
445
- subject.set_user_roles!(:client_id => 'client_id', :private_key => 'private_key')
446
- end.should_not raise_error(ArgumentError)
447
- end
448
- end
449
-
450
- describe '#get_account!' do
451
- before(:each) do
452
- mock_api_server('{ "result": {}, "status": "Ok" }')
453
- end
454
-
455
- it 'accepts access credentials hash' do
456
- lambda do
457
- subject.get_account!(:client_id => 'client_id', :private_key => 'private_key')
458
- end.should_not raise_error(ArgumentError)
459
- end
460
- end
461
-
462
- describe '#remove_account!' do
463
- before(:each) do
464
- mock_api_server('{ "result": {}, "status": "Ok" }')
465
- end
466
-
467
- it 'accepts access credentials hash' do
468
- lambda do
469
- subject.remove_account!(:client_id => 'client_id', :private_key => 'private_key')
470
- end.should_not raise_error(ArgumentError)
471
- end
472
- end
473
-
474
- describe '.download!' do
475
- before(:each) do
476
- mock_api_server('{ "result": {}, "status": "Ok" }')
477
- end
478
-
479
- it 'accepts access credentials hash' do
480
- lambda do
481
- subject.download!(:filename => 'test.txt', :render => 2)
482
- end.should_not raise_error(ArgumentError)
483
- end
484
- end
485
-
486
257
  end
@@ -44,6 +44,10 @@ RSpec.configure do |spec|
44
44
  end
45
45
  end
46
46
 
47
+ RSpec.configure do |c|
48
+ c.deprecation_stream = File.open('deprecations.txt', 'w')
49
+ end
50
+
47
51
 
48
52
  #
49
53
  # Mocks JSON response.
@@ -0,0 +1,11 @@
1
+ {
2
+ "result": {
3
+
4
+ "width": "500",
5
+ "height": "600"
6
+
7
+ },
8
+ "status": "Ok",
9
+ "error_message": null,
10
+ "composedOn": 1380187729272
11
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "result": {
3
+ "envelopeId":"5acc689f18adf71cfd6c19574dc8590b",
4
+ "recipient": {
5
+ "comment":null,
6
+ "delegatedRecipientId":null,
7
+ "email":"3skif9@mail.ru",
8
+ "embedUrl":"",
9
+ "firstName":"evgen",
10
+ "id":"e143ad6ac2517ac14e79d38bcb80c5cf",
11
+ "lastName":"efimov",
12
+ "order":0,
13
+ "roleId":2,
14
+ "signatureBrowser":null,
15
+ "signatureFingerprint":null,
16
+ "signatureHost":null,
17
+ "signatureLocation":null,
18
+ "status":0,
19
+ "statusDateTime":"",
20
+ "statusMessage":null,
21
+ "userGuid":"380e5376c6e21cb8"
22
+ }
23
+ },
24
+ "status": "Ok",
25
+ "error_message": null,
26
+ "composedOn": 1381925965056
27
+ }
@@ -1,108 +1,40 @@
1
1
  {
2
- "result": {
3
- "count": 604,
4
- "entries": [
2
+ "result":
3
+ {
4
+ "job_status": "Archived",
5
+ "inputs":
6
+ [
7
+ {
8
+ "status": "InProgress",
9
+ "output_formats": "pdf",
10
+ "outputs":
11
+ [
5
12
  {
6
- "inputs": [
7
- {
8
- "status": "Processed",
9
- "proc_date": 1364978283767,
10
- "output_formats": "jpg",
11
- "outputs": [
12
- {
13
- "error": null,
14
- "name": null,
15
- "version": null,
16
- "size": 0,
17
- "type": "Cells",
18
- "type_str": "Cells",
19
- "file_type_str": "Jpg",
20
- "document_path": null,
21
- "access": "Private",
22
- "url": null,
23
- "file_type": "Jpg",
24
- "id": 0,
25
- "guid": null
26
- }
27
- ],
28
- "job_errors": [
29
- {
30
- "job_id": 17205,
31
- "original_document_id": 60804,
32
- "error_code": -1,
33
- "expected_format": "xml"
34
- }
35
- ],
36
- "actions": "View",
37
- "supported_output_file_types": null,
38
- "name": "GroupDocs_Signature_Demo.pdf",
39
- "version": 9,
40
- "size": 1132663,
41
- "type": "Pdf",
42
- "type_str": "Pdf",
43
- "file_type_str": "Pdf",
44
- "document_path": "samples/signature\\GroupDocs_Signature_Demo.pdf",
45
- "access": "Private",
46
- "url": "https://api.groupdocs.com/v2.0/shared/files/7bddf6878cde223426abf285c7d7d320bbcb476d3fcc9778049daea044322038",
47
- "file_type": "Pdf",
48
- "id": 60804,
49
- "guid": "7bddf6878cde223426abf285c7d7d320bbcb476d3fcc9778049daea044322038"
50
- }
51
- ],
52
- "outputs": null
53
- },
13
+ "ftype": 19,
14
+ "error": null,
15
+ "url": "http://groupdocs.com",
16
+ "name": "Test.pdf"
17
+ }
18
+ ],
19
+ "id": 123
20
+ },
21
+ {
22
+ "status": "Scheduled",
23
+ "output_formats": "tiff",
24
+ "outputs":
25
+ [
54
26
  {
55
- "inputs": [
56
- {
57
- "status": "Processed",
58
- "proc_date": 1364994080143,
59
- "output_formats": "jpg",
60
- "outputs": [
61
- {
62
- "error": null,
63
- "name": null,
64
- "version": null,
65
- "size": 0,
66
- "type": "Cells",
67
- "type_str": "Cells",
68
- "file_type_str": "Jpg",
69
- "document_path": null,
70
- "access": "Private",
71
- "url": null,
72
- "file_type": "Jpg",
73
- "id": 0,
74
- "guid": null
75
- }
76
- ],
77
- "job_errors": [
78
- {
79
- "job_id": 17266,
80
- "original_document_id": 60804,
81
- "error_code": -1,
82
- "expected_format": "xml"
83
- }
84
- ],
85
- "actions": "View",
86
- "supported_output_file_types": null,
87
- "name": "GroupDocs_Signature_Demo.pdf",
88
- "version": 9,
89
- "size": 1132663,
90
- "type": "Pdf",
91
- "type_str": "Pdf",
92
- "file_type_str": "Pdf",
93
- "document_path": "samples/signature\\GroupDocs_Signature_Demo.pdf",
94
- "access": "Private",
95
- "url": "https://api.groupdocs.com/v2.0/shared/files/7bddf6878cde223426abf285c7d7d320bbcb476d3fcc9778049daea044322038",
96
- "file_type": "Pdf",
97
- "id": 60804,
98
- "guid": "7bddf6878cde223426abf285c7d7d320bbcb476d3fcc9778049daea044322038"
99
- }
100
- ],
101
- "outputs": null
27
+ "ftype": 15,
28
+ "error": null,
29
+ "url": "http://groupdocs.com",
30
+ "name": "CV.doc"
102
31
  }
103
- ]
32
+ ],
33
+ "id": 345
34
+ }
35
+ ],
36
+ "outputs": null
104
37
  },
105
- "status": "Ok",
106
- "error_message": null,
107
- "composedOn": 1380265154451
108
- }
38
+ "status": "Ok",
39
+ "error_message": null
40
+ }