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.
Files changed (130) hide show
  1. data/CHANGELOG.md +41 -0
  2. data/examples/README.md +2 -3
  3. data/examples/api-samples/Gemfile +5 -0
  4. data/examples/api-samples/Gemfile.lock +27 -0
  5. data/examples/api-samples/README.md +12 -0
  6. data/examples/api-samples/app.rb +17 -0
  7. data/examples/api-samples/public/css/style.css +166 -0
  8. data/examples/api-samples/samples/sample1.rb +17 -0
  9. data/examples/api-samples/samples/sample10.rb +36 -0
  10. data/examples/api-samples/samples/sample2.rb +19 -0
  11. data/examples/api-samples/samples/sample3.rb +23 -0
  12. data/examples/api-samples/samples/sample4.rb +31 -0
  13. data/examples/api-samples/samples/sample5.rb +44 -0
  14. data/examples/api-samples/samples/sample6.rb +3 -0
  15. data/examples/api-samples/samples/sample7.rb +33 -0
  16. data/examples/api-samples/samples/sample8.rb +40 -0
  17. data/examples/api-samples/samples/sample9.rb +22 -0
  18. data/examples/api-samples/views/index.haml +23 -0
  19. data/examples/api-samples/views/layout.haml +7 -0
  20. data/examples/api-samples/views/sample1.haml +71 -0
  21. data/examples/api-samples/views/sample10.haml +69 -0
  22. data/examples/api-samples/views/sample2.haml +59 -0
  23. data/examples/api-samples/views/sample3.haml +62 -0
  24. data/examples/api-samples/views/sample4.haml +58 -0
  25. data/examples/api-samples/views/sample5.haml +62 -0
  26. data/examples/api-samples/views/sample6.haml +145 -0
  27. data/examples/api-samples/views/sample7.haml +59 -0
  28. data/examples/api-samples/views/sample8.haml +75 -0
  29. data/examples/api-samples/views/sample9.haml +61 -0
  30. data/examples/{annotations → viewer}/Gemfile +0 -0
  31. data/examples/viewer/app.rb +52 -0
  32. data/groupdocs.gemspec +5 -4
  33. data/lib/groupdocs/api.rb +1 -0
  34. data/lib/groupdocs/api/entity.rb +2 -0
  35. data/lib/groupdocs/api/helpers.rb +2 -0
  36. data/lib/groupdocs/api/helpers/accessor_helper.rb +30 -0
  37. data/lib/groupdocs/api/helpers/mime_helper.rb +21 -0
  38. data/lib/groupdocs/api/helpers/rest_helper.rb +3 -2
  39. data/lib/groupdocs/api/request.rb +1 -3
  40. data/lib/groupdocs/datasource.rb +1 -2
  41. data/lib/groupdocs/document.rb +133 -3
  42. data/lib/groupdocs/document/annotation.rb +14 -13
  43. data/lib/groupdocs/document/annotation/reply.rb +4 -8
  44. data/lib/groupdocs/document/annotation/reviewer.rb +2 -4
  45. data/lib/groupdocs/document/field.rb +10 -8
  46. data/lib/groupdocs/document/rectangle.rb +10 -18
  47. data/lib/groupdocs/job.rb +1 -1
  48. data/lib/groupdocs/questionnaire.rb +138 -44
  49. data/lib/groupdocs/questionnaire/collector.rb +262 -0
  50. data/lib/groupdocs/questionnaire/execution.rb +93 -10
  51. data/lib/groupdocs/questionnaire/question.rb +1 -2
  52. data/lib/groupdocs/signature.rb +16 -24
  53. data/lib/groupdocs/signature/contact.rb +2 -4
  54. data/lib/groupdocs/signature/envelope.rb +3 -6
  55. data/lib/groupdocs/signature/envelope/log.rb +2 -4
  56. data/lib/groupdocs/signature/field.rb +21 -42
  57. data/lib/groupdocs/signature/field/location.rb +18 -36
  58. data/lib/groupdocs/signature/form.rb +9 -18
  59. data/lib/groupdocs/signature/list.rb +1 -2
  60. data/lib/groupdocs/signature/recipient.rb +3 -6
  61. data/lib/groupdocs/signature/role.rb +4 -8
  62. data/lib/groupdocs/signature/shared/entity_fields.rb +12 -20
  63. data/lib/groupdocs/signature/template.rb +1 -2
  64. data/lib/groupdocs/storage/file.rb +3 -1
  65. data/lib/groupdocs/storage/folder.rb +7 -1
  66. data/lib/groupdocs/subscription.rb +6 -12
  67. data/lib/groupdocs/subscription/limit.rb +4 -8
  68. data/lib/groupdocs/user.rb +3 -6
  69. data/lib/groupdocs/version.rb +1 -1
  70. data/spec/groupdocs/api/helpers/accessor_helper_spec.rb +16 -0
  71. data/spec/groupdocs/api/helpers/mime_helper_spec.rb +16 -0
  72. data/spec/groupdocs/api/helpers/rest_helper_spec.rb +4 -0
  73. data/spec/groupdocs/api/request_spec.rb +3 -5
  74. data/spec/groupdocs/datasource/field_spec.rb +3 -6
  75. data/spec/groupdocs/datasource_spec.rb +8 -15
  76. data/spec/groupdocs/document/annotation/reply_spec.rb +13 -24
  77. data/spec/groupdocs/document/annotation/reviewer_spec.rb +5 -9
  78. data/spec/groupdocs/document/annotation_spec.rb +35 -40
  79. data/spec/groupdocs/document/change_spec.rb +6 -11
  80. data/spec/groupdocs/document/field_spec.rb +13 -13
  81. data/spec/groupdocs/document/metadata_spec.rb +5 -10
  82. data/spec/groupdocs/document/rectangle_spec.rb +6 -18
  83. data/spec/groupdocs/document/view_spec.rb +3 -6
  84. data/spec/groupdocs/document_spec.rb +123 -10
  85. data/spec/groupdocs/job_spec.rb +9 -18
  86. data/spec/groupdocs/questionnaire/collector_spec.rb +201 -0
  87. data/spec/groupdocs/questionnaire/execution_spec.rb +91 -23
  88. data/spec/groupdocs/questionnaire/page_spec.rb +3 -6
  89. data/spec/groupdocs/questionnaire/question/answer_spec.rb +2 -4
  90. data/spec/groupdocs/questionnaire/question_spec.rb +7 -14
  91. data/spec/groupdocs/questionnaire_spec.rb +117 -41
  92. data/spec/groupdocs/signature/contact_spec.rb +9 -17
  93. data/spec/groupdocs/signature/envelope/log_spec.rb +8 -16
  94. data/spec/groupdocs/signature/envelope_spec.rb +9 -17
  95. data/spec/groupdocs/signature/field/location_spec.rb +32 -65
  96. data/spec/groupdocs/signature/field_spec.rb +48 -95
  97. data/spec/groupdocs/signature/form_spec.rb +22 -43
  98. data/spec/groupdocs/signature/list_spec.rb +6 -11
  99. data/spec/groupdocs/signature/recipient_spec.rb +11 -22
  100. data/spec/groupdocs/signature/role_spec.rb +11 -21
  101. data/spec/groupdocs/signature/template_spec.rb +2 -4
  102. data/spec/groupdocs/signature_spec.rb +28 -54
  103. data/spec/groupdocs/storage/file_spec.rb +14 -26
  104. data/spec/groupdocs/storage/folder_spec.rb +16 -22
  105. data/spec/groupdocs/storage/package_spec.rb +2 -4
  106. data/spec/groupdocs/subscription/limit_spec.rb +8 -16
  107. data/spec/groupdocs/subscription_spec.rb +11 -22
  108. data/spec/groupdocs/user_spec.rb +21 -41
  109. data/spec/groupdocs_spec.rb +4 -8
  110. data/spec/spec_helper.rb +12 -0
  111. data/spec/support/files/signature.png +0 -0
  112. data/spec/support/json/annotation_list.json +6 -6
  113. data/spec/support/json/comparison_changes.json +8 -8
  114. data/spec/support/json/document_fields.json +8 -8
  115. data/spec/support/json/document_page_images_get.json +20 -0
  116. data/spec/support/json/questionnaire_collector.json +17 -0
  117. data/spec/support/json/questionnaire_collectors.json +38 -0
  118. data/spec/support/json/questionnaire_collectors_add.json +10 -0
  119. data/spec/support/json/questionnaire_create.json +3 -1
  120. data/spec/support/json/{questionnaire_execution_create.json → questionnaire_execution_add.json} +1 -1
  121. data/spec/support/json/questionnaire_get.json +3 -0
  122. data/spec/support/json/questionnaires_get.json +36 -18
  123. data/spec/support/json/sign_documents.json +16 -0
  124. data/spec/support/json/templates_get.json +21 -0
  125. data/spec/support/shared_examples/api/entity.rb +2 -0
  126. data/spec/support/shared_examples/api/helpers/access_mode_helper.rb +1 -2
  127. data/spec/support/shared_examples/api/helpers/status_helper.rb +1 -2
  128. data/spec/support/shared_examples/signature/shared/entity_fields.rb +22 -43
  129. metadata +82 -16
  130. 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 '.all!' do
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.all!(client_id: 'client_id', private_key: 'private_key')
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 'just calls GroupDocs::Questionnaire.executions! method' do
16
- GroupDocs::Questionnaire.should_receive(:executions!).with({})
17
- described_class.all!
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 respond_to(:id) }
22
- it { should respond_to(:id=) }
23
- it { should respond_to(:questionnaire_id) }
24
- it { should respond_to(:questionnaire_id=) }
25
- it { should respond_to(:questionnaire_name) }
26
- it { should respond_to(:questionnaire_name=) }
27
- it { should respond_to(:owner) }
28
- it { should respond_to(:owner=) }
29
- it { should respond_to(:executive) }
30
- it { should respond_to(:executive=) }
31
- it { should respond_to(:approver) }
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 respond_to(:questions) }
8
- it { should respond_to(:questions=) }
9
- it { should respond_to(:number) }
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 respond_to(:text) }
8
- it { should respond_to(:text=) }
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 respond_to(:field) }
8
- it { should respond_to(:field=) }
9
- it { should respond_to(:text) }
10
- it { should respond_to(:text=) }
11
- it { should respond_to(:def_answer) }
12
- it { should respond_to(:def_answer=) }
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 have_alias(:default_answer, :def_answer) }
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
- describe '.executions!' do
49
- before(:each) do
50
- mock_api_server(load_json('questionnaire_executions'))
51
- end
52
-
53
- it 'accepts access credentials hash' do
54
- lambda do
55
- described_class.executions!(client_id: 'client_id', private_key: 'private_key')
56
- end.should_not raise_error(ArgumentError)
57
- end
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 have_alias(:description, :descr) }
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 identifier of questionnaire' do
131
+ it 'updates questionnaire attributes' do
129
132
  lambda do
130
133
  subject.create!
131
- end.should change(subject, :id)
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 '#create_execution!' do
191
+ describe '#executions!' do
185
192
  before(:each) do
186
- mock_api_server(load_json('questionnaire_execution_create'))
193
+ mock_api_server(load_json('questionnaire_executions'))
187
194
  end
188
195
 
189
- let(:execution) { GroupDocs::Questionnaire::Execution.new }
190
- let(:email) { 'email@email.com' }
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.create_execution!(execution, email, client_id: 'client_id', private_key: 'private_key')
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 'raises error if execution is not GroupDocs::Questionnaire::Execution object' do
199
- -> { subject.create_execution!('Execution', email) }.should raise_error(ArgumentError)
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 'uses hashed version of execution along with executive payload' do
203
- hash = {}
204
- execution.should_receive(:to_hash).and_return(hash)
205
- hash.should_receive(:merge).with({ executive: { primary_email: email } })
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::Execution object' do
210
- subject.create_execution!(execution, email).should be_a(GroupDocs::Questionnaire::Execution)
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 respond_to(:id) }
61
- it { should respond_to(:id=) }
62
- it { should respond_to(:firstName) }
63
- it { should respond_to(:firstName=) }
64
- it { should respond_to(:lastName) }
65
- it { should respond_to(:lastName=) }
66
- it { should respond_to(:nickname) }
67
- it { should respond_to(:nickname=) }
68
- it { should respond_to(:email) }
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 respond_to(:id) }
8
- it { should respond_to(:id=) }
9
- it { should respond_to(:date) }
10
- it { should respond_to(:date=) }
11
- it { should respond_to(:userName) }
12
- it { should respond_to(:userName=) }
13
- it { should respond_to(:action) }
14
- it { should respond_to(:action=) }
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