groupdocs 0.3.11 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +150 -0
- data/README.md +6 -58
- data/Rakefile +1 -1
- data/examples/README.md +13 -0
- data/examples/annotations/Gemfile +5 -0
- data/examples/annotations/app.rb +67 -0
- data/groupdocs.gemspec +3 -3
- data/lib/groupdocs.rb +11 -2
- data/lib/groupdocs/api/entity.rb +17 -1
- data/lib/groupdocs/api/helpers/path_helper.rb +10 -10
- data/lib/groupdocs/api/helpers/rest_helper.rb +7 -2
- data/lib/groupdocs/api/helpers/url_helper.rb +2 -4
- data/lib/groupdocs/api/request.rb +2 -4
- data/lib/groupdocs/datasource.rb +2 -2
- data/lib/groupdocs/datasource/field.rb +1 -1
- data/lib/groupdocs/document.rb +6 -18
- data/lib/groupdocs/document/annotation.rb +25 -2
- data/lib/groupdocs/document/annotation/reply.rb +6 -10
- data/lib/groupdocs/document/change.rb +1 -1
- data/lib/groupdocs/document/field.rb +1 -1
- data/lib/groupdocs/document/metadata.rb +1 -1
- data/lib/groupdocs/document/rectangle.rb +1 -1
- data/lib/groupdocs/document/view.rb +1 -1
- data/lib/groupdocs/job.rb +51 -8
- data/lib/groupdocs/questionnaire.rb +2 -2
- data/lib/groupdocs/questionnaire/execution.rb +1 -1
- data/lib/groupdocs/questionnaire/page.rb +1 -1
- data/lib/groupdocs/questionnaire/question.rb +1 -1
- data/lib/groupdocs/questionnaire/question/answer.rb +1 -1
- data/lib/groupdocs/signature.rb +134 -0
- data/lib/groupdocs/signature/contact.rb +141 -0
- data/lib/groupdocs/signature/envelope.rb +376 -0
- data/lib/groupdocs/signature/envelope/log.rb +22 -0
- data/lib/groupdocs/signature/field.rb +253 -0
- data/lib/groupdocs/signature/field/location.rb +72 -0
- data/lib/groupdocs/signature/form.rb +202 -0
- data/lib/groupdocs/signature/list.rb +93 -0
- data/lib/groupdocs/signature/recipient.rb +47 -0
- data/lib/groupdocs/signature/role.rb +84 -0
- data/lib/groupdocs/signature/shared.rb +6 -0
- data/lib/groupdocs/signature/shared/document_methods.rb +98 -0
- data/lib/groupdocs/signature/shared/entity_fields.rb +94 -0
- data/lib/groupdocs/signature/shared/entity_methods.rb +145 -0
- data/lib/groupdocs/signature/shared/field_methods.rb +282 -0
- data/lib/groupdocs/signature/shared/recipient_methods.rb +63 -0
- data/lib/groupdocs/signature/shared/resource_methods.rb +65 -0
- data/lib/groupdocs/signature/template.rb +104 -0
- data/lib/groupdocs/storage/file.rb +69 -62
- data/lib/groupdocs/storage/folder.rb +54 -88
- data/lib/groupdocs/storage/package.rb +1 -1
- data/lib/groupdocs/subscription.rb +113 -0
- data/lib/groupdocs/subscription/limit.rb +24 -0
- data/lib/groupdocs/user.rb +22 -2
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/api/entity_spec.rb +14 -0
- data/spec/groupdocs/api/helpers/path_helper_spec.rb +6 -19
- data/spec/groupdocs/api/helpers/rest_helper_spec.rb +9 -0
- data/spec/groupdocs/api/request_spec.rb +2 -7
- data/spec/groupdocs/datasource_spec.rb +3 -7
- data/spec/groupdocs/document/annotation/reply_spec.rb +11 -20
- data/spec/groupdocs/document/annotation_spec.rb +35 -31
- data/spec/groupdocs/document/field_spec.rb +1 -4
- data/spec/groupdocs/document/rectangle_spec.rb +10 -22
- data/spec/groupdocs/document_spec.rb +7 -27
- data/spec/groupdocs/job_spec.rb +43 -0
- data/spec/groupdocs/questionnaire/question_spec.rb +2 -6
- data/spec/groupdocs/questionnaire_spec.rb +3 -7
- data/spec/groupdocs/signature/contact_spec.rb +129 -0
- data/spec/groupdocs/signature/envelope/log_spec.rb +23 -0
- data/spec/groupdocs/signature/envelope_spec.rb +296 -0
- data/spec/groupdocs/signature/field/location_spec.rb +73 -0
- data/spec/groupdocs/signature/field_spec.rb +264 -0
- data/spec/groupdocs/signature/form_spec.rb +174 -0
- data/spec/groupdocs/signature/list_spec.rb +92 -0
- data/spec/groupdocs/signature/recipient_spec.rb +37 -0
- data/spec/groupdocs/signature/role_spec.rb +100 -0
- data/spec/groupdocs/signature/template_spec.rb +82 -0
- data/spec/groupdocs/signature_spec.rb +117 -0
- data/spec/groupdocs/storage/file_spec.rb +76 -61
- data/spec/groupdocs/storage/folder_spec.rb +43 -90
- data/spec/groupdocs/storage/package_spec.rb +1 -2
- data/spec/groupdocs/subscription/limit_spec.rb +24 -0
- data/spec/groupdocs/subscription_spec.rb +85 -0
- data/spec/groupdocs/user_spec.rb +27 -18
- data/spec/groupdocs_spec.rb +11 -0
- data/spec/spec_helper.rb +10 -1
- data/spec/support/files/envelope.zip +0 -0
- data/spec/support/json/annotation_access_set.json +11 -0
- data/spec/support/json/contact_add.json +12 -0
- data/spec/support/json/contacts_get.json +19 -0
- data/spec/support/json/contacts_import.json +8 -0
- data/spec/support/json/envelope_get.json +46 -0
- data/spec/support/json/envelope_logs.json +16 -0
- data/spec/support/json/envelopes_all.json +48 -0
- data/spec/support/json/envelopes_resources.json +31 -0
- data/spec/support/json/form_get.json +21 -0
- data/spec/support/json/forms_all.json +23 -0
- data/spec/support/json/job_get.json +30 -0
- data/spec/support/json/list_add.json +12 -0
- data/spec/support/json/lists_get.json +19 -0
- data/spec/support/json/signature_create.json +12 -0
- data/spec/support/json/signature_field_add.json +25 -0
- data/spec/support/json/signature_fields_get.json +27 -0
- data/spec/support/json/signature_roles_get.json +17 -0
- data/spec/support/json/signatures_get.json +19 -0
- data/spec/support/json/subscription_plan_get.json +9 -0
- data/spec/support/json/subscription_plans_get.json +17 -0
- data/spec/support/json/template_get.json +35 -0
- data/spec/support/json/template_get_documents.json +15 -0
- data/spec/support/json/template_get_recipients.json +20 -0
- data/spec/support/json/templates_all.json +37 -0
- data/spec/support/json/user_users_get.json +27 -0
- data/spec/support/shared_examples/signature/shared/document_methods.rb +68 -0
- data/spec/support/shared_examples/signature/shared/entity_fields.rb +89 -0
- data/spec/support/shared_examples/signature/shared/entity_methods.rb +116 -0
- data/spec/support/shared_examples/signature/shared/field_methods.rb +188 -0
- data/spec/support/shared_examples/signature/shared/recipient_methods.rb +42 -0
- data/spec/support/shared_examples/signature/shared/resource_methods.rb +46 -0
- metadata +139 -29
- data/lib/groupdocs/extensions.rb +0 -1
- data/lib/groupdocs/extensions/lookup.rb +0 -52
- data/spec/support/shared_examples/extensions/lookup.rb +0 -57
@@ -3,7 +3,6 @@ require 'spec_helper'
|
|
3
3
|
describe GroupDocs::Storage::Folder do
|
4
4
|
|
5
5
|
it_behaves_like GroupDocs::Api::Entity
|
6
|
-
include_examples GroupDocs::Extensions::Lookup
|
7
6
|
include_examples GroupDocs::Api::Helpers::AccessMode
|
8
7
|
|
9
8
|
describe '.create!' do
|
@@ -13,18 +12,12 @@ describe GroupDocs::Storage::Folder do
|
|
13
12
|
|
14
13
|
it 'accepts access credentials hash' do
|
15
14
|
lambda do
|
16
|
-
described_class.create!('
|
15
|
+
described_class.create!('Test', client_id: 'client_id', private_key: 'private_key')
|
17
16
|
end.should_not raise_error(ArgumentError)
|
18
17
|
end
|
19
18
|
|
20
|
-
it 'checks that path starts with /' do
|
21
|
-
GroupDocs::Api::Helpers::Path.should_receive(:verify_starts_with_root).with('Test')
|
22
|
-
described_class.create!('Test')
|
23
|
-
end
|
24
|
-
|
25
19
|
it 'returns GroupDocs::Storage::Folder object' do
|
26
|
-
|
27
|
-
folder = described_class.create!('/Test')
|
20
|
+
folder = described_class.create!('Test')
|
28
21
|
folder.should be_a(GroupDocs::Storage::Folder)
|
29
22
|
end
|
30
23
|
end
|
@@ -36,21 +29,21 @@ describe GroupDocs::Storage::Folder do
|
|
36
29
|
|
37
30
|
it 'accepts access credentials hash' do
|
38
31
|
lambda do
|
39
|
-
described_class.list!('
|
32
|
+
described_class.list!('', {}, client_id: 'client_id', private_key: 'private_key')
|
40
33
|
end.should_not raise_error(ArgumentError)
|
41
34
|
end
|
42
35
|
|
43
36
|
it 'allows passing path' do
|
44
|
-
-> { described_class.list!('
|
37
|
+
-> { described_class.list!('test') }.should_not raise_error(ArgumentError)
|
45
38
|
end
|
46
39
|
|
47
40
|
it 'allows passing options' do
|
48
|
-
-> { described_class.list!('
|
41
|
+
-> { described_class.list!('', page: 1, count: 1) }.should_not raise_error(ArgumentError)
|
49
42
|
end
|
50
43
|
|
51
44
|
it 'creates new instance of GroupDocs::Storage::Folder and calls #list!' do
|
52
45
|
folder = stub('folder')
|
53
|
-
GroupDocs::Storage::Folder.should_receive(:new).with(path: '
|
46
|
+
GroupDocs::Storage::Folder.should_receive(:new).with(path: '').and_return(folder)
|
54
47
|
folder.should_receive(:list!).with({}, {})
|
55
48
|
described_class.list!
|
56
49
|
end
|
@@ -91,125 +84,85 @@ describe GroupDocs::Storage::Folder do
|
|
91
84
|
end
|
92
85
|
end
|
93
86
|
|
94
|
-
describe '#
|
87
|
+
describe '#list!' do
|
95
88
|
before(:each) do
|
96
|
-
mock_api_server(load_json('
|
89
|
+
mock_api_server(load_json('folder_list'))
|
90
|
+
subject.stub(path: '/Test1')
|
97
91
|
end
|
98
92
|
|
99
93
|
it 'accepts access credentials hash' do
|
100
94
|
lambda do
|
101
|
-
subject.
|
95
|
+
subject.list!({}, client_id: 'client_id', private_key: 'private_key')
|
102
96
|
end.should_not raise_error(ArgumentError)
|
103
97
|
end
|
104
98
|
|
105
|
-
it '
|
106
|
-
|
107
|
-
subject.move!('Test1')
|
99
|
+
it 'allows passing options' do
|
100
|
+
-> { subject.list!(page: 1, count: 1) }.should_not raise_error(ArgumentError)
|
108
101
|
end
|
109
102
|
|
110
|
-
it '
|
111
|
-
|
112
|
-
|
113
|
-
subject.
|
103
|
+
it 'capitalizes :order_by option' do
|
104
|
+
options = { order_by: 'field' }
|
105
|
+
options[:order_by].should_receive(:capitalize!)
|
106
|
+
subject.list!(options)
|
114
107
|
end
|
115
108
|
|
116
|
-
it 'returns
|
117
|
-
|
118
|
-
moved.should be_a(String)
|
119
|
-
moved.should == '/Test2/Test1/'
|
109
|
+
it 'returns array' do
|
110
|
+
subject.list!.should be_an(Array)
|
120
111
|
end
|
121
|
-
end
|
122
112
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
subject.rename!('Test2', client_id: 'client_id', private_key: 'private_key')
|
127
|
-
end.should_not raise_error(ArgumentError)
|
113
|
+
it 'returns empty array if nothing is listed in directory' do
|
114
|
+
mock_api_server('{"result": {"folders": [], "files": []}, "status": "Ok"}')
|
115
|
+
subject.list!.should be_empty
|
128
116
|
end
|
129
117
|
|
130
|
-
it '
|
131
|
-
subject.
|
132
|
-
|
118
|
+
it 'determines folders in response' do
|
119
|
+
subject.list!.detect do |entity|
|
120
|
+
entity.id == 1
|
121
|
+
end.should be_a(GroupDocs::Storage::Folder)
|
133
122
|
end
|
134
123
|
|
135
|
-
it '
|
136
|
-
subject.
|
137
|
-
|
138
|
-
|
139
|
-
renamed.should == 'Test2'
|
124
|
+
it 'determines files in response' do
|
125
|
+
subject.list!.detect do |entity|
|
126
|
+
entity.id == 2
|
127
|
+
end.should be_a(GroupDocs::Storage::File)
|
140
128
|
end
|
141
129
|
end
|
142
130
|
|
143
|
-
describe '#
|
131
|
+
describe '#move!' do
|
144
132
|
before(:each) do
|
133
|
+
subject.path = ''
|
145
134
|
mock_api_server(load_json('folder_move'))
|
146
135
|
end
|
147
136
|
|
148
137
|
it 'accepts access credentials hash' do
|
149
138
|
lambda do
|
150
|
-
subject.
|
139
|
+
subject.move!('Test', client_id: 'client_id', private_key: 'private_key')
|
151
140
|
end.should_not raise_error(ArgumentError)
|
152
141
|
end
|
153
142
|
|
154
|
-
it 'checks that path starts with /' do
|
155
|
-
GroupDocs::Api::Helpers::Path.should_receive(:verify_starts_with_root).with('Test2')
|
156
|
-
subject.copy!('Test2')
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'sends "Groupdocs-Copy" header' do
|
160
|
-
mock_api_server(load_json('folder_move'), :'Groupdocs-Copy' => 'Test1')
|
161
|
-
subject.stub(name: 'Test1')
|
162
|
-
subject.copy!('/Test2')
|
163
|
-
end
|
164
|
-
|
165
143
|
it 'returns moved to folder path' do
|
166
|
-
moved = subject.
|
144
|
+
moved = subject.move!('Test2/Test1')
|
167
145
|
moved.should be_a(String)
|
168
|
-
moved.should == '
|
146
|
+
moved.should == 'Test2/Test1/'
|
169
147
|
end
|
170
148
|
end
|
171
149
|
|
172
|
-
describe '#
|
150
|
+
describe '#copy!' do
|
173
151
|
before(:each) do
|
174
|
-
|
175
|
-
|
152
|
+
subject.path = ''
|
153
|
+
mock_api_server(load_json('folder_move'))
|
176
154
|
end
|
177
155
|
|
178
156
|
it 'accepts access credentials hash' do
|
179
157
|
lambda do
|
180
|
-
subject.
|
158
|
+
subject.copy!('/Test2', client_id: 'client_id', private_key: 'private_key')
|
181
159
|
end.should_not raise_error(ArgumentError)
|
182
160
|
end
|
183
161
|
|
184
|
-
it '
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
it 'capitalizes :order_by option' do
|
189
|
-
options = { order_by: 'field' }
|
190
|
-
options[:order_by].should_receive(:capitalize!)
|
191
|
-
subject.list!(options)
|
192
|
-
end
|
193
|
-
|
194
|
-
it 'returns array' do
|
195
|
-
subject.list!.should be_an(Array)
|
196
|
-
end
|
197
|
-
|
198
|
-
it 'returns empty array if nothing is listed in directory' do
|
199
|
-
mock_api_server('{"result": {"folders": [], "files": []}, "status": "Ok"}')
|
200
|
-
subject.list!.should be_empty
|
201
|
-
end
|
202
|
-
|
203
|
-
it 'determines folders in response' do
|
204
|
-
subject.list!.detect do |entity|
|
205
|
-
entity.id == 1
|
206
|
-
end.should be_a(GroupDocs::Storage::Folder)
|
207
|
-
end
|
208
|
-
|
209
|
-
it 'determines files in response' do
|
210
|
-
subject.list!.detect do |entity|
|
211
|
-
entity.id == 2
|
212
|
-
end.should be_a(GroupDocs::Storage::File)
|
162
|
+
it 'returns moved to folder path' do
|
163
|
+
moved = subject.copy!('Test2/Test1')
|
164
|
+
moved.should be_a(String)
|
165
|
+
moved.should == 'Test2/Test1/'
|
213
166
|
end
|
214
167
|
end
|
215
168
|
|
@@ -226,7 +179,7 @@ describe GroupDocs::Storage::Folder do
|
|
226
179
|
|
227
180
|
it 'calls create! class method and pass parameters to it' do
|
228
181
|
subject = described_class.new(name: 'Test1')
|
229
|
-
described_class.should_receive(:create!).with('
|
182
|
+
described_class.should_receive(:create!).with('Test1', {})
|
230
183
|
subject.create!
|
231
184
|
end
|
232
185
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GroupDocs::Subscription::Limit do
|
4
|
+
|
5
|
+
it_behaves_like GroupDocs::Api::Entity
|
6
|
+
|
7
|
+
it { should respond_to(:Id) }
|
8
|
+
it { should respond_to(:Id=) }
|
9
|
+
it { should respond_to(:Min) }
|
10
|
+
it { should respond_to(:Min=) }
|
11
|
+
it { should respond_to(:Max) }
|
12
|
+
it { should respond_to(:Max=) }
|
13
|
+
it { should respond_to(:Description) }
|
14
|
+
it { should respond_to(:Description=) }
|
15
|
+
|
16
|
+
it { should have_alias(:id, :Id) }
|
17
|
+
it { should have_alias(:id=, :Id=) }
|
18
|
+
it { should have_alias(:min, :Min) }
|
19
|
+
it { should have_alias(:min=, :Min=) }
|
20
|
+
it { should have_alias(:max, :Max) }
|
21
|
+
it { should have_alias(:max=, :Max=) }
|
22
|
+
it { should have_alias(:description, :Description) }
|
23
|
+
it { should have_alias(:description=, :Description=) }
|
24
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GroupDocs::Subscription do
|
4
|
+
|
5
|
+
it_behaves_like GroupDocs::Api::Entity
|
6
|
+
|
7
|
+
describe '.current!' do
|
8
|
+
before(:each) do
|
9
|
+
mock_api_server(load_json('subscription_plan_get'))
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'accepts access credentials hash' do
|
13
|
+
lambda do
|
14
|
+
described_class.current!(client_id: 'client_id', private_key: 'private_key')
|
15
|
+
end.should_not raise_error(ArgumentError)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'returns GroupDocs::Subscription object' do
|
19
|
+
described_class.current!.should be_a(GroupDocs::Subscription)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.list!' do
|
24
|
+
before(:each) do
|
25
|
+
mock_api_server(load_json('subscription_plans_get'))
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'accepts access credentials hash' do
|
29
|
+
lambda do
|
30
|
+
described_class.list!(client_id: 'client_id', private_key: 'private_key')
|
31
|
+
end.should_not raise_error(ArgumentError)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'returns array of GroupDocs::Subscription objects' do
|
35
|
+
plans = described_class.list!
|
36
|
+
plans.should be_an(Array)
|
37
|
+
plans.each do |plan|
|
38
|
+
plan.should be_a(GroupDocs::Subscription)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it { should respond_to(:Id) }
|
44
|
+
it { should respond_to(:Id=) }
|
45
|
+
it { should respond_to(:Name) }
|
46
|
+
it { should respond_to(:Name=) }
|
47
|
+
it { should respond_to(:PricingPlanId) }
|
48
|
+
it { should respond_to(:PricingPlanId=) }
|
49
|
+
it { should respond_to(:Price) }
|
50
|
+
it { should respond_to(:Price=) }
|
51
|
+
it { should respond_to(:CurrencyCode) }
|
52
|
+
it { should respond_to(:CurrencyCode=) }
|
53
|
+
|
54
|
+
it { should have_alias(:id, :Id) }
|
55
|
+
it { should have_alias(:id=, :Id=) }
|
56
|
+
it { should have_alias(:name, :Name) }
|
57
|
+
it { should have_alias(:name=, :Name=) }
|
58
|
+
it { should have_alias(:pricing_plan_id, :PricingPlanId) }
|
59
|
+
it { should have_alias(:pricing_plan_id=, :PricingPlanId=) }
|
60
|
+
it { should have_alias(:price, :Price) }
|
61
|
+
it { should have_alias(:price=, :Price=) }
|
62
|
+
it { should have_alias(:currency_code, :CurrencyCode) }
|
63
|
+
it { should have_alias(:currency_code=, :CurrencyCode=) }
|
64
|
+
|
65
|
+
it { should have_alias(:ref_id=, :id=) }
|
66
|
+
|
67
|
+
GroupDocs::Subscription::LIMITS.each do |snake, camel|
|
68
|
+
it { should respond_to(:"#{camel}") }
|
69
|
+
it { should respond_to(:"#{camel}=") }
|
70
|
+
|
71
|
+
# reader is overwritten
|
72
|
+
it { should have_alias(:"#{snake}=", :"#{camel}=") }
|
73
|
+
|
74
|
+
describe "##{snake}" do
|
75
|
+
it 'converts hash to GroupDocs::Subscription::Limit object' do
|
76
|
+
subject.send(:"#{snake}=", { min: 2, max: 3, description: 'Description' })
|
77
|
+
limit = subject.send(snake)
|
78
|
+
limit.should be_a(GroupDocs::Subscription::Limit)
|
79
|
+
limit.min.should == 2
|
80
|
+
limit.max.should == 3
|
81
|
+
limit.description.should == 'Description'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
data/spec/groupdocs/user_spec.rb
CHANGED
@@ -51,25 +51,14 @@ describe GroupDocs::User do
|
|
51
51
|
it { should respond_to(:signed_up_on) }
|
52
52
|
it { should respond_to(:signed_up_on=) }
|
53
53
|
|
54
|
-
it
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
subject.method(:pkey=).should == subject.method(:private_key=)
|
59
|
-
subject.method(:pswd_salt=).should == subject.method(:password_salt=)
|
60
|
-
subject.method(:signedupOn=).should == subject.method(:signed_up_on=)
|
61
|
-
end
|
54
|
+
it { should have_alias(:first_name, :firstname) }
|
55
|
+
it { should have_alias(:first_name=, :firstname=) }
|
56
|
+
it { should have_alias(:last_name, :lastname) }
|
57
|
+
it { should have_alias(:last_name=, :lastname=) }
|
62
58
|
|
63
|
-
it
|
64
|
-
|
65
|
-
|
66
|
-
subject.should respond_to(:last_name)
|
67
|
-
subject.should respond_to(:last_name=)
|
68
|
-
subject.method(:first_name).should == subject.method(:firstname)
|
69
|
-
subject.method(:first_name=).should == subject.method(:firstname=)
|
70
|
-
subject.method(:last_name).should == subject.method(:lastname)
|
71
|
-
subject.method(:last_name=).should == subject.method(:lastname=)
|
72
|
-
end
|
59
|
+
it { should have_alias(:pkey=, :private_key=) }
|
60
|
+
it { should have_alias(:pswd_salt=, :password_salt=) }
|
61
|
+
it { should have_alias(:signedupOn=, :signed_up_on=) }
|
73
62
|
|
74
63
|
describe '#signed_up_on' do
|
75
64
|
it 'returns converted to Time object Unix timestamp' do
|
@@ -94,4 +83,24 @@ describe GroupDocs::User do
|
|
94
83
|
subject.update!
|
95
84
|
end
|
96
85
|
end
|
86
|
+
|
87
|
+
describe '#users!' do
|
88
|
+
before(:each) do
|
89
|
+
mock_api_server(load_json('user_users_get'))
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'accepts access credentials hash' do
|
93
|
+
lambda do
|
94
|
+
subject.users!(client_id: 'client_id', private_key: 'private_key')
|
95
|
+
end.should_not raise_error(ArgumentError)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'returns array of GroupDocs::User objects' do
|
99
|
+
users = subject.users!
|
100
|
+
users.should be_an(Array)
|
101
|
+
users.each do |user|
|
102
|
+
user.should be_a(GroupDocs::User)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
97
106
|
end
|
data/spec/groupdocs_spec.rb
CHANGED
@@ -53,4 +53,15 @@ describe GroupDocs do
|
|
53
53
|
subject.api_server.should == 'https://dev-api.groupdocs.com'
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
describe '#api_version' do
|
58
|
+
it 'returns default version if it has not been overwritten' do
|
59
|
+
subject.api_version.should == '2.0'
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'returns custom overwritten version' do
|
63
|
+
subject.api_version = '3.0'
|
64
|
+
subject.api_version.should == '3.0'
|
65
|
+
end
|
66
|
+
end
|
56
67
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -11,10 +11,19 @@ require 'groupdocs'
|
|
11
11
|
# shared examples
|
12
12
|
Dir['spec/support/shared_examples/**/*.rb'].each { |file| file = file.sub(/spec\//, ''); require file }
|
13
13
|
|
14
|
+
# matchers extension
|
15
|
+
RSpec::Matchers.define :have_alias do |aliased, original|
|
16
|
+
match do |object|
|
17
|
+
object.should respond_to(aliased)
|
18
|
+
object.method(aliased).should == object.method(original)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# configure API access
|
14
23
|
RSpec.configure do |spec|
|
15
24
|
spec.before(:all) do
|
16
25
|
GroupDocs.configure do |groupdocs|
|
17
|
-
groupdocs.client_id
|
26
|
+
groupdocs.client_id = '07aaaf95f8eb33a4'
|
18
27
|
groupdocs.private_key = '5cb711b3a52ffc5d90ee8a0f79206f5a'
|
19
28
|
groupdocs.api_version = '2.0'
|
20
29
|
end
|
Binary file
|