uploadcare-ruby 2.1.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/gem-push.yml +20 -0
  3. data/.github/workflows/ruby.yml +52 -0
  4. data/.gitignore +13 -6
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +20 -0
  7. data/.yardopts +4 -0
  8. data/CHANGELOG.md +24 -51
  9. data/DEVELOPMENT.md +18 -0
  10. data/Gemfile +2 -0
  11. data/LICENSE +1 -1
  12. data/README.md +164 -578
  13. data/Rakefile +5 -5
  14. data/bin/console +15 -0
  15. data/bin/setup +8 -0
  16. data/lib/uploadcare.rb +36 -32
  17. data/lib/uploadcare/api/api.rb +25 -0
  18. data/lib/uploadcare/client/file_client.rb +44 -0
  19. data/lib/uploadcare/client/file_list_client.rb +46 -0
  20. data/lib/uploadcare/client/group_client.rb +45 -0
  21. data/lib/uploadcare/client/multipart_upload/chunks_client.rb +46 -0
  22. data/lib/uploadcare/client/multipart_upload_client.rb +62 -0
  23. data/lib/uploadcare/client/project_client.rb +18 -0
  24. data/lib/uploadcare/client/rest_client.rb +73 -0
  25. data/lib/uploadcare/client/rest_group_client.rb +23 -0
  26. data/lib/uploadcare/client/upload_client.rb +35 -0
  27. data/lib/uploadcare/client/uploader_client.rb +93 -0
  28. data/lib/uploadcare/client/webhook_client.rb +43 -0
  29. data/lib/uploadcare/concern/error_handler.rb +54 -0
  30. data/lib/uploadcare/concern/throttle_handler.rb +25 -0
  31. data/lib/uploadcare/concern/upload_error_handler.rb +32 -0
  32. data/lib/uploadcare/entity/decorator/paginator.rb +81 -0
  33. data/lib/uploadcare/entity/entity.rb +18 -0
  34. data/lib/uploadcare/entity/file.rb +81 -0
  35. data/lib/uploadcare/entity/file_list.rb +30 -0
  36. data/lib/uploadcare/entity/group.rb +41 -0
  37. data/lib/uploadcare/entity/group_list.rb +24 -0
  38. data/lib/uploadcare/entity/project.rb +13 -0
  39. data/lib/uploadcare/entity/uploader.rb +73 -0
  40. data/lib/uploadcare/entity/webhook.rb +14 -0
  41. data/lib/uploadcare/exception/request_error.rb +9 -0
  42. data/lib/uploadcare/exception/throttle_error.rb +14 -0
  43. data/lib/uploadcare/param/authentication_header.rb +25 -0
  44. data/lib/uploadcare/param/param.rb +10 -0
  45. data/lib/uploadcare/param/secure_auth_header.rb +37 -0
  46. data/lib/uploadcare/param/simple_auth_header.rb +14 -0
  47. data/lib/uploadcare/param/upload/signature_generator.rb +24 -0
  48. data/lib/uploadcare/param/upload/upload_params_generator.rb +23 -0
  49. data/lib/uploadcare/param/user_agent.rb +21 -0
  50. data/lib/uploadcare/ruby/version.rb +5 -0
  51. data/uploadcare-ruby.gemspec +50 -37
  52. metadata +98 -113
  53. data/.travis.yml +0 -26
  54. data/UPGRADE_NOTES.md +0 -36
  55. data/lib/uploadcare/api.rb +0 -26
  56. data/lib/uploadcare/api/file_api.rb +0 -7
  57. data/lib/uploadcare/api/file_list_api.rb +0 -19
  58. data/lib/uploadcare/api/file_storage_api.rb +0 -34
  59. data/lib/uploadcare/api/group_api.rb +0 -38
  60. data/lib/uploadcare/api/group_list_api.rb +0 -17
  61. data/lib/uploadcare/api/project_api.rb +0 -9
  62. data/lib/uploadcare/api/raw_api.rb +0 -38
  63. data/lib/uploadcare/api/uploading_api.rb +0 -71
  64. data/lib/uploadcare/api/uploading_api/upload_params.rb +0 -72
  65. data/lib/uploadcare/api/validators/file_list_options_validator.rb +0 -73
  66. data/lib/uploadcare/api/validators/group_list_options_validator.rb +0 -49
  67. data/lib/uploadcare/errors/errors.rb +0 -64
  68. data/lib/uploadcare/resources/file.rb +0 -164
  69. data/lib/uploadcare/resources/file_list.rb +0 -14
  70. data/lib/uploadcare/resources/group.rb +0 -115
  71. data/lib/uploadcare/resources/group_list.rb +0 -14
  72. data/lib/uploadcare/resources/project.rb +0 -13
  73. data/lib/uploadcare/resources/resource_list.rb +0 -83
  74. data/lib/uploadcare/rest/auth/auth.rb +0 -31
  75. data/lib/uploadcare/rest/auth/secure.rb +0 -43
  76. data/lib/uploadcare/rest/auth/simple.rb +0 -16
  77. data/lib/uploadcare/rest/connections/api_connection.rb +0 -53
  78. data/lib/uploadcare/rest/connections/upload_connection.rb +0 -22
  79. data/lib/uploadcare/rest/middlewares/auth_middleware.rb +0 -24
  80. data/lib/uploadcare/rest/middlewares/parse_json_middleware.rb +0 -33
  81. data/lib/uploadcare/rest/middlewares/raise_error_middleware.rb +0 -21
  82. data/lib/uploadcare/utils/parser.rb +0 -71
  83. data/lib/uploadcare/utils/user_agent.rb +0 -44
  84. data/lib/uploadcare/version.rb +0 -3
  85. data/spec/api/file_list_api_spec.rb +0 -95
  86. data/spec/api/file_storage_api_spec.rb +0 -88
  87. data/spec/api/group_list_api_spec.rb +0 -59
  88. data/spec/api/raw_api_spec.rb +0 -25
  89. data/spec/api/uploading_api/upload_params_spec.rb +0 -99
  90. data/spec/api/uploading_api_spec.rb +0 -59
  91. data/spec/resources/file_list_spec.rb +0 -25
  92. data/spec/resources/file_spec.rb +0 -223
  93. data/spec/resources/group_list_spec.rb +0 -25
  94. data/spec/resources/group_spec.rb +0 -101
  95. data/spec/resources/operations_spec.rb +0 -59
  96. data/spec/resources/project_spec.rb +0 -21
  97. data/spec/rest/api_connection_spec.rb +0 -68
  98. data/spec/rest/auth/secure_spec.rb +0 -66
  99. data/spec/rest/auth/simple_spec.rb +0 -31
  100. data/spec/rest/errors_spec.rb +0 -75
  101. data/spec/rest/upload_connection_spec.rb +0 -19
  102. data/spec/shared/resource_list.rb +0 -188
  103. data/spec/spec_helper.rb +0 -54
  104. data/spec/uploadcare_spec.rb +0 -43
  105. data/spec/utils/parser_spec.rb +0 -85
  106. data/spec/utils/user_agent_spec.rb +0 -46
  107. data/spec/view.png +0 -0
  108. data/spec/view2.jpg +0 -0
@@ -1,99 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Uploadcare::UploadingApi::UploadParams do
4
- shared_examples 'handles store flag' do |key_name|
5
- let(:true_value) { 1 }
6
- let(:false_value) { 0 }
7
-
8
- context 'when neither global nor per-request store option is set' do
9
- it { is_expected.not_to include(key_name) }
10
- end
11
-
12
- context 'accepts :auto value in :store option' do
13
- before { request_options.merge!(store: :auto) }
14
- it { is_expected.to include(key_name => 'auto') }
15
- end
16
-
17
- context 'when only global :autostore option is set' do
18
- context 'to true' do
19
- before { global_options.merge!(autostore: true) }
20
- it { is_expected.to include(key_name => true_value) }
21
- end
22
-
23
- context 'to false' do
24
- before { global_options.merge!(autostore: false) }
25
- it { is_expected.to include(key_name => false_value) }
26
- end
27
- end
28
-
29
- context 'per-request :store option is set' do
30
- context 'to true' do
31
- before { request_options.merge!(store: true) }
32
- it { is_expected.to include(key_name => true_value) }
33
- end
34
-
35
- context 'to false' do
36
- before { request_options.merge!(store: false) }
37
- it { is_expected.to include(key_name => false_value) }
38
- end
39
- end
40
-
41
- context 'when both global and per-request store options are set' do
42
- before do
43
- global_options.merge!(autostore: false)
44
- request_options.merge!(store: true)
45
- end
46
-
47
- it 'per-request :store option has higher presidence' do
48
- is_expected.to include(key_name => true_value)
49
- end
50
- end
51
- end
52
-
53
- let(:global_options) { {public_key: 'test_public_key'} }
54
- let(:request_options) { {} }
55
-
56
- describe '#for_url_upload' do
57
- let(:url) { 'http://example.com/image.jpg' }
58
- subject(:upload_params) do
59
- described_class.new(global_options, request_options).for_url_upload(url)
60
- end
61
-
62
- it { is_expected.to include(source_url: URI.parse(url)) }
63
- it { is_expected.to include(pub_key: 'test_public_key') }
64
- it_behaves_like 'handles store flag', :store
65
-
66
- context 'works with https URLs' do
67
- let(:url) { 'https://example.com/image.jpg' }
68
- it { expect { upload_params }.not_to raise_error }
69
- end
70
-
71
- context 'if url is not http/https' do
72
- let(:url) { 'ftp://example.com/image.jpg' }
73
- it { expect { upload_params }.to raise_error(ArgumentError) }
74
- end
75
- end
76
-
77
- describe '#for_file_upload' do
78
- let(:files) { FILES_ARY } # contains 2 files, first is png, second is jpg
79
- subject(:upload_params) do
80
- described_class.new(global_options, request_options).for_file_upload(files)
81
- end
82
-
83
- it { is_expected.to include(UPLOADCARE_PUB_KEY: 'test_public_key') }
84
- it_behaves_like 'handles store flag', :UPLOADCARE_STORE
85
-
86
- context 'file params' do
87
- subject(:file_params) { upload_params.select { |k, _| k =~ /^file\[\d+\]/ }.values }
88
-
89
- it { expect(file_params.size).to eq(files.size) }
90
- it { is_expected.to all(be_a(Faraday::UploadIO)) }
91
- it { is_expected.to all(satisfy { |file| file.content_type =~ /image\/(png|jpeg)/}) }
92
- end
93
-
94
- context 'when any of given objects is not a File' do
95
- let(:files) { FILES_ARY + ['not a File'] }
96
- it { expect {upload_params}.to raise_error(ArgumentError) }
97
- end
98
- end
99
- end
@@ -1,59 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Uploadcare::Api do
4
- shared_examples 'respects :store option' do
5
- context 'respects :store option' do
6
- let(:upload_options) { {store: store} }
7
- subject { Array(uploaded).map(&:load_data) }
8
-
9
- context 'when :store option is true' do
10
- let(:store) { true }
11
- it { is_expected.to all(be_stored) }
12
- end
13
-
14
- define_negated_matcher :be_not_stored, :be_stored
15
- context 'when :store option is false' do
16
- let(:store) { false }
17
- it { is_expected.to all(be_not_stored) }
18
- end
19
- end
20
- end
21
-
22
- let(:api) { API }
23
- let(:upload_options) { {} }
24
-
25
- context 'when uploading single object' do
26
- subject(:uploaded) { api.upload(object, upload_options) }
27
-
28
- context 'when uploading a file' do
29
- let(:object) { FILE1 }
30
-
31
- it { is_expected.to be_a(Uploadcare::Api::File) }
32
- it { is_expected.to have_attributes(uuid: match(UUID_REGEX)) }
33
- include_examples 'respects :store option'
34
- end
35
-
36
- context 'when uploading from url' do
37
- let(:object) { IMAGE_URL }
38
-
39
- it { is_expected.to be_a(Uploadcare::Api::File) }
40
- it { is_expected.to have_attributes(uuid: match(UUID_REGEX)) }
41
- it { expect { api.upload('invalid.url.') }.to raise_error(ArgumentError) }
42
- include_examples 'respects :store option'
43
- end
44
- end
45
-
46
- context 'when loading multiple objects' do
47
- before(:all) { @uploaded_files = API.upload(FILES_ARY) }
48
- subject(:uploaded) { @uploaded_files.dup }
49
-
50
- it { is_expected.to be_a(Array) }
51
- it { is_expected.to all(be_a(Uploadcare::Api::File)) }
52
- it { is_expected.to all(have_attributes(uuid: match(UUID_REGEX))) }
53
- it { expect { uploaded.map(&:load_data) }.not_to raise_error }
54
- end
55
-
56
- context 'when given object is not a File, Array or String' do
57
- it { expect { api.upload(12) }.to raise_error(ArgumentError) }
58
- end
59
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Uploadcare::Api::FileList do
4
- before :all do
5
- @api = API
6
-
7
- # ensure that current project has at least three files
8
- count = @api.get('/files/', limit: 3)['results'].size
9
- (3 - count).times{ @api.upload(IMAGE_URL) } if count < 3
10
-
11
- @list = @api.file_list(limit: 1)
12
- end
13
-
14
- let(:resource_class){ Uploadcare::Api::File }
15
- subject{ @list }
16
-
17
- it_behaves_like 'resource list'
18
-
19
- describe '#objects' do
20
- subject{ @list.objects }
21
-
22
- it{ is_expected.to all(be_a(resource_class)) }
23
- it{ is_expected.to all(be_loaded) }
24
- end
25
- end
@@ -1,223 +0,0 @@
1
- require 'spec_helper'
2
- require 'uri'
3
- require 'socket'
4
- require 'securerandom'
5
-
6
- describe Uploadcare::Api::File do
7
- let(:api) { API }
8
- let(:file) { api.upload IMAGE_URL }
9
-
10
- it 'is an instance of File' do
11
- expect(file).to be_an_instance_of Uploadcare::Api::File
12
- end
13
-
14
- it 'is not initialized without correct UUID given' do
15
- expect {Uploadcare::Api::File.new(api, "not-uuid")}.to raise_error NoMethodError
16
- end
17
-
18
- it 'has a valid url' do
19
- expect(file.uuid).to match UUID_REGEX
20
- end
21
-
22
- it 'returns a public url' do
23
- expect(file).to respond_to :cdn_url
24
- expect(file).to respond_to :public_url
25
- end
26
-
27
- it 'has a public url that is valid' do
28
- url = file.cdn_url
29
- uri = URI.parse(url)
30
- expect(uri).to be_kind_of(URI::HTTP)
31
- end
32
-
33
- it 'is able to load image data' do
34
- expect {file.load_data}.to_not raise_error
35
- end
36
-
37
- it 'stores itself' do
38
- expect { file.store }.to_not raise_error
39
- end
40
-
41
- it 'responds with nil for :stored? and :deleted? methods unless loaded' do
42
- expect(file.is_loaded?).to be false
43
- expect(file.is_stored?).to be_nil
44
- expect(file.is_deleted?).to be_nil
45
- end
46
-
47
- it 'is able to tell thenever file was stored' do
48
- file.load
49
- expect(file.stored?).to be(true)
50
- wait_until_ready(file)
51
- file.delete
52
- expect(file.stored?).to be(false)
53
- end
54
-
55
- it 'deletes itself' do
56
- expect { file.delete }.to_not raise_error
57
- end
58
-
59
- it 'is able to tell thenever file was deleted' do
60
- file.load
61
- file.is_deleted?.should == false
62
- wait_until_ready(file)
63
- file.delete
64
- expect(file.is_deleted?).to be true
65
- end
66
-
67
- it 'constructs file from uuid' do
68
- uuid_file = api.file file.uuid
69
- expect(uuid_file).to be_kind_of(Uploadcare::Api::File)
70
- end
71
-
72
- it 'constructs file from cdn url' do
73
- url = file.cdn_url + "-/crop/150x150/center/-/format/png/"
74
- file = api.file url
75
- expect(file).to be_kind_of(Uploadcare::Api::File)
76
- end
77
-
78
- it 'responds to datetime_ methods' do
79
- file.load
80
- expect(file).to respond_to(:datetime_original)
81
- expect(file).to respond_to(:datetime_uploaded)
82
- expect(file).to respond_to(:datetime_stored)
83
- expect(file).to respond_to(:datetime_removed)
84
- end
85
-
86
- it 'responds to datetime_uploaded' do
87
- file.load
88
- expect(file.datetime_uploaded).to be_kind_of(DateTime)
89
- end
90
-
91
- it 'responds to datetime_stored' do
92
- file.load
93
- file.store
94
- expect(file.datetime_stored).to be_kind_of(DateTime)
95
- end
96
-
97
- it 'responds to datetime_removed' do
98
- file.load
99
- wait_until_ready(file)
100
- file.delete
101
- expect(file.datetime_removed).to be_kind_of(DateTime)
102
- expect(file.datetime_deleted).to be_kind_of(DateTime)
103
- expect(file.datetime_removed).to eq file.datetime_deleted
104
- end
105
-
106
-
107
- it 'copies itself' do
108
- # This can cause "File is not ready yet" error if ran too early
109
- # In this case we retry it 3 times before giving up
110
- result = retry_if(Uploadcare::Error::RequestError::BadRequest){file.copy}
111
- expect(result).to be_kind_of(Hash)
112
- expect(result["type"]).to eq "file"
113
- end
114
-
115
-
116
- describe '#internal_copy' do
117
- describe 'integration' do
118
- it 'creates an internal copy of the file' do
119
- response = retry_if(Uploadcare::Error::RequestError::BadRequest){file.internal_copy}
120
-
121
- expect( response['type'] ).to eq 'file'
122
- expect( response['result']['uuid'] ).not_to eq file.uuid
123
- end
124
- end
125
-
126
- describe 'params' do
127
- let(:url_without_ops){ api.file(SecureRandom.uuid).cdn_url }
128
- let(:url_with_ops){ url_without_ops + "-/crop/5x5/center/" }
129
- let(:file){ api.file(url_with_ops) }
130
-
131
- context 'if no params given' do
132
- it 'requests server to create an unstored copy with operataions applied' do
133
- expect(api).to receive(:post)
134
- .with('/files/', source: url_with_ops)
135
-
136
- file.internal_copy
137
- end
138
- end
139
-
140
- context 'if strip_operations: true given' do
141
- it 'passes url without operations as a source for a copy' do
142
- expect(api).to receive(:post)
143
- .with('/files/', source: url_without_ops)
144
-
145
- file.internal_copy(strip_operations: true)
146
- end
147
- end
148
-
149
- context 'if store: true given' do
150
- it 'requests server to create a stored copy' do
151
- expect(api).to receive(:post)
152
- .with('/files/', source: url_with_ops, store: true)
153
-
154
- file.internal_copy(store: true)
155
- end
156
- end
157
- end
158
- end
159
-
160
-
161
- describe '#external_copy' do
162
- let(:target){ 'with-prefix' }
163
-
164
- describe 'integration', :payed_feature do
165
- it 'creates an external copy of the file' do
166
- response = retry_if(Uploadcare::Error::RequestError::BadRequest) do
167
- file.external_copy(target)
168
- end
169
-
170
- expect( response['type'] ).to eq 'url'
171
- expect( response['result'] ).to match(URI.regexp)
172
- end
173
- end
174
-
175
- describe 'params' do
176
- let(:url_without_ops){ api.file(SecureRandom.uuid).cdn_url }
177
- let(:url_with_ops){ url_without_ops + "-/resize/50x50/" }
178
- let(:file){ api.file(url_with_ops) }
179
-
180
- context 'if only target is given' do
181
- it 'requests server to create a private copy with default name and with operataions applied' do
182
- expect(api).to receive(:post)
183
- .with('/files/', source: url_with_ops, target: target)
184
-
185
- file.external_copy(target)
186
- end
187
- end
188
-
189
- context 'if target is not given' do
190
- it 'raises ArgumentError' do
191
- expect{ file.external_copy }.to raise_error(ArgumentError)
192
- end
193
- end
194
-
195
- context 'if strip_operations: true given' do
196
- it 'passes url without operations as a source for a copy' do
197
- expect(api).to receive(:post)
198
- .with('/files/', source: url_without_ops, target: target)
199
-
200
- file.external_copy(target, strip_operations: true)
201
- end
202
- end
203
-
204
- context 'if :make_public given' do
205
- it 'requests server to create a copy with correspondent permissions' do
206
- expect(api).to receive(:post)
207
- .with('/files/', source: url_with_ops, target: target, make_public: false)
208
-
209
- file.external_copy(target, make_public: false)
210
- end
211
- end
212
-
213
- context 'if :pattern given' do
214
- it 'requests server to apply given pattern to name of a copy' do
215
- expect(api).to receive(:post)
216
- .with('/files/', source: url_with_ops, target: target, pattern: 'test')
217
-
218
- file.external_copy(target, pattern: 'test')
219
- end
220
- end
221
- end
222
- end
223
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Uploadcare::Api::GroupList do
4
- before :all do
5
- @api = API
6
-
7
- # ensure that current project has at least three groups
8
- count = @api.get('/groups/', limit: 3)['results'].size
9
- (3 - count).times{ @api.create_group([@api.upload(IMAGE_URL)]) } if count < 3
10
-
11
- @list = @api.group_list(limit: 1)
12
- end
13
-
14
- let(:resource_class){ Uploadcare::Api::Group }
15
- subject{ @list }
16
-
17
- it_behaves_like 'resource list'
18
-
19
- describe '#objects' do
20
- subject{ @list.objects }
21
-
22
- it{ is_expected.to all(be_a(resource_class)) }
23
- it{ is_expected.not_to include(be_loaded) }
24
- end
25
- end
@@ -1,101 +0,0 @@
1
- require 'spec_helper'
2
- require 'uri'
3
- require 'socket'
4
-
5
- describe Uploadcare::Api::Group do
6
- before :all do
7
- @api = API
8
- @files = @api.upload FILES_ARY
9
- end
10
-
11
- it "should return group object" do
12
- group = @api.create_group @files
13
- group.should be_kind_of(Uploadcare::Api::Group)
14
- end
15
-
16
- it "should have valid UUID and count of files" do
17
- group = @api.create_group @files
18
- group.should respond_to(:uuid)
19
- group.should respond_to(:files_count)
20
- end
21
-
22
- it "should may have files" do
23
- group = @api.create_group @files
24
- group.should respond_to(:files)
25
- group.files.should be_kind_of(Array)
26
- group.files.each do |file|
27
- file.should be_kind_of(Uploadcare::Api::File)
28
- end
29
- end
30
-
31
- it "should create group by id" do
32
- group = @api.create_group @files
33
-
34
- expect {group_uloaded = @api.group group.uuid}.to_not raise_error
35
- end
36
-
37
- it "should create loaded and unloaded groups" do
38
- group = @api.create_group @files
39
- group_uloaded = @api.group group.uuid
40
- group.is_loaded?.should be true
41
- group_uloaded.is_loaded?.should be false
42
- end
43
-
44
- it "group should load data" do
45
- group = @api.create_group @files
46
- group_uloaded = @api.group group.uuid
47
- group_uloaded.should respond_to(:load_data)
48
- expect {group_uloaded.load_data}.to_not raise_error
49
- group_uloaded.is_loaded?.should be true
50
- end
51
-
52
- it "group should store itself" do
53
- group = @api.create_group @files
54
- expect {group.store}.to_not raise_error
55
- end
56
-
57
- it "should be able to tell when group is stored" do
58
- group = @api.create_group @files
59
- group_unloaded = @api.group group.uuid
60
-
61
- group_unloaded.is_loaded?.should == false
62
- group_unloaded.is_stored?.should == nil
63
-
64
- group_unloaded.load
65
- group_unloaded.is_stored?.should == false
66
-
67
- group_unloaded.store
68
- group_unloaded.is_stored?.should == true
69
- end
70
-
71
- it "group should have datetime attributes" do
72
- group = @api.create_group @files
73
- group.should respond_to(:datetime_created)
74
- group.should respond_to(:datetime_stored)
75
- end
76
-
77
- it "group should have datetime_created as DateTime object" do
78
- group = @api.create_group @files
79
- group.datetime_created.should be_kind_of(DateTime)
80
- end
81
-
82
- it "group should have datetime_created as DateTime object" do
83
- group = @api.create_group @files
84
- group.store
85
- group.datetime_stored.should be_kind_of(DateTime)
86
- end
87
-
88
- it "should return cdn string for file in group by it index" do
89
- group = @api.create_group @files
90
-
91
- file_cdn_url = group.file_cdn_url(0)
92
-
93
- file_cdn_url.should be_kind_of(String)
94
- file_cdn_url.should == group.cdn_url + "nth/0/"
95
- end
96
-
97
- it 'should raise an error if index is greater than files count in group' do
98
- group = @api.create_group @files
99
- expect {group.file_cdn_url(5)}.to raise_error ArgumentError
100
- end
101
- end