groupdocs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/README.md +141 -0
- data/Rakefile +9 -0
- data/groupdocs.gemspec +28 -0
- data/lib/groupdocs.rb +53 -0
- data/lib/groupdocs/api.rb +3 -0
- data/lib/groupdocs/api/entity.rb +113 -0
- data/lib/groupdocs/api/helpers.rb +5 -0
- data/lib/groupdocs/api/helpers/access_helper.rb +56 -0
- data/lib/groupdocs/api/helpers/actions_helper.rb +48 -0
- data/lib/groupdocs/api/helpers/rest_helper.rb +89 -0
- data/lib/groupdocs/api/helpers/status_helper.rb +48 -0
- data/lib/groupdocs/api/helpers/url_helper.rb +89 -0
- data/lib/groupdocs/api/request.rb +73 -0
- data/lib/groupdocs/api/sugar/lookup.rb +48 -0
- data/lib/groupdocs/datasource.rb +162 -0
- data/lib/groupdocs/datasource/field.rb +44 -0
- data/lib/groupdocs/document.rb +513 -0
- data/lib/groupdocs/document/annotation.rb +215 -0
- data/lib/groupdocs/document/annotation/reply.rb +167 -0
- data/lib/groupdocs/document/change.rb +35 -0
- data/lib/groupdocs/document/field.rb +27 -0
- data/lib/groupdocs/document/metadata.rb +26 -0
- data/lib/groupdocs/document/rectangle.rb +24 -0
- data/lib/groupdocs/document/view.rb +36 -0
- data/lib/groupdocs/errors.rb +10 -0
- data/lib/groupdocs/job.rb +201 -0
- data/lib/groupdocs/questionnaire.rb +221 -0
- data/lib/groupdocs/questionnaire/execution.rb +120 -0
- data/lib/groupdocs/questionnaire/page.rb +43 -0
- data/lib/groupdocs/questionnaire/question.rb +75 -0
- data/lib/groupdocs/questionnaire/question/answer.rb +10 -0
- data/lib/groupdocs/storage.rb +37 -0
- data/lib/groupdocs/storage/file.rb +248 -0
- data/lib/groupdocs/storage/folder.rb +314 -0
- data/lib/groupdocs/storage/package.rb +42 -0
- data/lib/groupdocs/user.rb +50 -0
- data/lib/groupdocs/version.rb +3 -0
- data/spec/groupdocs/api/entity_spec.rb +54 -0
- data/spec/groupdocs/api/helpers/access_helper_spec.rb +89 -0
- data/spec/groupdocs/api/helpers/actions_helper_spec.rb +51 -0
- data/spec/groupdocs/api/helpers/rest_helper_spec.rb +187 -0
- data/spec/groupdocs/api/helpers/status_helper_spec.rb +85 -0
- data/spec/groupdocs/api/helpers/url_helper_spec.rb +93 -0
- data/spec/groupdocs/api/request_spec.rb +85 -0
- data/spec/groupdocs/datasource/field_spec.rb +50 -0
- data/spec/groupdocs/datasource_spec.rb +156 -0
- data/spec/groupdocs/document/annotation/reply_spec.rb +179 -0
- data/spec/groupdocs/document/annotation_spec.rb +226 -0
- data/spec/groupdocs/document/change_spec.rb +35 -0
- data/spec/groupdocs/document/field_spec.rb +31 -0
- data/spec/groupdocs/document/metadata_spec.rb +26 -0
- data/spec/groupdocs/document/rectangle_spec.rb +34 -0
- data/spec/groupdocs/document/view_spec.rb +36 -0
- data/spec/groupdocs/document_spec.rb +509 -0
- data/spec/groupdocs/errors_spec.rb +7 -0
- data/spec/groupdocs/job_spec.rb +196 -0
- data/spec/groupdocs/questionnaire/execution_spec.rb +136 -0
- data/spec/groupdocs/questionnaire/page_spec.rb +50 -0
- data/spec/groupdocs/questionnaire/question/answer_spec.rb +11 -0
- data/spec/groupdocs/questionnaire/question_spec.rb +84 -0
- data/spec/groupdocs/questionnaire_spec.rb +217 -0
- data/spec/groupdocs/storage/file_spec.rb +242 -0
- data/spec/groupdocs/storage/folder_spec.rb +310 -0
- data/spec/groupdocs/storage/package_spec.rb +41 -0
- data/spec/groupdocs/storage_spec.rb +27 -0
- data/spec/groupdocs/user_spec.rb +53 -0
- data/spec/groupdocs_spec.rb +56 -0
- data/spec/spec_helper.rb +46 -0
- data/spec/support/files/resume.pdf +0 -0
- data/spec/support/json/annotation_collaborators_set.json +16 -0
- data/spec/support/json/annotation_create.json +12 -0
- data/spec/support/json/annotation_list.json +32 -0
- data/spec/support/json/annotation_remove.json +9 -0
- data/spec/support/json/annotation_replies_create.json +9 -0
- data/spec/support/json/annotation_replies_get.json +25 -0
- data/spec/support/json/comparison_changes.json +46 -0
- data/spec/support/json/comparison_compare.json +8 -0
- data/spec/support/json/comparison_document.json +10 -0
- data/spec/support/json/datasource_add.json +8 -0
- data/spec/support/json/datasource_get.json +22 -0
- data/spec/support/json/datasource_remove.json +8 -0
- data/spec/support/json/datasource_update.json +8 -0
- data/spec/support/json/document_access_info_get.json +14 -0
- data/spec/support/json/document_convert.json +8 -0
- data/spec/support/json/document_datasource.json +10 -0
- data/spec/support/json/document_fields.json +34 -0
- data/spec/support/json/document_formats.json +8 -0
- data/spec/support/json/document_metadata.json +15 -0
- data/spec/support/json/document_questionnaire_create.json +9 -0
- data/spec/support/json/document_questionnaires.json +23 -0
- data/spec/support/json/document_sharers_remove.json +8 -0
- data/spec/support/json/document_sharers_set.json +16 -0
- data/spec/support/json/document_views.json +32 -0
- data/spec/support/json/file_compress.json +8 -0
- data/spec/support/json/file_copy.json +14 -0
- data/spec/support/json/file_delete.json +5 -0
- data/spec/support/json/file_move.json +14 -0
- data/spec/support/json/file_upload.json +8 -0
- data/spec/support/json/folder_create.json +8 -0
- data/spec/support/json/folder_delete.json +5 -0
- data/spec/support/json/folder_list.json +21 -0
- data/spec/support/json/folder_move.json +8 -0
- data/spec/support/json/folder_sharers_get.json +16 -0
- data/spec/support/json/folder_sharers_remove.json +8 -0
- data/spec/support/json/folder_sharers_set.json +16 -0
- data/spec/support/json/job_add_url.json +8 -0
- data/spec/support/json/job_create.json +8 -0
- data/spec/support/json/job_documents.json +39 -0
- data/spec/support/json/job_file_add.json +8 -0
- data/spec/support/json/job_update.json +7 -0
- data/spec/support/json/jobs_get.json +52 -0
- data/spec/support/json/package_create.json +7 -0
- data/spec/support/json/questionnaire_create.json +8 -0
- data/spec/support/json/questionnaire_datasources.json +26 -0
- data/spec/support/json/questionnaire_execution_create.json +9 -0
- data/spec/support/json/questionnaire_execution_status_set.json +8 -0
- data/spec/support/json/questionnaire_execution_update.json +8 -0
- data/spec/support/json/questionnaire_executions.json +24 -0
- data/spec/support/json/questionnaire_get.json +14 -0
- data/spec/support/json/questionnaire_remove.json +8 -0
- data/spec/support/json/questionnaire_update.json +8 -0
- data/spec/support/json/questionnaires_get.json +22 -0
- data/spec/support/json/storage_info.json +10 -0
- data/spec/support/shared_examples/api/entity.rb +37 -0
- data/spec/support/shared_examples/api/helpers/status_helper.rb +12 -0
- data/spec/support/shared_examples/api/sugar/lookup.rb +57 -0
- metadata +356 -0
data/spec/spec_helper.rb
ADDED
@@ -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
|
Binary file
|
@@ -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,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,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,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,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,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
|
+
}
|