infopark_cloud_connector 6.8.0.beta.200.889.d503e42 → 6.8.0.beta.200.891.647580e

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 (2) hide show
  1. data/lib/rails_connector/s3_blob.rb +19 -2
  2. metadata +9 -13
@@ -4,7 +4,11 @@ class S3Blob
4
4
  class << self
5
5
 
6
6
  def s3_objects
7
- @s3_objects ||= s3_api.buckets[bucket_name].objects
7
+ @s3_objects ||= bucket.objects
8
+ end
9
+
10
+ def bucket
11
+ s3_api.buckets[bucket_name]
8
12
  end
9
13
 
10
14
  def s3_api
@@ -14,8 +18,15 @@ class S3Blob
14
18
  )
15
19
  end
16
20
 
21
+ def bucket_url
22
+ @cached_bucket_url ||= bucket.url
23
+ end
24
+
17
25
  def configure(spec)
18
26
  @spec = spec.symbolize_keys
27
+
28
+ # invalidate cache
29
+ @cached_bucket_url = nil
19
30
  end
20
31
 
21
32
  def find(id, options)
@@ -51,7 +62,13 @@ class S3Blob
51
62
  end
52
63
 
53
64
  def url
54
- s3_object.public_url.to_s
65
+ # the 'official' way to calculate an s3 url is as follows:
66
+ # s3_object.public_url.to_s
67
+ #
68
+ # this is about 25x faster:
69
+ # assumption: 'id' does not contain any characters that need escaping.
70
+ # the assumptions is valid for cms blobs.
71
+ "#{self.class.bucket_url}#{@id}"
55
72
  end
56
73
 
57
74
  def content_type
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_cloud_connector
3
3
  version: !ruby/object:Gem::Version
4
- hash: -629374736
4
+ hash: -306389274
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 6
@@ -9,12 +9,10 @@ version: !ruby/object:Gem::Version
9
9
  - 0
10
10
  - beta
11
11
  - 200
12
- - 889
13
- - d
14
- - 503
12
+ - 891
13
+ - 647580
15
14
  - e
16
- - 42
17
- version: 6.8.0.beta.200.889.d503e42
15
+ version: 6.8.0.beta.200.891.647580e
18
16
  platform: ruby
19
17
  authors:
20
18
  - Infopark AG
@@ -22,7 +20,7 @@ autorequire:
22
20
  bindir: bin
23
21
  cert_chain: []
24
22
 
25
- date: 2012-08-17 00:00:00 +02:00
23
+ date: 2012-08-29 00:00:00 +02:00
26
24
  default_executable:
27
25
  dependencies:
28
26
  - !ruby/object:Gem::Dependency
@@ -62,19 +60,17 @@ dependencies:
62
60
  requirements:
63
61
  - - "="
64
62
  - !ruby/object:Gem::Version
65
- hash: -629374736
63
+ hash: -306389274
66
64
  segments:
67
65
  - 6
68
66
  - 8
69
67
  - 0
70
68
  - beta
71
69
  - 200
72
- - 889
73
- - d
74
- - 503
70
+ - 891
71
+ - 647580
75
72
  - e
76
- - 42
77
- version: 6.8.0.beta.200.889.d503e42
73
+ version: 6.8.0.beta.200.891.647580e
78
74
  version_requirements: *id003
79
75
  name: kvom
80
76
  prerelease: false