groupdocs 0.3.11 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +150 -0
- data/README.md +6 -58
- data/Rakefile +1 -1
- data/examples/README.md +13 -0
- data/examples/annotations/Gemfile +5 -0
- data/examples/annotations/app.rb +67 -0
- data/groupdocs.gemspec +3 -3
- data/lib/groupdocs.rb +11 -2
- data/lib/groupdocs/api/entity.rb +17 -1
- data/lib/groupdocs/api/helpers/path_helper.rb +10 -10
- data/lib/groupdocs/api/helpers/rest_helper.rb +7 -2
- data/lib/groupdocs/api/helpers/url_helper.rb +2 -4
- data/lib/groupdocs/api/request.rb +2 -4
- data/lib/groupdocs/datasource.rb +2 -2
- data/lib/groupdocs/datasource/field.rb +1 -1
- data/lib/groupdocs/document.rb +6 -18
- data/lib/groupdocs/document/annotation.rb +25 -2
- data/lib/groupdocs/document/annotation/reply.rb +6 -10
- data/lib/groupdocs/document/change.rb +1 -1
- data/lib/groupdocs/document/field.rb +1 -1
- data/lib/groupdocs/document/metadata.rb +1 -1
- data/lib/groupdocs/document/rectangle.rb +1 -1
- data/lib/groupdocs/document/view.rb +1 -1
- data/lib/groupdocs/job.rb +51 -8
- data/lib/groupdocs/questionnaire.rb +2 -2
- data/lib/groupdocs/questionnaire/execution.rb +1 -1
- data/lib/groupdocs/questionnaire/page.rb +1 -1
- data/lib/groupdocs/questionnaire/question.rb +1 -1
- data/lib/groupdocs/questionnaire/question/answer.rb +1 -1
- data/lib/groupdocs/signature.rb +134 -0
- data/lib/groupdocs/signature/contact.rb +141 -0
- data/lib/groupdocs/signature/envelope.rb +376 -0
- data/lib/groupdocs/signature/envelope/log.rb +22 -0
- data/lib/groupdocs/signature/field.rb +253 -0
- data/lib/groupdocs/signature/field/location.rb +72 -0
- data/lib/groupdocs/signature/form.rb +202 -0
- data/lib/groupdocs/signature/list.rb +93 -0
- data/lib/groupdocs/signature/recipient.rb +47 -0
- data/lib/groupdocs/signature/role.rb +84 -0
- data/lib/groupdocs/signature/shared.rb +6 -0
- data/lib/groupdocs/signature/shared/document_methods.rb +98 -0
- data/lib/groupdocs/signature/shared/entity_fields.rb +94 -0
- data/lib/groupdocs/signature/shared/entity_methods.rb +145 -0
- data/lib/groupdocs/signature/shared/field_methods.rb +282 -0
- data/lib/groupdocs/signature/shared/recipient_methods.rb +63 -0
- data/lib/groupdocs/signature/shared/resource_methods.rb +65 -0
- data/lib/groupdocs/signature/template.rb +104 -0
- data/lib/groupdocs/storage/file.rb +69 -62
- data/lib/groupdocs/storage/folder.rb +54 -88
- data/lib/groupdocs/storage/package.rb +1 -1
- data/lib/groupdocs/subscription.rb +113 -0
- data/lib/groupdocs/subscription/limit.rb +24 -0
- data/lib/groupdocs/user.rb +22 -2
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/api/entity_spec.rb +14 -0
- data/spec/groupdocs/api/helpers/path_helper_spec.rb +6 -19
- data/spec/groupdocs/api/helpers/rest_helper_spec.rb +9 -0
- data/spec/groupdocs/api/request_spec.rb +2 -7
- data/spec/groupdocs/datasource_spec.rb +3 -7
- data/spec/groupdocs/document/annotation/reply_spec.rb +11 -20
- data/spec/groupdocs/document/annotation_spec.rb +35 -31
- data/spec/groupdocs/document/field_spec.rb +1 -4
- data/spec/groupdocs/document/rectangle_spec.rb +10 -22
- data/spec/groupdocs/document_spec.rb +7 -27
- data/spec/groupdocs/job_spec.rb +43 -0
- data/spec/groupdocs/questionnaire/question_spec.rb +2 -6
- data/spec/groupdocs/questionnaire_spec.rb +3 -7
- data/spec/groupdocs/signature/contact_spec.rb +129 -0
- data/spec/groupdocs/signature/envelope/log_spec.rb +23 -0
- data/spec/groupdocs/signature/envelope_spec.rb +296 -0
- data/spec/groupdocs/signature/field/location_spec.rb +73 -0
- data/spec/groupdocs/signature/field_spec.rb +264 -0
- data/spec/groupdocs/signature/form_spec.rb +174 -0
- data/spec/groupdocs/signature/list_spec.rb +92 -0
- data/spec/groupdocs/signature/recipient_spec.rb +37 -0
- data/spec/groupdocs/signature/role_spec.rb +100 -0
- data/spec/groupdocs/signature/template_spec.rb +82 -0
- data/spec/groupdocs/signature_spec.rb +117 -0
- data/spec/groupdocs/storage/file_spec.rb +76 -61
- data/spec/groupdocs/storage/folder_spec.rb +43 -90
- data/spec/groupdocs/storage/package_spec.rb +1 -2
- data/spec/groupdocs/subscription/limit_spec.rb +24 -0
- data/spec/groupdocs/subscription_spec.rb +85 -0
- data/spec/groupdocs/user_spec.rb +27 -18
- data/spec/groupdocs_spec.rb +11 -0
- data/spec/spec_helper.rb +10 -1
- data/spec/support/files/envelope.zip +0 -0
- data/spec/support/json/annotation_access_set.json +11 -0
- data/spec/support/json/contact_add.json +12 -0
- data/spec/support/json/contacts_get.json +19 -0
- data/spec/support/json/contacts_import.json +8 -0
- data/spec/support/json/envelope_get.json +46 -0
- data/spec/support/json/envelope_logs.json +16 -0
- data/spec/support/json/envelopes_all.json +48 -0
- data/spec/support/json/envelopes_resources.json +31 -0
- data/spec/support/json/form_get.json +21 -0
- data/spec/support/json/forms_all.json +23 -0
- data/spec/support/json/job_get.json +30 -0
- data/spec/support/json/list_add.json +12 -0
- data/spec/support/json/lists_get.json +19 -0
- data/spec/support/json/signature_create.json +12 -0
- data/spec/support/json/signature_field_add.json +25 -0
- data/spec/support/json/signature_fields_get.json +27 -0
- data/spec/support/json/signature_roles_get.json +17 -0
- data/spec/support/json/signatures_get.json +19 -0
- data/spec/support/json/subscription_plan_get.json +9 -0
- data/spec/support/json/subscription_plans_get.json +17 -0
- data/spec/support/json/template_get.json +35 -0
- data/spec/support/json/template_get_documents.json +15 -0
- data/spec/support/json/template_get_recipients.json +20 -0
- data/spec/support/json/templates_all.json +37 -0
- data/spec/support/json/user_users_get.json +27 -0
- data/spec/support/shared_examples/signature/shared/document_methods.rb +68 -0
- data/spec/support/shared_examples/signature/shared/entity_fields.rb +89 -0
- data/spec/support/shared_examples/signature/shared/entity_methods.rb +116 -0
- data/spec/support/shared_examples/signature/shared/field_methods.rb +188 -0
- data/spec/support/shared_examples/signature/shared/recipient_methods.rb +42 -0
- data/spec/support/shared_examples/signature/shared/resource_methods.rb +46 -0
- metadata +139 -29
- data/lib/groupdocs/extensions.rb +0 -1
- data/lib/groupdocs/extensions/lookup.rb +0 -52
- data/spec/support/shared_examples/extensions/lookup.rb +0 -57
data/lib/groupdocs/extensions.rb
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require 'groupdocs/extensions/lookup'
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
module GroupDocs
|
|
2
|
-
module Extensions
|
|
3
|
-
#
|
|
4
|
-
# Extends classes providing them with .find! and .find_all! class methods
|
|
5
|
-
# which is a bit of sugar for working with files, folder and documents,
|
|
6
|
-
#
|
|
7
|
-
# It's not that flexible because requires extending class to implement
|
|
8
|
-
# .all! class method.
|
|
9
|
-
#
|
|
10
|
-
# This module is a subject to modifications.
|
|
11
|
-
#
|
|
12
|
-
module Lookup
|
|
13
|
-
|
|
14
|
-
#
|
|
15
|
-
# Returns first object matching given options.
|
|
16
|
-
#
|
|
17
|
-
# @param [Symbol] attribute
|
|
18
|
-
# @param [Integer, String, Regexp] value
|
|
19
|
-
# @param [Hash] access Access credentials
|
|
20
|
-
# @option access [String] :client_id
|
|
21
|
-
# @option access [String] :private_key
|
|
22
|
-
# @return [GroupDocs::Api::Entity] Matching entity
|
|
23
|
-
#
|
|
24
|
-
def find!(attribute, value, access = {})
|
|
25
|
-
find_all!(attribute, value, access).first
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
#
|
|
29
|
-
# Returns all objects matching given options.
|
|
30
|
-
#
|
|
31
|
-
# Each entity has to implement #all! method for this to work.
|
|
32
|
-
#
|
|
33
|
-
# @param [Symbol] attribute
|
|
34
|
-
# @param [Integer, String, Regexp] value
|
|
35
|
-
# @param [Hash] access Access credentials
|
|
36
|
-
# @option access [String] :client_id
|
|
37
|
-
# @option access [String] :private_key
|
|
38
|
-
# @return [Array] Array of matching entities
|
|
39
|
-
#
|
|
40
|
-
# @raise [NoMethodError] if extending class does not implement .all! class method.
|
|
41
|
-
#
|
|
42
|
-
def find_all!(attribute, value, access = {})
|
|
43
|
-
respond_to?(:all!) or raise NoMethodError, "#{self}.all! is not implemented - aborting."
|
|
44
|
-
|
|
45
|
-
all!('/', access).select do |object|
|
|
46
|
-
value === object.send(attribute)
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
end # Lookup
|
|
51
|
-
end # Extensions
|
|
52
|
-
end # GroupDocs
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
shared_examples_for GroupDocs::Extensions::Lookup do
|
|
2
|
-
before(:each) do
|
|
3
|
-
# make sure `name` attribute exists
|
|
4
|
-
described_class.class_eval('attr_accessor :name')
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
let(:found) do
|
|
8
|
-
if described_class == GroupDocs::Document
|
|
9
|
-
described_class.new(id: 1, file: GroupDocs::Storage::File.new)
|
|
10
|
-
else
|
|
11
|
-
described_class.new(id: 1)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe '.find!' do
|
|
16
|
-
it 'calls #find_all! and return its first result' do
|
|
17
|
-
described_class.should_receive(:find_all!).with(:id, 1, {}).and_return([found])
|
|
18
|
-
described_class.find!(:id, 1).should == found
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe '.find_all!' do
|
|
23
|
-
before(:each) do
|
|
24
|
-
folder1 = stub(list!: [], id: 1, name: 'Test')
|
|
25
|
-
folder2 = stub(list!: [folder1], id: 2, name: 'Test2')
|
|
26
|
-
described_class.stub(all!: [folder1, folder2])
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it 'raises error if class does not implement #all!' do
|
|
30
|
-
described_class.stub(:respond_to?).with(:all!).and_return(false)
|
|
31
|
-
lambda do
|
|
32
|
-
described_class.find_all!(:id, 1)
|
|
33
|
-
end.should raise_error(NoMethodError, "#{described_class}.all! is not implemented - aborting.")
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it 'allows passing attribute and its value' do
|
|
37
|
-
-> { described_class.find_all!(:id, 1) }.should_not raise_error(ArgumentError)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it 'calls #all! and search within it' do
|
|
41
|
-
described_class.should_receive(:all!).and_return([found])
|
|
42
|
-
described_class.find_all!(:name, 'Test')
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it 'returns an array' do
|
|
46
|
-
described_class.find_all!(:id, 1).should be_an(Array)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it 'finds by exact match' do
|
|
50
|
-
described_class.find_all!(:name, 'Test').length.should == 1
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'finds by regexp match' do
|
|
54
|
-
described_class.find_all!(:name, /Test/).length.should == 2
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|