groupdocs 1.2.11 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -0
- data/Gemfile +1 -1
- data/README.md +0 -2
- data/Rakefile +1 -1
- data/examples/api-samples/Gemfile +1 -1
- data/examples/api-samples/samples/annotation-sample.rb +50 -0
- data/examples/api-samples/samples/sample18.rb +11 -2
- data/examples/api-samples/samples/sample19.rb +58 -0
- data/examples/api-samples/samples/sample20.rb +50 -0
- data/examples/api-samples/samples/sample21.rb +65 -0
- data/examples/api-samples/samples/sample22.rb +52 -0
- data/examples/api-samples/views/annotation_sample.haml +64 -0
- data/examples/api-samples/views/index.haml +8 -0
- data/examples/api-samples/views/sample1.haml +9 -1
- data/examples/api-samples/views/sample10.haml +9 -1
- data/examples/api-samples/views/sample11.haml +10 -0
- data/examples/api-samples/views/sample12.haml +8 -0
- data/examples/api-samples/views/sample13.haml +8 -0
- data/examples/api-samples/views/sample14.haml +8 -0
- data/examples/api-samples/views/sample15.haml +8 -0
- data/examples/api-samples/views/sample16.haml +8 -0
- data/examples/api-samples/views/sample17.haml +8 -0
- data/examples/api-samples/views/sample18.haml +11 -0
- data/examples/api-samples/views/sample19.haml +102 -0
- data/examples/api-samples/views/sample2.haml +9 -1
- data/examples/api-samples/views/sample20.haml +89 -0
- data/examples/api-samples/views/sample21.haml +106 -0
- data/examples/api-samples/views/sample22.haml +107 -0
- data/examples/api-samples/views/sample3.haml +10 -2
- data/examples/api-samples/views/sample4.haml +8 -0
- data/examples/api-samples/views/sample5.haml +8 -0
- data/examples/api-samples/views/sample6.haml +8 -0
- data/examples/api-samples/views/sample7.haml +9 -1
- data/examples/api-samples/views/sample8.haml +10 -2
- data/examples/api-samples/views/sample9.haml +10 -2
- data/groupdocs.gemspec +4 -3
- data/lib/groupdocs.rb +2 -4
- data/lib/groupdocs/api.rb +2 -0
- data/lib/groupdocs/api/entity.rb +4 -36
- data/lib/groupdocs/api/helpers/access_rights_helper.rb +4 -4
- data/lib/groupdocs/api/helpers/byte_flag_helper.rb +3 -3
- data/lib/groupdocs/api/helpers/rest_helper.rb +5 -5
- data/lib/groupdocs/api/helpers/status_helper.rb +2 -2
- data/lib/groupdocs/api/helpers/url_helper.rb +2 -2
- data/lib/groupdocs/document.rb +55 -24
- data/lib/groupdocs/document/annotation.rb +7 -7
- data/lib/groupdocs/document/annotation/reply.rb +2 -2
- data/lib/groupdocs/document/view.rb +1 -1
- data/lib/groupdocs/job.rb +20 -20
- data/lib/groupdocs/questionnaire.rb +2 -2
- data/lib/groupdocs/questionnaire/collector.rb +2 -2
- data/lib/groupdocs/questionnaire/execution.rb +1 -1
- data/lib/groupdocs/questionnaire/question.rb +2 -2
- data/lib/groupdocs/signature.rb +1 -1
- data/lib/groupdocs/signature/envelope.rb +19 -19
- data/lib/groupdocs/signature/field.rb +6 -6
- data/lib/groupdocs/signature/form.rb +7 -7
- data/lib/groupdocs/signature/list.rb +2 -2
- data/lib/groupdocs/signature/recipient.rb +6 -6
- data/lib/groupdocs/signature/shared/document_methods.rb +5 -5
- data/lib/groupdocs/signature/shared/entity_methods.rb +4 -4
- data/lib/groupdocs/signature/shared/field_methods.rb +8 -8
- data/lib/groupdocs/signature/shared/recipient_methods.rb +2 -2
- data/lib/groupdocs/signature/shared/resource_methods.rb +1 -1
- data/lib/groupdocs/signature/template.rb +4 -4
- data/lib/groupdocs/storage.rb +4 -4
- data/lib/groupdocs/storage/file.rb +4 -4
- data/lib/groupdocs/storage/folder.rb +4 -4
- data/lib/groupdocs/subscription.rb +15 -15
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/api/entity_spec.rb +10 -37
- data/spec/groupdocs/api/helpers/access_mode_helper_spec.rb +1 -1
- data/spec/groupdocs/api/helpers/access_rights_helper_spec.rb +3 -3
- data/spec/groupdocs/api/helpers/credentials_helpers_spec.rb +5 -5
- data/spec/groupdocs/api/helpers/rest_helper_spec.rb +15 -15
- data/spec/groupdocs/api/helpers/status_helper_spec.rb +1 -1
- data/spec/groupdocs/api/helpers/url_helper_spec.rb +11 -11
- data/spec/groupdocs/api/request_spec.rb +6 -6
- data/spec/groupdocs/datasource_spec.rb +9 -9
- data/spec/groupdocs/document/annotation/reply_spec.rb +15 -15
- data/spec/groupdocs/document/annotation/reviewer_spec.rb +3 -3
- data/spec/groupdocs/document/annotation_spec.rb +17 -17
- data/spec/groupdocs/document/change_spec.rb +1 -1
- data/spec/groupdocs/document/field_spec.rb +1 -1
- data/spec/groupdocs/document/metadata_spec.rb +3 -3
- data/spec/groupdocs/document/view_spec.rb +4 -4
- data/spec/groupdocs/document_spec.rb +92 -66
- data/spec/groupdocs/job_spec.rb +29 -29
- data/spec/groupdocs/questionnaire/collector_spec.rb +15 -19
- data/spec/groupdocs/questionnaire/execution_spec.rb +12 -12
- data/spec/groupdocs/questionnaire/page_spec.rb +4 -4
- data/spec/groupdocs/questionnaire/question_spec.rb +6 -6
- data/spec/groupdocs/questionnaire_spec.rb +18 -18
- data/spec/groupdocs/signature/contact_spec.rb +9 -9
- data/spec/groupdocs/signature/envelope_spec.rb +34 -34
- data/spec/groupdocs/signature/field_spec.rb +13 -13
- data/spec/groupdocs/signature/form_spec.rb +9 -9
- data/spec/groupdocs/signature/list_spec.rb +3 -3
- data/spec/groupdocs/signature/role_spec.rb +2 -2
- data/spec/groupdocs/signature/template_spec.rb +6 -6
- data/spec/groupdocs/signature_spec.rb +3 -3
- data/spec/groupdocs/storage/file_spec.rb +20 -20
- data/spec/groupdocs/storage/folder_spec.rb +21 -21
- data/spec/groupdocs/storage/package_spec.rb +2 -2
- data/spec/groupdocs/storage_spec.rb +1 -1
- data/spec/groupdocs/subscription_spec.rb +3 -3
- data/spec/groupdocs/user_spec.rb +5 -5
- data/spec/spec_helper.rb +9 -7
- data/spec/support/json/document_thumbnails.json +24 -0
- data/spec/support/shared_examples/api/entity.rb +8 -8
- data/spec/support/shared_examples/signature/shared/document_methods.rb +8 -8
- data/spec/support/shared_examples/signature/shared/entity_fields.rb +3 -3
- data/spec/support/shared_examples/signature/shared/entity_methods.rb +12 -12
- data/spec/support/shared_examples/signature/shared/field_methods.rb +29 -29
- data/spec/support/shared_examples/signature/shared/recipient_methods.rb +3 -3
- data/spec/support/shared_examples/signature/shared/resource_methods.rb +2 -2
- metadata +33 -5
@@ -6,9 +6,9 @@ describe GroupDocs::Document::Annotation::Reply do
|
|
6
6
|
|
7
7
|
subject do
|
8
8
|
file = GroupDocs::Storage::File.new
|
9
|
-
document = GroupDocs::Document.new(file
|
10
|
-
annotation = GroupDocs::Document::Annotation.new(document
|
11
|
-
described_class.new(annotation
|
9
|
+
document = GroupDocs::Document.new(:file => file)
|
10
|
+
annotation = GroupDocs::Document::Annotation.new(:document => document)
|
11
|
+
described_class.new(:annotation => annotation)
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '.get!' do
|
@@ -17,34 +17,34 @@ describe GroupDocs::Document::Annotation::Reply do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
let(:annotation) do
|
20
|
-
document = GroupDocs::Document.new(file
|
21
|
-
GroupDocs::Document::Annotation.new(document
|
20
|
+
document = GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
|
21
|
+
GroupDocs::Document::Annotation.new(:document => document)
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'accepts access credentials hash' do
|
25
25
|
lambda do
|
26
|
-
described_class.get!(annotation, {}, client_id
|
26
|
+
described_class.get!(annotation, {}, :client_id => 'client_id', :private_key => 'private_key')
|
27
27
|
end.should_not raise_error(ArgumentError)
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'accepts options hash' do
|
31
31
|
lambda do
|
32
|
-
described_class.get!(annotation, after
|
32
|
+
described_class.get!(annotation, :after => Time.now)
|
33
33
|
end.should_not raise_error(ArgumentError)
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'raises error if annotation is not an instance of GroupDocs::Document::Annotation' do
|
37
|
-
|
37
|
+
lambda { described_class.get!('Annotation') }.should raise_error(ArgumentError)
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'raises error if option :after is not an instance of Time' do
|
41
|
-
|
41
|
+
lambda { described_class.get!(annotation, :after => 'Yesterday') }.should raise_error(ArgumentError)
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'converts option :after to Unix timestamp' do
|
45
45
|
time = Time.now
|
46
46
|
time.should_receive(:to_i).and_return(1334125808)
|
47
|
-
described_class.get!(annotation, after
|
47
|
+
described_class.get!(annotation, :after => time)
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'returns an array of GroupDocs::Document::Annotation::Reply objects' do
|
@@ -74,11 +74,11 @@ describe GroupDocs::Document::Annotation::Reply do
|
|
74
74
|
|
75
75
|
describe '#initialize' do
|
76
76
|
it 'raises error if annotation is not specified' do
|
77
|
-
|
77
|
+
lambda { described_class.new }.should raise_error(ArgumentError)
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'raises error if annotation is not an instance of GroupDocs::Document::Annotation' do
|
81
|
-
|
81
|
+
lambda { described_class.new(:annotation => '') }.should raise_error(ArgumentError)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
@@ -96,7 +96,7 @@ describe GroupDocs::Document::Annotation::Reply do
|
|
96
96
|
|
97
97
|
it 'accepts access credentials hash' do
|
98
98
|
lambda do
|
99
|
-
subject.create!(client_id
|
99
|
+
subject.create!(:client_id => 'client_id', :private_key => 'private_key')
|
100
100
|
end.should_not raise_error(ArgumentError)
|
101
101
|
end
|
102
102
|
|
@@ -122,7 +122,7 @@ describe GroupDocs::Document::Annotation::Reply do
|
|
122
122
|
|
123
123
|
it 'accepts access credentials hash' do
|
124
124
|
lambda do
|
125
|
-
subject.edit!(client_id
|
125
|
+
subject.edit!(:client_id => 'client_id', :private_key => 'private_key')
|
126
126
|
end.should_not raise_error(ArgumentError)
|
127
127
|
end
|
128
128
|
end
|
@@ -134,7 +134,7 @@ describe GroupDocs::Document::Annotation::Reply do
|
|
134
134
|
|
135
135
|
it 'accepts access credentials hash' do
|
136
136
|
lambda do
|
137
|
-
subject.remove!(client_id
|
137
|
+
subject.remove!(:client_id => 'client_id', :private_key => 'private_key')
|
138
138
|
end.should_not raise_error(ArgumentError)
|
139
139
|
end
|
140
140
|
end
|
@@ -11,7 +11,7 @@ describe GroupDocs::Document::Annotation::Reviewer do
|
|
11
11
|
|
12
12
|
it 'accepts access credentials hash' do
|
13
13
|
lambda do
|
14
|
-
described_class.all!(client_id
|
14
|
+
described_class.all!(:client_id => 'client_id', :private_key => 'private_key')
|
15
15
|
end.should_not raise_error(ArgumentError)
|
16
16
|
end
|
17
17
|
|
@@ -29,11 +29,11 @@ describe GroupDocs::Document::Annotation::Reviewer do
|
|
29
29
|
mock_api_server(load_json('annotation_reviewers_get'))
|
30
30
|
end
|
31
31
|
|
32
|
-
let!(:reviewers) { [described_class.new(email_address
|
32
|
+
let!(:reviewers) { [described_class.new(:email_address => 'test@test.com')] }
|
33
33
|
|
34
34
|
it 'accepts access credentials hash' do
|
35
35
|
lambda do
|
36
|
-
described_class.set!(reviewers, client_id
|
36
|
+
described_class.set!(reviewers, :client_id => 'client_id', :private_key => 'private_key')
|
37
37
|
end.should_not raise_error(ArgumentError)
|
38
38
|
end
|
39
39
|
|
@@ -7,8 +7,8 @@ describe GroupDocs::Document::Annotation do
|
|
7
7
|
|
8
8
|
subject do
|
9
9
|
file = GroupDocs::Storage::File.new
|
10
|
-
document = GroupDocs::Document.new(file
|
11
|
-
described_class.new(document
|
10
|
+
document = GroupDocs::Document.new(:file => file)
|
11
|
+
described_class.new(:document => document)
|
12
12
|
end
|
13
13
|
|
14
14
|
it { should have_accessor(:document) }
|
@@ -38,11 +38,11 @@ describe GroupDocs::Document::Annotation do
|
|
38
38
|
|
39
39
|
describe '#initialize' do
|
40
40
|
it 'raises error if document is not specified' do
|
41
|
-
|
41
|
+
lambda { described_class.new }.should raise_error(ArgumentError)
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'raises error if document is not an instance of GroupDocs::Document' do
|
45
|
-
|
45
|
+
lambda { described_class.new(:document => '') }.should raise_error(ArgumentError)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -58,7 +58,7 @@ describe GroupDocs::Document::Annotation do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'raises error if type is unknown' do
|
61
|
-
|
61
|
+
lambda { subject.type = :unknown }.should raise_error(ArgumentError)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -90,7 +90,7 @@ describe GroupDocs::Document::Annotation do
|
|
90
90
|
|
91
91
|
describe '#box=' do
|
92
92
|
it 'converts passed hash to GroupDocs::Document::Rectangle object' do
|
93
|
-
subject.box = { x
|
93
|
+
subject.box = { :x => 0.90, :y => 0.05, :width => 0.06745, :height => 0.005967 }
|
94
94
|
subject.box.should be_a(GroupDocs::Document::Rectangle)
|
95
95
|
subject.box.x.should == 0.90
|
96
96
|
subject.box.y.should == 0.05
|
@@ -111,8 +111,8 @@ describe GroupDocs::Document::Annotation do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
it 'saves each reply if it is GroupDocs::Document::Annotation::Reply object' do
|
114
|
-
reply1 = GroupDocs::Document::Annotation::Reply.new(annotation
|
115
|
-
reply2 = GroupDocs::Document::Annotation::Reply.new(annotation
|
114
|
+
reply1 = GroupDocs::Document::Annotation::Reply.new(:annotation => subject)
|
115
|
+
reply2 = GroupDocs::Document::Annotation::Reply.new(:annotation => subject)
|
116
116
|
subject.replies = [reply1, reply2]
|
117
117
|
subject.replies.should include(reply1)
|
118
118
|
subject.replies.should include(reply2)
|
@@ -127,11 +127,11 @@ describe GroupDocs::Document::Annotation do
|
|
127
127
|
|
128
128
|
describe '#add_reply' do
|
129
129
|
it 'raises error if reply is not GroupDocs::Document::Annotation::Reply object' do
|
130
|
-
|
130
|
+
lambda { subject.add_reply('Reply') }.should raise_error(ArgumentError)
|
131
131
|
end
|
132
132
|
|
133
133
|
it 'saves reply' do
|
134
|
-
reply = GroupDocs::Document::Annotation::Reply.new(annotation
|
134
|
+
reply = GroupDocs::Document::Annotation::Reply.new(:annotation => subject)
|
135
135
|
subject.add_reply(reply)
|
136
136
|
subject.replies.should == [reply]
|
137
137
|
end
|
@@ -144,7 +144,7 @@ describe GroupDocs::Document::Annotation do
|
|
144
144
|
|
145
145
|
it 'accepts access credentials hash' do
|
146
146
|
lambda do
|
147
|
-
subject.create!(client_id
|
147
|
+
subject.create!(:client_id => 'client_id', :private_key => 'private_key')
|
148
148
|
end.should_not raise_error(ArgumentError)
|
149
149
|
end
|
150
150
|
|
@@ -173,7 +173,7 @@ describe GroupDocs::Document::Annotation do
|
|
173
173
|
|
174
174
|
it 'accepts access credentials hash' do
|
175
175
|
lambda do
|
176
|
-
subject.remove!(client_id
|
176
|
+
subject.remove!(:client_id => 'client_id', :private_key => 'private_key')
|
177
177
|
end.should_not raise_error(ArgumentError)
|
178
178
|
end
|
179
179
|
end
|
@@ -192,14 +192,14 @@ describe GroupDocs::Document::Annotation do
|
|
192
192
|
|
193
193
|
it 'accepts access credentials hash' do
|
194
194
|
lambda do
|
195
|
-
subject.move!(10, 10, client_id
|
195
|
+
subject.move!(10, 10, :client_id => 'client_id', :private_key => 'private_key')
|
196
196
|
end.should_not raise_error(ArgumentError)
|
197
197
|
end
|
198
198
|
|
199
199
|
it 'updates annotation position' do
|
200
200
|
lambda do
|
201
201
|
subject.move!(10, 10)
|
202
|
-
end.should change(subject, :annotation_position).to(x
|
202
|
+
end.should change(subject, :annotation_position).to(:x => 10, :y => 10)
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
@@ -210,12 +210,12 @@ describe GroupDocs::Document::Annotation do
|
|
210
210
|
|
211
211
|
it 'accepts access credentials hash' do
|
212
212
|
lambda do
|
213
|
-
subject.move_marker!(10, 10, client_id
|
213
|
+
subject.move_marker!(10, 10, :client_id => 'client_id', :private_key => 'private_key')
|
214
214
|
end.should_not raise_error(ArgumentError)
|
215
215
|
end
|
216
216
|
|
217
217
|
it 'updates box coordinates if it is set' do
|
218
|
-
subject.box = { x
|
218
|
+
subject.box = { :x => 1, :y => 2 }
|
219
219
|
subject.move_marker! 10, 10
|
220
220
|
subject.box.x.should == 10
|
221
221
|
subject.box.y.should == 10
|
@@ -235,7 +235,7 @@ describe GroupDocs::Document::Annotation do
|
|
235
235
|
|
236
236
|
it 'accepts access credentials hash' do
|
237
237
|
lambda do
|
238
|
-
subject.set_access!(:private, client_id
|
238
|
+
subject.set_access!(:private, :client_id => 'client_id', :private_key => 'private_key')
|
239
239
|
end.should_not raise_error(ArgumentError)
|
240
240
|
end
|
241
241
|
|
@@ -19,7 +19,7 @@ describe GroupDocs::Document::Change do
|
|
19
19
|
|
20
20
|
describe '#box=' do
|
21
21
|
it 'converts passed hash to GroupDocs::Document::Rectangle object' do
|
22
|
-
subject.box = { x
|
22
|
+
subject.box = { :x => 0.90, :y => 0.05, :width => 0.06745, :height => 0.005967 }
|
23
23
|
subject.box.should be_a(GroupDocs::Document::Rectangle)
|
24
24
|
subject.box.x.should == 0.90
|
25
25
|
subject.box.y.should == 0.05
|
@@ -10,7 +10,7 @@ describe GroupDocs::Document::Field do
|
|
10
10
|
|
11
11
|
describe '#rect=' do
|
12
12
|
it 'converts passed hash to GroupDocs::Document::Rectangle object' do
|
13
|
-
subject.rect = { x
|
13
|
+
subject.rect = { :x => 0.90, :y => 0.05, :width => 0.06745, :height => 0.005967 }
|
14
14
|
subject.rectangle.should be_a(GroupDocs::Document::Rectangle)
|
15
15
|
subject.rectangle.x.should == 0.90
|
16
16
|
subject.rectangle.y.should == 0.05
|
@@ -12,10 +12,10 @@ describe GroupDocs::Document::MetaData do
|
|
12
12
|
|
13
13
|
describe '#last_view=' do
|
14
14
|
it 'converts passed hash to GroupDocs::Document::View object' do
|
15
|
-
subject.last_view = { document
|
15
|
+
subject.last_view = { :document => { :id => 1, :name => 'test.pdf' } }
|
16
16
|
subject.last_view.should be_a(GroupDocs::Document::View)
|
17
|
-
subject.last_view.document.id.should
|
18
|
-
subject.last_view.document.name.should == 'test.pdf'
|
17
|
+
subject.last_view.document.file.id.should == 1
|
18
|
+
subject.last_view.document.file.name.should == 'test.pdf'
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -10,17 +10,17 @@ describe GroupDocs::Document::View do
|
|
10
10
|
|
11
11
|
describe '#document=' do
|
12
12
|
it 'sets document if GroupDocs::Document object is passed' do
|
13
|
-
document = GroupDocs::Document.new(file
|
13
|
+
document = GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
|
14
14
|
subject.document = document
|
15
15
|
subject.document.should == document
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'creates new GroupDocs::Document object from passed hash' do
|
19
|
-
subject.document = { id
|
19
|
+
subject.document = { :id => 1, :name => 'test.pdf' }
|
20
20
|
document = subject.document
|
21
21
|
document.should be_a(GroupDocs::Document)
|
22
|
-
document.id.should
|
23
|
-
document.name.should == 'test.pdf'
|
22
|
+
document.file.id.should == 1
|
23
|
+
document.file.name.should == 'test.pdf'
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -7,7 +7,7 @@ describe GroupDocs::Document do
|
|
7
7
|
|
8
8
|
subject do
|
9
9
|
file = GroupDocs::Storage::File.new
|
10
|
-
described_class.new(file
|
10
|
+
described_class.new(:file => file)
|
11
11
|
end
|
12
12
|
|
13
13
|
describe '.views!' do
|
@@ -17,7 +17,7 @@ describe GroupDocs::Document do
|
|
17
17
|
|
18
18
|
it 'accepts access credentials hash' do
|
19
19
|
lambda do
|
20
|
-
described_class.views!({}, client_id
|
20
|
+
described_class.views!({}, :client_id => 'client_id', :private_key => 'private_key')
|
21
21
|
end.should_not raise_error(ArgumentError)
|
22
22
|
end
|
23
23
|
|
@@ -37,7 +37,7 @@ describe GroupDocs::Document do
|
|
37
37
|
|
38
38
|
it 'accepts access credentials hash' do
|
39
39
|
lambda do
|
40
|
-
described_class.templates!(client_id
|
40
|
+
described_class.templates!(:client_id => 'client_id', :private_key => 'private_key')
|
41
41
|
end.should_not raise_error(ArgumentError)
|
42
42
|
end
|
43
43
|
|
@@ -56,48 +56,48 @@ describe GroupDocs::Document do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
let(:documents) do
|
59
|
-
[GroupDocs::Document.new(file
|
60
|
-
GroupDocs::Document.new(file
|
59
|
+
[GroupDocs::Document.new(:file => GroupDocs::Storage::File.new(:name => 'Document1', :local_path => __FILE__)),
|
60
|
+
GroupDocs::Document.new(:file => GroupDocs::Storage::File.new(:name => 'Document2', :local_path => 'spec/support/files/resume.pdf'))]
|
61
61
|
end
|
62
|
-
let(:signatures) { [GroupDocs::Signature.new(name
|
62
|
+
let(:signatures) { [GroupDocs::Signature.new(:name => 'John Smith', :image_path => 'spec/support/files/signature.png', :position => {})] }
|
63
63
|
|
64
64
|
it 'accepts access credentials hash' do
|
65
65
|
lambda do
|
66
|
-
described_class.sign_documents!(documents, signatures, {}, client_id
|
66
|
+
described_class.sign_documents!(documents, signatures, {}, :client_id => 'client_id', :private_key => 'private_key')
|
67
67
|
end.should_not raise_error(ArgumentError)
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'raises error if document is not GroupDocs::Document object' do
|
71
|
-
|
71
|
+
lambda { described_class.sign_documents!(['Document'], signatures) }.should raise_error(ArgumentError)
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'raises error if document file does not have name' do
|
75
|
-
documents = [GroupDocs::Document.new(file
|
76
|
-
|
75
|
+
documents = [GroupDocs::Document.new(:file => GroupDocs::Storage::File.new(:local_path => __FILE__))]
|
76
|
+
lambda { described_class.sign_documents!(documents, signatures) }.should raise_error(ArgumentError)
|
77
77
|
end
|
78
78
|
|
79
79
|
it 'raises error if document file does not have local path' do
|
80
|
-
documents = [GroupDocs::Document.new(file
|
81
|
-
|
80
|
+
documents = [GroupDocs::Document.new(:file => GroupDocs::Storage::File.new(:name => 'Document'))]
|
81
|
+
lambda { described_class.sign_documents!(documents, signatures) }.should raise_error(ArgumentError)
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'raises error if signature is not GroupDocs::Signature object' do
|
85
|
-
|
85
|
+
lambda { described_class.sign_documents!(documents, ['Signature']) }.should raise_error(ArgumentError)
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'raises error if signature does not have name' do
|
89
|
-
signatures = [GroupDocs::Signature.new(image_path
|
90
|
-
|
89
|
+
signatures = [GroupDocs::Signature.new(:image_path => __FILE__, :position => {})]
|
90
|
+
lambda { described_class.sign_documents!(documents, signatures) }.should raise_error(ArgumentError)
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'raises error if signature does not have image path' do
|
94
|
-
signatures = [GroupDocs::Signature.new(name
|
95
|
-
|
94
|
+
signatures = [GroupDocs::Signature.new(:name => 'John Smith', :position => {})]
|
95
|
+
lambda { described_class.sign_documents!(documents, signatures) }.should raise_error(ArgumentError)
|
96
96
|
end
|
97
97
|
|
98
98
|
it 'raises error if signature does not have position' do
|
99
|
-
signatures = [GroupDocs::Signature.new(name
|
100
|
-
|
99
|
+
signatures = [GroupDocs::Signature.new(:name => 'John Smith', :image_path => __FILE__)]
|
100
|
+
lambda { described_class.sign_documents!(documents, signatures) }.should raise_error(ArgumentError)
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'detects each document and signature file MIME type' do
|
@@ -128,7 +128,7 @@ describe GroupDocs::Document do
|
|
128
128
|
|
129
129
|
it 'accepts access credentials hash' do
|
130
130
|
lambda do
|
131
|
-
described_class.metadata!('document_one.doc', client_id
|
131
|
+
described_class.metadata!('document_one.doc', :client_id => 'client_id', :private_key => 'private_key')
|
132
132
|
end.should_not raise_error(ArgumentError)
|
133
133
|
end
|
134
134
|
|
@@ -158,8 +158,8 @@ describe GroupDocs::Document do
|
|
158
158
|
describe '#outputs=' do
|
159
159
|
let(:response) do
|
160
160
|
[
|
161
|
-
{ ftype
|
162
|
-
{ ftype
|
161
|
+
{ :ftype => 1, :guid => 'fhy9yh94u238dgf' },
|
162
|
+
{ :ftype => 2, :guid => 'ofh9rhy9rfohf9s' }
|
163
163
|
]
|
164
164
|
end
|
165
165
|
|
@@ -195,11 +195,11 @@ describe GroupDocs::Document do
|
|
195
195
|
|
196
196
|
describe '#initialize' do
|
197
197
|
it 'raises error if file is not specified' do
|
198
|
-
|
198
|
+
lambda { described_class.new }.should raise_error(ArgumentError)
|
199
199
|
end
|
200
200
|
|
201
201
|
it 'raises error if file is not an instance of GroupDocs::Storage::File' do
|
202
|
-
|
202
|
+
lambda { described_class.new(:file => '') }.should raise_error(ArgumentError)
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
@@ -210,13 +210,13 @@ describe GroupDocs::Document do
|
|
210
210
|
|
211
211
|
it 'accepts access credentials hash' do
|
212
212
|
lambda do
|
213
|
-
subject.page_images!(640, 480, {}, client_id
|
213
|
+
subject.page_images!(640, 480, {}, :client_id => 'client_id', :private_key => 'private_key')
|
214
214
|
end.should_not raise_error(ArgumentError)
|
215
215
|
end
|
216
216
|
|
217
217
|
it 'accepts options hash' do
|
218
218
|
lambda do
|
219
|
-
subject.page_images!(640, 480, first_page
|
219
|
+
subject.page_images!(640, 480, :first_page => 0, :page_count => 1)
|
220
220
|
end.should_not raise_error(ArgumentError)
|
221
221
|
end
|
222
222
|
|
@@ -229,6 +229,32 @@ describe GroupDocs::Document do
|
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
232
|
+
describe '#thumbnails!' do
|
233
|
+
before(:each) do
|
234
|
+
mock_api_server(load_json('document_thumbnails'))
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'accepts access credentials hash' do
|
238
|
+
lambda do
|
239
|
+
subject.thumbnails!({}, :client_id => 'client_id', :private_key => 'private_key')
|
240
|
+
end.should_not raise_error(ArgumentError)
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'accepts options hash' do
|
244
|
+
lambda do
|
245
|
+
subject.thumbnails!(:page_number => 0, :page_count => 1)
|
246
|
+
end.should_not raise_error(ArgumentError)
|
247
|
+
end
|
248
|
+
|
249
|
+
it 'returns array of URLs' do
|
250
|
+
urls = subject.thumbnails!
|
251
|
+
urls.should be_an(Array)
|
252
|
+
urls.each do |url|
|
253
|
+
url.should be_a(String)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
232
258
|
describe '#access_mode!' do
|
233
259
|
before(:each) do
|
234
260
|
mock_api_server(load_json('document_access_info_get'))
|
@@ -236,7 +262,7 @@ describe GroupDocs::Document do
|
|
236
262
|
|
237
263
|
it 'accepts access credentials hash' do
|
238
264
|
lambda do
|
239
|
-
subject.access_mode!(client_id
|
265
|
+
subject.access_mode!(:client_id => 'client_id', :private_key => 'private_key')
|
240
266
|
end.should_not raise_error(ArgumentError)
|
241
267
|
end
|
242
268
|
|
@@ -253,7 +279,7 @@ describe GroupDocs::Document do
|
|
253
279
|
|
254
280
|
it 'accepts access credentials hash' do
|
255
281
|
lambda do
|
256
|
-
subject.access_mode_set!(:private, client_id
|
282
|
+
subject.access_mode_set!(:private, :client_id => 'client_id', :private_key => 'private_key')
|
257
283
|
end.should_not raise_error(ArgumentError)
|
258
284
|
end
|
259
285
|
|
@@ -279,7 +305,7 @@ describe GroupDocs::Document do
|
|
279
305
|
|
280
306
|
it 'accepts access credentials hash' do
|
281
307
|
lambda do
|
282
|
-
subject.formats!(client_id
|
308
|
+
subject.formats!(:client_id => 'client_id', :private_key => 'private_key')
|
283
309
|
end.should_not raise_error(ArgumentError)
|
284
310
|
end
|
285
311
|
|
@@ -299,7 +325,7 @@ describe GroupDocs::Document do
|
|
299
325
|
|
300
326
|
it 'accepts access credentials hash' do
|
301
327
|
lambda do
|
302
|
-
subject.metadata!(client_id
|
328
|
+
subject.metadata!(:client_id => 'client_id', :private_key => 'private_key')
|
303
329
|
end.should_not raise_error(ArgumentError)
|
304
330
|
end
|
305
331
|
|
@@ -328,7 +354,7 @@ describe GroupDocs::Document do
|
|
328
354
|
|
329
355
|
it 'accepts access credentials hash' do
|
330
356
|
lambda do
|
331
|
-
subject.fields!(client_id
|
357
|
+
subject.fields!(:client_id => 'client_id', :private_key => 'private_key')
|
332
358
|
end.should_not raise_error(ArgumentError)
|
333
359
|
end
|
334
360
|
|
@@ -348,7 +374,7 @@ describe GroupDocs::Document do
|
|
348
374
|
|
349
375
|
it 'accepts access credentials hash' do
|
350
376
|
lambda do
|
351
|
-
subject.sharers!(client_id
|
377
|
+
subject.sharers!(:client_id => 'client_id', :private_key => 'private_key')
|
352
378
|
end.should_not raise_error(ArgumentError)
|
353
379
|
end
|
354
380
|
|
@@ -368,7 +394,7 @@ describe GroupDocs::Document do
|
|
368
394
|
|
369
395
|
it 'accepts access credentials hash' do
|
370
396
|
lambda do
|
371
|
-
subject.sharers_set!(%w(test1@email.com), client_id
|
397
|
+
subject.sharers_set!(%w(test1@email.com), :client_id => 'client_id', :private_key => 'private_key')
|
372
398
|
end.should_not raise_error(ArgumentError)
|
373
399
|
end
|
374
400
|
|
@@ -398,7 +424,7 @@ describe GroupDocs::Document do
|
|
398
424
|
|
399
425
|
it 'accepts access credentials hash' do
|
400
426
|
lambda do
|
401
|
-
subject.sharers_clear!(client_id
|
427
|
+
subject.sharers_clear!(:client_id => 'client_id', :private_key => 'private_key')
|
402
428
|
end.should_not raise_error(ArgumentError)
|
403
429
|
end
|
404
430
|
|
@@ -414,13 +440,13 @@ describe GroupDocs::Document do
|
|
414
440
|
|
415
441
|
it 'accepts access credentials hash' do
|
416
442
|
lambda do
|
417
|
-
subject.convert!(:pdf, {}, client_id
|
443
|
+
subject.convert!(:pdf, {}, :client_id => 'client_id', :private_key => 'private_key')
|
418
444
|
end.should_not raise_error(ArgumentError)
|
419
445
|
end
|
420
446
|
|
421
447
|
it 'accepts options hash' do
|
422
448
|
lambda do
|
423
|
-
subject.convert!(:pdf, email_results
|
449
|
+
subject.convert!(:pdf, :email_results => true)
|
424
450
|
end.should_not raise_error(ArgumentError)
|
425
451
|
end
|
426
452
|
|
@@ -436,7 +462,7 @@ describe GroupDocs::Document do
|
|
436
462
|
|
437
463
|
it 'accepts access credentials hash' do
|
438
464
|
lambda do
|
439
|
-
subject.questionnaires!(client_id
|
465
|
+
subject.questionnaires!(:client_id => 'client_id', :private_key => 'private_key')
|
440
466
|
end.should_not raise_error(ArgumentError)
|
441
467
|
end
|
442
468
|
|
@@ -451,17 +477,17 @@ describe GroupDocs::Document do
|
|
451
477
|
|
452
478
|
describe '#add_questionnaire!' do
|
453
479
|
let(:questionnaire) do
|
454
|
-
GroupDocs::Questionnaire.new(id
|
480
|
+
GroupDocs::Questionnaire.new(:id => 1)
|
455
481
|
end
|
456
482
|
|
457
483
|
it 'accepts access credentials hash' do
|
458
484
|
lambda do
|
459
|
-
subject.add_questionnaire!(questionnaire, client_id
|
485
|
+
subject.add_questionnaire!(questionnaire, :client_id => 'client_id', :private_key => 'private_key')
|
460
486
|
end.should_not raise_error(ArgumentError)
|
461
487
|
end
|
462
488
|
|
463
489
|
it 'raises error if questionnaire is not GroupDocs::Questionnaire object' do
|
464
|
-
|
490
|
+
lambda { subject.add_questionnaire!('Questionnaire') }.should raise_error(ArgumentError)
|
465
491
|
end
|
466
492
|
end
|
467
493
|
|
@@ -471,17 +497,17 @@ describe GroupDocs::Document do
|
|
471
497
|
end
|
472
498
|
|
473
499
|
let(:questionnaire) do
|
474
|
-
GroupDocs::Questionnaire.new(name
|
500
|
+
GroupDocs::Questionnaire.new(:name => 'Q1')
|
475
501
|
end
|
476
502
|
|
477
503
|
it 'accepts access credentials hash' do
|
478
504
|
lambda do
|
479
|
-
subject.create_questionnaire!(questionnaire, client_id
|
505
|
+
subject.create_questionnaire!(questionnaire, :client_id => 'client_id', :private_key => 'private_key')
|
480
506
|
end.should_not raise_error(ArgumentError)
|
481
507
|
end
|
482
508
|
|
483
509
|
it 'raises error if questionnaire is not GroupDocs::Questionnaire object' do
|
484
|
-
|
510
|
+
lambda { subject.create_questionnaire!('Questionnaire') }.should raise_error(ArgumentError)
|
485
511
|
end
|
486
512
|
|
487
513
|
it 'returns GroupDocs::Questionnaire object' do
|
@@ -502,17 +528,17 @@ describe GroupDocs::Document do
|
|
502
528
|
|
503
529
|
describe '#remove_questionnaire!' do
|
504
530
|
let(:questionnaire) do
|
505
|
-
GroupDocs::Questionnaire.new(id
|
531
|
+
GroupDocs::Questionnaire.new(:id => 1)
|
506
532
|
end
|
507
533
|
|
508
534
|
it 'accepts access credentials hash' do
|
509
535
|
lambda do
|
510
|
-
subject.remove_questionnaire!(questionnaire, client_id
|
536
|
+
subject.remove_questionnaire!(questionnaire, :client_id => 'client_id', :private_key => 'private_key')
|
511
537
|
end.should_not raise_error(ArgumentError)
|
512
538
|
end
|
513
539
|
|
514
540
|
it 'raises error if questionnaire is not GroupDocs::Questionnaire object' do
|
515
|
-
|
541
|
+
lambda { subject.remove_questionnaire!('Questionnaire') }.should raise_error(ArgumentError)
|
516
542
|
end
|
517
543
|
end
|
518
544
|
|
@@ -522,23 +548,23 @@ describe GroupDocs::Document do
|
|
522
548
|
end
|
523
549
|
|
524
550
|
let(:datasource) do
|
525
|
-
GroupDocs::DataSource.new(id
|
551
|
+
GroupDocs::DataSource.new(:id => 1)
|
526
552
|
end
|
527
553
|
|
528
554
|
it 'accepts access credentials hash' do
|
529
555
|
lambda do
|
530
|
-
subject.datasource!(datasource, {}, client_id
|
556
|
+
subject.datasource!(datasource, {}, :client_id => 'client_id', :private_key => 'private_key')
|
531
557
|
end.should_not raise_error(ArgumentError)
|
532
558
|
end
|
533
559
|
|
534
560
|
it 'accepts options hash' do
|
535
561
|
lambda do
|
536
|
-
subject.datasource!(datasource, new_type
|
562
|
+
subject.datasource!(datasource, :new_type => :pdf)
|
537
563
|
end.should_not raise_error(ArgumentError)
|
538
564
|
end
|
539
565
|
|
540
566
|
it 'raises error if datasource is not GroupDocs::Datasource object' do
|
541
|
-
|
567
|
+
lambda { subject.datasource!('Datasource') }.should raise_error(ArgumentError)
|
542
568
|
end
|
543
569
|
|
544
570
|
it 'returns GroupDocs::Job object' do
|
@@ -554,7 +580,7 @@ describe GroupDocs::Document do
|
|
554
580
|
|
555
581
|
it 'accepts access credentials hash' do
|
556
582
|
lambda do
|
557
|
-
subject.annotations!(client_id
|
583
|
+
subject.annotations!(:client_id => 'client_id', :private_key => 'private_key')
|
558
584
|
end.should_not raise_error(ArgumentError)
|
559
585
|
end
|
560
586
|
|
@@ -579,7 +605,7 @@ describe GroupDocs::Document do
|
|
579
605
|
|
580
606
|
it 'accepts access credentials hash' do
|
581
607
|
lambda do
|
582
|
-
subject.details!(client_id
|
608
|
+
subject.details!(:client_id => 'client_id', :private_key => 'private_key')
|
583
609
|
end.should_not raise_error(ArgumentError)
|
584
610
|
end
|
585
611
|
|
@@ -594,17 +620,17 @@ describe GroupDocs::Document do
|
|
594
620
|
end
|
595
621
|
|
596
622
|
let(:document) do
|
597
|
-
GroupDocs::Document.new(file
|
623
|
+
GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
|
598
624
|
end
|
599
625
|
|
600
626
|
it 'accepts access credentials hash' do
|
601
627
|
lambda do
|
602
|
-
subject.compare!(document, client_id
|
628
|
+
subject.compare!(document, :client_id => 'client_id', :private_key => 'private_key')
|
603
629
|
end.should_not raise_error(ArgumentError)
|
604
630
|
end
|
605
631
|
|
606
632
|
it 'raises error if document is not GroupDocs::Document object' do
|
607
|
-
|
633
|
+
lambda { subject.compare!('Document') }.should raise_error(ArgumentError)
|
608
634
|
end
|
609
635
|
|
610
636
|
it 'returns GroupDocs::Job object' do
|
@@ -619,7 +645,7 @@ describe GroupDocs::Document do
|
|
619
645
|
|
620
646
|
it 'accepts access credentials hash' do
|
621
647
|
lambda do
|
622
|
-
subject.changes!(client_id
|
648
|
+
subject.changes!(:client_id => 'client_id', :private_key => 'private_key')
|
623
649
|
end.should_not raise_error(ArgumentError)
|
624
650
|
end
|
625
651
|
|
@@ -640,7 +666,7 @@ describe GroupDocs::Document do
|
|
640
666
|
|
641
667
|
it 'accepts access credentials hash' do
|
642
668
|
lambda do
|
643
|
-
subject.collaborators!(client_id
|
669
|
+
subject.collaborators!(:client_id => 'client_id', :private_key => 'private_key')
|
644
670
|
end.should_not raise_error(ArgumentError)
|
645
671
|
end
|
646
672
|
|
@@ -660,7 +686,7 @@ describe GroupDocs::Document do
|
|
660
686
|
|
661
687
|
it 'accepts access credentials hash' do
|
662
688
|
lambda do
|
663
|
-
subject.set_collaborators!(%w(test1@email.com), 1, client_id
|
689
|
+
subject.set_collaborators!(%w(test1@email.com), 1, :client_id => 'client_id', :private_key => 'private_key')
|
664
690
|
end.should_not raise_error(ArgumentError)
|
665
691
|
end
|
666
692
|
|
@@ -688,7 +714,7 @@ describe GroupDocs::Document do
|
|
688
714
|
|
689
715
|
it 'accepts access credentials hash' do
|
690
716
|
lambda do
|
691
|
-
subject.add_collaborator!(collaborator, client_id
|
717
|
+
subject.add_collaborator!(collaborator, :client_id => 'client_id', :private_key => 'private_key')
|
692
718
|
end.should_not raise_error(ArgumentError)
|
693
719
|
end
|
694
720
|
|
@@ -698,7 +724,7 @@ describe GroupDocs::Document do
|
|
698
724
|
end
|
699
725
|
|
700
726
|
it 'raises error if collaborator is not an instance of GroupDocs::User' do
|
701
|
-
|
727
|
+
lambda { subject.add_collaborator!('collaborator') }.should raise_error(ArgumentError)
|
702
728
|
end
|
703
729
|
end
|
704
730
|
|
@@ -711,7 +737,7 @@ describe GroupDocs::Document do
|
|
711
737
|
|
712
738
|
it 'accepts access credentials hash' do
|
713
739
|
lambda do
|
714
|
-
subject.set_reviewers!(reviewers, client_id
|
740
|
+
subject.set_reviewers!(reviewers, :client_id => 'client_id', :private_key => 'private_key')
|
715
741
|
end.should_not raise_error(ArgumentError)
|
716
742
|
end
|
717
743
|
|
@@ -730,7 +756,7 @@ describe GroupDocs::Document do
|
|
730
756
|
|
731
757
|
it 'accepts access credentials hash' do
|
732
758
|
lambda do
|
733
|
-
subject.shared_link_access_rights!(client_id
|
759
|
+
subject.shared_link_access_rights!(:client_id => 'client_id', :private_key => 'private_key')
|
734
760
|
end.should_not raise_error(ArgumentError)
|
735
761
|
end
|
736
762
|
|
@@ -760,7 +786,7 @@ describe GroupDocs::Document do
|
|
760
786
|
|
761
787
|
it 'accepts access credentials hash' do
|
762
788
|
lambda do
|
763
|
-
subject.set_shared_link_access_rights!(%w(view), client_id
|
789
|
+
subject.set_shared_link_access_rights!(%w(view), :client_id => 'client_id', :private_key => 'private_key')
|
764
790
|
end.should_not raise_error(ArgumentError)
|
765
791
|
end
|
766
792
|
|
@@ -777,18 +803,18 @@ describe GroupDocs::Document do
|
|
777
803
|
|
778
804
|
it 'accepts access credentials hash' do
|
779
805
|
lambda do
|
780
|
-
subject.set_session_callback!('http://www.example.com', client_id
|
806
|
+
subject.set_session_callback!('http://www.example.com', :client_id => 'client_id', :private_key => 'private_key')
|
781
807
|
end.should_not raise_error(ArgumentError)
|
782
808
|
end
|
783
809
|
end
|
784
810
|
|
785
811
|
describe '#method_missing' do
|
786
812
|
it 'passes unknown methods to file object' do
|
787
|
-
|
813
|
+
lambda { subject.name }.should_not raise_error(NoMethodError)
|
788
814
|
end
|
789
815
|
|
790
816
|
it 'raises NoMethodError if neither self nor file responds to method' do
|
791
|
-
|
817
|
+
lambda { subject.unknown_method }.should raise_error(NoMethodError)
|
792
818
|
end
|
793
819
|
end
|
794
820
|
|