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
@@ -13,12 +13,12 @@ describe GroupDocs::Signature::Form do
|
|
13
13
|
|
14
14
|
it 'accepts access credentials hash' do
|
15
15
|
lambda do
|
16
|
-
described_class.all!({}, client_id
|
16
|
+
described_class.all!({}, :client_id => 'client_id', :private_key => 'private_key')
|
17
17
|
end.should_not raise_error(ArgumentError)
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'allows passing options' do
|
21
|
-
|
21
|
+
lambda { described_class.all!(:page => 1, :count => 3) }.should_not raise_error(ArgumentError)
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'returns array of GroupDocs::Signature::Form objects' do
|
@@ -69,13 +69,13 @@ describe GroupDocs::Signature::Form do
|
|
69
69
|
|
70
70
|
it 'accepts access credentials hash' do
|
71
71
|
lambda do
|
72
|
-
subject.create!(template, {}, client_id
|
72
|
+
subject.create!(template, {}, :client_id => 'client_id', :private_key => 'private_key')
|
73
73
|
end.should_not raise_error(ArgumentError)
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'accepts options hash' do
|
77
77
|
lambda do
|
78
|
-
subject.create!(template, assembly_id
|
78
|
+
subject.create!(template, :assembly_id => 'aodfh43yr9834hf943h')
|
79
79
|
end.should_not raise_error(ArgumentError)
|
80
80
|
end
|
81
81
|
|
@@ -91,7 +91,7 @@ describe GroupDocs::Signature::Form do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'raises error if template is not GroupDocs::Signature::Template object' do
|
94
|
-
|
94
|
+
lambda { subject.create!('Template') }.should raise_error(ArgumentError)
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -102,7 +102,7 @@ describe GroupDocs::Signature::Form do
|
|
102
102
|
|
103
103
|
it 'accepts access credentials hash' do
|
104
104
|
lambda do
|
105
|
-
subject.documents!(client_id
|
105
|
+
subject.documents!(:client_id => 'client_id', :private_key => 'private_key')
|
106
106
|
end.should_not raise_error(ArgumentError)
|
107
107
|
end
|
108
108
|
|
@@ -122,7 +122,7 @@ describe GroupDocs::Signature::Form do
|
|
122
122
|
|
123
123
|
it 'accepts access credentials hash' do
|
124
124
|
lambda do
|
125
|
-
subject.publish!(client_id
|
125
|
+
subject.publish!(: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::Signature::Form do
|
|
134
134
|
|
135
135
|
it 'accepts access credentials hash' do
|
136
136
|
lambda do
|
137
|
-
subject.complete!(client_id
|
137
|
+
subject.complete!(:client_id => 'client_id', :private_key => 'private_key')
|
138
138
|
end.should_not raise_error(ArgumentError)
|
139
139
|
end
|
140
140
|
end
|
@@ -146,7 +146,7 @@ describe GroupDocs::Signature::Form do
|
|
146
146
|
|
147
147
|
it 'accepts access credentials hash' do
|
148
148
|
lambda do
|
149
|
-
subject.archive!(client_id
|
149
|
+
subject.archive!(:client_id => 'client_id', :private_key => 'private_key')
|
150
150
|
end.should_not raise_error(ArgumentError)
|
151
151
|
end
|
152
152
|
end
|
@@ -11,7 +11,7 @@ describe GroupDocs::Signature::List do
|
|
11
11
|
|
12
12
|
it 'accepts access credentials hash' do
|
13
13
|
lambda do
|
14
|
-
described_class.get!(client_id
|
14
|
+
described_class.get!(:client_id => 'client_id', :private_key => 'private_key')
|
15
15
|
end.should_not raise_error(ArgumentError)
|
16
16
|
end
|
17
17
|
|
@@ -57,7 +57,7 @@ describe GroupDocs::Signature::List do
|
|
57
57
|
|
58
58
|
it 'accepts access credentials hash' do
|
59
59
|
lambda do
|
60
|
-
subject.add!(client_id
|
60
|
+
subject.add!(:client_id => 'client_id', :private_key => 'private_key')
|
61
61
|
end.should_not raise_error(ArgumentError)
|
62
62
|
end
|
63
63
|
|
@@ -80,7 +80,7 @@ describe GroupDocs::Signature::List do
|
|
80
80
|
|
81
81
|
it 'accepts access credentials hash' do
|
82
82
|
lambda do
|
83
|
-
subject.delete!(client_id
|
83
|
+
subject.delete!(:client_id => 'client_id', :private_key => 'private_key')
|
84
84
|
end.should_not raise_error(ArgumentError)
|
85
85
|
end
|
86
86
|
end
|
@@ -11,12 +11,12 @@ describe GroupDocs::Signature::Role do
|
|
11
11
|
|
12
12
|
it 'accepts access credentials hash' do
|
13
13
|
lambda do
|
14
|
-
described_class.get!({}, client_id
|
14
|
+
described_class.get!({}, :client_id => 'client_id', :private_key => 'private_key')
|
15
15
|
end.should_not raise_error(ArgumentError)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'allows passing options' do
|
19
|
-
|
19
|
+
lambda { described_class.get!(:id => "dsaoij3928ukr03") }.should_not raise_error(ArgumentError)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'returns array of GroupDocs::Signature::Role objects' do
|
@@ -17,12 +17,12 @@ describe GroupDocs::Signature::Template do
|
|
17
17
|
|
18
18
|
it 'accepts access credentials hash' do
|
19
19
|
lambda do
|
20
|
-
described_class.all!({}, client_id
|
20
|
+
described_class.all!({}, :client_id => 'client_id', :private_key => 'private_key')
|
21
21
|
end.should_not raise_error(ArgumentError)
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'allows passing options' do
|
25
|
-
|
25
|
+
lambda { described_class.all!(:page => 1, :count => 3) }.should_not raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'returns array of GroupDocs::Signature::Template objects' do
|
@@ -49,12 +49,12 @@ describe GroupDocs::Signature::Template do
|
|
49
49
|
|
50
50
|
it 'accepts access credentials hash' do
|
51
51
|
lambda do
|
52
|
-
subject.add_recipient!(recipient, client_id
|
52
|
+
subject.add_recipient!(recipient, :client_id => 'client_id', :private_key => 'private_key')
|
53
53
|
end.should_not raise_error(ArgumentError)
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
|
57
|
-
|
57
|
+
lambda { subject.add_recipient!('Recipient') }.should raise_error(ArgumentError)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -69,12 +69,12 @@ describe GroupDocs::Signature::Template do
|
|
69
69
|
|
70
70
|
it 'accepts access credentials hash' do
|
71
71
|
lambda do
|
72
|
-
subject.modify_recipient!(recipient, client_id
|
72
|
+
subject.modify_recipient!(recipient, :client_id => 'client_id', :private_key => 'private_key')
|
73
73
|
end.should_not raise_error(ArgumentError)
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
|
77
|
-
|
77
|
+
lambda { subject.modify_recipient!('Recipient') }.should raise_error(ArgumentError)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -11,7 +11,7 @@ describe GroupDocs::Signature do
|
|
11
11
|
|
12
12
|
it 'accepts access credentials hash' do
|
13
13
|
lambda do
|
14
|
-
described_class.get!(client_id
|
14
|
+
described_class.get!(:client_id => 'client_id', :private_key => 'private_key')
|
15
15
|
end.should_not raise_error(ArgumentError)
|
16
16
|
end
|
17
17
|
|
@@ -61,7 +61,7 @@ describe GroupDocs::Signature do
|
|
61
61
|
|
62
62
|
it 'accepts access credentials hash' do
|
63
63
|
lambda do
|
64
|
-
subject.create!('Signature', client_id
|
64
|
+
subject.create!('Signature', :client_id => 'client_id', :private_key => 'private_key')
|
65
65
|
end.should_not raise_error(ArgumentError)
|
66
66
|
end
|
67
67
|
|
@@ -84,7 +84,7 @@ describe GroupDocs::Signature do
|
|
84
84
|
|
85
85
|
it 'accepts access credentials hash' do
|
86
86
|
lambda do
|
87
|
-
subject.delete!(client_id
|
87
|
+
subject.delete!(:client_id => 'client_id', :private_key => 'private_key')
|
88
88
|
end.should_not raise_error(ArgumentError)
|
89
89
|
end
|
90
90
|
end
|
@@ -12,13 +12,13 @@ describe GroupDocs::Storage::File do
|
|
12
12
|
|
13
13
|
it 'accepts access credentials hash' do
|
14
14
|
lambda do
|
15
|
-
described_class.upload!(__FILE__, {}, client_id
|
15
|
+
described_class.upload!(__FILE__, {}, :client_id => 'client_id', :private_key => 'private_key')
|
16
16
|
end.should_not raise_error(ArgumentError)
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'accepts options hash' do
|
20
20
|
lambda do
|
21
|
-
described_class.upload!(__FILE__, path
|
21
|
+
described_class.upload!(__FILE__, :path => 'folder1')
|
22
22
|
end.should_not raise_error(ArgumentError)
|
23
23
|
end
|
24
24
|
|
@@ -35,7 +35,7 @@ describe GroupDocs::Storage::File do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'uses name if passed' do
|
38
|
-
opts = { name
|
38
|
+
opts = { :name => 'file.pdf' }
|
39
39
|
described_class.upload!(__FILE__, opts)
|
40
40
|
opts[:name].should == opts[:name]
|
41
41
|
end
|
@@ -52,7 +52,7 @@ describe GroupDocs::Storage::File do
|
|
52
52
|
|
53
53
|
it 'accepts access credentials hash' do
|
54
54
|
lambda do
|
55
|
-
described_class.upload_web!('http://www.google.com', client_id
|
55
|
+
described_class.upload_web!('http://www.google.com', :client_id => 'client_id', :private_key => 'private_key')
|
56
56
|
end.should_not raise_error(ArgumentError)
|
57
57
|
end
|
58
58
|
|
@@ -90,7 +90,7 @@ describe GroupDocs::Storage::File do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'raises error if type is unknown' do
|
93
|
-
|
93
|
+
lambda { subject.type = :unknown }.should raise_error(ArgumentError)
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -125,14 +125,14 @@ describe GroupDocs::Storage::File do
|
|
125
125
|
describe '#download!' do
|
126
126
|
before(:each) do
|
127
127
|
mock_api_server(File.read('spec/support/files/resume.pdf'))
|
128
|
-
subject.stub(name
|
128
|
+
subject.stub(:name => 'resume.pdf')
|
129
129
|
end
|
130
130
|
|
131
131
|
let(:path) { Dir.tmpdir }
|
132
132
|
|
133
133
|
it 'accepts access credentials hash' do
|
134
134
|
lambda do
|
135
|
-
subject.download!(path, client_id
|
135
|
+
subject.download!(path, :client_id => 'client_id', :private_key => 'private_key')
|
136
136
|
end.should_not raise_error(ArgumentError)
|
137
137
|
end
|
138
138
|
|
@@ -155,13 +155,13 @@ describe GroupDocs::Storage::File do
|
|
155
155
|
|
156
156
|
it 'accepts access credentials hash' do
|
157
157
|
lambda do
|
158
|
-
subject.move!('folder1', {}, client_id
|
158
|
+
subject.move!('folder1', {}, :client_id => 'client_id', :private_key => 'private_key')
|
159
159
|
end.should_not raise_error(ArgumentError)
|
160
160
|
end
|
161
161
|
|
162
162
|
it 'accepts options credentials hash' do
|
163
163
|
lambda do
|
164
|
-
subject.move!('folder1', name
|
164
|
+
subject.move!('folder1', :name => 'file.pdf')
|
165
165
|
end.should_not raise_error(ArgumentError)
|
166
166
|
end
|
167
167
|
|
@@ -173,7 +173,7 @@ describe GroupDocs::Storage::File do
|
|
173
173
|
end
|
174
174
|
|
175
175
|
it 'uses name if passed' do
|
176
|
-
opts = { name
|
176
|
+
opts = { :name => 'file.pdf' }
|
177
177
|
subject.move!('folder1', opts)
|
178
178
|
opts[:name].should == opts[:name]
|
179
179
|
end
|
@@ -190,12 +190,12 @@ describe GroupDocs::Storage::File do
|
|
190
190
|
|
191
191
|
it 'accepts access credentials hash' do
|
192
192
|
lambda do
|
193
|
-
subject.rename!('resume.pdf', client_id
|
193
|
+
subject.rename!('resume.pdf', :client_id => 'client_id', :private_key => 'private_key')
|
194
194
|
end.should_not raise_error(ArgumentError)
|
195
195
|
end
|
196
196
|
|
197
197
|
it 'uses #move! to rename file' do
|
198
|
-
subject.should_receive(:move!).with(subject.path, { name
|
198
|
+
subject.should_receive(:move!).with(subject.path, { :name => 'resume2.pdf' }, {})
|
199
199
|
subject.rename!('resume2.pdf')
|
200
200
|
end
|
201
201
|
end
|
@@ -207,13 +207,13 @@ describe GroupDocs::Storage::File do
|
|
207
207
|
|
208
208
|
it 'accepts access credentials hash' do
|
209
209
|
lambda do
|
210
|
-
subject.copy!('resume.pdf', {}, client_id
|
210
|
+
subject.copy!('resume.pdf', {}, :client_id => 'client_id', :private_key => 'private_key')
|
211
211
|
end.should_not raise_error(ArgumentError)
|
212
212
|
end
|
213
213
|
|
214
214
|
it 'accepts options credentials hash' do
|
215
215
|
lambda do
|
216
|
-
subject.copy!('folder1', name
|
216
|
+
subject.copy!('folder1', :name => 'file.pdf')
|
217
217
|
end.should_not raise_error(ArgumentError)
|
218
218
|
end
|
219
219
|
|
@@ -225,7 +225,7 @@ describe GroupDocs::Storage::File do
|
|
225
225
|
end
|
226
226
|
|
227
227
|
it 'uses name if passed' do
|
228
|
-
opts = { name
|
228
|
+
opts = { :name => 'file.pdf' }
|
229
229
|
subject.copy!('folder1', opts)
|
230
230
|
opts[:name].should == opts[:name]
|
231
231
|
end
|
@@ -242,17 +242,17 @@ describe GroupDocs::Storage::File do
|
|
242
242
|
|
243
243
|
it 'accepts access credentials hash' do
|
244
244
|
lambda do
|
245
|
-
subject.compress!(client_id
|
245
|
+
subject.compress!(:client_id => 'client_id', :private_key => 'private_key')
|
246
246
|
end.should_not raise_error(ArgumentError)
|
247
247
|
end
|
248
248
|
|
249
249
|
it 'returns archived file' do
|
250
|
-
subject.stub(name
|
250
|
+
subject.stub(:name => 'resume.pdf')
|
251
251
|
subject.compress!.should be_a(GroupDocs::Storage::File)
|
252
252
|
end
|
253
253
|
|
254
254
|
it 'creates archive filename as filename + archive type' do
|
255
|
-
subject.stub(name
|
255
|
+
subject.stub(:name => 'resume.pdf')
|
256
256
|
subject.compress!.name.should == 'resume.pdf.zip'
|
257
257
|
end
|
258
258
|
end
|
@@ -260,7 +260,7 @@ describe GroupDocs::Storage::File do
|
|
260
260
|
describe '#delete!' do
|
261
261
|
it 'accepts access credentials hash' do
|
262
262
|
lambda do
|
263
|
-
subject.delete!(client_id
|
263
|
+
subject.delete!(:client_id => 'client_id', :private_key => 'private_key')
|
264
264
|
end.should_not raise_error(ArgumentError)
|
265
265
|
end
|
266
266
|
|
@@ -274,7 +274,7 @@ describe GroupDocs::Storage::File do
|
|
274
274
|
describe '#move_to_trash!' do
|
275
275
|
it 'accepts access credentials hash' do
|
276
276
|
lambda do
|
277
|
-
subject.move_to_trash!(client_id
|
277
|
+
subject.move_to_trash!(:client_id => 'client_id', :private_key => 'private_key')
|
278
278
|
end.should_not raise_error(ArgumentError)
|
279
279
|
end
|
280
280
|
end
|
@@ -12,7 +12,7 @@ describe GroupDocs::Storage::Folder do
|
|
12
12
|
|
13
13
|
it 'accepts access credentials hash' do
|
14
14
|
lambda do
|
15
|
-
described_class.create!('Test', client_id
|
15
|
+
described_class.create!('Test', :client_id => 'client_id', :private_key => 'private_key')
|
16
16
|
end.should_not raise_error(ArgumentError)
|
17
17
|
end
|
18
18
|
|
@@ -29,21 +29,21 @@ describe GroupDocs::Storage::Folder do
|
|
29
29
|
|
30
30
|
it 'accepts access credentials hash' do
|
31
31
|
lambda do
|
32
|
-
described_class.list!('', {}, client_id
|
32
|
+
described_class.list!('', {}, :client_id => 'client_id', :private_key => 'private_key')
|
33
33
|
end.should_not raise_error(ArgumentError)
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'allows passing path' do
|
37
|
-
|
37
|
+
lambda { described_class.list!('test') }.should_not raise_error(ArgumentError)
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'allows passing options' do
|
41
|
-
|
41
|
+
lambda { described_class.list!('', :page => 1, :count => 1) }.should_not raise_error(ArgumentError)
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'creates new instance of GroupDocs::Storage::Folder and calls #list!' do
|
45
45
|
folder = stub('folder')
|
46
|
-
GroupDocs::Storage::Folder.should_receive(:new).with(path
|
46
|
+
GroupDocs::Storage::Folder.should_receive(:new).with(:path => '').and_return(folder)
|
47
47
|
folder.should_receive(:list!).with({}, {})
|
48
48
|
described_class.list!
|
49
49
|
end
|
@@ -77,27 +77,27 @@ describe GroupDocs::Storage::Folder do
|
|
77
77
|
describe '#list!' do
|
78
78
|
before(:each) do
|
79
79
|
mock_api_server(load_json('folder_list'))
|
80
|
-
subject.stub(path
|
80
|
+
subject.stub(:path => '/Test1')
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'accepts access credentials hash' do
|
84
84
|
lambda do
|
85
|
-
subject.list!({}, client_id
|
85
|
+
subject.list!({}, :client_id => 'client_id', :private_key => 'private_key')
|
86
86
|
end.should_not raise_error(ArgumentError)
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'allows passing options' do
|
90
|
-
|
90
|
+
lambda { subject.list!(:page => 1, :count => 1) }.should_not raise_error(ArgumentError)
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'capitalizes :order_by option' do
|
94
|
-
options = { order_by
|
95
|
-
|
94
|
+
options = { :order_by => 'field' }
|
95
|
+
lambda { subject.list!(options) }.should change { options[:order_by] }.to('Field')
|
96
96
|
end
|
97
97
|
|
98
98
|
it 'camelizes :order_by option' do
|
99
|
-
options = { order_by
|
100
|
-
|
99
|
+
options = { :order_by => 'modified_on' }
|
100
|
+
lambda { subject.list!(options) }.should change { options[:order_by] }.to('ModifiedOn')
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'returns array' do
|
@@ -130,7 +130,7 @@ describe GroupDocs::Storage::Folder do
|
|
130
130
|
|
131
131
|
it 'accepts access credentials hash' do
|
132
132
|
lambda do
|
133
|
-
subject.move!('Test', client_id
|
133
|
+
subject.move!('Test', :client_id => 'client_id', :private_key => 'private_key')
|
134
134
|
end.should_not raise_error(ArgumentError)
|
135
135
|
end
|
136
136
|
|
@@ -149,7 +149,7 @@ describe GroupDocs::Storage::Folder do
|
|
149
149
|
|
150
150
|
it 'accepts access credentials hash' do
|
151
151
|
lambda do
|
152
|
-
subject.copy!('/Test2', client_id
|
152
|
+
subject.copy!('/Test2', :client_id => 'client_id', :private_key => 'private_key')
|
153
153
|
end.should_not raise_error(ArgumentError)
|
154
154
|
end
|
155
155
|
|
@@ -167,18 +167,18 @@ describe GroupDocs::Storage::Folder do
|
|
167
167
|
|
168
168
|
it 'accepts access credentials hash' do
|
169
169
|
lambda do
|
170
|
-
subject.create!(client_id
|
170
|
+
subject.create!(:client_id => 'client_id', :private_key => 'private_key')
|
171
171
|
end.should_not raise_error(ArgumentError)
|
172
172
|
end
|
173
173
|
|
174
174
|
it 'calls create! class method and pass parameters to it' do
|
175
|
-
subject = described_class.new(name
|
175
|
+
subject = described_class.new(:name => 'Test1')
|
176
176
|
described_class.should_receive(:create!).with('Test1', {})
|
177
177
|
subject.create!
|
178
178
|
end
|
179
179
|
|
180
180
|
it 'returns new GroupDocs::Storage::Folder object' do
|
181
|
-
subject = described_class.new(name
|
181
|
+
subject = described_class.new(:name => 'Test1')
|
182
182
|
new_folder = subject.create!
|
183
183
|
new_folder.should be_a(GroupDocs::Storage::Folder)
|
184
184
|
new_folder.should_not == subject
|
@@ -192,7 +192,7 @@ describe GroupDocs::Storage::Folder do
|
|
192
192
|
|
193
193
|
it 'accepts access credentials hash' do
|
194
194
|
lambda do
|
195
|
-
subject.delete!(client_id
|
195
|
+
subject.delete!(:client_id => 'client_id', :private_key => 'private_key')
|
196
196
|
end.should_not raise_error(ArgumentError)
|
197
197
|
end
|
198
198
|
|
@@ -209,7 +209,7 @@ describe GroupDocs::Storage::Folder do
|
|
209
209
|
|
210
210
|
it 'accepts access credentials hash' do
|
211
211
|
lambda do
|
212
|
-
subject.sharers!(client_id
|
212
|
+
subject.sharers!(:client_id => 'client_id', :private_key => 'private_key')
|
213
213
|
end.should_not raise_error(ArgumentError)
|
214
214
|
end
|
215
215
|
|
@@ -229,7 +229,7 @@ describe GroupDocs::Storage::Folder do
|
|
229
229
|
|
230
230
|
it 'accepts access credentials hash' do
|
231
231
|
lambda do
|
232
|
-
subject.sharers_set!(%w(test1@email.com), client_id
|
232
|
+
subject.sharers_set!(%w(test1@email.com), :client_id => 'client_id', :private_key => 'private_key')
|
233
233
|
end.should_not raise_error(ArgumentError)
|
234
234
|
end
|
235
235
|
|
@@ -259,7 +259,7 @@ describe GroupDocs::Storage::Folder do
|
|
259
259
|
|
260
260
|
it 'accepts access credentials hash' do
|
261
261
|
lambda do
|
262
|
-
subject.sharers_clear!(client_id
|
262
|
+
subject.sharers_clear!(:client_id => 'client_id', :private_key => 'private_key')
|
263
263
|
end.should_not raise_error(ArgumentError)
|
264
264
|
end
|
265
265
|
|