groupdocs 1.2.11 → 1.3.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/.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
data/spec/groupdocs/job_spec.rb
CHANGED
|
@@ -12,13 +12,13 @@ describe GroupDocs::Job do
|
|
|
12
12
|
|
|
13
13
|
it 'accepts access credentials hash' do
|
|
14
14
|
lambda do
|
|
15
|
-
described_class.all!({}, client_id
|
|
15
|
+
described_class.all!({}, :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.all!(page
|
|
21
|
+
described_class.all!(:page => 1, :count => 2)
|
|
22
22
|
end.should_not raise_error(ArgumentError)
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -38,7 +38,7 @@ describe GroupDocs::Job do
|
|
|
38
38
|
|
|
39
39
|
it 'accepts access credentials hash' do
|
|
40
40
|
lambda do
|
|
41
|
-
described_class.get!(1, client_id
|
|
41
|
+
described_class.get!(1, :client_id => 'client_id', :private_key => 'private_key')
|
|
42
42
|
end.should_not raise_error(ArgumentError)
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -56,27 +56,27 @@ describe GroupDocs::Job do
|
|
|
56
56
|
|
|
57
57
|
it 'accepts access credentials hash' do
|
|
58
58
|
lambda do
|
|
59
|
-
described_class.create!({ actions
|
|
59
|
+
described_class.create!({ :actions => %w(convert) }, :client_id => 'client_id', :private_key => 'private_key')
|
|
60
60
|
end.should_not raise_error(ArgumentError)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
it 'raises error if actions are passed' do
|
|
64
|
-
|
|
64
|
+
lambda { described_class.create!({}) }.should raise_error(ArgumentError)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
it 'convert actions to byte flag' do
|
|
68
68
|
described_class.should_receive(:convert_actions_to_byte).with(actions).and_return(5)
|
|
69
|
-
described_class.create!(actions
|
|
69
|
+
described_class.create!(:actions => actions)
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
it 'converts array of out formats to string' do
|
|
73
73
|
formats = %w(pdf txt)
|
|
74
74
|
formats.should_receive(:join).with(?;)
|
|
75
|
-
described_class.create!(actions
|
|
75
|
+
described_class.create!(:actions => actions, :out_formats => formats)
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
it 'returns GroupDocs::Job object' do
|
|
79
|
-
described_class.create!(actions
|
|
79
|
+
described_class.create!(:actions => actions).should be_a(GroupDocs::Job)
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
@@ -93,9 +93,9 @@ describe GroupDocs::Job do
|
|
|
93
93
|
describe '#documents=' do
|
|
94
94
|
let(:response) do
|
|
95
95
|
{
|
|
96
|
-
inputs
|
|
97
|
-
{ id
|
|
98
|
-
{ id
|
|
96
|
+
:inputs => [
|
|
97
|
+
{ :id => 1, :guid => 'fhy9yh94u238dgf', :status => 0, :outputs => [] },
|
|
98
|
+
{ :id => 2, :guid => 'ofh9rhy9rfohf9s', :status => 2, :outputs => [] }
|
|
99
99
|
]
|
|
100
100
|
}
|
|
101
101
|
end
|
|
@@ -142,7 +142,7 @@ describe GroupDocs::Job do
|
|
|
142
142
|
|
|
143
143
|
it 'accepts access credentials hash' do
|
|
144
144
|
lambda do
|
|
145
|
-
subject.documents!(client_id
|
|
145
|
+
subject.documents!(:client_id => 'client_id', :private_key => 'private_key')
|
|
146
146
|
end.should_not raise_error(ArgumentError)
|
|
147
147
|
end
|
|
148
148
|
|
|
@@ -173,7 +173,7 @@ describe GroupDocs::Job do
|
|
|
173
173
|
|
|
174
174
|
it 'returns empty arrays if there are no documents' do
|
|
175
175
|
mock_api_server('{ "status": "Ok", "result": {}}')
|
|
176
|
-
subject.documents!.should == { inputs
|
|
176
|
+
subject.documents!.should == { :inputs => [], :outputs => [] }
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
179
|
|
|
@@ -183,23 +183,23 @@ describe GroupDocs::Job do
|
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
let(:document) do
|
|
186
|
-
GroupDocs::Document.new(file
|
|
186
|
+
GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
|
|
187
187
|
end
|
|
188
188
|
|
|
189
189
|
it 'accepts access credentials hash' do
|
|
190
190
|
lambda do
|
|
191
|
-
subject.add_document!(document, {}, client_id
|
|
191
|
+
subject.add_document!(document, {}, :client_id => 'client_id', :private_key => 'private_key')
|
|
192
192
|
end.should_not raise_error(ArgumentError)
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
it 'accepts options hash' do
|
|
196
196
|
lambda do
|
|
197
|
-
subject.add_document!(document, output_formats
|
|
197
|
+
subject.add_document!(document, :output_formats => %w(pdf txt))
|
|
198
198
|
end.should_not raise_error(ArgumentError)
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
it 'raises error if document is not an instance of GroupDocs::Document' do
|
|
202
|
-
|
|
202
|
+
lambda { subject.add_document!('Document') }.should raise_error(ArgumentError)
|
|
203
203
|
end
|
|
204
204
|
|
|
205
205
|
it 'returns document ID' do
|
|
@@ -214,7 +214,7 @@ describe GroupDocs::Job do
|
|
|
214
214
|
|
|
215
215
|
it 'accepts access credentials hash' do
|
|
216
216
|
lambda do
|
|
217
|
-
subject.delete_document!('a9ufg8s7dfgsdf', client_id
|
|
217
|
+
subject.delete_document!('a9ufg8s7dfgsdf', :client_id => 'client_id', :private_key => 'private_key')
|
|
218
218
|
end.should_not raise_error(ArgumentError)
|
|
219
219
|
end
|
|
220
220
|
|
|
@@ -225,7 +225,7 @@ describe GroupDocs::Job do
|
|
|
225
225
|
|
|
226
226
|
describe '#add_datasource!' do
|
|
227
227
|
let(:document) do
|
|
228
|
-
GroupDocs::Document.new(file
|
|
228
|
+
GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
|
|
229
229
|
end
|
|
230
230
|
|
|
231
231
|
let(:datasource) do
|
|
@@ -234,16 +234,16 @@ describe GroupDocs::Job do
|
|
|
234
234
|
|
|
235
235
|
it 'accepts access credentials hash' do
|
|
236
236
|
lambda do
|
|
237
|
-
subject.add_datasource!(document, datasource, client_id
|
|
237
|
+
subject.add_datasource!(document, datasource, :client_id => 'client_id', :private_key => 'private_key')
|
|
238
238
|
end.should_not raise_error(ArgumentError)
|
|
239
239
|
end
|
|
240
240
|
|
|
241
241
|
it 'raises error if document is not an instance of GroupDocs::Document' do
|
|
242
|
-
|
|
242
|
+
lambda { subject.add_datasource!('Document') }.should raise_error(ArgumentError)
|
|
243
243
|
end
|
|
244
244
|
|
|
245
245
|
it 'raises error if datasource is not an instance of GroupDocs::DataSource' do
|
|
246
|
-
|
|
246
|
+
lambda { subject.add_datasource!(document, 'DataSource') }.should raise_error(ArgumentError)
|
|
247
247
|
end
|
|
248
248
|
end
|
|
249
249
|
|
|
@@ -256,13 +256,13 @@ describe GroupDocs::Job do
|
|
|
256
256
|
|
|
257
257
|
it 'accepts access credentials hash' do
|
|
258
258
|
lambda do
|
|
259
|
-
subject.add_url!(url, {}, client_id
|
|
259
|
+
subject.add_url!(url, {}, :client_id => 'client_id', :private_key => 'private_key')
|
|
260
260
|
end.should_not raise_error(ArgumentError)
|
|
261
261
|
end
|
|
262
262
|
|
|
263
263
|
it 'accepts options hash' do
|
|
264
264
|
lambda do
|
|
265
|
-
subject.add_url!(url, out_formats
|
|
265
|
+
subject.add_url!(url, :out_formats => %W(pdf txt))
|
|
266
266
|
end.should_not raise_error(ArgumentError)
|
|
267
267
|
end
|
|
268
268
|
|
|
@@ -278,13 +278,13 @@ describe GroupDocs::Job do
|
|
|
278
278
|
|
|
279
279
|
it 'accepts access credentials hash' do
|
|
280
280
|
lambda do
|
|
281
|
-
subject.update!({}, client_id
|
|
281
|
+
subject.update!({}, :client_id => 'client_id', :private_key => 'private_key')
|
|
282
282
|
end.should_not raise_error(ArgumentError)
|
|
283
283
|
end
|
|
284
284
|
|
|
285
285
|
it 'parses status' do
|
|
286
286
|
subject.should_receive(:parse_status).with(:draft).and_return(-1)
|
|
287
|
-
subject.update!(status
|
|
287
|
+
subject.update!(:status => :draft)
|
|
288
288
|
end
|
|
289
289
|
end
|
|
290
290
|
|
|
@@ -295,7 +295,7 @@ describe GroupDocs::Job do
|
|
|
295
295
|
|
|
296
296
|
it 'accepts access credentials hash' do
|
|
297
297
|
lambda do
|
|
298
|
-
subject.delete!(client_id
|
|
298
|
+
subject.delete!(:client_id => 'client_id', :private_key => 'private_key')
|
|
299
299
|
end.should_not raise_error(ArgumentError)
|
|
300
300
|
end
|
|
301
301
|
end
|
|
@@ -304,11 +304,11 @@ describe GroupDocs::Job do
|
|
|
304
304
|
let(:actions) { %w(convert compare) }
|
|
305
305
|
|
|
306
306
|
it 'raises error if actions is not an array' do
|
|
307
|
-
|
|
307
|
+
lambda { described_class.convert_actions_to_byte(:export) }.should raise_error(ArgumentError)
|
|
308
308
|
end
|
|
309
309
|
|
|
310
310
|
it 'raises error if action is unknown' do
|
|
311
|
-
|
|
311
|
+
lambda { described_class.convert_actions_to_byte(%w(unknown)) }.should raise_error(ArgumentError)
|
|
312
312
|
end
|
|
313
313
|
|
|
314
314
|
it 'converts each action to Symbol' do
|
|
@@ -7,7 +7,7 @@ describe GroupDocs::Questionnaire::Collector do
|
|
|
7
7
|
|
|
8
8
|
subject do
|
|
9
9
|
questionnaire = GroupDocs::Questionnaire.new
|
|
10
|
-
described_class.new(questionnaire
|
|
10
|
+
described_class.new(:questionnaire => questionnaire)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
describe '.get!' do
|
|
@@ -17,7 +17,7 @@ describe GroupDocs::Questionnaire::Collector do
|
|
|
17
17
|
|
|
18
18
|
it 'accepts access credentials hash' do
|
|
19
19
|
lambda do
|
|
20
|
-
described_class.get!('9fh349hfdskf', client_id
|
|
20
|
+
described_class.get!('9fh349hfdskf', :client_id => 'client_id', :private_key => 'private_key')
|
|
21
21
|
end.should_not raise_error(ArgumentError)
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -37,11 +37,11 @@ describe GroupDocs::Questionnaire::Collector do
|
|
|
37
37
|
|
|
38
38
|
describe '#initialize' do
|
|
39
39
|
it 'raises error if questionnaire is not specified' do
|
|
40
|
-
|
|
40
|
+
lambda { described_class.new }.should raise_error(ArgumentError)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
it 'raises error if questionnaire is not an instance of GroupDocs::Questionnaire' do
|
|
44
|
-
|
|
44
|
+
lambda { described_class.new(:questionnaire => '') }.should raise_error(ArgumentError)
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -75,19 +75,15 @@ describe GroupDocs::Questionnaire::Collector do
|
|
|
75
75
|
describe '#add!' do
|
|
76
76
|
before(:each) do
|
|
77
77
|
mock_api_server(load_json('questionnaire_collectors_add'))
|
|
78
|
+
subject.questionnaire = GroupDocs::Questionnaire.new
|
|
78
79
|
end
|
|
79
80
|
|
|
80
81
|
it 'accepts access credentials hash' do
|
|
81
82
|
lambda do
|
|
82
|
-
subject.add!(client_id
|
|
83
|
+
subject.add!(:client_id => 'client_id', :private_key => 'private_key')
|
|
83
84
|
end.should_not raise_error(ArgumentError)
|
|
84
85
|
end
|
|
85
86
|
|
|
86
|
-
it 'gets questionnaire id' do
|
|
87
|
-
subject.questionnaire.should_receive(:guid)
|
|
88
|
-
subject.add!
|
|
89
|
-
end
|
|
90
|
-
|
|
91
87
|
it 'updates id and guid with response' do
|
|
92
88
|
lambda do
|
|
93
89
|
subject.add!
|
|
@@ -105,7 +101,7 @@ describe GroupDocs::Questionnaire::Collector do
|
|
|
105
101
|
|
|
106
102
|
it 'accepts access credentials hash' do
|
|
107
103
|
lambda do
|
|
108
|
-
subject.update!(client_id
|
|
104
|
+
subject.update!(:client_id => 'client_id', :private_key => 'private_key')
|
|
109
105
|
end.should_not raise_error(ArgumentError)
|
|
110
106
|
end
|
|
111
107
|
end
|
|
@@ -117,7 +113,7 @@ describe GroupDocs::Questionnaire::Collector do
|
|
|
117
113
|
|
|
118
114
|
it 'accepts access credentials hash' do
|
|
119
115
|
lambda do
|
|
120
|
-
subject.remove!(client_id
|
|
116
|
+
subject.remove!(:client_id => 'client_id', :private_key => 'private_key')
|
|
121
117
|
end.should_not raise_error(ArgumentError)
|
|
122
118
|
end
|
|
123
119
|
end
|
|
@@ -129,7 +125,7 @@ describe GroupDocs::Questionnaire::Collector do
|
|
|
129
125
|
|
|
130
126
|
it 'accepts access credentials hash' do
|
|
131
127
|
lambda do
|
|
132
|
-
subject.executions!(client_id
|
|
128
|
+
subject.executions!(:client_id => 'client_id', :private_key => 'private_key')
|
|
133
129
|
end.should_not raise_error(ArgumentError)
|
|
134
130
|
end
|
|
135
131
|
|
|
@@ -151,12 +147,12 @@ describe GroupDocs::Questionnaire::Collector do
|
|
|
151
147
|
|
|
152
148
|
it 'accepts access credentials hash' do
|
|
153
149
|
lambda do
|
|
154
|
-
subject.add_execution!(execution, client_id
|
|
150
|
+
subject.add_execution!(execution, :client_id => 'client_id', :private_key => 'private_key')
|
|
155
151
|
end.should_not raise_error(ArgumentError)
|
|
156
152
|
end
|
|
157
153
|
|
|
158
154
|
it 'raises error if execution is not GroupDocs::Questionnaire::Execution object' do
|
|
159
|
-
|
|
155
|
+
lambda { subject.add_execution!('Execution') }.should raise_error(ArgumentError)
|
|
160
156
|
end
|
|
161
157
|
|
|
162
158
|
it 'uses hashed version of execution along with executive payload' do
|
|
@@ -175,23 +171,23 @@ describe GroupDocs::Questionnaire::Collector do
|
|
|
175
171
|
end
|
|
176
172
|
|
|
177
173
|
let(:datasource) do
|
|
178
|
-
GroupDocs::DataSource.new(id
|
|
174
|
+
GroupDocs::DataSource.new(:id => 1)
|
|
179
175
|
end
|
|
180
176
|
|
|
181
177
|
it 'accepts access credentials hash' do
|
|
182
178
|
lambda do
|
|
183
|
-
subject.fill!(datasource, {}, client_id
|
|
179
|
+
subject.fill!(datasource, {}, :client_id => 'client_id', :private_key => 'private_key')
|
|
184
180
|
end.should_not raise_error(ArgumentError)
|
|
185
181
|
end
|
|
186
182
|
|
|
187
183
|
it 'accepts options hash' do
|
|
188
184
|
lambda do
|
|
189
|
-
subject.fill!(datasource, new_type
|
|
185
|
+
subject.fill!(datasource, :new_type => :pdf)
|
|
190
186
|
end.should_not raise_error(ArgumentError)
|
|
191
187
|
end
|
|
192
188
|
|
|
193
189
|
it 'raises error if datasource is not GroupDocs::Datasource object' do
|
|
194
|
-
|
|
190
|
+
lambda { subject.fill!('Datasource') }.should raise_error(ArgumentError)
|
|
195
191
|
end
|
|
196
192
|
|
|
197
193
|
it 'returns GroupDocs::Job object' do
|
|
@@ -12,7 +12,7 @@ describe GroupDocs::Questionnaire::Execution do
|
|
|
12
12
|
|
|
13
13
|
it 'accepts access credentials hash' do
|
|
14
14
|
lambda do
|
|
15
|
-
described_class.get!('45dsfh9348uf0fj834y92h', client_id
|
|
15
|
+
described_class.get!('45dsfh9348uf0fj834y92h', :client_id => 'client_id', :private_key => 'private_key')
|
|
16
16
|
end.should_not raise_error(ArgumentError)
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -41,14 +41,14 @@ describe GroupDocs::Questionnaire::Execution do
|
|
|
41
41
|
%w(owner executive approver).each do |method|
|
|
42
42
|
describe "##{method}=" do
|
|
43
43
|
it 'converts passed hash to GroupDocs::User object' do
|
|
44
|
-
subject.send(:"#{method}=", { first_name
|
|
44
|
+
subject.send(:"#{method}=", { :first_name => 'Test' })
|
|
45
45
|
user = subject.send(:"#{method}")
|
|
46
46
|
user.should be_a(GroupDocs::User)
|
|
47
47
|
user.first_name.should == 'Test'
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
it 'does nothing if GroupDocs::User is passed' do
|
|
51
|
-
subject.send(:"#{method}=", GroupDocs::User.new(first_name
|
|
51
|
+
subject.send(:"#{method}=", GroupDocs::User.new(:first_name => 'Test'))
|
|
52
52
|
subject.send(:"#{method}").first_name.should == 'Test'
|
|
53
53
|
end
|
|
54
54
|
end
|
|
@@ -63,12 +63,12 @@ describe GroupDocs::Questionnaire::Execution do
|
|
|
63
63
|
|
|
64
64
|
describe "#document=" do
|
|
65
65
|
it 'converts passed hash to GroupDocs::Storage::File object' do
|
|
66
|
-
subject.document = { id
|
|
66
|
+
subject.document = { :id => 123 }
|
|
67
67
|
subject.document.should be_a(GroupDocs::Storage::File)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
it 'gets file from passed GroupDocs::Document' do
|
|
71
|
-
document = GroupDocs::Document.new(file
|
|
71
|
+
document = GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
|
|
72
72
|
subject.document = document
|
|
73
73
|
subject.document.should == document.file
|
|
74
74
|
end
|
|
@@ -86,7 +86,7 @@ describe GroupDocs::Questionnaire::Execution do
|
|
|
86
86
|
|
|
87
87
|
it 'accepts access credentials hash' do
|
|
88
88
|
lambda do
|
|
89
|
-
subject.set_status!(:submitted, client_id
|
|
89
|
+
subject.set_status!(:submitted, :client_id => 'client_id', :private_key => 'private_key')
|
|
90
90
|
end.should_not raise_error(ArgumentError)
|
|
91
91
|
end
|
|
92
92
|
|
|
@@ -108,7 +108,7 @@ describe GroupDocs::Questionnaire::Execution do
|
|
|
108
108
|
|
|
109
109
|
it 'accepts access credentials hash' do
|
|
110
110
|
lambda do
|
|
111
|
-
subject.update!(client_id
|
|
111
|
+
subject.update!(:client_id => 'client_id', :private_key => 'private_key')
|
|
112
112
|
end.should_not raise_error(ArgumentError)
|
|
113
113
|
end
|
|
114
114
|
|
|
@@ -125,7 +125,7 @@ describe GroupDocs::Questionnaire::Execution do
|
|
|
125
125
|
|
|
126
126
|
it 'accepts access credentials hash' do
|
|
127
127
|
lambda do
|
|
128
|
-
subject.delete!(client_id
|
|
128
|
+
subject.delete!(:client_id => 'client_id', :private_key => 'private_key')
|
|
129
129
|
end.should_not raise_error(ArgumentError)
|
|
130
130
|
end
|
|
131
131
|
end
|
|
@@ -136,23 +136,23 @@ describe GroupDocs::Questionnaire::Execution do
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
let(:datasource) do
|
|
139
|
-
GroupDocs::DataSource.new(id
|
|
139
|
+
GroupDocs::DataSource.new(:id => 1)
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
it 'accepts access credentials hash' do
|
|
143
143
|
lambda do
|
|
144
|
-
subject.fill!(datasource, {}, client_id
|
|
144
|
+
subject.fill!(datasource, {}, :client_id => 'client_id', :private_key => 'private_key')
|
|
145
145
|
end.should_not raise_error(ArgumentError)
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
it 'accepts options hash' do
|
|
149
149
|
lambda do
|
|
150
|
-
subject.fill!(datasource, new_type
|
|
150
|
+
subject.fill!(datasource, :new_type => :pdf)
|
|
151
151
|
end.should_not raise_error(ArgumentError)
|
|
152
152
|
end
|
|
153
153
|
|
|
154
154
|
it 'raises error if datasource is not GroupDocs::Datasource object' do
|
|
155
|
-
|
|
155
|
+
lambda { subject.fill!('Datasource') }.should raise_error(ArgumentError)
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
it 'returns GroupDocs::Job object' do
|
|
@@ -10,7 +10,7 @@ describe GroupDocs::Questionnaire::Page do
|
|
|
10
10
|
|
|
11
11
|
describe '#questions=' do
|
|
12
12
|
it 'converts each question to GroupDocs::Questionnaire::Question object if hash is passed' do
|
|
13
|
-
subject.questions = [{ field
|
|
13
|
+
subject.questions = [{ :field => 'Field1', :text => 'Text1', :def_answer => 'A1' }]
|
|
14
14
|
questions = subject.questions
|
|
15
15
|
questions.should be_an(Array)
|
|
16
16
|
questions.each do |question|
|
|
@@ -19,8 +19,8 @@ describe GroupDocs::Questionnaire::Page do
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it 'saves each question if it is GroupDocs::Questionnaire::Question object' do
|
|
22
|
-
question1 = GroupDocs::Questionnaire::Question.new(field
|
|
23
|
-
question2 = GroupDocs::Questionnaire::Question.new(field
|
|
22
|
+
question1 = GroupDocs::Questionnaire::Question.new(:field => 'field1')
|
|
23
|
+
question2 = GroupDocs::Questionnaire::Question.new(:field => 'field2')
|
|
24
24
|
subject.questions = [question1, question2]
|
|
25
25
|
subject.questions.should include(question1)
|
|
26
26
|
subject.questions.should include(question2)
|
|
@@ -35,7 +35,7 @@ describe GroupDocs::Questionnaire::Page do
|
|
|
35
35
|
|
|
36
36
|
describe '#add_question' do
|
|
37
37
|
it 'raises error if question is not GroupDocs::Questionnaire::Page object' do
|
|
38
|
-
|
|
38
|
+
lambda { subject.add_question('Page') }.should raise_error(ArgumentError)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
it 'saves question' do
|
|
@@ -15,7 +15,7 @@ describe GroupDocs::Questionnaire::Question do
|
|
|
15
15
|
|
|
16
16
|
describe '#answers=' do
|
|
17
17
|
it 'converts each answer to GroupDocs::Questionnaire::Question::Answer object' do
|
|
18
|
-
subject.answers = [{ text
|
|
18
|
+
subject.answers = [{ :text => 'Text1', :value => 'Value1' }, { :text => 'Text2', :value => 'Value2' }]
|
|
19
19
|
answers = subject.answers
|
|
20
20
|
answers.should be_an(Array)
|
|
21
21
|
answers.each do |answer|
|
|
@@ -24,8 +24,8 @@ describe GroupDocs::Questionnaire::Question do
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
it 'saves each answer if it is GroupDocs::Questionnaire::Question::Answer object' do
|
|
27
|
-
answer1 = GroupDocs::Questionnaire::Question::Answer.new(text
|
|
28
|
-
answer2 = GroupDocs::Questionnaire::Question::Answer.new(text
|
|
27
|
+
answer1 = GroupDocs::Questionnaire::Question::Answer.new(:text => 'text1')
|
|
28
|
+
answer2 = GroupDocs::Questionnaire::Question::Answer.new(:text => 'text2')
|
|
29
29
|
subject.answers = [answer1, answer2]
|
|
30
30
|
subject.answers.should include(answer1)
|
|
31
31
|
subject.answers.should include(answer2)
|
|
@@ -40,11 +40,11 @@ describe GroupDocs::Questionnaire::Question do
|
|
|
40
40
|
|
|
41
41
|
describe '#add_answer' do
|
|
42
42
|
it 'raises error if answer is not GroupDocs::Questionnaire::Question::Answer object' do
|
|
43
|
-
|
|
43
|
+
lambda { subject.add_answer('Answer') }.should raise_error(ArgumentError)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
it 'saves answer' do
|
|
47
|
-
answer = GroupDocs::Questionnaire::Question::Answer.new(text
|
|
47
|
+
answer = GroupDocs::Questionnaire::Question::Answer.new(:text => 'Text', :value => 'Value')
|
|
48
48
|
subject.add_answer(answer)
|
|
49
49
|
subject.answers.should == [answer]
|
|
50
50
|
end
|
|
@@ -62,7 +62,7 @@ describe GroupDocs::Questionnaire::Question do
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
it 'raises error if type is unknown' do
|
|
65
|
-
|
|
65
|
+
lambda { subject.type = :unknown }.should raise_error(ArgumentError)
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|