groupdocs 0.3.11 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/CHANGELOG.md +150 -0
  2. data/README.md +6 -58
  3. data/Rakefile +1 -1
  4. data/examples/README.md +13 -0
  5. data/examples/annotations/Gemfile +5 -0
  6. data/examples/annotations/app.rb +67 -0
  7. data/groupdocs.gemspec +3 -3
  8. data/lib/groupdocs.rb +11 -2
  9. data/lib/groupdocs/api/entity.rb +17 -1
  10. data/lib/groupdocs/api/helpers/path_helper.rb +10 -10
  11. data/lib/groupdocs/api/helpers/rest_helper.rb +7 -2
  12. data/lib/groupdocs/api/helpers/url_helper.rb +2 -4
  13. data/lib/groupdocs/api/request.rb +2 -4
  14. data/lib/groupdocs/datasource.rb +2 -2
  15. data/lib/groupdocs/datasource/field.rb +1 -1
  16. data/lib/groupdocs/document.rb +6 -18
  17. data/lib/groupdocs/document/annotation.rb +25 -2
  18. data/lib/groupdocs/document/annotation/reply.rb +6 -10
  19. data/lib/groupdocs/document/change.rb +1 -1
  20. data/lib/groupdocs/document/field.rb +1 -1
  21. data/lib/groupdocs/document/metadata.rb +1 -1
  22. data/lib/groupdocs/document/rectangle.rb +1 -1
  23. data/lib/groupdocs/document/view.rb +1 -1
  24. data/lib/groupdocs/job.rb +51 -8
  25. data/lib/groupdocs/questionnaire.rb +2 -2
  26. data/lib/groupdocs/questionnaire/execution.rb +1 -1
  27. data/lib/groupdocs/questionnaire/page.rb +1 -1
  28. data/lib/groupdocs/questionnaire/question.rb +1 -1
  29. data/lib/groupdocs/questionnaire/question/answer.rb +1 -1
  30. data/lib/groupdocs/signature.rb +134 -0
  31. data/lib/groupdocs/signature/contact.rb +141 -0
  32. data/lib/groupdocs/signature/envelope.rb +376 -0
  33. data/lib/groupdocs/signature/envelope/log.rb +22 -0
  34. data/lib/groupdocs/signature/field.rb +253 -0
  35. data/lib/groupdocs/signature/field/location.rb +72 -0
  36. data/lib/groupdocs/signature/form.rb +202 -0
  37. data/lib/groupdocs/signature/list.rb +93 -0
  38. data/lib/groupdocs/signature/recipient.rb +47 -0
  39. data/lib/groupdocs/signature/role.rb +84 -0
  40. data/lib/groupdocs/signature/shared.rb +6 -0
  41. data/lib/groupdocs/signature/shared/document_methods.rb +98 -0
  42. data/lib/groupdocs/signature/shared/entity_fields.rb +94 -0
  43. data/lib/groupdocs/signature/shared/entity_methods.rb +145 -0
  44. data/lib/groupdocs/signature/shared/field_methods.rb +282 -0
  45. data/lib/groupdocs/signature/shared/recipient_methods.rb +63 -0
  46. data/lib/groupdocs/signature/shared/resource_methods.rb +65 -0
  47. data/lib/groupdocs/signature/template.rb +104 -0
  48. data/lib/groupdocs/storage/file.rb +69 -62
  49. data/lib/groupdocs/storage/folder.rb +54 -88
  50. data/lib/groupdocs/storage/package.rb +1 -1
  51. data/lib/groupdocs/subscription.rb +113 -0
  52. data/lib/groupdocs/subscription/limit.rb +24 -0
  53. data/lib/groupdocs/user.rb +22 -2
  54. data/lib/groupdocs/version.rb +1 -1
  55. data/spec/groupdocs/api/entity_spec.rb +14 -0
  56. data/spec/groupdocs/api/helpers/path_helper_spec.rb +6 -19
  57. data/spec/groupdocs/api/helpers/rest_helper_spec.rb +9 -0
  58. data/spec/groupdocs/api/request_spec.rb +2 -7
  59. data/spec/groupdocs/datasource_spec.rb +3 -7
  60. data/spec/groupdocs/document/annotation/reply_spec.rb +11 -20
  61. data/spec/groupdocs/document/annotation_spec.rb +35 -31
  62. data/spec/groupdocs/document/field_spec.rb +1 -4
  63. data/spec/groupdocs/document/rectangle_spec.rb +10 -22
  64. data/spec/groupdocs/document_spec.rb +7 -27
  65. data/spec/groupdocs/job_spec.rb +43 -0
  66. data/spec/groupdocs/questionnaire/question_spec.rb +2 -6
  67. data/spec/groupdocs/questionnaire_spec.rb +3 -7
  68. data/spec/groupdocs/signature/contact_spec.rb +129 -0
  69. data/spec/groupdocs/signature/envelope/log_spec.rb +23 -0
  70. data/spec/groupdocs/signature/envelope_spec.rb +296 -0
  71. data/spec/groupdocs/signature/field/location_spec.rb +73 -0
  72. data/spec/groupdocs/signature/field_spec.rb +264 -0
  73. data/spec/groupdocs/signature/form_spec.rb +174 -0
  74. data/spec/groupdocs/signature/list_spec.rb +92 -0
  75. data/spec/groupdocs/signature/recipient_spec.rb +37 -0
  76. data/spec/groupdocs/signature/role_spec.rb +100 -0
  77. data/spec/groupdocs/signature/template_spec.rb +82 -0
  78. data/spec/groupdocs/signature_spec.rb +117 -0
  79. data/spec/groupdocs/storage/file_spec.rb +76 -61
  80. data/spec/groupdocs/storage/folder_spec.rb +43 -90
  81. data/spec/groupdocs/storage/package_spec.rb +1 -2
  82. data/spec/groupdocs/subscription/limit_spec.rb +24 -0
  83. data/spec/groupdocs/subscription_spec.rb +85 -0
  84. data/spec/groupdocs/user_spec.rb +27 -18
  85. data/spec/groupdocs_spec.rb +11 -0
  86. data/spec/spec_helper.rb +10 -1
  87. data/spec/support/files/envelope.zip +0 -0
  88. data/spec/support/json/annotation_access_set.json +11 -0
  89. data/spec/support/json/contact_add.json +12 -0
  90. data/spec/support/json/contacts_get.json +19 -0
  91. data/spec/support/json/contacts_import.json +8 -0
  92. data/spec/support/json/envelope_get.json +46 -0
  93. data/spec/support/json/envelope_logs.json +16 -0
  94. data/spec/support/json/envelopes_all.json +48 -0
  95. data/spec/support/json/envelopes_resources.json +31 -0
  96. data/spec/support/json/form_get.json +21 -0
  97. data/spec/support/json/forms_all.json +23 -0
  98. data/spec/support/json/job_get.json +30 -0
  99. data/spec/support/json/list_add.json +12 -0
  100. data/spec/support/json/lists_get.json +19 -0
  101. data/spec/support/json/signature_create.json +12 -0
  102. data/spec/support/json/signature_field_add.json +25 -0
  103. data/spec/support/json/signature_fields_get.json +27 -0
  104. data/spec/support/json/signature_roles_get.json +17 -0
  105. data/spec/support/json/signatures_get.json +19 -0
  106. data/spec/support/json/subscription_plan_get.json +9 -0
  107. data/spec/support/json/subscription_plans_get.json +17 -0
  108. data/spec/support/json/template_get.json +35 -0
  109. data/spec/support/json/template_get_documents.json +15 -0
  110. data/spec/support/json/template_get_recipients.json +20 -0
  111. data/spec/support/json/templates_all.json +37 -0
  112. data/spec/support/json/user_users_get.json +27 -0
  113. data/spec/support/shared_examples/signature/shared/document_methods.rb +68 -0
  114. data/spec/support/shared_examples/signature/shared/entity_fields.rb +89 -0
  115. data/spec/support/shared_examples/signature/shared/entity_methods.rb +116 -0
  116. data/spec/support/shared_examples/signature/shared/field_methods.rb +188 -0
  117. data/spec/support/shared_examples/signature/shared/recipient_methods.rb +42 -0
  118. data/spec/support/shared_examples/signature/shared/resource_methods.rb +46 -0
  119. metadata +139 -29
  120. data/lib/groupdocs/extensions.rb +0 -1
  121. data/lib/groupdocs/extensions/lookup.rb +0 -52
  122. 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!('/Test', client_id: 'client_id', private_key: 'private_key')
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
- described_class.stub(find!: described_class.new(id: 1))
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!('/', {}, client_id: 'client_id', private_key: 'private_key')
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!('/test') }.should_not raise_error(ArgumentError)
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!('/', page: 1, count: 1) }.should_not raise_error(ArgumentError)
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: '/').and_return(folder)
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 '#move!' do
87
+ describe '#list!' do
95
88
  before(:each) do
96
- mock_api_server(load_json('folder_move'))
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.move!('/Test', client_id: 'client_id', private_key: 'private_key')
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 'checks that path starts with /' do
106
- GroupDocs::Api::Helpers::Path.should_receive(:verify_starts_with_root).with('Test1')
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 'sends "Groupdocs-Move" header' do
111
- mock_api_server(load_json('folder_move'), :'Groupdocs-Move' => 'Test1')
112
- subject.stub(name: 'Test1')
113
- subject.move!('/Test2')
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 moved to folder path' do
117
- moved = subject.move!('/Test2/Test1')
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
- describe '#rename!' do
124
- it 'accepts access credentials hash' do
125
- lambda do
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 'uses #move! to rename directory' do
131
- subject.should_receive(:move!).with('/Test2', {}).and_return('/Test2')
132
- subject.rename!('Test2')
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 'strips leading / symbol from new name' do
136
- subject.stub(move!: '/Test2')
137
- renamed = subject.rename!('Test2')
138
- renamed.should be_a(String)
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 '#copy!' do
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.copy!('/Test2', client_id: 'client_id', private_key: 'private_key')
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.copy!('/Test2/Test1')
144
+ moved = subject.move!('Test2/Test1')
167
145
  moved.should be_a(String)
168
- moved.should == '/Test2/Test1/'
146
+ moved.should == 'Test2/Test1/'
169
147
  end
170
148
  end
171
149
 
172
- describe '#list!' do
150
+ describe '#copy!' do
173
151
  before(:each) do
174
- mock_api_server(load_json('folder_list'))
175
- subject.stub(path: '/Test1')
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.list!({}, client_id: 'client_id', private_key: 'private_key')
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 'allows passing options' do
185
- -> { subject.list!(page: 1, count: 1) }.should_not raise_error(ArgumentError)
186
- end
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('/Test1', {})
182
+ described_class.should_receive(:create!).with('Test1', {})
230
183
  subject.create!
231
184
  end
232
185
 
@@ -17,8 +17,7 @@ describe GroupDocs::Storage::Package do
17
17
  end
18
18
 
19
19
  it 'is aliased to #<<' do
20
- subject.should respond_to(:<<)
21
- subject.method(:<<).should == subject.method(:add)
20
+ subject.should have_alias(:<<, :add)
22
21
  end
23
22
  end
24
23
 
@@ -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
@@ -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 'is compatible with response JSON' do
55
- subject.should respond_to(:pkey=)
56
- subject.should respond_to(:pswd_salt=)
57
- subject.should respond_to(:signedupOn=)
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 'has human-readable accessors' do
64
- subject.should respond_to(:first_name)
65
- subject.should respond_to(:first_name=)
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
@@ -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 = '07aaaf95f8eb33a4'
26
+ groupdocs.client_id = '07aaaf95f8eb33a4'
18
27
  groupdocs.private_key = '5cb711b3a52ffc5d90ee8a0f79206f5a'
19
28
  groupdocs.api_version = '2.0'
20
29
  end
Binary file
@@ -0,0 +1,11 @@
1
+ {
2
+ "result":
3
+ {
4
+ "annotation":
5
+ {
6
+ "access": "Private"
7
+ }
8
+ },
9
+ "status": "Ok",
10
+ "error_message": null
11
+ }