groupdocs 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/.travis.yml +5 -0
  2. data/Gemfile +3 -0
  3. data/README.md +141 -0
  4. data/Rakefile +9 -0
  5. data/groupdocs.gemspec +28 -0
  6. data/lib/groupdocs.rb +53 -0
  7. data/lib/groupdocs/api.rb +3 -0
  8. data/lib/groupdocs/api/entity.rb +113 -0
  9. data/lib/groupdocs/api/helpers.rb +5 -0
  10. data/lib/groupdocs/api/helpers/access_helper.rb +56 -0
  11. data/lib/groupdocs/api/helpers/actions_helper.rb +48 -0
  12. data/lib/groupdocs/api/helpers/rest_helper.rb +89 -0
  13. data/lib/groupdocs/api/helpers/status_helper.rb +48 -0
  14. data/lib/groupdocs/api/helpers/url_helper.rb +89 -0
  15. data/lib/groupdocs/api/request.rb +73 -0
  16. data/lib/groupdocs/api/sugar/lookup.rb +48 -0
  17. data/lib/groupdocs/datasource.rb +162 -0
  18. data/lib/groupdocs/datasource/field.rb +44 -0
  19. data/lib/groupdocs/document.rb +513 -0
  20. data/lib/groupdocs/document/annotation.rb +215 -0
  21. data/lib/groupdocs/document/annotation/reply.rb +167 -0
  22. data/lib/groupdocs/document/change.rb +35 -0
  23. data/lib/groupdocs/document/field.rb +27 -0
  24. data/lib/groupdocs/document/metadata.rb +26 -0
  25. data/lib/groupdocs/document/rectangle.rb +24 -0
  26. data/lib/groupdocs/document/view.rb +36 -0
  27. data/lib/groupdocs/errors.rb +10 -0
  28. data/lib/groupdocs/job.rb +201 -0
  29. data/lib/groupdocs/questionnaire.rb +221 -0
  30. data/lib/groupdocs/questionnaire/execution.rb +120 -0
  31. data/lib/groupdocs/questionnaire/page.rb +43 -0
  32. data/lib/groupdocs/questionnaire/question.rb +75 -0
  33. data/lib/groupdocs/questionnaire/question/answer.rb +10 -0
  34. data/lib/groupdocs/storage.rb +37 -0
  35. data/lib/groupdocs/storage/file.rb +248 -0
  36. data/lib/groupdocs/storage/folder.rb +314 -0
  37. data/lib/groupdocs/storage/package.rb +42 -0
  38. data/lib/groupdocs/user.rb +50 -0
  39. data/lib/groupdocs/version.rb +3 -0
  40. data/spec/groupdocs/api/entity_spec.rb +54 -0
  41. data/spec/groupdocs/api/helpers/access_helper_spec.rb +89 -0
  42. data/spec/groupdocs/api/helpers/actions_helper_spec.rb +51 -0
  43. data/spec/groupdocs/api/helpers/rest_helper_spec.rb +187 -0
  44. data/spec/groupdocs/api/helpers/status_helper_spec.rb +85 -0
  45. data/spec/groupdocs/api/helpers/url_helper_spec.rb +93 -0
  46. data/spec/groupdocs/api/request_spec.rb +85 -0
  47. data/spec/groupdocs/datasource/field_spec.rb +50 -0
  48. data/spec/groupdocs/datasource_spec.rb +156 -0
  49. data/spec/groupdocs/document/annotation/reply_spec.rb +179 -0
  50. data/spec/groupdocs/document/annotation_spec.rb +226 -0
  51. data/spec/groupdocs/document/change_spec.rb +35 -0
  52. data/spec/groupdocs/document/field_spec.rb +31 -0
  53. data/spec/groupdocs/document/metadata_spec.rb +26 -0
  54. data/spec/groupdocs/document/rectangle_spec.rb +34 -0
  55. data/spec/groupdocs/document/view_spec.rb +36 -0
  56. data/spec/groupdocs/document_spec.rb +509 -0
  57. data/spec/groupdocs/errors_spec.rb +7 -0
  58. data/spec/groupdocs/job_spec.rb +196 -0
  59. data/spec/groupdocs/questionnaire/execution_spec.rb +136 -0
  60. data/spec/groupdocs/questionnaire/page_spec.rb +50 -0
  61. data/spec/groupdocs/questionnaire/question/answer_spec.rb +11 -0
  62. data/spec/groupdocs/questionnaire/question_spec.rb +84 -0
  63. data/spec/groupdocs/questionnaire_spec.rb +217 -0
  64. data/spec/groupdocs/storage/file_spec.rb +242 -0
  65. data/spec/groupdocs/storage/folder_spec.rb +310 -0
  66. data/spec/groupdocs/storage/package_spec.rb +41 -0
  67. data/spec/groupdocs/storage_spec.rb +27 -0
  68. data/spec/groupdocs/user_spec.rb +53 -0
  69. data/spec/groupdocs_spec.rb +56 -0
  70. data/spec/spec_helper.rb +46 -0
  71. data/spec/support/files/resume.pdf +0 -0
  72. data/spec/support/json/annotation_collaborators_set.json +16 -0
  73. data/spec/support/json/annotation_create.json +12 -0
  74. data/spec/support/json/annotation_list.json +32 -0
  75. data/spec/support/json/annotation_remove.json +9 -0
  76. data/spec/support/json/annotation_replies_create.json +9 -0
  77. data/spec/support/json/annotation_replies_get.json +25 -0
  78. data/spec/support/json/comparison_changes.json +46 -0
  79. data/spec/support/json/comparison_compare.json +8 -0
  80. data/spec/support/json/comparison_document.json +10 -0
  81. data/spec/support/json/datasource_add.json +8 -0
  82. data/spec/support/json/datasource_get.json +22 -0
  83. data/spec/support/json/datasource_remove.json +8 -0
  84. data/spec/support/json/datasource_update.json +8 -0
  85. data/spec/support/json/document_access_info_get.json +14 -0
  86. data/spec/support/json/document_convert.json +8 -0
  87. data/spec/support/json/document_datasource.json +10 -0
  88. data/spec/support/json/document_fields.json +34 -0
  89. data/spec/support/json/document_formats.json +8 -0
  90. data/spec/support/json/document_metadata.json +15 -0
  91. data/spec/support/json/document_questionnaire_create.json +9 -0
  92. data/spec/support/json/document_questionnaires.json +23 -0
  93. data/spec/support/json/document_sharers_remove.json +8 -0
  94. data/spec/support/json/document_sharers_set.json +16 -0
  95. data/spec/support/json/document_views.json +32 -0
  96. data/spec/support/json/file_compress.json +8 -0
  97. data/spec/support/json/file_copy.json +14 -0
  98. data/spec/support/json/file_delete.json +5 -0
  99. data/spec/support/json/file_move.json +14 -0
  100. data/spec/support/json/file_upload.json +8 -0
  101. data/spec/support/json/folder_create.json +8 -0
  102. data/spec/support/json/folder_delete.json +5 -0
  103. data/spec/support/json/folder_list.json +21 -0
  104. data/spec/support/json/folder_move.json +8 -0
  105. data/spec/support/json/folder_sharers_get.json +16 -0
  106. data/spec/support/json/folder_sharers_remove.json +8 -0
  107. data/spec/support/json/folder_sharers_set.json +16 -0
  108. data/spec/support/json/job_add_url.json +8 -0
  109. data/spec/support/json/job_create.json +8 -0
  110. data/spec/support/json/job_documents.json +39 -0
  111. data/spec/support/json/job_file_add.json +8 -0
  112. data/spec/support/json/job_update.json +7 -0
  113. data/spec/support/json/jobs_get.json +52 -0
  114. data/spec/support/json/package_create.json +7 -0
  115. data/spec/support/json/questionnaire_create.json +8 -0
  116. data/spec/support/json/questionnaire_datasources.json +26 -0
  117. data/spec/support/json/questionnaire_execution_create.json +9 -0
  118. data/spec/support/json/questionnaire_execution_status_set.json +8 -0
  119. data/spec/support/json/questionnaire_execution_update.json +8 -0
  120. data/spec/support/json/questionnaire_executions.json +24 -0
  121. data/spec/support/json/questionnaire_get.json +14 -0
  122. data/spec/support/json/questionnaire_remove.json +8 -0
  123. data/spec/support/json/questionnaire_update.json +8 -0
  124. data/spec/support/json/questionnaires_get.json +22 -0
  125. data/spec/support/json/storage_info.json +10 -0
  126. data/spec/support/shared_examples/api/entity.rb +37 -0
  127. data/spec/support/shared_examples/api/helpers/status_helper.rb +12 -0
  128. data/spec/support/shared_examples/api/sugar/lookup.rb +57 -0
  129. metadata +356 -0
@@ -0,0 +1,46 @@
1
+ require 'simplecov'
2
+ SimpleCov.configure do
3
+ add_filter('spec/')
4
+ add_filter('vendor/')
5
+ end
6
+ SimpleCov.start
7
+
8
+ require 'webmock/rspec'
9
+ require 'groupdocs'
10
+
11
+ # shared examples
12
+ Dir['spec/support/shared_examples/**/*.rb'].each { |file| file = file.sub(/spec\//, ''); require file }
13
+
14
+ RSpec.configure do |spec|
15
+ spec.before(:all) do
16
+ GroupDocs.configure do |groupdocs|
17
+ groupdocs.client_id = '07aaaf95f8eb33a4'
18
+ groupdocs.private_key = '5cb711b3a52ffc5d90ee8a0f79206f5a'
19
+ groupdocs.api_version = '2.0'
20
+ end
21
+ end
22
+ end
23
+
24
+
25
+ #
26
+ # Mocks JSON response.
27
+ #
28
+ def mock_response(json)
29
+ subject.response = json
30
+ end
31
+
32
+ #
33
+ # Mocks API server.
34
+ #
35
+ def mock_api_server(json, headers = {})
36
+ request = stub_request(:any, /#{GroupDocs.api_server}.*/)
37
+ request = request.with(headers: headers) unless headers.empty?
38
+ request.to_return(body: json)
39
+ end
40
+
41
+ #
42
+ # Loads JSON file.
43
+ #
44
+ def load_json(name)
45
+ File.read("spec/support/json/#{name}.json")
46
+ end
@@ -0,0 +1,16 @@
1
+ {
2
+ "result":
3
+ {
4
+ "collaborators":
5
+ [
6
+ {
7
+ "primary_email": "test1@email.com"
8
+ },
9
+ {
10
+ "primary_email": "test2@email.com"
11
+ }
12
+ ]
13
+ },
14
+ "status": "Ok",
15
+ "error_message": null
16
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "result":
3
+ {
4
+ "id": 1,
5
+ "documentGuid": "30c799ca61866ff6121eb397e4f51659317b8befb682d9da4d85e540ac6849ba",
6
+ "annotationGuid": "44656ecedd3ff906",
7
+ "replyGuid": null,
8
+ "sessionGuid": "fe17dc12144a3f4e"
9
+ },
10
+ "status": "Ok",
11
+ "error_message": null
12
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "result":
3
+ {
4
+ "sessionGuid": 3,
5
+ "annotations":
6
+ [
7
+ {
8
+ "guid": "81ff0db3df8347fb",
9
+ "documentGuid": null,
10
+ "sessionGuid": null,
11
+ "box":
12
+ {
13
+ "X": 0.8938259,
14
+ "Y": 0.31941694,
15
+ "Width": 0.0457534268,
16
+ "Height": 0.01388945
17
+ },
18
+ "annotationPosition":
19
+ {
20
+ "X": null,
21
+ "Y": null
22
+ },
23
+ "type": 0,
24
+ "access":null,
25
+ "createdOn": 1334028956687,
26
+ "replies": []
27
+ }
28
+ ]
29
+ },
30
+ "status": "Ok",
31
+ "error_message": null
32
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "result":
3
+ {
4
+ "id": 1,
5
+ "guid": "44656ecedd3ff906"
6
+ },
7
+ "status": "Ok",
8
+ "error_message": null
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "result":
3
+ {
4
+ "annotationGuid": "44656ecedd3ff906",
5
+ "replyGuid": "0ee8bacd"
6
+ },
7
+ "status": "Ok",
8
+ "error_message": null
9
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "result":
3
+ {
4
+ "annotationGuid": "44656ecedd3ff906",
5
+ "replies":
6
+ [
7
+ {
8
+ "guid": "0ee8bacd",
9
+ "userGuid": "8f3b68ed784b2702",
10
+ "userName": "test@test.com",
11
+ "text": "Test reply 1",
12
+ "repliedOn": 1334124512797
13
+ },
14
+ {
15
+ "guid": "d27350b6",
16
+ "userGuid": "8f3b68ed784b2702",
17
+ "userName": "test@test.com",
18
+ "text": "Test reply 2",
19
+ "repliedOn": 1334124571640
20
+ }
21
+ ]
22
+ },
23
+ "status": "Ok",
24
+ "error_message": null
25
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "result":
3
+ {
4
+ "changes":
5
+ [
6
+ {
7
+ "id": 1,
8
+ "type": "delete",
9
+ "page":
10
+ {
11
+ "id": 1,
12
+ "width": 612,
13
+ "height": 792
14
+ },
15
+ "box":
16
+ {
17
+ "X": 0.8938259,
18
+ "Y": 0.31941694,
19
+ "Width": 0.0457534268,
20
+ "Height": 0.01388945
21
+ },
22
+ "text": "This part was deleted"
23
+ },
24
+ {
25
+ "id": 2,
26
+ "type": "insert",
27
+ "page":
28
+ {
29
+ "id": 2,
30
+ "width": 612,
31
+ "height": 792
32
+ },
33
+ "box":
34
+ {
35
+ "X": 0.34985,
36
+ "Y": 0.3476543,
37
+ "Width": 0.2374,
38
+ "Height": 0.4765943
39
+ },
40
+ "text": "This part was inserted"
41
+ }
42
+ ]
43
+ },
44
+ "status": "Ok",
45
+ "error_message": null
46
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "result":
3
+ {
4
+ "job_id": 1
5
+ },
6
+ "status": "Ok",
7
+ "error_message": null
8
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "result":
3
+ {
4
+ "guid": "30c799ca61866ff6121eb397e4f51659317b8befb682d9da4d85e540ac6849ba",
5
+ "name:": "CV.doc",
6
+ "supported": true
7
+ },
8
+ "status": "Ok",
9
+ "error_message": null
10
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "result":
3
+ {
4
+ "datasource_id": 1
5
+ },
6
+ "status": "Ok",
7
+ "error_message": null
8
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "result":
3
+ {
4
+ "datasource":
5
+ {
6
+ "id": 1,
7
+ "questionnaire_id": 123,
8
+ "descr": "Description",
9
+ "fields":
10
+ [
11
+ {
12
+ "name": "Field1",
13
+ "values": ["Value1", "Value2"]
14
+ }
15
+ ],
16
+ "created_on": 1333021624375,
17
+ "modified_on": 1333021624375
18
+ }
19
+ },
20
+ "status": "Ok",
21
+ "error_message": null
22
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "result":
3
+ {
4
+ "datasource_id": null
5
+ },
6
+ "status": "Ok",
7
+ "error_message": null
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "result":
3
+ {
4
+ "datasource_id": 1
5
+ },
6
+ "status": "Ok",
7
+ "error_message": null
8
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "result":
3
+ {
4
+ "access": 0,
5
+ "sharers":
6
+ [
7
+ {
8
+ "primary_email": "test@test.com"
9
+ }
10
+ ]
11
+ },
12
+ "status": "Ok",
13
+ "error_message": null
14
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "result":
3
+ {
4
+ "job_id": 1
5
+ },
6
+ "status": "Ok",
7
+ "error_message": null
8
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "result":
3
+ {
4
+ "job_id": 1,
5
+ "document_id": 1,
6
+ "datasource_id": 1
7
+ },
8
+ "status": "Ok",
9
+ "error_message": null
10
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "result":
3
+ {
4
+ "fields":
5
+ [
6
+ {
7
+ "page": 1,
8
+ "name": "topmostSubform[0].Page1[0].f1_01_0_[0]",
9
+ "type": null,
10
+ "rect":
11
+ {
12
+ "X": 0.8938259,
13
+ "Y": 0.31941694,
14
+ "Width": 0.0457534268,
15
+ "Height": 0.01388945
16
+ }
17
+ },
18
+ {
19
+ "page": 2,
20
+ "name": "topmostSubform[0].Page1[0].f1_02_0_[0]",
21
+ "type": null,
22
+ "rect":
23
+ {
24
+ "X": 0.8938259,
25
+ "Y": 0.3497212,
26
+ "Width": 0.0457534268,
27
+ "Height": 0.01388945
28
+ }
29
+ }
30
+ ]
31
+ },
32
+ "status": "Ok",
33
+ "error_message": null
34
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "result":
3
+ {
4
+ "types": "Pdf;Tiff;Jpeg"
5
+ },
6
+ "status": "Ok",
7
+ "error_message": null
8
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "result":
3
+ {
4
+ "page_count": 1,
5
+ "views_count": 15,
6
+ "last_view":
7
+ {
8
+ "document": {},
9
+ "short_url": "https://dev-api.groupdocs.com/v2.0/53/viewer/440e29",
10
+ "viewed_on": 1331467451493
11
+ }
12
+ },
13
+ "status": "Ok",
14
+ "error_message": null
15
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "result":
3
+ {
4
+ "document_id": 1,
5
+ "questionnaire_id": 1
6
+ },
7
+ "status": "Ok",
8
+ "error_message": null
9
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "result":
3
+ {
4
+ "document_id": 1,
5
+ "questionnaires":
6
+ [
7
+ {
8
+ "id": 1,
9
+ "name": "Q1",
10
+ "descr": "Description",
11
+ "pages": null
12
+ },
13
+ {
14
+ "id": 2,
15
+ "name": "Q2",
16
+ "descr": "Description",
17
+ "pages": null
18
+ }
19
+ ]
20
+ },
21
+ "status": "Ok",
22
+ "error_message": null
23
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "result":
3
+ {
4
+ "shared_users": null
5
+ },
6
+ "status": "Ok",
7
+ "error_message": null
8
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "result":
3
+ {
4
+ "shared_users":
5
+ [
6
+ {
7
+ "primary_email": "test1@email.com"
8
+ },
9
+ {
10
+ "primary_email": "test2@email.com"
11
+ }
12
+ ]
13
+ },
14
+ "status": "Ok",
15
+ "error_message": null
16
+ }