groupdocs 1.1.0 → 1.2.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 +41 -0
- data/examples/README.md +2 -3
- data/examples/api-samples/Gemfile +5 -0
- data/examples/api-samples/Gemfile.lock +27 -0
- data/examples/api-samples/README.md +12 -0
- data/examples/api-samples/app.rb +17 -0
- data/examples/api-samples/public/css/style.css +166 -0
- data/examples/api-samples/samples/sample1.rb +17 -0
- data/examples/api-samples/samples/sample10.rb +36 -0
- data/examples/api-samples/samples/sample2.rb +19 -0
- data/examples/api-samples/samples/sample3.rb +23 -0
- data/examples/api-samples/samples/sample4.rb +31 -0
- data/examples/api-samples/samples/sample5.rb +44 -0
- data/examples/api-samples/samples/sample6.rb +3 -0
- data/examples/api-samples/samples/sample7.rb +33 -0
- data/examples/api-samples/samples/sample8.rb +40 -0
- data/examples/api-samples/samples/sample9.rb +22 -0
- data/examples/api-samples/views/index.haml +23 -0
- data/examples/api-samples/views/layout.haml +7 -0
- data/examples/api-samples/views/sample1.haml +71 -0
- data/examples/api-samples/views/sample10.haml +69 -0
- data/examples/api-samples/views/sample2.haml +59 -0
- data/examples/api-samples/views/sample3.haml +62 -0
- data/examples/api-samples/views/sample4.haml +58 -0
- data/examples/api-samples/views/sample5.haml +62 -0
- data/examples/api-samples/views/sample6.haml +145 -0
- data/examples/api-samples/views/sample7.haml +59 -0
- data/examples/api-samples/views/sample8.haml +75 -0
- data/examples/api-samples/views/sample9.haml +61 -0
- data/examples/{annotations → viewer}/Gemfile +0 -0
- data/examples/viewer/app.rb +52 -0
- data/groupdocs.gemspec +5 -4
- data/lib/groupdocs/api.rb +1 -0
- data/lib/groupdocs/api/entity.rb +2 -0
- data/lib/groupdocs/api/helpers.rb +2 -0
- data/lib/groupdocs/api/helpers/accessor_helper.rb +30 -0
- data/lib/groupdocs/api/helpers/mime_helper.rb +21 -0
- data/lib/groupdocs/api/helpers/rest_helper.rb +3 -2
- data/lib/groupdocs/api/request.rb +1 -3
- data/lib/groupdocs/datasource.rb +1 -2
- data/lib/groupdocs/document.rb +133 -3
- data/lib/groupdocs/document/annotation.rb +14 -13
- data/lib/groupdocs/document/annotation/reply.rb +4 -8
- data/lib/groupdocs/document/annotation/reviewer.rb +2 -4
- data/lib/groupdocs/document/field.rb +10 -8
- data/lib/groupdocs/document/rectangle.rb +10 -18
- data/lib/groupdocs/job.rb +1 -1
- data/lib/groupdocs/questionnaire.rb +138 -44
- data/lib/groupdocs/questionnaire/collector.rb +262 -0
- data/lib/groupdocs/questionnaire/execution.rb +93 -10
- data/lib/groupdocs/questionnaire/question.rb +1 -2
- data/lib/groupdocs/signature.rb +16 -24
- data/lib/groupdocs/signature/contact.rb +2 -4
- data/lib/groupdocs/signature/envelope.rb +3 -6
- data/lib/groupdocs/signature/envelope/log.rb +2 -4
- data/lib/groupdocs/signature/field.rb +21 -42
- data/lib/groupdocs/signature/field/location.rb +18 -36
- data/lib/groupdocs/signature/form.rb +9 -18
- data/lib/groupdocs/signature/list.rb +1 -2
- data/lib/groupdocs/signature/recipient.rb +3 -6
- data/lib/groupdocs/signature/role.rb +4 -8
- data/lib/groupdocs/signature/shared/entity_fields.rb +12 -20
- data/lib/groupdocs/signature/template.rb +1 -2
- data/lib/groupdocs/storage/file.rb +3 -1
- data/lib/groupdocs/storage/folder.rb +7 -1
- data/lib/groupdocs/subscription.rb +6 -12
- data/lib/groupdocs/subscription/limit.rb +4 -8
- data/lib/groupdocs/user.rb +3 -6
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/api/helpers/accessor_helper_spec.rb +16 -0
- data/spec/groupdocs/api/helpers/mime_helper_spec.rb +16 -0
- data/spec/groupdocs/api/helpers/rest_helper_spec.rb +4 -0
- data/spec/groupdocs/api/request_spec.rb +3 -5
- data/spec/groupdocs/datasource/field_spec.rb +3 -6
- data/spec/groupdocs/datasource_spec.rb +8 -15
- data/spec/groupdocs/document/annotation/reply_spec.rb +13 -24
- data/spec/groupdocs/document/annotation/reviewer_spec.rb +5 -9
- data/spec/groupdocs/document/annotation_spec.rb +35 -40
- data/spec/groupdocs/document/change_spec.rb +6 -11
- data/spec/groupdocs/document/field_spec.rb +13 -13
- data/spec/groupdocs/document/metadata_spec.rb +5 -10
- data/spec/groupdocs/document/rectangle_spec.rb +6 -18
- data/spec/groupdocs/document/view_spec.rb +3 -6
- data/spec/groupdocs/document_spec.rb +123 -10
- data/spec/groupdocs/job_spec.rb +9 -18
- data/spec/groupdocs/questionnaire/collector_spec.rb +201 -0
- data/spec/groupdocs/questionnaire/execution_spec.rb +91 -23
- data/spec/groupdocs/questionnaire/page_spec.rb +3 -6
- data/spec/groupdocs/questionnaire/question/answer_spec.rb +2 -4
- data/spec/groupdocs/questionnaire/question_spec.rb +7 -14
- data/spec/groupdocs/questionnaire_spec.rb +117 -41
- data/spec/groupdocs/signature/contact_spec.rb +9 -17
- data/spec/groupdocs/signature/envelope/log_spec.rb +8 -16
- data/spec/groupdocs/signature/envelope_spec.rb +9 -17
- data/spec/groupdocs/signature/field/location_spec.rb +32 -65
- data/spec/groupdocs/signature/field_spec.rb +48 -95
- data/spec/groupdocs/signature/form_spec.rb +22 -43
- data/spec/groupdocs/signature/list_spec.rb +6 -11
- data/spec/groupdocs/signature/recipient_spec.rb +11 -22
- data/spec/groupdocs/signature/role_spec.rb +11 -21
- data/spec/groupdocs/signature/template_spec.rb +2 -4
- data/spec/groupdocs/signature_spec.rb +28 -54
- data/spec/groupdocs/storage/file_spec.rb +14 -26
- data/spec/groupdocs/storage/folder_spec.rb +16 -22
- data/spec/groupdocs/storage/package_spec.rb +2 -4
- data/spec/groupdocs/subscription/limit_spec.rb +8 -16
- data/spec/groupdocs/subscription_spec.rb +11 -22
- data/spec/groupdocs/user_spec.rb +21 -41
- data/spec/groupdocs_spec.rb +4 -8
- data/spec/spec_helper.rb +12 -0
- data/spec/support/files/signature.png +0 -0
- data/spec/support/json/annotation_list.json +6 -6
- data/spec/support/json/comparison_changes.json +8 -8
- data/spec/support/json/document_fields.json +8 -8
- data/spec/support/json/document_page_images_get.json +20 -0
- data/spec/support/json/questionnaire_collector.json +17 -0
- data/spec/support/json/questionnaire_collectors.json +38 -0
- data/spec/support/json/questionnaire_collectors_add.json +10 -0
- data/spec/support/json/questionnaire_create.json +3 -1
- data/spec/support/json/{questionnaire_execution_create.json → questionnaire_execution_add.json} +1 -1
- data/spec/support/json/questionnaire_get.json +3 -0
- data/spec/support/json/questionnaires_get.json +36 -18
- data/spec/support/json/sign_documents.json +16 -0
- data/spec/support/json/templates_get.json +21 -0
- data/spec/support/shared_examples/api/entity.rb +2 -0
- data/spec/support/shared_examples/api/helpers/access_mode_helper.rb +1 -2
- data/spec/support/shared_examples/api/helpers/status_helper.rb +1 -2
- data/spec/support/shared_examples/signature/shared/entity_fields.rb +22 -43
- metadata +82 -16
- data/examples/annotations/app.rb +0 -67
|
@@ -5,37 +5,38 @@ describe GroupDocs::Questionnaire::Execution do
|
|
|
5
5
|
it_behaves_like GroupDocs::Api::Entity
|
|
6
6
|
include_examples GroupDocs::Api::Helpers::Status
|
|
7
7
|
|
|
8
|
-
describe '.
|
|
8
|
+
describe '.get!' do
|
|
9
|
+
before(:each) do
|
|
10
|
+
mock_api_server(load_json('questionnaire_get'))
|
|
11
|
+
end
|
|
12
|
+
|
|
9
13
|
it 'accepts access credentials hash' do
|
|
10
14
|
lambda do
|
|
11
|
-
described_class.
|
|
15
|
+
described_class.get!('45dsfh9348uf0fj834y92h', client_id: 'client_id', private_key: 'private_key')
|
|
12
16
|
end.should_not raise_error(ArgumentError)
|
|
13
17
|
end
|
|
14
18
|
|
|
15
|
-
it '
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
it 'returns GroupDocs::Questionnaire::Execution object' do
|
|
20
|
+
described_class.get!('45dsfh9348uf0fj834y92h').should be_a(GroupDocs::Questionnaire::Execution)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'returns nil if BadResponseError was raised' do
|
|
24
|
+
GroupDocs::Api::Request.any_instance.should_receive(:execute!).and_raise(GroupDocs::BadResponseError)
|
|
25
|
+
described_class.get!('45dsfh9348uf0fj834y92h').should be_nil
|
|
18
26
|
end
|
|
19
27
|
end
|
|
20
28
|
|
|
21
|
-
it { should
|
|
22
|
-
it { should
|
|
23
|
-
it { should
|
|
24
|
-
it { should
|
|
25
|
-
it { should
|
|
26
|
-
it { should
|
|
27
|
-
it { should
|
|
28
|
-
it { should
|
|
29
|
-
it { should
|
|
30
|
-
it { should
|
|
31
|
-
it { should
|
|
32
|
-
it { should respond_to(:approver=) }
|
|
33
|
-
it { should respond_to(:datasource_id) }
|
|
34
|
-
it { should respond_to(:datasource_id=) }
|
|
35
|
-
it { should respond_to(:status) }
|
|
36
|
-
it { should respond_to(:status=) }
|
|
37
|
-
it { should respond_to(:guid) }
|
|
38
|
-
it { should respond_to(:guid=) }
|
|
29
|
+
it { should have_accessor(:id) }
|
|
30
|
+
it { should have_accessor(:guid) }
|
|
31
|
+
it { should have_accessor(:collector_id) }
|
|
32
|
+
it { should have_accessor(:collector_guid) }
|
|
33
|
+
it { should have_accessor(:questionnaire_name) }
|
|
34
|
+
it { should have_accessor(:owner) }
|
|
35
|
+
it { should have_accessor(:executive) }
|
|
36
|
+
it { should have_accessor(:approver) }
|
|
37
|
+
it { should have_accessor(:datasource_id) }
|
|
38
|
+
it { should have_accessor(:modified) }
|
|
39
|
+
it { should have_accessor(:document) }
|
|
39
40
|
|
|
40
41
|
%w(owner executive approver).each do |method|
|
|
41
42
|
describe "##{method}=" do
|
|
@@ -53,6 +54,31 @@ describe GroupDocs::Questionnaire::Execution do
|
|
|
53
54
|
end
|
|
54
55
|
end
|
|
55
56
|
|
|
57
|
+
describe '#modified' do
|
|
58
|
+
it 'returns converted to Time object Unix timestamp' do
|
|
59
|
+
subject.modified = 1330450135000
|
|
60
|
+
subject.modified.should == Time.at(1330450135)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
describe "#document=" do
|
|
65
|
+
it 'converts passed hash to GroupDocs::Storage::File object' do
|
|
66
|
+
subject.document = { id: 123 }
|
|
67
|
+
subject.document.should be_a(GroupDocs::Storage::File)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'gets file from passed GroupDocs::Document' do
|
|
71
|
+
document = GroupDocs::Document.new(file: GroupDocs::Storage::File.new)
|
|
72
|
+
subject.document = document
|
|
73
|
+
subject.document.should == document.file
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'does nothing if nil is passed' do
|
|
77
|
+
subject.document = nil
|
|
78
|
+
subject.document.should be_nil
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
56
82
|
describe '#set_status!' do
|
|
57
83
|
before(:each) do
|
|
58
84
|
mock_api_server(load_json('questionnaire_execution_status_set'))
|
|
@@ -91,4 +117,46 @@ describe GroupDocs::Questionnaire::Execution do
|
|
|
91
117
|
subject.update!
|
|
92
118
|
end
|
|
93
119
|
end
|
|
120
|
+
|
|
121
|
+
describe '#delete!' do
|
|
122
|
+
before(:each) do
|
|
123
|
+
mock_api_server('{ "status": "Ok", "result": {}}')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it 'accepts access credentials hash' do
|
|
127
|
+
lambda do
|
|
128
|
+
subject.delete!(client_id: 'client_id', private_key: 'private_key')
|
|
129
|
+
end.should_not raise_error(ArgumentError)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
describe '#fill!' do
|
|
134
|
+
before(:each) do
|
|
135
|
+
mock_api_server(load_json('document_datasource'))
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
let(:datasource) do
|
|
139
|
+
GroupDocs::DataSource.new(id: 1)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
it 'accepts access credentials hash' do
|
|
143
|
+
lambda do
|
|
144
|
+
subject.fill!(datasource, {}, client_id: 'client_id', private_key: 'private_key')
|
|
145
|
+
end.should_not raise_error(ArgumentError)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
it 'accepts options hash' do
|
|
149
|
+
lambda do
|
|
150
|
+
subject.fill!(datasource, new_type: :pdf)
|
|
151
|
+
end.should_not raise_error(ArgumentError)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
it 'raises error if datasource is not GroupDocs::Datasource object' do
|
|
155
|
+
-> { subject.fill!('Datasource') }.should raise_error(ArgumentError)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it 'returns GroupDocs::Job object' do
|
|
159
|
+
subject.fill!(datasource).should be_a(GroupDocs::Job)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
94
162
|
end
|
|
@@ -4,12 +4,9 @@ describe GroupDocs::Questionnaire::Page do
|
|
|
4
4
|
|
|
5
5
|
it_behaves_like GroupDocs::Api::Entity
|
|
6
6
|
|
|
7
|
-
it { should
|
|
8
|
-
it { should
|
|
9
|
-
it { should
|
|
10
|
-
it { should respond_to(:number=) }
|
|
11
|
-
it { should respond_to(:title) }
|
|
12
|
-
it { should respond_to(:title=) }
|
|
7
|
+
it { should have_accessor(:questions) }
|
|
8
|
+
it { should have_accessor(:number) }
|
|
9
|
+
it { should have_accessor(:title) }
|
|
13
10
|
|
|
14
11
|
describe '#questions=' do
|
|
15
12
|
it 'converts each question to GroupDocs::Questionnaire::Question object if hash is passed' do
|
|
@@ -4,8 +4,6 @@ describe GroupDocs::Questionnaire::Question::Answer do
|
|
|
4
4
|
|
|
5
5
|
it_behaves_like GroupDocs::Api::Entity
|
|
6
6
|
|
|
7
|
-
it { should
|
|
8
|
-
it { should
|
|
9
|
-
it { should respond_to(:value) }
|
|
10
|
-
it { should respond_to(:value=) }
|
|
7
|
+
it { should have_accessor(:text) }
|
|
8
|
+
it { should have_accessor(:value) }
|
|
11
9
|
end
|
|
@@ -4,21 +4,14 @@ describe GroupDocs::Questionnaire::Question do
|
|
|
4
4
|
|
|
5
5
|
it_behaves_like GroupDocs::Api::Entity
|
|
6
6
|
|
|
7
|
-
it { should
|
|
8
|
-
it { should
|
|
9
|
-
it { should
|
|
10
|
-
it { should
|
|
11
|
-
it { should
|
|
12
|
-
it { should
|
|
13
|
-
it { should respond_to(:required) }
|
|
14
|
-
it { should respond_to(:required=) }
|
|
15
|
-
it { should respond_to(:type) }
|
|
16
|
-
it { should respond_to(:type=) }
|
|
17
|
-
it { should respond_to(:answers) }
|
|
18
|
-
it { should respond_to(:answers=) }
|
|
7
|
+
it { should have_accessor(:field) }
|
|
8
|
+
it { should have_accessor(:text) }
|
|
9
|
+
it { should have_accessor(:def_answer) }
|
|
10
|
+
it { should have_accessor(:required) }
|
|
11
|
+
it { should have_accessor(:type) }
|
|
12
|
+
it { should have_accessor(:answers) }
|
|
19
13
|
|
|
20
|
-
it { should
|
|
21
|
-
it { should have_alias(:default_answer=, :def_answer=) }
|
|
14
|
+
it { should alias_accessor(:default_answer, :def_answer) }
|
|
22
15
|
|
|
23
16
|
describe '#answers=' do
|
|
24
17
|
it 'converts each answer to GroupDocs::Questionnaire::Question::Answer object' do
|
|
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
|
3
3
|
describe GroupDocs::Questionnaire do
|
|
4
4
|
|
|
5
5
|
it_behaves_like GroupDocs::Api::Entity
|
|
6
|
+
include_examples GroupDocs::Api::Helpers::Status
|
|
6
7
|
|
|
7
8
|
describe '.all!' do
|
|
8
9
|
before(:each) do
|
|
@@ -11,10 +12,24 @@ describe GroupDocs::Questionnaire do
|
|
|
11
12
|
|
|
12
13
|
it 'accepts access credentials hash' do
|
|
13
14
|
lambda do
|
|
14
|
-
described_class.all!(client_id: 'client_id', private_key: 'private_key')
|
|
15
|
+
described_class.all!({}, client_id: 'client_id', private_key: 'private_key')
|
|
15
16
|
end.should_not raise_error(ArgumentError)
|
|
16
17
|
end
|
|
17
18
|
|
|
19
|
+
it 'accepts options hash' do
|
|
20
|
+
lambda do
|
|
21
|
+
described_class.all!(status: :draft)
|
|
22
|
+
end.should_not raise_error(ArgumentError)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'parses status if passed' do
|
|
26
|
+
status = :draft
|
|
27
|
+
subject = described_class.new
|
|
28
|
+
described_class.should_receive(:new).any_number_of_times.and_return(subject)
|
|
29
|
+
subject.should_receive(:parse_status).with(status)
|
|
30
|
+
described_class.all!(status: status)
|
|
31
|
+
end
|
|
32
|
+
|
|
18
33
|
it 'returns an array of GroupDocs::Questionnaire objects' do
|
|
19
34
|
questionnaires = described_class.all!
|
|
20
35
|
questionnaires.should be_an(Array)
|
|
@@ -45,31 +60,19 @@ describe GroupDocs::Questionnaire do
|
|
|
45
60
|
end
|
|
46
61
|
end
|
|
47
62
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
it 'returns an array of GroupDocs::Questionnaire::Execution objects' do
|
|
60
|
-
executions = described_class.executions!
|
|
61
|
-
executions.should be_an(Array)
|
|
62
|
-
executions.each do |execution|
|
|
63
|
-
execution.should be_a(GroupDocs::Questionnaire::Execution)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it { should respond_to(:pages) }
|
|
69
|
-
it { should respond_to(:pages=) }
|
|
63
|
+
it { should have_accessor(:id) }
|
|
64
|
+
it { should have_accessor(:guid) }
|
|
65
|
+
it { should have_accessor(:name) }
|
|
66
|
+
it { should have_accessor(:descr) }
|
|
67
|
+
it { should have_accessor(:pages) }
|
|
68
|
+
it { should have_accessor(:resolved_executions) }
|
|
69
|
+
it { should have_accessor(:assigned_questions) }
|
|
70
|
+
it { should have_accessor(:total_questions) }
|
|
71
|
+
it { should have_accessor(:modified) }
|
|
72
|
+
it { should have_accessor(:expires) }
|
|
73
|
+
it { should have_accessor(:document_ids) }
|
|
70
74
|
|
|
71
|
-
it { should
|
|
72
|
-
it { should have_alias(:description=, :descr=) }
|
|
75
|
+
it { should alias_accessor(:description, :descr) }
|
|
73
76
|
|
|
74
77
|
describe '#pages=' do
|
|
75
78
|
it 'converts each page to GroupDocs::Questionnaire::Page object if hash is passed' do
|
|
@@ -125,10 +128,14 @@ describe GroupDocs::Questionnaire do
|
|
|
125
128
|
subject.create!
|
|
126
129
|
end
|
|
127
130
|
|
|
128
|
-
it 'updates
|
|
131
|
+
it 'updates questionnaire attributes' do
|
|
129
132
|
lambda do
|
|
130
133
|
subject.create!
|
|
131
|
-
end.should change
|
|
134
|
+
end.should change {
|
|
135
|
+
subject.id
|
|
136
|
+
subject.guid
|
|
137
|
+
subject.name
|
|
138
|
+
}
|
|
132
139
|
end
|
|
133
140
|
end
|
|
134
141
|
|
|
@@ -181,33 +188,102 @@ describe GroupDocs::Questionnaire do
|
|
|
181
188
|
end
|
|
182
189
|
end
|
|
183
190
|
|
|
184
|
-
describe '#
|
|
191
|
+
describe '#executions!' do
|
|
185
192
|
before(:each) do
|
|
186
|
-
mock_api_server(load_json('
|
|
193
|
+
mock_api_server(load_json('questionnaire_executions'))
|
|
187
194
|
end
|
|
188
195
|
|
|
189
|
-
|
|
190
|
-
|
|
196
|
+
it 'accepts access credentials hash' do
|
|
197
|
+
lambda do
|
|
198
|
+
subject.executions!(client_id: 'client_id', private_key: 'private_key')
|
|
199
|
+
end.should_not raise_error(ArgumentError)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
it 'returns an array of GroupDocs::Questionnaire::Execution objects' do
|
|
203
|
+
executions = subject.executions!
|
|
204
|
+
executions.should be_an(Array)
|
|
205
|
+
executions.each do |execution|
|
|
206
|
+
execution.should be_a(GroupDocs::Questionnaire::Execution)
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
describe '#collectors!' do
|
|
212
|
+
before(:each) do
|
|
213
|
+
mock_api_server(load_json('questionnaire_collectors'))
|
|
214
|
+
end
|
|
191
215
|
|
|
192
216
|
it 'accepts access credentials hash' do
|
|
193
217
|
lambda do
|
|
194
|
-
subject.
|
|
218
|
+
subject.collectors!(client_id: 'client_id', private_key: 'private_key')
|
|
195
219
|
end.should_not raise_error(ArgumentError)
|
|
196
220
|
end
|
|
197
221
|
|
|
198
|
-
it '
|
|
199
|
-
|
|
222
|
+
it 'returns an array of GroupDocs::Questionnaire::Collector objects' do
|
|
223
|
+
collectors = subject.collectors!
|
|
224
|
+
collectors.should be_an(Array)
|
|
225
|
+
collectors.each do |collector|
|
|
226
|
+
collector.should be_a(GroupDocs::Questionnaire::Collector)
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
describe '#metadata!' do
|
|
232
|
+
before(:each) do
|
|
233
|
+
mock_api_server(load_json('questionnaire_get'))
|
|
200
234
|
end
|
|
201
235
|
|
|
202
|
-
it '
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
subject.create_execution!(execution, email)
|
|
236
|
+
it 'accepts access credentials hash' do
|
|
237
|
+
lambda do
|
|
238
|
+
subject.metadata!(client_id: 'client_id', private_key: 'private_key')
|
|
239
|
+
end.should_not raise_error(ArgumentError)
|
|
207
240
|
end
|
|
208
241
|
|
|
209
|
-
it 'returns GroupDocs::Questionnaire
|
|
210
|
-
subject.
|
|
242
|
+
it 'returns GroupDocs::Questionnaire object' do
|
|
243
|
+
subject.metadata!.should be_a(GroupDocs::Questionnaire)
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
describe '#update_metadata!' do
|
|
248
|
+
before(:each) do
|
|
249
|
+
mock_api_server('{ "status": "Ok", "result": { "questionnaire_id": 123456 }}')
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
let!(:metadata) { GroupDocs::Questionnaire.new }
|
|
253
|
+
|
|
254
|
+
it 'accepts access credentials hash' do
|
|
255
|
+
lambda do
|
|
256
|
+
subject.update_metadata!(metadata, client_id: 'client_id', private_key: 'private_key')
|
|
257
|
+
end.should_not raise_error(ArgumentError)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
it 'raises error if metadata is not GroupDocs::Questionnaire object' do
|
|
261
|
+
-> { subject.update_metadata!('Metadata') }.should raise_error(ArgumentError)
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
it 'uses hashed version as payload' do
|
|
265
|
+
metadata.should_receive(:to_hash)
|
|
266
|
+
subject.update_metadata!(metadata)
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
describe '#fields!' do
|
|
271
|
+
before(:each) do
|
|
272
|
+
mock_api_server(load_json('document_fields'))
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
it 'accepts access credentials hash' do
|
|
276
|
+
lambda do
|
|
277
|
+
subject.fields!(client_id: 'client_id', private_key: 'private_key')
|
|
278
|
+
end.should_not raise_error(ArgumentError)
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
it 'returns array of GroupDocs::Document::Field objects' do
|
|
282
|
+
fields = subject.fields!
|
|
283
|
+
fields.should be_an(Array)
|
|
284
|
+
fields.each do |field|
|
|
285
|
+
field.should be_a(GroupDocs::Document::Field)
|
|
286
|
+
end
|
|
211
287
|
end
|
|
212
288
|
end
|
|
213
289
|
end
|
|
@@ -57,23 +57,15 @@ describe GroupDocs::Signature::Contact do
|
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
it { should
|
|
61
|
-
it { should
|
|
62
|
-
it { should
|
|
63
|
-
it { should
|
|
64
|
-
it { should
|
|
65
|
-
it { should
|
|
66
|
-
|
|
67
|
-
it { should
|
|
68
|
-
it { should
|
|
69
|
-
it { should respond_to(:email=) }
|
|
70
|
-
it { should respond_to(:provider) }
|
|
71
|
-
it { should respond_to(:provider=) }
|
|
72
|
-
|
|
73
|
-
it { should have_alias(:first_name, :firstName) }
|
|
74
|
-
it { should have_alias(:first_name=, :firstName=) }
|
|
75
|
-
it { should have_alias(:last_name, :lastName) }
|
|
76
|
-
it { should have_alias(:last_name=, :lastName=) }
|
|
60
|
+
it { should have_accessor(:id) }
|
|
61
|
+
it { should have_accessor(:firstName) }
|
|
62
|
+
it { should have_accessor(:lastName) }
|
|
63
|
+
it { should have_accessor(:nickname) }
|
|
64
|
+
it { should have_accessor(:email) }
|
|
65
|
+
it { should have_accessor(:provider) }
|
|
66
|
+
|
|
67
|
+
it { should alias_accessor(:first_name, :firstName) }
|
|
68
|
+
it { should alias_accessor(:last_name, :lastName) }
|
|
77
69
|
|
|
78
70
|
describe '#add!' do
|
|
79
71
|
before(:each) do
|
|
@@ -4,20 +4,12 @@ describe GroupDocs::Signature::Envelope::Log do
|
|
|
4
4
|
|
|
5
5
|
it_behaves_like GroupDocs::Api::Entity
|
|
6
6
|
|
|
7
|
-
it { should
|
|
8
|
-
it { should
|
|
9
|
-
it { should
|
|
10
|
-
it { should
|
|
11
|
-
it { should
|
|
12
|
-
|
|
13
|
-
it { should
|
|
14
|
-
it { should
|
|
15
|
-
it { should respond_to(:remoteAddress) }
|
|
16
|
-
it { should respond_to(:remoteAddress=) }
|
|
17
|
-
|
|
18
|
-
it { should have_alias(:user_name, :userName) }
|
|
19
|
-
it { should have_alias(:user_name=, :userName=) }
|
|
20
|
-
it { should have_alias(:remote_address, :remoteAddress) }
|
|
21
|
-
it { should have_alias(:remote_address=, :remoteAddress=) }
|
|
22
|
-
|
|
7
|
+
it { should have_accessor(:id) }
|
|
8
|
+
it { should have_accessor(:date) }
|
|
9
|
+
it { should have_accessor(:userName) }
|
|
10
|
+
it { should have_accessor(:action) }
|
|
11
|
+
it { should have_accessor(:remoteAddress) }
|
|
12
|
+
|
|
13
|
+
it { should alias_accessor(:user_name, :userName) }
|
|
14
|
+
it { should alias_accessor(:remote_address, :remoteAddress) }
|
|
23
15
|
end
|