uploadcare-ruby 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c63edfa62d8759b56f821bb38f6957b5d42ae75f
4
- data.tar.gz: ae19b88823e5fb73772d21d959f98492908533c7
3
+ metadata.gz: 13befd5dd6e5faed651bdb5735db6273577ce2da
4
+ data.tar.gz: f93c39068ff590a2b0fcd5bb1388b225c477e00f
5
5
  SHA512:
6
- metadata.gz: 749b43b1fe88668e030593d5af86baf81c05070e55e7822ec8b50824d7f89da8df0248e9afff5ecf3c92cabae099044e99d8830b57501208374db5708f5a53cc
7
- data.tar.gz: 871f99159127223f82939e94657f6a6e7710a95e0ae018f472d09e7ffff7052a3cf7eb75bee89d9faa2de7d5074a8f93c86f925b8604efcd6a18294ffa3175fb
6
+ metadata.gz: 4138493da1575faba21ed1136845693c540ef97a04f22bde1f1ea27b2f0cbb02d613cdd207afaa09bec01866984451c14aed15e5b3838b6dcd45a49547102588
7
+ data.tar.gz: c00dca425022a489b824add52361f82454e79aa8aa51e7afe8e8750ec9ead0145558187b22cb894ddaca46ce93c406a345ab37a9d2c1c9d8fd93babd2c95e7d1
@@ -18,6 +18,10 @@ module Uploadcare
18
18
  @api.options[:static_url_base] + "/#{uuid}/"
19
19
  end
20
20
 
21
+ def file_cdn_url index=0
22
+ raise ArgumentError.new "The index was given is greater than files count in group." if index + 1 > files_count
23
+ cdn_url + "nth/#{index}/"
24
+ end
21
25
 
22
26
  # Loading logic
23
27
  def is_loaded?
@@ -1,3 +1,3 @@
1
1
  module Uploadcare
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
data/spec/group_spec.rb CHANGED
@@ -87,4 +87,18 @@ describe Uploadcare::Api::Group do
87
87
  group.store
88
88
  group.datetime_stored.should be_kind_of(DateTime)
89
89
  end
90
+
91
+ it "should return cdn string for file in group by it index" do
92
+ group = @api.create_group @files
93
+
94
+ file_cdn_url = group.file_cdn_url(0)
95
+
96
+ file_cdn_url.should be_kind_of(String)
97
+ file_cdn_url.should == group.cdn_url + "nth/0/"
98
+ end
99
+
100
+ it 'should raise an error if index is greater than files count in group' do
101
+ group = @api.create_group @files
102
+ expect {group.file_cdn_url(5)}.to raise_error
103
+ end
90
104
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uploadcare-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - '@rastyagaev (Vadim Rastyagaev)'
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-16 00:00:00.000000000 Z
13
+ date: 2014-04-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday