groupdocs 1.4.2 → 1.5.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/CHANGELOG.md +18 -0
- data/lib/groupdocs/api/helpers.rb +1 -0
- data/lib/groupdocs/api/helpers/signature_public_helper.rb +22 -0
- data/lib/groupdocs/signature.rb +81 -0
- data/lib/groupdocs/signature/envelope.rb +11 -4
- data/lib/groupdocs/signature/form.rb +32 -2
- data/lib/groupdocs/signature/shared/document_methods.rb +22 -2
- data/lib/groupdocs/signature/shared/entity_methods.rb +1 -1
- data/lib/groupdocs/signature/shared/field_methods.rb +1 -0
- data/lib/groupdocs/signature/shared/recipient_methods.rb +6 -2
- data/lib/groupdocs/signature/shared/resource_methods.rb +1 -1
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/api/helpers/signature_public_helper_spec.rb +21 -0
- data/spec/groupdocs/signature/envelope_spec.rb +10 -2
- data/spec/groupdocs/signature/form_spec.rb +5 -1
- data/spec/groupdocs/signature_spec.rb +99 -0
- data/spec/support/shared_examples/signature/shared/recipient_methods.rb +5 -1
- metadata +7 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## v1.5.0
|
2
|
+
|
3
|
+
**New**
|
4
|
+
|
5
|
+
* Added `Signature.get_for_recipients!`
|
6
|
+
* Added `Signature#create_for_recipient!`
|
7
|
+
* Added `Signature#signature_data!`
|
8
|
+
* Added `Signature#initials_data!`
|
9
|
+
|
10
|
+
**Changes**
|
11
|
+
|
12
|
+
* `Signature::Envelope#fill_field!` supports `:public` flag
|
13
|
+
* `Signature::Envelope#sign!` supports `:public` flag
|
14
|
+
* `Signature::Form.get!` supports `:public` flag
|
15
|
+
* `Signature::Form#documents!` supports `:public` flag
|
16
|
+
* `Signature::Envelope#documents!` supports `:public` flag
|
17
|
+
* `Signature::Envelope#recipients!` supports `:public` flag
|
18
|
+
|
1
19
|
## v1.4.2
|
2
20
|
|
3
21
|
**New**
|
@@ -6,5 +6,6 @@ require 'groupdocs/api/helpers/credentials_helper'
|
|
6
6
|
require 'groupdocs/api/helpers/mime_helper'
|
7
7
|
require 'groupdocs/api/helpers/path_helper'
|
8
8
|
require 'groupdocs/api/helpers/rest_helper'
|
9
|
+
require 'groupdocs/api/helpers/signature_public_helper'
|
9
10
|
require 'groupdocs/api/helpers/status_helper'
|
10
11
|
require 'groupdocs/api/helpers/url_helper'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module GroupDocs
|
2
|
+
module Api
|
3
|
+
module Helpers
|
4
|
+
module SignaturePublic
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
#
|
9
|
+
# Returns corresponding URI fragment for (un)public call.
|
10
|
+
#
|
11
|
+
# @param [Boolean, nil] public_flag
|
12
|
+
# @return [String]
|
13
|
+
# @api private
|
14
|
+
#
|
15
|
+
def client_id(public_flag)
|
16
|
+
!!public_flag ? 'public' : '{{client_id}}'
|
17
|
+
end
|
18
|
+
|
19
|
+
end # SignaturePublic
|
20
|
+
end # Helpers
|
21
|
+
end # Api
|
22
|
+
end # GroupDocs
|
data/lib/groupdocs/signature.rb
CHANGED
@@ -33,6 +33,32 @@ module GroupDocs
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
#
|
37
|
+
# Returns a list of all signatures for recipient.
|
38
|
+
#
|
39
|
+
# @param [GroupDocs::Signature::Recipient] recipient
|
40
|
+
# @param [Hash] access Access credentials
|
41
|
+
# @option access [String] :client_id
|
42
|
+
# @option access [String] :private_key
|
43
|
+
# @return [Array<GroupDocs::Signature>]
|
44
|
+
#
|
45
|
+
def self.get_for_recipient!(recipient, access = {})
|
46
|
+
recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError,
|
47
|
+
"Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}"
|
48
|
+
|
49
|
+
api = Api::Request.new do |request|
|
50
|
+
request[:access] = access
|
51
|
+
request[:method] = :GET
|
52
|
+
request[:path] = '/signature/public/signatures'
|
53
|
+
end
|
54
|
+
api.add_params(:recipientId => recipient.id)
|
55
|
+
json = api.execute!
|
56
|
+
|
57
|
+
json[:signatures].map do |signature|
|
58
|
+
new(signature)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
36
62
|
# @attr [String] id
|
37
63
|
attr_accessor :id
|
38
64
|
# @attr [String] userGuid
|
@@ -113,6 +139,31 @@ module GroupDocs
|
|
113
139
|
self.id = json[:signature][:id]
|
114
140
|
end
|
115
141
|
|
142
|
+
#
|
143
|
+
# Creates signature for recipient.
|
144
|
+
#
|
145
|
+
# @param [GroupDocs::Signature::Recipient] recipient
|
146
|
+
# @param [String] title Signature title
|
147
|
+
# @param [Hash] access Access credentials
|
148
|
+
# @option access [String] :client_id
|
149
|
+
# @option access [String] :private_key
|
150
|
+
#
|
151
|
+
def create_for_recipient!(recipient, title, access = {})
|
152
|
+
recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError,
|
153
|
+
"Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}"
|
154
|
+
|
155
|
+
api = Api::Request.new do |request|
|
156
|
+
request[:access] = access
|
157
|
+
request[:method] = :POST
|
158
|
+
request[:path] = '/signature/public/signature'
|
159
|
+
request[:request_body] = to_hash
|
160
|
+
end
|
161
|
+
api.add_params(:name => title, :recipientId => recipient.id)
|
162
|
+
json = api.execute!
|
163
|
+
|
164
|
+
self.id = json[:signature][:id]
|
165
|
+
end
|
166
|
+
|
116
167
|
#
|
117
168
|
# Deletes signature.
|
118
169
|
#
|
@@ -128,5 +179,35 @@ module GroupDocs
|
|
128
179
|
end.execute!
|
129
180
|
end
|
130
181
|
|
182
|
+
#
|
183
|
+
# Returns signature data.
|
184
|
+
#
|
185
|
+
# @param [Hash] access Access credentials
|
186
|
+
# @option access [String] :client_id
|
187
|
+
# @option access [String] :private_key
|
188
|
+
#
|
189
|
+
def signature_data!(access = {})
|
190
|
+
self.signature_data = Api::Request.new do |request|
|
191
|
+
request[:access] = access
|
192
|
+
request[:method] = :GET
|
193
|
+
request[:path] = "/signature/public/signatures/signature/#{id}/signatureData"
|
194
|
+
end.execute!
|
195
|
+
end
|
196
|
+
|
197
|
+
#
|
198
|
+
# Returns initials data.
|
199
|
+
#
|
200
|
+
# @param [Hash] access Access credentials
|
201
|
+
# @option access [String] :client_id
|
202
|
+
# @option access [String] :private_key
|
203
|
+
#
|
204
|
+
def initials_data!(access = {})
|
205
|
+
self.initials_data = Api::Request.new do |request|
|
206
|
+
request[:access] = access
|
207
|
+
request[:method] = :GET
|
208
|
+
request[:path] = "/signature/public/signatures/signature/#{id}/initialsData"
|
209
|
+
end.execute!
|
210
|
+
end
|
211
|
+
|
131
212
|
end # Signature
|
132
213
|
end # GroupDocs
|
@@ -15,6 +15,7 @@ module GroupDocs
|
|
15
15
|
:scheduled => 99,
|
16
16
|
}
|
17
17
|
|
18
|
+
include Api::Helpers::SignaturePublic
|
18
19
|
include Signature::DocumentMethods
|
19
20
|
include Signature::EntityFields
|
20
21
|
include Signature::EntityMethods
|
@@ -245,6 +246,8 @@ module GroupDocs
|
|
245
246
|
# @param [GroupDocs::Signature::Field] field
|
246
247
|
# @param [GroupDocs::Document] document
|
247
248
|
# @param [GroupDocs::Signature::Recipient] recipient
|
249
|
+
# @param [Hash] options
|
250
|
+
# @option options [Boolean] :public Defaults to false
|
248
251
|
# @param [Hash] access Access credentials
|
249
252
|
# @option access [String] :client_id
|
250
253
|
# @option access [String] :private_key
|
@@ -253,7 +256,7 @@ module GroupDocs
|
|
253
256
|
# @raise [ArgumentError] if document is not GroupDocs::Document
|
254
257
|
# @raise [ArgumentError] if recipient is not GroupDocs::Signature::Recipient
|
255
258
|
#
|
256
|
-
def fill_field!(value, field, document, recipient, access = {})
|
259
|
+
def fill_field!(value, field, document, recipient, options = {}, access = {})
|
257
260
|
field.is_a?(GroupDocs::Signature::Field) or raise ArgumentError,
|
258
261
|
"Field should be GroupDocs::Signature::Field object, received: #{field.inspect}"
|
259
262
|
document.is_a?(GroupDocs::Document) or raise ArgumentError,
|
@@ -261,10 +264,11 @@ module GroupDocs
|
|
261
264
|
recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError,
|
262
265
|
"Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}"
|
263
266
|
|
267
|
+
client_id = client_id(options[:public])
|
264
268
|
api = Api::Request.new do |request|
|
265
269
|
request[:access] = access
|
266
270
|
request[:method] = :PUT
|
267
|
-
request[:path] = "/signature
|
271
|
+
request[:path] = "/signature/#{client_id}/envelopes/#{id}/documents/#{document.file.guid}/recipient/#{recipient.id}/field/#{field.id}"
|
268
272
|
end
|
269
273
|
|
270
274
|
type = field.field_type
|
@@ -286,19 +290,22 @@ module GroupDocs
|
|
286
290
|
# Signs envelope.
|
287
291
|
#
|
288
292
|
# @param [GroupDocs::Signature::Recipient] recipient
|
293
|
+
# @param [Hash] options
|
294
|
+
# @option options [Boolean] :public Defaults to false
|
289
295
|
# @param [Hash] access Access credentials
|
290
296
|
# @option access [String] :client_id
|
291
297
|
# @option access [String] :private_key
|
292
298
|
# @raise [ArgumentError] if recipient is not GroupDocs::Signature::Recipient
|
293
299
|
#
|
294
|
-
def sign!(recipient,
|
300
|
+
def sign!(recipient, options = {}, ccess = {})
|
295
301
|
recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError,
|
296
302
|
"Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}"
|
297
303
|
|
304
|
+
client_id = client_id(options[:public])
|
298
305
|
Api::Request.new do |request|
|
299
306
|
request[:access] = access
|
300
307
|
request[:method] = :PUT
|
301
|
-
request[:path] = "/signature
|
308
|
+
request[:path] = "/signature/#{client_id}/envelopes/#{id}/recipient/#{recipient.id}/sign"
|
302
309
|
end.execute!
|
303
310
|
end
|
304
311
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module GroupDocs
|
2
2
|
class Signature::Form < Api::Entity
|
3
3
|
|
4
|
+
include Api::Helpers::SignaturePublic
|
4
5
|
include Signature::EntityMethods
|
5
6
|
include Signature::DocumentMethods
|
6
7
|
include Signature::FieldMethods
|
@@ -48,6 +49,31 @@ module GroupDocs
|
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
52
|
+
#
|
53
|
+
# Returns form by its identifier.
|
54
|
+
#
|
55
|
+
# @param [String] id
|
56
|
+
# @param [Hash] options
|
57
|
+
# @option options [Boolean] :public Defaults to false
|
58
|
+
# @param [Hash] access Access credentials
|
59
|
+
# @option access [String] :client_id
|
60
|
+
# @option access [String] :private_key
|
61
|
+
# @return [GroupDocs::Signature::Form]
|
62
|
+
#
|
63
|
+
def self.get!(id, options = {}, access = {})
|
64
|
+
if options[:public]
|
65
|
+
json = Api::Request.new do |request|
|
66
|
+
request[:access] = access
|
67
|
+
request[:method] = :GET
|
68
|
+
request[:path] = "/signature/public/forms/#{id}"
|
69
|
+
end.execute!
|
70
|
+
|
71
|
+
new(json[:form])
|
72
|
+
else
|
73
|
+
super(id, access)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
51
77
|
# @attr [String] id
|
52
78
|
attr_accessor :id
|
53
79
|
# @attr [String] name
|
@@ -154,16 +180,20 @@ module GroupDocs
|
|
154
180
|
#
|
155
181
|
# Returns documents array.
|
156
182
|
#
|
183
|
+
# @param [Hash] options
|
184
|
+
# @option options [Boolean] :public Defaults to false
|
157
185
|
# @param [Hash] access Access credentials
|
158
186
|
# @option access [String] :client_id
|
159
187
|
# @option access [String] :private_key
|
160
188
|
# @return [Array<GroupDocs::Document>]
|
161
189
|
#
|
162
|
-
def documents!(access = {})
|
190
|
+
def documents!(options = {}, access = {})
|
191
|
+
client_id = client_id(options[:public])
|
192
|
+
|
163
193
|
json = Api::Request.new do |request|
|
164
194
|
request[:access] = access
|
165
195
|
request[:method] = :GET
|
166
|
-
request[:path] = "/signature
|
196
|
+
request[:path] = "/signature/#{client_id}/forms/#{id}/documents"
|
167
197
|
end.execute!
|
168
198
|
|
169
199
|
json[:documents].map do |document|
|
@@ -4,6 +4,7 @@ module GroupDocs
|
|
4
4
|
# Envelope and template entities share the same set of document methods.
|
5
5
|
#
|
6
6
|
# @see GroupDocs::Signature::Envelope
|
7
|
+
# @see GroupDocs::Signature::Form
|
7
8
|
# @see GroupDocs::Signature::Template
|
8
9
|
#
|
9
10
|
module DocumentMethods
|
@@ -11,16 +12,35 @@ module GroupDocs
|
|
11
12
|
#
|
12
13
|
# Returns documents array.
|
13
14
|
#
|
15
|
+
# @param [Hash] options
|
16
|
+
# @option options [Boolean] :public Defaults to false
|
17
|
+
# @option options [GroupDocs::Signature::Recipient] :recipient Used if :public is true and self is envelope
|
14
18
|
# @param [Hash] access Access credentials
|
15
19
|
# @option access [String] :client_id
|
16
20
|
# @option access [String] :private_key
|
17
21
|
# @return [Array<GroupDocs::Document>]
|
18
22
|
#
|
19
|
-
def documents!(access = {})
|
23
|
+
def documents!(options = {}, access = {})
|
24
|
+
path = if options[:public]
|
25
|
+
case class_name
|
26
|
+
when 'envelope'
|
27
|
+
options[:recipient].is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError,
|
28
|
+
"Recipient should be GroupDocs::Signature::Recipient object, received: #{options[:recipient].inspect}"
|
29
|
+
|
30
|
+
"/signature/public/envelopes/#{id}/recipient/#{options[:recipient].id}/documents"
|
31
|
+
when 'form'
|
32
|
+
"/signature/public/forms/#{id}/documents"
|
33
|
+
else
|
34
|
+
raise ArgumentError, "Public is supported only for envelope or form."
|
35
|
+
end
|
36
|
+
else
|
37
|
+
"/signature/{{client_id}}/#{class_name.pluralize}/#{id}/documents"
|
38
|
+
end
|
39
|
+
|
20
40
|
json = Api::Request.new do |request|
|
21
41
|
request[:access] = access
|
22
42
|
request[:method] = :GET
|
23
|
-
request[:path] =
|
43
|
+
request[:path] = path
|
24
44
|
end.execute!
|
25
45
|
|
26
46
|
json[:documents].map do |document|
|
@@ -3,8 +3,8 @@ module GroupDocs
|
|
3
3
|
#
|
4
4
|
# Envelope and template entities share the same set of methods.
|
5
5
|
#
|
6
|
-
# @see GroupDocs::Signature::Form
|
7
6
|
# @see GroupDocs::Signature::Envelope
|
7
|
+
# @see GroupDocs::Signature::Form
|
8
8
|
# @see GroupDocs::Signature::Template
|
9
9
|
#
|
10
10
|
module EntityMethods
|
@@ -8,19 +8,23 @@ module GroupDocs
|
|
8
8
|
#
|
9
9
|
module RecipientMethods
|
10
10
|
|
11
|
+
include Api::Helpers::SignaturePublic
|
12
|
+
|
11
13
|
#
|
12
14
|
# Returns recipients array.
|
13
15
|
#
|
16
|
+
# @param [Hash] options
|
17
|
+
# @option options [Boolean] :public Defaults to false
|
14
18
|
# @param [Hash] access Access credentials
|
15
19
|
# @option access [String] :client_id
|
16
20
|
# @option access [String] :private_key
|
17
21
|
# @return [Array<GroupDocs::Signature::Recipient>]
|
18
22
|
#
|
19
|
-
def recipients!(access = {})
|
23
|
+
def recipients!(options = {}, access = {})
|
20
24
|
json = Api::Request.new do |request|
|
21
25
|
request[:access] = access
|
22
26
|
request[:method] = :GET
|
23
|
-
request[:path] = "/signature
|
27
|
+
request[:path] = "/signature/#{client_id(options[:public])}/#{class_name.pluralize}/#{id}/recipients"
|
24
28
|
end.execute!
|
25
29
|
|
26
30
|
json[:recipients].map do |recipient|
|
@@ -3,8 +3,8 @@ module GroupDocs
|
|
3
3
|
#
|
4
4
|
# Envelope and template entities share the same set of resource methods.
|
5
5
|
#
|
6
|
-
# @see GroupDocs::Signature::Form
|
7
6
|
# @see GroupDocs::Signature::Envelope
|
7
|
+
# @see GroupDocs::Signature::Form
|
8
8
|
# @see GroupDocs::Signature::Template
|
9
9
|
#
|
10
10
|
module ResourceMethods
|
data/lib/groupdocs/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GroupDocs::Api::Helpers::SignaturePublic do
|
4
|
+
subject do
|
5
|
+
GroupDocs::Signature::Envelope.new
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#client_id' do
|
9
|
+
it 'returns "public" if true is passed' do
|
10
|
+
subject.send(:client_id, true).should == 'public'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'returns "{{client_id}}" if false is passed' do
|
14
|
+
subject.send(:client_id, false).should == '{{client_id}}'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'returns "{{client_id}}" if nil is passed' do
|
18
|
+
subject.send(:client_id, false).should == '{{client_id}}'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -151,10 +151,14 @@ describe GroupDocs::Signature::Envelope do
|
|
151
151
|
|
152
152
|
it 'accepts access credentials hash' do
|
153
153
|
lambda do
|
154
|
-
subject.fill_field!('test', field, document, recipient, :client_id => 'client_id', :private_key => 'private_key')
|
154
|
+
subject.fill_field!('test', field, document, recipient, {}, :client_id => 'client_id', :private_key => 'private_key')
|
155
155
|
end.should_not raise_error(ArgumentError)
|
156
156
|
end
|
157
157
|
|
158
|
+
it 'can be public' do
|
159
|
+
lambda { subject.fill_field!('test', field, document, recipient, :public => true) }.should_not raise_error(ArgumentError)
|
160
|
+
end
|
161
|
+
|
158
162
|
it 'raises error if field is not GroupDocs::Signature::Field object' do
|
159
163
|
lambda { subject.fill_field!('test', 'Field', document, recipient) }.should raise_error(ArgumentError)
|
160
164
|
end
|
@@ -202,10 +206,14 @@ describe GroupDocs::Signature::Envelope do
|
|
202
206
|
|
203
207
|
it 'accepts access credentials hash' do
|
204
208
|
lambda do
|
205
|
-
subject.sign!(recipient, :client_id => 'client_id', :private_key => 'private_key')
|
209
|
+
subject.sign!(recipient, {}, :client_id => 'client_id', :private_key => 'private_key')
|
206
210
|
end.should_not raise_error(ArgumentError)
|
207
211
|
end
|
208
212
|
|
213
|
+
it 'can be public' do
|
214
|
+
lambda { subject.fill_field!('test', field, document, recipient, :public => true) }.should_not raise_error(ArgumentError)
|
215
|
+
end
|
216
|
+
|
209
217
|
it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
|
210
218
|
lambda { subject.sign!('Recipient') }.should raise_error(ArgumentError)
|
211
219
|
end
|
@@ -120,10 +120,14 @@ describe GroupDocs::Signature::Form do
|
|
120
120
|
|
121
121
|
it 'accepts access credentials hash' do
|
122
122
|
lambda do
|
123
|
-
subject.documents!(:client_id => 'client_id', :private_key => 'private_key')
|
123
|
+
subject.documents!({}, :client_id => 'client_id', :private_key => 'private_key')
|
124
124
|
end.should_not raise_error(ArgumentError)
|
125
125
|
end
|
126
126
|
|
127
|
+
it 'can be public' do
|
128
|
+
lambda { subject.documents!(:public => true) }.should_not raise_error(ArgumentError)
|
129
|
+
end
|
130
|
+
|
127
131
|
it 'returns array of GroupDocs::Document objects' do
|
128
132
|
documents = subject.documents!
|
129
133
|
documents.should be_an(Array)
|
@@ -24,6 +24,32 @@ describe GroupDocs::Signature do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
describe '.get_for_recipient!' do
|
28
|
+
let(:recipient) { GroupDocs::Signature::Recipient.new }
|
29
|
+
|
30
|
+
before(:each) do
|
31
|
+
mock_api_server(load_json('signatures_get'))
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'accepts access credentials hash' do
|
35
|
+
lambda do
|
36
|
+
described_class.get_for_recipient!(recipient, :client_id => 'client_id', :private_key => 'private_key')
|
37
|
+
end.should_not raise_error(ArgumentError)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
|
41
|
+
lambda { described_class.get_for_recipient!('Recipient') }.should raise_error(ArgumentError)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'returns array of GroupDocs::Signature objects' do
|
45
|
+
signatures = described_class.get_for_recipient!(recipient)
|
46
|
+
signatures.should be_an(Array)
|
47
|
+
signatures.each do |signature|
|
48
|
+
signature.should be_a(GroupDocs::Signature)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
27
53
|
it { should have_accessor(:id) }
|
28
54
|
it { should have_accessor(:userGuid) }
|
29
55
|
it { should have_accessor(:recipientId) }
|
@@ -81,6 +107,35 @@ describe GroupDocs::Signature do
|
|
81
107
|
end
|
82
108
|
end
|
83
109
|
|
110
|
+
describe '#create_for_recipient!' do
|
111
|
+
let(:recipient) { GroupDocs::Signature::Recipient.new }
|
112
|
+
|
113
|
+
before(:each) do
|
114
|
+
mock_api_server(load_json('signature_create'))
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'accepts access credentials hash' do
|
118
|
+
lambda do
|
119
|
+
subject.create_for_recipient!(recipient, 'Signature', :client_id => 'client_id', :private_key => 'private_key')
|
120
|
+
end.should_not raise_error(ArgumentError)
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
|
124
|
+
lambda { subject.create_for_recipient!('Recipient') }.should raise_error(ArgumentError)
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'uses hashed version of self as request body' do
|
128
|
+
subject.should_receive(:to_hash)
|
129
|
+
subject.create_for_recipient!(recipient, 'Signature')
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'updates identifier of signature' do
|
133
|
+
lambda do
|
134
|
+
subject.create_for_recipient!(recipient, 'Signature')
|
135
|
+
end.should change(subject, :id)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
84
139
|
describe '#delete!' do
|
85
140
|
before(:each) do
|
86
141
|
mock_api_server('{ "status": "Ok", "result": {}}')
|
@@ -92,4 +147,48 @@ describe GroupDocs::Signature do
|
|
92
147
|
end.should_not raise_error(ArgumentError)
|
93
148
|
end
|
94
149
|
end
|
150
|
+
|
151
|
+
describe '#signature_data!' do
|
152
|
+
before(:each) do
|
153
|
+
mock_api_server('{ "status": "Ok", "result": "Data"}')
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'accepts access credentials hash' do
|
157
|
+
lambda do
|
158
|
+
subject.signature_data!(:client_id => 'client_id', :private_key => 'private_key')
|
159
|
+
end.should_not raise_error(ArgumentError)
|
160
|
+
end
|
161
|
+
|
162
|
+
it 'returns data' do
|
163
|
+
subject.signature_data!.should == 'Data'
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'updates signature data of signature' do
|
167
|
+
lambda do
|
168
|
+
subject.signature_data!
|
169
|
+
end.should change(subject, :signature_data)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe '#initials_data!' do
|
174
|
+
before(:each) do
|
175
|
+
mock_api_server('{ "status": "Ok", "result": "Data"}')
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'accepts access credentials hash' do
|
179
|
+
lambda do
|
180
|
+
subject.initials_data!(:client_id => 'client_id', :private_key => 'private_key')
|
181
|
+
end.should_not raise_error(ArgumentError)
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'returns data' do
|
185
|
+
subject.initials_data!.should == 'Data'
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'updates initials data of signature' do
|
189
|
+
lambda do
|
190
|
+
subject.initials_data!
|
191
|
+
end.should change(subject, :initials_data)
|
192
|
+
end
|
193
|
+
end
|
95
194
|
end
|
@@ -7,10 +7,14 @@ shared_examples_for GroupDocs::Signature::RecipientMethods do
|
|
7
7
|
|
8
8
|
it 'accepts access credentials hash' do
|
9
9
|
lambda do
|
10
|
-
subject.recipients!(:client_id => 'client_id', :private_key => 'private_key')
|
10
|
+
subject.recipients!({}, :client_id => 'client_id', :private_key => 'private_key')
|
11
11
|
end.should_not raise_error(ArgumentError)
|
12
12
|
end
|
13
13
|
|
14
|
+
it 'can be public' do
|
15
|
+
lambda { subject.recipients!(:public => true) }.should_not raise_error(ArgumentError)
|
16
|
+
end
|
17
|
+
|
14
18
|
it 'returns array of GroupDocs::Signature::Recipient objects' do
|
15
19
|
recipients = subject.recipients!
|
16
20
|
recipients.should be_an(Array)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groupdocs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -278,6 +278,7 @@ files:
|
|
278
278
|
- lib/groupdocs/api/helpers/mime_helper.rb
|
279
279
|
- lib/groupdocs/api/helpers/path_helper.rb
|
280
280
|
- lib/groupdocs/api/helpers/rest_helper.rb
|
281
|
+
- lib/groupdocs/api/helpers/signature_public_helper.rb
|
281
282
|
- lib/groupdocs/api/helpers/status_helper.rb
|
282
283
|
- lib/groupdocs/api/helpers/url_helper.rb
|
283
284
|
- lib/groupdocs/api/request.rb
|
@@ -336,6 +337,7 @@ files:
|
|
336
337
|
- spec/groupdocs/api/helpers/mime_helper_spec.rb
|
337
338
|
- spec/groupdocs/api/helpers/path_helper_spec.rb
|
338
339
|
- spec/groupdocs/api/helpers/rest_helper_spec.rb
|
340
|
+
- spec/groupdocs/api/helpers/signature_public_helper_spec.rb
|
339
341
|
- spec/groupdocs/api/helpers/status_helper_spec.rb
|
340
342
|
- spec/groupdocs/api/helpers/url_helper_spec.rb
|
341
343
|
- spec/groupdocs/api/request_spec.rb
|
@@ -499,7 +501,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
499
501
|
version: '0'
|
500
502
|
segments:
|
501
503
|
- 0
|
502
|
-
hash:
|
504
|
+
hash: 2302864106414593407
|
503
505
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
504
506
|
none: false
|
505
507
|
requirements:
|
@@ -508,7 +510,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
508
510
|
version: '0'
|
509
511
|
segments:
|
510
512
|
- 0
|
511
|
-
hash:
|
513
|
+
hash: 2302864106414593407
|
512
514
|
requirements: []
|
513
515
|
rubyforge_project:
|
514
516
|
rubygems_version: 1.8.23
|
@@ -525,6 +527,7 @@ test_files:
|
|
525
527
|
- spec/groupdocs/api/helpers/mime_helper_spec.rb
|
526
528
|
- spec/groupdocs/api/helpers/path_helper_spec.rb
|
527
529
|
- spec/groupdocs/api/helpers/rest_helper_spec.rb
|
530
|
+
- spec/groupdocs/api/helpers/signature_public_helper_spec.rb
|
528
531
|
- spec/groupdocs/api/helpers/status_helper_spec.rb
|
529
532
|
- spec/groupdocs/api/helpers/url_helper_spec.rb
|
530
533
|
- spec/groupdocs/api/request_spec.rb
|