uber-s3 0.1.4 → 0.1.5
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.
data/lib/uber-s3/object.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
class UberS3
|
2
2
|
class Object
|
3
3
|
include Operation::Object::AccessPolicy
|
4
|
-
include Operation::Object::CacheControl
|
5
4
|
include Operation::Object::ContentDisposition
|
6
5
|
include Operation::Object::ContentEncoding
|
7
6
|
include Operation::Object::ContentMd5
|
8
7
|
include Operation::Object::ContentType
|
9
|
-
include Operation::Object::
|
8
|
+
include Operation::Object::HttpCache
|
10
9
|
include Operation::Object::Meta
|
11
10
|
include Operation::Object::StorageClass
|
12
11
|
|
@@ -44,12 +43,13 @@ class UberS3
|
|
44
43
|
gzip_content!
|
45
44
|
|
46
45
|
# Standard pass through values
|
47
|
-
headers['Cache-Control'] = cache_control
|
48
46
|
headers['Content-Disposition'] = content_disposition
|
49
47
|
headers['Content-Encoding'] = content_encoding
|
50
48
|
headers['Content-Length'] = size.to_s
|
51
49
|
headers['Content-Type'] = content_type
|
50
|
+
headers['Cache-Control'] = cache_control
|
52
51
|
headers['Expires'] = expires
|
52
|
+
headers['Pragma'] = pragma
|
53
53
|
|
54
54
|
headers.each {|k,v| headers.delete(k) if v.nil? || v.empty? }
|
55
55
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module UberS3::Operation::Object
|
2
|
+
module HttpCache
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.send :extend, ClassMethods
|
6
|
+
base.send :include, InstanceMethods
|
7
|
+
|
8
|
+
base.instance_eval do
|
9
|
+
attr_accessor :cache_control, :expires, :pragma, :ttl
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
end
|
15
|
+
|
16
|
+
module InstanceMethods
|
17
|
+
|
18
|
+
# Helper method that will set the max-age for cache-control
|
19
|
+
def ttl=(seconds)
|
20
|
+
@ttl = seconds
|
21
|
+
self.cache_control = "public,max-age=#{seconds}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Expires can take a time or string
|
25
|
+
def expires=(val)
|
26
|
+
if val.is_a?(String)
|
27
|
+
self.expires = val
|
28
|
+
elsif val.is_a?(Time)
|
29
|
+
# RFC 1123 format
|
30
|
+
self.expires = val.strftime("%a, %d %b %Y %H:%I:%S %Z")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/lib/uber-s3/response.rb
CHANGED
@@ -13,14 +13,14 @@ class UberS3
|
|
13
13
|
self.body = options[:body]
|
14
14
|
self.raw = options[:raw]
|
15
15
|
|
16
|
-
|
16
|
+
success?
|
17
17
|
end
|
18
18
|
|
19
19
|
# TODO: can/should we normalize the keys..? downcase.. etc.?
|
20
20
|
# def header=(header)
|
21
21
|
# end
|
22
22
|
|
23
|
-
def
|
23
|
+
def success?
|
24
24
|
return if status < 400 || body.to_s.empty?
|
25
25
|
|
26
26
|
# Errors are XML
|
data/lib/uber-s3/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uber-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-11-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mime-types
|
16
|
-
requirement: &
|
16
|
+
requirement: &70176041499080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '1.
|
21
|
+
version: '1.17'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70176041499080
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70176041498320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70176041498320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70176041496840 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 2.7.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70176041496840
|
47
47
|
description: A simple & very fast S3 client supporting sync / async HTTP adapters
|
48
48
|
email:
|
49
49
|
- peter@nulayer.com
|
@@ -61,12 +61,11 @@ files:
|
|
61
61
|
- lib/uber-s3/error.rb
|
62
62
|
- lib/uber-s3/object.rb
|
63
63
|
- lib/uber-s3/operation/object/access_policy.rb
|
64
|
-
- lib/uber-s3/operation/object/cache_control.rb
|
65
64
|
- lib/uber-s3/operation/object/content_disposition.rb
|
66
65
|
- lib/uber-s3/operation/object/content_encoding.rb
|
67
66
|
- lib/uber-s3/operation/object/content_md5.rb
|
68
67
|
- lib/uber-s3/operation/object/content_type.rb
|
69
|
-
- lib/uber-s3/operation/object/
|
68
|
+
- lib/uber-s3/operation/object/http_cache.rb
|
70
69
|
- lib/uber-s3/operation/object/meta.rb
|
71
70
|
- lib/uber-s3/operation/object/storage_class.rb
|
72
71
|
- lib/uber-s3/operation.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module UberS3::Operation::Object
|
2
|
-
module CacheControl
|
3
|
-
|
4
|
-
def self.included(base)
|
5
|
-
base.send :extend, ClassMethods
|
6
|
-
base.send :include, InstanceMethods
|
7
|
-
|
8
|
-
base.instance_eval do
|
9
|
-
attr_accessor :cache_control
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
module ClassMethods
|
14
|
-
end
|
15
|
-
|
16
|
-
module InstanceMethods
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module UberS3::Operation::Object
|
2
|
-
module Expires
|
3
|
-
|
4
|
-
def self.included(base)
|
5
|
-
base.send :extend, ClassMethods
|
6
|
-
base.send :include, InstanceMethods
|
7
|
-
|
8
|
-
base.instance_eval do
|
9
|
-
attr_accessor :expires
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
module ClassMethods
|
14
|
-
end
|
15
|
-
|
16
|
-
module InstanceMethods
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|