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
@@ -12,13 +12,13 @@ describe GroupDocs::Questionnaire 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!(status
|
21
|
+
described_class.all!(:status => :draft)
|
22
22
|
end.should_not raise_error(ArgumentError)
|
23
23
|
end
|
24
24
|
|
@@ -27,7 +27,7 @@ describe GroupDocs::Questionnaire do
|
|
27
27
|
subject = described_class.new
|
28
28
|
described_class.should_receive(:new).any_number_of_times.and_return(subject)
|
29
29
|
subject.should_receive(:parse_status).with(status)
|
30
|
-
described_class.all!(status
|
30
|
+
described_class.all!(:status => status)
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'returns an array of GroupDocs::Questionnaire objects' do
|
@@ -46,7 +46,7 @@ describe GroupDocs::Questionnaire do
|
|
46
46
|
|
47
47
|
it 'accepts access credentials hash' do
|
48
48
|
lambda do
|
49
|
-
described_class.get!(1, client_id
|
49
|
+
described_class.get!(1, :client_id => 'client_id', :private_key => 'private_key')
|
50
50
|
end.should_not raise_error(ArgumentError)
|
51
51
|
end
|
52
52
|
|
@@ -76,7 +76,7 @@ describe GroupDocs::Questionnaire do
|
|
76
76
|
|
77
77
|
describe '#pages=' do
|
78
78
|
it 'converts each page to GroupDocs::Questionnaire::Page object if hash is passed' do
|
79
|
-
subject.pages = [{ number
|
79
|
+
subject.pages = [{ :number => 1, :title => 'Page1' }, { :number => 2, :title => 'Page2' }]
|
80
80
|
pages = subject.pages
|
81
81
|
pages.should be_an(Array)
|
82
82
|
pages.each do |page|
|
@@ -85,8 +85,8 @@ describe GroupDocs::Questionnaire do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'saves each page if it is GroupDocs::Questionnaire::Page object' do
|
88
|
-
page1 = GroupDocs::Questionnaire::Page.new(number
|
89
|
-
page2 = GroupDocs::Questionnaire::Page.new(number
|
88
|
+
page1 = GroupDocs::Questionnaire::Page.new(:number => 1)
|
89
|
+
page2 = GroupDocs::Questionnaire::Page.new(:number => 2)
|
90
90
|
subject.pages = [page1, page2]
|
91
91
|
subject.pages.should include(page1)
|
92
92
|
subject.pages.should include(page2)
|
@@ -101,7 +101,7 @@ describe GroupDocs::Questionnaire do
|
|
101
101
|
|
102
102
|
describe '#add_page' do
|
103
103
|
it 'raises error if page is not GroupDocs::Questionnaire::Page object' do
|
104
|
-
|
104
|
+
lambda { subject.add_page('Page') }.should raise_error(ArgumentError)
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'adds page to pages instance variable' do
|
@@ -119,7 +119,7 @@ describe GroupDocs::Questionnaire do
|
|
119
119
|
|
120
120
|
it 'accepts access credentials hash' do
|
121
121
|
lambda do
|
122
|
-
subject.create!(client_id
|
122
|
+
subject.create!(:client_id => 'client_id', :private_key => 'private_key')
|
123
123
|
end.should_not raise_error(ArgumentError)
|
124
124
|
end
|
125
125
|
|
@@ -146,7 +146,7 @@ describe GroupDocs::Questionnaire do
|
|
146
146
|
|
147
147
|
it 'accepts access credentials hash' do
|
148
148
|
lambda do
|
149
|
-
subject.update!(client_id
|
149
|
+
subject.update!(:client_id => 'client_id', :private_key => 'private_key')
|
150
150
|
end.should_not raise_error(ArgumentError)
|
151
151
|
end
|
152
152
|
|
@@ -163,7 +163,7 @@ describe GroupDocs::Questionnaire do
|
|
163
163
|
|
164
164
|
it 'accepts access credentials hash' do
|
165
165
|
lambda do
|
166
|
-
subject.remove!(client_id
|
166
|
+
subject.remove!(:client_id => 'client_id', :private_key => 'private_key')
|
167
167
|
end.should_not raise_error(ArgumentError)
|
168
168
|
end
|
169
169
|
end
|
@@ -175,7 +175,7 @@ describe GroupDocs::Questionnaire do
|
|
175
175
|
|
176
176
|
it 'accepts access credentials hash' do
|
177
177
|
lambda do
|
178
|
-
subject.datasources!(client_id
|
178
|
+
subject.datasources!(:client_id => 'client_id', :private_key => 'private_key')
|
179
179
|
end.should_not raise_error(ArgumentError)
|
180
180
|
end
|
181
181
|
|
@@ -195,7 +195,7 @@ describe GroupDocs::Questionnaire do
|
|
195
195
|
|
196
196
|
it 'accepts access credentials hash' do
|
197
197
|
lambda do
|
198
|
-
subject.executions!(client_id
|
198
|
+
subject.executions!(:client_id => 'client_id', :private_key => 'private_key')
|
199
199
|
end.should_not raise_error(ArgumentError)
|
200
200
|
end
|
201
201
|
|
@@ -215,7 +215,7 @@ describe GroupDocs::Questionnaire do
|
|
215
215
|
|
216
216
|
it 'accepts access credentials hash' do
|
217
217
|
lambda do
|
218
|
-
subject.collectors!(client_id
|
218
|
+
subject.collectors!(:client_id => 'client_id', :private_key => 'private_key')
|
219
219
|
end.should_not raise_error(ArgumentError)
|
220
220
|
end
|
221
221
|
|
@@ -235,7 +235,7 @@ describe GroupDocs::Questionnaire do
|
|
235
235
|
|
236
236
|
it 'accepts access credentials hash' do
|
237
237
|
lambda do
|
238
|
-
subject.metadata!(client_id
|
238
|
+
subject.metadata!(:client_id => 'client_id', :private_key => 'private_key')
|
239
239
|
end.should_not raise_error(ArgumentError)
|
240
240
|
end
|
241
241
|
|
@@ -253,12 +253,12 @@ describe GroupDocs::Questionnaire do
|
|
253
253
|
|
254
254
|
it 'accepts access credentials hash' do
|
255
255
|
lambda do
|
256
|
-
subject.update_metadata!(metadata, client_id
|
256
|
+
subject.update_metadata!(metadata, :client_id => 'client_id', :private_key => 'private_key')
|
257
257
|
end.should_not raise_error(ArgumentError)
|
258
258
|
end
|
259
259
|
|
260
260
|
it 'raises error if metadata is not GroupDocs::Questionnaire object' do
|
261
|
-
|
261
|
+
lambda { subject.update_metadata!('Metadata') }.should raise_error(ArgumentError)
|
262
262
|
end
|
263
263
|
|
264
264
|
it 'uses hashed version as payload' do
|
@@ -274,7 +274,7 @@ describe GroupDocs::Questionnaire do
|
|
274
274
|
|
275
275
|
it 'accepts access credentials hash' do
|
276
276
|
lambda do
|
277
|
-
subject.fields!(client_id
|
277
|
+
subject.fields!(:client_id => 'client_id', :private_key => 'private_key')
|
278
278
|
end.should_not raise_error(ArgumentError)
|
279
279
|
end
|
280
280
|
|
@@ -11,12 +11,12 @@ describe GroupDocs::Signature::Contact 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!(:page => 1, :email => 'com') }.should_not raise_error(ArgumentError)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'returns array of GroupDocs::Signature::Contact objects' do
|
@@ -30,7 +30,7 @@ describe GroupDocs::Signature::Contact do
|
|
30
30
|
|
31
31
|
describe '.import!' do
|
32
32
|
let(:contact) do
|
33
|
-
described_class.new(first_name
|
33
|
+
described_class.new(:first_name => 'John', :last_name => 'Smith', :email => 'john@smith.com')
|
34
34
|
end
|
35
35
|
|
36
36
|
before(:each) do
|
@@ -39,16 +39,16 @@ describe GroupDocs::Signature::Contact do
|
|
39
39
|
|
40
40
|
it 'accepts access credentials hash' do
|
41
41
|
lambda do
|
42
|
-
described_class.import!([contact], client_id
|
42
|
+
described_class.import!([contact], :client_id => 'client_id', :private_key => 'private_key')
|
43
43
|
end.should_not raise_error(ArgumentError)
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'raises error if contacts is not array' do
|
47
|
-
|
47
|
+
lambda { described_class.import!(contact) }.should raise_error(ArgumentError)
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'raises error if array element is not GroupDocs::Signature::Contact' do
|
51
|
-
|
51
|
+
lambda { described_class.import!(%w(test)) }.should raise_error(ArgumentError)
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'uses hashed version of array elements as request body' do
|
@@ -74,7 +74,7 @@ describe GroupDocs::Signature::Contact do
|
|
74
74
|
|
75
75
|
it 'accepts access credentials hash' do
|
76
76
|
lambda do
|
77
|
-
subject.add!(client_id
|
77
|
+
subject.add!(:client_id => 'client_id', :private_key => 'private_key')
|
78
78
|
end.should_not raise_error(ArgumentError)
|
79
79
|
end
|
80
80
|
|
@@ -97,7 +97,7 @@ describe GroupDocs::Signature::Contact do
|
|
97
97
|
|
98
98
|
it 'accepts access credentials hash' do
|
99
99
|
lambda do
|
100
|
-
subject.update!(client_id
|
100
|
+
subject.update!(:client_id => 'client_id', :private_key => 'private_key')
|
101
101
|
end.should_not raise_error(ArgumentError)
|
102
102
|
end
|
103
103
|
|
@@ -114,7 +114,7 @@ describe GroupDocs::Signature::Contact do
|
|
114
114
|
|
115
115
|
it 'accepts access credentials hash' do
|
116
116
|
lambda do
|
117
|
-
subject.delete!(client_id
|
117
|
+
subject.delete!(:client_id => 'client_id', :private_key => 'private_key')
|
118
118
|
end.should_not raise_error(ArgumentError)
|
119
119
|
end
|
120
120
|
end
|
@@ -17,12 +17,12 @@ describe GroupDocs::Signature::Envelope 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::Envelope objects' do
|
@@ -41,12 +41,12 @@ describe GroupDocs::Signature::Envelope do
|
|
41
41
|
|
42
42
|
it 'accepts access credentials hash' do
|
43
43
|
lambda do
|
44
|
-
described_class.for_me!({}, client_id
|
44
|
+
described_class.for_me!({}, :client_id => 'client_id', :private_key => 'private_key')
|
45
45
|
end.should_not raise_error(ArgumentError)
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'allows passing options' do
|
49
|
-
|
49
|
+
lambda { described_class.for_me!(:page => 1, :count => 3) }.should_not raise_error(ArgumentError)
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'returns array of GroupDocs::Signature::Envelope objects' do
|
@@ -86,12 +86,12 @@ describe GroupDocs::Signature::Envelope do
|
|
86
86
|
|
87
87
|
it 'accepts access credentials hash' do
|
88
88
|
lambda do
|
89
|
-
subject.add_recipient!(recipient, client_id
|
89
|
+
subject.add_recipient!(recipient, :client_id => 'client_id', :private_key => 'private_key')
|
90
90
|
end.should_not raise_error(ArgumentError)
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
|
94
|
-
|
94
|
+
lambda { subject.add_recipient!('Recipient') }.should raise_error(ArgumentError)
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -106,18 +106,18 @@ describe GroupDocs::Signature::Envelope do
|
|
106
106
|
|
107
107
|
it 'accepts access credentials hash' do
|
108
108
|
lambda do
|
109
|
-
subject.modify_recipient!(recipient, client_id
|
109
|
+
subject.modify_recipient!(recipient, :client_id => 'client_id', :private_key => 'private_key')
|
110
110
|
end.should_not raise_error(ArgumentError)
|
111
111
|
end
|
112
112
|
|
113
113
|
it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
|
114
|
-
|
114
|
+
lambda { subject.modify_recipient!('Recipient') }.should raise_error(ArgumentError)
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
118
|
describe '#fill_field!' do
|
119
|
-
let(:field) { GroupDocs::Signature::Field.new(location
|
120
|
-
let(:document) { GroupDocs::Document.new(file
|
119
|
+
let(:field) { GroupDocs::Signature::Field.new(:location => { :location_x => 0.1, :page => 1 }) }
|
120
|
+
let(:document) { GroupDocs::Document.new(:file => GroupDocs::Storage::File.new) }
|
121
121
|
let(:recipient) { GroupDocs::Signature::Recipient.new }
|
122
122
|
|
123
123
|
before(:each) do
|
@@ -126,20 +126,20 @@ describe GroupDocs::Signature::Envelope do
|
|
126
126
|
|
127
127
|
it 'accepts access credentials hash' do
|
128
128
|
lambda do
|
129
|
-
subject.fill_field!('test', field, document, recipient, client_id
|
129
|
+
subject.fill_field!('test', field, document, recipient, :client_id => 'client_id', :private_key => 'private_key')
|
130
130
|
end.should_not raise_error(ArgumentError)
|
131
131
|
end
|
132
132
|
|
133
133
|
it 'raises error if field is not GroupDocs::Signature::Field object' do
|
134
|
-
|
134
|
+
lambda { subject.fill_field!('test', 'Field', document, recipient) }.should raise_error(ArgumentError)
|
135
135
|
end
|
136
136
|
|
137
137
|
it 'raises error if document is not GroupDocs::Document object' do
|
138
|
-
|
138
|
+
lambda { subject.fill_field!('test', field, 'Document', recipient) }.should raise_error(ArgumentError)
|
139
139
|
end
|
140
140
|
|
141
141
|
it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
|
142
|
-
|
142
|
+
lambda { subject.fill_field!('test', field, document, 'Recipient') }.should raise_error(ArgumentError)
|
143
143
|
end
|
144
144
|
|
145
145
|
it 'returns filled field' do
|
@@ -148,10 +148,10 @@ describe GroupDocs::Signature::Envelope do
|
|
148
148
|
|
149
149
|
it 'uses signature identifier if field is :signature and GroupDocs::Signature is passed' do
|
150
150
|
api = stub(GroupDocs::Api::Request)
|
151
|
-
api.stub!(execute
|
152
|
-
GroupDocs::Api::Request.stub(new
|
153
|
-
signature = GroupDocs::Signature.new(id
|
154
|
-
api.should_receive(:add_params).with(signatureId
|
151
|
+
api.stub!(:execute! => { :field => {} })
|
152
|
+
GroupDocs::Api::Request.stub(:new => api)
|
153
|
+
signature = GroupDocs::Signature.new(:id => '123')
|
154
|
+
api.should_receive(:add_params).with(:signatureId => '123')
|
155
155
|
field.field_type = :signature
|
156
156
|
subject.fill_field!(signature, field, document, recipient)
|
157
157
|
end
|
@@ -159,9 +159,9 @@ describe GroupDocs::Signature::Envelope do
|
|
159
159
|
it 'converts boolean value to required string if field is :checkbox' do
|
160
160
|
api = stub(GroupDocs::Api::Request)
|
161
161
|
options = {}
|
162
|
-
api.stub!(execute
|
163
|
-
api.stub!(options
|
164
|
-
GroupDocs::Api::Request.stub(new
|
162
|
+
api.stub!(:execute! => { :field => {} })
|
163
|
+
api.stub!(:options => { :request_body => nil })
|
164
|
+
GroupDocs::Api::Request.stub(:new => api)
|
165
165
|
field.field_type = :checkbox
|
166
166
|
subject.fill_field!(true, field, document, recipient)
|
167
167
|
api.options[:request_body].should == 'on'
|
@@ -177,12 +177,12 @@ describe GroupDocs::Signature::Envelope do
|
|
177
177
|
|
178
178
|
it 'accepts access credentials hash' do
|
179
179
|
lambda do
|
180
|
-
subject.sign!(recipient, client_id
|
180
|
+
subject.sign!(recipient, :client_id => 'client_id', :private_key => 'private_key')
|
181
181
|
end.should_not raise_error(ArgumentError)
|
182
182
|
end
|
183
183
|
|
184
184
|
it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
|
185
|
-
|
185
|
+
lambda { subject.sign!('Recipient') }.should raise_error(ArgumentError)
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
@@ -195,12 +195,12 @@ describe GroupDocs::Signature::Envelope do
|
|
195
195
|
|
196
196
|
it 'accepts access credentials hash' do
|
197
197
|
lambda do
|
198
|
-
subject.decline!(recipient, client_id
|
198
|
+
subject.decline!(recipient, :client_id => 'client_id', :private_key => 'private_key')
|
199
199
|
end.should_not raise_error(ArgumentError)
|
200
200
|
end
|
201
201
|
|
202
202
|
it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
|
203
|
-
|
203
|
+
lambda { subject.decline!('Recipient') }.should raise_error(ArgumentError)
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
@@ -214,12 +214,12 @@ describe GroupDocs::Signature::Envelope do
|
|
214
214
|
|
215
215
|
it 'accepts access credentials hash' do
|
216
216
|
lambda do
|
217
|
-
subject.signed_documents!(path, client_id
|
217
|
+
subject.signed_documents!(path, :client_id => 'client_id', :private_key => 'private_key')
|
218
218
|
end.should_not raise_error(ArgumentError)
|
219
219
|
end
|
220
220
|
|
221
221
|
it 'returns saved file path' do
|
222
|
-
subject.stub(documents
|
222
|
+
subject.stub(:documents! => [1])
|
223
223
|
subject.signed_documents!(path).should == "#{path}/#{subject.name}.pdf"
|
224
224
|
end
|
225
225
|
|
@@ -230,7 +230,7 @@ describe GroupDocs::Signature::Envelope do
|
|
230
230
|
|
231
231
|
it 'downloads ZIP file' do
|
232
232
|
file = stub('file')
|
233
|
-
subject.stub(documents
|
233
|
+
subject.stub(:documents! => [])
|
234
234
|
Object::File.should_receive(:open).with("#{path}/#{subject.name}.zip", 'wb').and_yield(file)
|
235
235
|
file.should_receive(:write).with(File.read('spec/support/files/envelope.zip'))
|
236
236
|
subject.signed_documents!(path)
|
@@ -244,7 +244,7 @@ describe GroupDocs::Signature::Envelope do
|
|
244
244
|
|
245
245
|
it 'downloads ZIP file' do
|
246
246
|
file = stub('file')
|
247
|
-
subject.stub(documents
|
247
|
+
subject.stub(:documents! => [1])
|
248
248
|
Object::File.should_receive(:open).with("#{path}/#{subject.name}.pdf", 'wb').and_yield(file)
|
249
249
|
file.should_receive(:write).with(File.read('spec/support/files/resume.pdf'))
|
250
250
|
subject.signed_documents!(path)
|
@@ -258,7 +258,7 @@ describe GroupDocs::Signature::Envelope do
|
|
258
258
|
|
259
259
|
it 'downloads ZIP file' do
|
260
260
|
file = stub('file')
|
261
|
-
subject.stub(documents
|
261
|
+
subject.stub(:documents! => [1, 2])
|
262
262
|
Object::File.should_receive(:open).with("#{path}/#{subject.name}.zip", 'wb').and_yield(file)
|
263
263
|
file.should_receive(:write).with(File.read('spec/support/files/envelope.zip'))
|
264
264
|
subject.signed_documents!(path)
|
@@ -273,7 +273,7 @@ describe GroupDocs::Signature::Envelope do
|
|
273
273
|
|
274
274
|
it 'accepts access credentials hash' do
|
275
275
|
lambda do
|
276
|
-
subject.logs!(client_id
|
276
|
+
subject.logs!(:client_id => 'client_id', :private_key => 'private_key')
|
277
277
|
end.should_not raise_error(ArgumentError)
|
278
278
|
end
|
279
279
|
|
@@ -293,7 +293,7 @@ describe GroupDocs::Signature::Envelope do
|
|
293
293
|
|
294
294
|
it 'accepts access credentials hash' do
|
295
295
|
lambda do
|
296
|
-
subject.send!(nil, client_id
|
296
|
+
subject.send!(nil, :client_id => 'client_id', :private_key => 'private_key')
|
297
297
|
end.should_not raise_error(ArgumentError)
|
298
298
|
end
|
299
299
|
|
@@ -309,7 +309,7 @@ describe GroupDocs::Signature::Envelope do
|
|
309
309
|
|
310
310
|
it 'accepts access credentials hash' do
|
311
311
|
lambda do
|
312
|
-
subject.archive!(client_id
|
312
|
+
subject.archive!(:client_id => 'client_id', :private_key => 'private_key')
|
313
313
|
end.should_not raise_error(ArgumentError)
|
314
314
|
end
|
315
315
|
end
|
@@ -321,7 +321,7 @@ describe GroupDocs::Signature::Envelope do
|
|
321
321
|
|
322
322
|
it 'accepts access credentials hash' do
|
323
323
|
lambda do
|
324
|
-
subject.restart!(client_id
|
324
|
+
subject.restart!(:client_id => 'client_id', :private_key => 'private_key')
|
325
325
|
end.should_not raise_error(ArgumentError)
|
326
326
|
end
|
327
327
|
end
|
@@ -11,12 +11,12 @@ describe GroupDocs::Signature::Field 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::Field objects' do
|
@@ -79,19 +79,19 @@ describe GroupDocs::Signature::Field do
|
|
79
79
|
|
80
80
|
describe '#location=' do
|
81
81
|
it 'converts location to GroupDocs::Signature::Field::Location object if hash is passed' do
|
82
|
-
subject.location = { id
|
82
|
+
subject.location = { :id => 'location1' }
|
83
83
|
subject.location.should be_a(GroupDocs::Signature::Field::Location)
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'saves each location if it is GroupDocs::Signature::Field::Location object' do
|
87
|
-
location = GroupDocs::Signature::Field::Location.new(id
|
87
|
+
location = GroupDocs::Signature::Field::Location.new(:id => 'location')
|
88
88
|
subject.location = location
|
89
89
|
subject.location.should == location
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'appends location to locations if it is not empty' do
|
93
|
-
location1 = GroupDocs::Signature::Field::Location.new(id
|
94
|
-
location2 = GroupDocs::Signature::Field::Location.new(id
|
93
|
+
location1 = GroupDocs::Signature::Field::Location.new(:id => 'location1')
|
94
|
+
location2 = GroupDocs::Signature::Field::Location.new(:id => 'location2')
|
95
95
|
subject.locations = [location1]
|
96
96
|
subject.location = location2
|
97
97
|
subject.locations.should == [location1, location2]
|
@@ -99,7 +99,7 @@ describe GroupDocs::Signature::Field do
|
|
99
99
|
|
100
100
|
it 'creates locations if it is empty' do
|
101
101
|
subject.locations = nil
|
102
|
-
location = GroupDocs::Signature::Field::Location.new(id
|
102
|
+
location = GroupDocs::Signature::Field::Location.new(:id => 'location')
|
103
103
|
subject.location = location
|
104
104
|
subject.locations.should == [location]
|
105
105
|
end
|
@@ -113,7 +113,7 @@ describe GroupDocs::Signature::Field do
|
|
113
113
|
|
114
114
|
describe '#locations=' do
|
115
115
|
it 'converts each location to GroupDocs::Signature::Field::Location object if hash is passed' do
|
116
|
-
subject.locations = [{ id
|
116
|
+
subject.locations = [{ :id => 'location1' }]
|
117
117
|
locations = subject.locations
|
118
118
|
locations.should be_an(Array)
|
119
119
|
locations.each do |location|
|
@@ -122,8 +122,8 @@ describe GroupDocs::Signature::Field do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'saves each location if it is GroupDocs::Signature::Field::Location object' do
|
125
|
-
location1 = GroupDocs::Signature::Field::Location.new(id
|
126
|
-
location2 = GroupDocs::Signature::Field::Location.new(id
|
125
|
+
location1 = GroupDocs::Signature::Field::Location.new(:id => 'location1')
|
126
|
+
location2 = GroupDocs::Signature::Field::Location.new(:id => 'location2')
|
127
127
|
subject.locations = [location1, location2]
|
128
128
|
subject.locations.should include(location1)
|
129
129
|
subject.locations.should include(location2)
|
@@ -170,7 +170,7 @@ describe GroupDocs::Signature::Field do
|
|
170
170
|
|
171
171
|
it 'accepts access credentials hash' do
|
172
172
|
lambda do
|
173
|
-
subject.create!(client_id
|
173
|
+
subject.create!(:client_id => 'client_id', :private_key => 'private_key')
|
174
174
|
end.should_not raise_error(ArgumentError)
|
175
175
|
end
|
176
176
|
|
@@ -193,7 +193,7 @@ describe GroupDocs::Signature::Field do
|
|
193
193
|
|
194
194
|
it 'accepts access credentials hash' do
|
195
195
|
lambda do
|
196
|
-
subject.modify!(client_id
|
196
|
+
subject.modify!(:client_id => 'client_id', :private_key => 'private_key')
|
197
197
|
end.should_not raise_error(ArgumentError)
|
198
198
|
end
|
199
199
|
|
@@ -210,7 +210,7 @@ describe GroupDocs::Signature::Field do
|
|
210
210
|
|
211
211
|
it 'accepts access credentials hash' do
|
212
212
|
lambda do
|
213
|
-
subject.delete!(client_id
|
213
|
+
subject.delete!(:client_id => 'client_id', :private_key => 'private_key')
|
214
214
|
end.should_not raise_error(ArgumentError)
|
215
215
|
end
|
216
216
|
end
|