groupdocs 1.5.5 → 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/groupdocs/datasource.rb +66 -1
- data/lib/groupdocs/document.rb +21 -31
- data/lib/groupdocs/document/annotation.rb +8 -5
- data/lib/groupdocs/job.rb +4 -3
- data/lib/groupdocs/post.rb +4 -12
- data/lib/groupdocs/questionnaire.rb +40 -44
- data/lib/groupdocs/signature.rb +47 -30
- data/lib/groupdocs/signature/envelope.rb +35 -7
- data/lib/groupdocs/signature/field.rb +1 -0
- data/lib/groupdocs/signature/field/location.rb +6 -0
- data/lib/groupdocs/signature/form.rb +33 -1
- data/lib/groupdocs/signature/shared/document_methods.rb +1 -0
- data/lib/groupdocs/storage/file.rb +19 -10
- data/lib/groupdocs/subscription.rb +3 -10
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/datasource_spec.rb +41 -0
- data/spec/groupdocs/document/annotation_spec.rb +38 -6
- data/spec/groupdocs/document_spec.rb +258 -25
- data/spec/groupdocs/job_spec.rb +52 -0
- data/spec/groupdocs/questionnaire_spec.rb +45 -9
- data/spec/groupdocs/signature_spec.rb +13 -0
- data/spec/groupdocs/storage/file_spec.rb +68 -0
- data/spec/groupdocs/subscription_spec.rb +119 -0
- data/spec/groupdocs/user_spec.rb +75 -3
- data/spec/support/json/annotation_collaborators_add.json +31 -0
- data/spec/support/json/annotation_collaborators_clear.json +22 -0
- data/spec/support/json/document_html_urls.json +12 -0
- data/spec/support/json/document_shared_documents_get.json +2 -1
- data/spec/support/json/job_resources_get.json +16 -0
- data/spec/support/json/jobs_documents.json +49 -30
- data/spec/support/json/subscription_billing_set.json +21 -0
- data/spec/support/json/subscription_countries_get.json +93 -0
- data/spec/support/json/subscription_get.json +23 -0
- data/spec/support/json/subscription_get_plan.json +48 -0
- data/spec/support/json/subscription_invoices_get.json +18 -0
- data/spec/support/json/subscription_states_get.json +93 -0
- data/spec/support/json/subscription_wizard_get.json +8 -0
- metadata +13 -2
data/lib/groupdocs/version.rb
CHANGED
@@ -131,6 +131,23 @@ describe GroupDocs::DataSource do
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
+
describe '#update_fields!' do
|
135
|
+
before(:each) do
|
136
|
+
mock_api_server(load_json('datasource_update'))
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'accepts access credentials hash' do
|
140
|
+
lambda do
|
141
|
+
subject.update_fields!(:client_id => 'client_id', :private_key => 'private_key')
|
142
|
+
end.should_not raise_error(ArgumentError)
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'uses hashed version of self as request body' do
|
146
|
+
subject.should_receive(:to_hash)
|
147
|
+
subject.add!
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
134
151
|
describe '#remove!' do
|
135
152
|
before(:each) do
|
136
153
|
mock_api_server(load_json('datasource_remove'))
|
@@ -142,4 +159,28 @@ describe GroupDocs::DataSource do
|
|
142
159
|
end.should_not raise_error(ArgumentError)
|
143
160
|
end
|
144
161
|
end
|
162
|
+
|
163
|
+
describe '#add_datasource!' do
|
164
|
+
before(:each) do
|
165
|
+
mock_api_server(load_json('datasource_update'))
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'accepts access credentials hash' do
|
169
|
+
lambda do
|
170
|
+
subject.add_datasource!(job, file_id, datasource, :client_id => 'client_id', :private_key => 'private_key')
|
171
|
+
end.should_not raise_error(ArgumentError)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
describe '#add_datasource_fields!' do
|
176
|
+
before(:each) do
|
177
|
+
mock_api_server(load_json('datasource_update'))
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'accepts access credentials hash' do
|
181
|
+
lambda do
|
182
|
+
subject.add_datasource_fields!(job, file_id, datasource, :client_id => 'client_id', :private_key => 'private_key')
|
183
|
+
end.should_not raise_error(ArgumentError)
|
184
|
+
end
|
185
|
+
end
|
145
186
|
end
|
@@ -144,18 +144,14 @@ describe GroupDocs::Document::Annotation do
|
|
144
144
|
|
145
145
|
it 'accepts access credentials hash' do
|
146
146
|
lambda do
|
147
|
-
subject.create!(:client_id => 'client_id', :private_key => 'private_key')
|
147
|
+
subject.create!('info', :client_id => 'client_id', :private_key => 'private_key')
|
148
148
|
end.should_not raise_error(ArgumentError)
|
149
149
|
end
|
150
150
|
|
151
|
-
it 'uses hashed version of self as request body' do
|
152
|
-
subject.should_receive(:to_hash).and_return({})
|
153
|
-
subject.create!
|
154
|
-
end
|
155
151
|
|
156
152
|
it 'updated self with response values' do
|
157
153
|
lambda do
|
158
|
-
subject.create!
|
154
|
+
subject.create!('info')
|
159
155
|
end.should change {
|
160
156
|
subject.id
|
161
157
|
subject.guid
|
@@ -228,6 +224,42 @@ describe GroupDocs::Document::Annotation do
|
|
228
224
|
end
|
229
225
|
end
|
230
226
|
|
227
|
+
describe '#resize!' do
|
228
|
+
before(:each) do
|
229
|
+
mock_api_server('{ "status": "Ok", "result": {}}')
|
230
|
+
end
|
231
|
+
|
232
|
+
it 'accepts access credentials hash' do
|
233
|
+
lambda do
|
234
|
+
subject.resize!(10, 10, :client_id => 'client_id', :private_key => 'private_key')
|
235
|
+
end.should_not raise_error(ArgumentError)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
describe '#text_info!' do
|
240
|
+
before(:each) do
|
241
|
+
mock_api_server('{ "status": "Ok", "result": {}}')
|
242
|
+
end
|
243
|
+
|
244
|
+
it 'accepts access credentials hash' do
|
245
|
+
lambda do
|
246
|
+
subject.text_info!(fieldText, fontFamily, fontSize, :client_id => 'client_id', :private_key => 'private_key')
|
247
|
+
end.should_not raise_error(ArgumentError)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
describe '#text_color!' do
|
252
|
+
before(:each) do
|
253
|
+
mock_api_server('{ "status": "Ok", "result": {}}')
|
254
|
+
end
|
255
|
+
|
256
|
+
it 'accepts access credentials hash' do
|
257
|
+
lambda do
|
258
|
+
subject.text_color!(font_color :client_id => 'client_id', :private_key => 'private_key')
|
259
|
+
end.should_not raise_error(ArgumentError)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
231
263
|
describe '#set_access!' do
|
232
264
|
before(:each) do
|
233
265
|
mock_api_server(load_json('annotation_access_set'))
|
@@ -105,23 +105,9 @@ describe GroupDocs::Document do
|
|
105
105
|
signatures.each { |signature| described_class.should_receive(:mime_type).with(signature.image_path).once }
|
106
106
|
described_class.sign_documents!(documents, signatures)
|
107
107
|
end
|
108
|
-
|
109
|
-
it 'returns array of GroupDocs::Document.objects' do
|
110
|
-
signed_documents = described_class.sign_documents!(documents, signatures)
|
111
|
-
signed_documents.should be_an(Array)
|
112
|
-
signed_documents.each do |document|
|
113
|
-
document.should be_a(GroupDocs::Document)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
it 'calculates file name for each signed document' do
|
118
|
-
signed_documents = described_class.sign_documents!(documents, signatures)
|
119
|
-
signed_documents[0].file.name.should == "#{documents[0].file.name}_signed.pdf"
|
120
|
-
signed_documents[1].file.name.should == "#{documents[1].file.name}_signed.pdf"
|
121
|
-
end
|
122
108
|
end
|
123
109
|
|
124
|
-
describe '
|
110
|
+
describe '.metadata!' do
|
125
111
|
before(:each) do
|
126
112
|
mock_api_server(load_json('document_metadata'))
|
127
113
|
end
|
@@ -366,10 +352,6 @@ describe GroupDocs::Document do
|
|
366
352
|
subject.metadata!.last_view.should be_a(GroupDocs::Document::View)
|
367
353
|
end
|
368
354
|
|
369
|
-
it 'uses self document in last view object' do
|
370
|
-
subject.metadata!.last_view.document.should == subject
|
371
|
-
end
|
372
|
-
|
373
355
|
it 'does not set last view if document has never been viewed' do
|
374
356
|
mock_api_server('{ "status": "Ok", "result": { "last_view": null }}')
|
375
357
|
subject.metadata!.last_view.should be_nil
|
@@ -602,6 +584,37 @@ describe GroupDocs::Document do
|
|
602
584
|
end
|
603
585
|
end
|
604
586
|
|
587
|
+
describe '#datasource_fields!' do
|
588
|
+
before(:each) do
|
589
|
+
mock_api_server(load_json('document_datasource'))
|
590
|
+
end
|
591
|
+
|
592
|
+
let(:datasource) do
|
593
|
+
GroupDocs::DataSource.new(:id => 1)
|
594
|
+
end
|
595
|
+
|
596
|
+
it 'accepts access credentials hash' do
|
597
|
+
lambda do
|
598
|
+
subject.datasource_fields!(datasource, {}, :client_id => 'client_id', :private_key => 'private_key')
|
599
|
+
end.should_not raise_error(ArgumentError)
|
600
|
+
end
|
601
|
+
|
602
|
+
it 'accepts options hash' do
|
603
|
+
lambda do
|
604
|
+
subject.datasource_fields!(datasource, :new_type => :pdf)
|
605
|
+
end.should_not raise_error(ArgumentError)
|
606
|
+
end
|
607
|
+
|
608
|
+
it 'raises error if datasource is not GroupDocs::Datasource object' do
|
609
|
+
lambda { subject.datasource!('Datasource') }.should raise_error(ArgumentError)
|
610
|
+
end
|
611
|
+
|
612
|
+
it 'returns GroupDocs::Job object' do
|
613
|
+
job = subject.datasource!(datasource)
|
614
|
+
job.should be_a(GroupDocs::Job)
|
615
|
+
end
|
616
|
+
end
|
617
|
+
|
605
618
|
describe '#annotations!' do
|
606
619
|
before(:each) do
|
607
620
|
mock_api_server(load_json('annotation_list'))
|
@@ -654,17 +667,13 @@ describe GroupDocs::Document do
|
|
654
667
|
|
655
668
|
it 'accepts access credentials hash' do
|
656
669
|
lambda do
|
657
|
-
subject.compare!(document, :client_id => 'client_id', :private_key => 'private_key')
|
670
|
+
subject.compare!(document, callback, :client_id => 'client_id', :private_key => 'private_key')
|
658
671
|
end.should_not raise_error(ArgumentError)
|
659
672
|
end
|
660
673
|
|
661
674
|
it 'raises error if document is not GroupDocs::Document object' do
|
662
675
|
lambda { subject.compare!('Document') }.should raise_error(ArgumentError)
|
663
676
|
end
|
664
|
-
|
665
|
-
it 'returns GroupDocs::Job object' do
|
666
|
-
subject.compare!(document).should be_a(GroupDocs::Job)
|
667
|
-
end
|
668
677
|
end
|
669
678
|
|
670
679
|
describe '#changes!' do
|
@@ -687,6 +696,24 @@ describe GroupDocs::Document do
|
|
687
696
|
end
|
688
697
|
end
|
689
698
|
|
699
|
+
describe '#update_changes!' do
|
700
|
+
before(:each) do
|
701
|
+
mock_api_server(load_json('comparison_changes'))
|
702
|
+
end
|
703
|
+
|
704
|
+
it 'accepts access credentials hash' do
|
705
|
+
lambda do
|
706
|
+
subject.changes!(options, :client_id => 'client_id', :private_key => 'private_key')
|
707
|
+
end.should_not raise_error(ArgumentError)
|
708
|
+
end
|
709
|
+
|
710
|
+
it 'accepts options credentials hash' do
|
711
|
+
lambda do
|
712
|
+
subject.changes!(:id => 1, :type => 'delete', :action => '', :page => {}, :box => {}, :text => '')
|
713
|
+
end.should_not raise_error(ArgumentError)
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
690
717
|
|
691
718
|
describe '#collaborators!' do
|
692
719
|
before(:each) do
|
@@ -736,7 +763,7 @@ describe GroupDocs::Document do
|
|
736
763
|
|
737
764
|
describe '#add_collaborator!' do
|
738
765
|
before(:each) do
|
739
|
-
mock_api_server(load_json('
|
766
|
+
mock_api_server(load_json('annotation_collaborators_add'))
|
740
767
|
end
|
741
768
|
|
742
769
|
let!(:collaborator) { GroupDocs::User.new }
|
@@ -757,6 +784,18 @@ describe GroupDocs::Document do
|
|
757
784
|
end
|
758
785
|
end
|
759
786
|
|
787
|
+
describe '#remove_collaborators!' do
|
788
|
+
before(:each) do
|
789
|
+
mock_api_server(load_json('annotation_collaborators_clear'))
|
790
|
+
end
|
791
|
+
|
792
|
+
it 'accepts access credentials hash' do
|
793
|
+
lambda do
|
794
|
+
subject.remove_collaborators!(reviewerId, :client_id => 'client_id', :private_key => 'private_key')
|
795
|
+
end.should_not raise_error(ArgumentError)
|
796
|
+
end
|
797
|
+
end
|
798
|
+
|
760
799
|
describe '#set_reviewers!' do
|
761
800
|
before(:each) do
|
762
801
|
mock_api_server('{ "status": "Ok", "result": {}}')
|
@@ -860,4 +899,198 @@ describe GroupDocs::Document do
|
|
860
899
|
subject.respond_to?(:unknown).should be_false
|
861
900
|
end
|
862
901
|
end
|
902
|
+
|
903
|
+
describe '#password_set!' do
|
904
|
+
before(:each) do
|
905
|
+
mock_api_server(load_json('document_password_set'))
|
906
|
+
end
|
907
|
+
|
908
|
+
it 'accepts access credentials hash' do
|
909
|
+
lambda do
|
910
|
+
subject.password_set(%w(password), :client_id => 'client_id', :private_key => 'private_key')
|
911
|
+
end.should_not raise_error(ArgumentError)
|
912
|
+
end
|
913
|
+
end
|
914
|
+
|
915
|
+
describe '#user_status_set!' do
|
916
|
+
before(:each) do
|
917
|
+
mock_api_server(load_json('document_user_status_set'))
|
918
|
+
end
|
919
|
+
|
920
|
+
it 'accepts access credentials hash' do
|
921
|
+
lambda do
|
922
|
+
subject.user_status_set(%w(status), :client_id => 'client_id', :private_key => 'private_key')
|
923
|
+
end.should_not raise_error(ArgumentError)
|
924
|
+
end
|
925
|
+
end
|
926
|
+
|
927
|
+
describe '#shared_documents!' do
|
928
|
+
before(:each) do
|
929
|
+
mock_api_server(load_json('document_shared_documents_get'))
|
930
|
+
end
|
931
|
+
|
932
|
+
it 'accepts access credentials hash' do
|
933
|
+
lambda do
|
934
|
+
subject.shared_documents( :client_id => 'client_id', :private_key => 'private_key')
|
935
|
+
end.should_not raise_error(ArgumentError)
|
936
|
+
end
|
937
|
+
end
|
938
|
+
|
939
|
+
describe '#page_image!' do
|
940
|
+
before(:each) do
|
941
|
+
mock_api_server(File.read('spec/support/files/resume.pdf'))
|
942
|
+
subject.stub(:name => 'resume.pdf')
|
943
|
+
end
|
944
|
+
|
945
|
+
let(:path) { Dir.tmpdir }
|
946
|
+
|
947
|
+
it 'accepts access credentials hash' do
|
948
|
+
lambda do
|
949
|
+
subject.shared_documents( :client_id => 'client_id', :private_key => 'private_key')
|
950
|
+
end.should_not raise_error(ArgumentError)
|
951
|
+
end
|
952
|
+
end
|
953
|
+
|
954
|
+
describe '#page_fixed_html!' do
|
955
|
+
before(:each) do
|
956
|
+
mock_api_server(File.read('spec/support/files/resume.pdf'))
|
957
|
+
subject.stub(:name => 'resume.pdf')
|
958
|
+
end
|
959
|
+
|
960
|
+
let(:path) { Dir.tmpdir }
|
961
|
+
|
962
|
+
it 'accepts access credentials hash' do
|
963
|
+
lambda do
|
964
|
+
subject.shared_documents( :client_id => 'client_id', :private_key => 'private_key')
|
965
|
+
end.should_not raise_error(ArgumentError)
|
966
|
+
end
|
967
|
+
end
|
968
|
+
|
969
|
+
describe '#page_html!' do
|
970
|
+
before(:each) do
|
971
|
+
mock_api_server(File.read('spec/support/files/resume.pdf'))
|
972
|
+
subject.stub(:name => 'resume.pdf')
|
973
|
+
end
|
974
|
+
|
975
|
+
let(:path) { Dir.tmpdir }
|
976
|
+
|
977
|
+
it 'accepts access credentials hash' do
|
978
|
+
lambda do
|
979
|
+
subject.shared_documents( :client_id => 'client_id', :private_key => 'private_key')
|
980
|
+
end.should_not raise_error(ArgumentError)
|
981
|
+
end
|
982
|
+
end
|
983
|
+
|
984
|
+
describe '#editlock!' do
|
985
|
+
before(:each) do
|
986
|
+
mock_api_server(load_json('document_edit_lock_get'))
|
987
|
+
end
|
988
|
+
|
989
|
+
it 'accepts access credentials hash' do
|
990
|
+
lambda do
|
991
|
+
subject.editlock!( :client_id => 'client_id', :private_key => 'private_key')
|
992
|
+
end.should_not raise_error(ArgumentError)
|
993
|
+
end
|
994
|
+
end
|
995
|
+
|
996
|
+
describe 'editlock_clear!' do
|
997
|
+
before(:each) do
|
998
|
+
mock_api_server(load_json('document_edit_lock_get'))
|
999
|
+
end
|
1000
|
+
|
1001
|
+
it 'accepts access credentials hash' do
|
1002
|
+
lambda do
|
1003
|
+
subject.editlock_clear!( {}, :client_id => 'client_id', :private_key => 'private_key')
|
1004
|
+
end.should_not raise_error(ArgumentError)
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
it 'accepts options credentials hash' do
|
1008
|
+
lambda do
|
1009
|
+
subject.editlock_clear!(:lockId => 'client_id')
|
1010
|
+
end.should_not raise_error(ArgumentError)
|
1011
|
+
end
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
describe '#tags!' do
|
1015
|
+
before(:each) do
|
1016
|
+
mock_api_server(load_json('document_edit_lock_get'))
|
1017
|
+
end
|
1018
|
+
|
1019
|
+
it 'accepts access credentials hash' do
|
1020
|
+
lambda do
|
1021
|
+
subject.tags!( :client_id => 'client_id', :private_key => 'private_key')
|
1022
|
+
end.should_not raise_error(ArgumentError)
|
1023
|
+
end
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
describe '#tags_clear!' do
|
1027
|
+
before(:each) do
|
1028
|
+
mock_api_server(load_json('document_editlock_remove'))
|
1029
|
+
end
|
1030
|
+
|
1031
|
+
it 'accepts access credentials hash' do
|
1032
|
+
lambda do
|
1033
|
+
subject.tags_clear!( :client_id => 'client_id', :private_key => 'private_key')
|
1034
|
+
end.should_not raise_error(ArgumentError)
|
1035
|
+
end
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
describe '#tags_set!' do
|
1039
|
+
before(:each) do
|
1040
|
+
mock_api_server(load_json('document_edit_lock_get'))
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
it 'accepts access credentials hash' do
|
1044
|
+
lambda do
|
1045
|
+
subject.tags_set!( :client_id => 'client_id', :private_key => 'private_key')
|
1046
|
+
end.should_not raise_error(ArgumentError)
|
1047
|
+
end
|
1048
|
+
end
|
1049
|
+
|
1050
|
+
describe '#content!' do
|
1051
|
+
before(:each) do
|
1052
|
+
mock_api_server('{ "status": "Ok", "result": {}}')
|
1053
|
+
end
|
1054
|
+
|
1055
|
+
it 'accepts access credentials hash' do
|
1056
|
+
lambda do
|
1057
|
+
subject.tags_set!(content_type, :client_id => 'client_id', :private_key => 'private_key')
|
1058
|
+
end.should_not raise_error(ArgumentError)
|
1059
|
+
end
|
1060
|
+
end
|
1061
|
+
|
1062
|
+
describe 'page_html_urls!' do
|
1063
|
+
before(:each) do
|
1064
|
+
mock_api_server(load_json('document_html_urls'))
|
1065
|
+
end
|
1066
|
+
|
1067
|
+
it 'accepts access credentials hash' do
|
1068
|
+
lambda do
|
1069
|
+
subject.editlock_clear!( {}, :client_id => 'client_id', :private_key => 'private_key')
|
1070
|
+
end.should_not raise_error(ArgumentError)
|
1071
|
+
end
|
1072
|
+
|
1073
|
+
it 'accepts options credentials hash' do
|
1074
|
+
lambda do
|
1075
|
+
subject.editlock_clear!(:first_page => 0, :page_count => 1)
|
1076
|
+
end.should_not raise_error(ArgumentError)
|
1077
|
+
end
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
describe '#download!' do
|
1081
|
+
before(:each) do
|
1082
|
+
mock_api_server(File.read('spec/support/files/resume.pdf'))
|
1083
|
+
subject.stub(:name => 'resume.pdf')
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
let(:path) { Dir.tmpdir }
|
1087
|
+
|
1088
|
+
it 'accepts access credentials hash' do
|
1089
|
+
lambda do
|
1090
|
+
subject.shared_documents( :client_id => 'client_id', :private_key => 'private_key')
|
1091
|
+
end.should_not raise_error(ArgumentError)
|
1092
|
+
end
|
1093
|
+
end
|
1094
|
+
|
1095
|
+
|
863
1096
|
end
|