sndacs 0.1.0 → 0.1.1
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/Gemfile.lock +1 -1
- data/lib/sndacs/bucket.rb +6 -2
- data/lib/sndacs/connection.rb +16 -0
- data/lib/sndacs/version.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/sndacs/bucket.rb
CHANGED
@@ -40,7 +40,7 @@ module Sndacs
|
|
40
40
|
# * <tt>:location</tt> - location of the bucket
|
41
41
|
# (<tt>huabei-1</tt> or <tt>huadong-1</tt>)
|
42
42
|
# * Any other options are passed through to Connection#request
|
43
|
-
def save(options = {})
|
43
|
+
def save(options = { :location => 'huabei-1'})
|
44
44
|
if options
|
45
45
|
if options.is_a?(String) && options.strip != ''
|
46
46
|
options = {:location => options.strip}
|
@@ -49,6 +49,10 @@ module Sndacs
|
|
49
49
|
if options.is_a?(Hash) && !options.has_key?(:location)
|
50
50
|
options.merge!(:location => location)
|
51
51
|
end
|
52
|
+
|
53
|
+
if options.is_a?(Hash) && options.has_key?(:location)
|
54
|
+
@location = options[:location]
|
55
|
+
end
|
52
56
|
else
|
53
57
|
options = {:location => location}
|
54
58
|
end
|
@@ -128,7 +132,7 @@ module Sndacs
|
|
128
132
|
location = options[:location].to_s.downcase if options[:location]
|
129
133
|
|
130
134
|
options[:headers] ||= {}
|
131
|
-
if location and location != REGION_DEFAULT
|
135
|
+
if location #and location != REGION_DEFAULT
|
132
136
|
options[:headers][:content_type] = "application/xml"
|
133
137
|
options[:body] = "<CreateBucketConfiguration><LocationConstraint>#{location}</LocationConstraint></CreateBucketConfiguration>"
|
134
138
|
end
|
data/lib/sndacs/connection.rb
CHANGED
@@ -179,6 +179,22 @@ module Sndacs
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def http(host)
|
182
|
+
|
183
|
+
if host.index("http://") === 0
|
184
|
+
start = "http://".size
|
185
|
+
host = host.slice(start,host.size-start)
|
186
|
+
end
|
187
|
+
|
188
|
+
if host.index("https://") === 0
|
189
|
+
start = "https://".size
|
190
|
+
host = host.slice(start,host.size-start)
|
191
|
+
end
|
192
|
+
|
193
|
+
endid = host.index("/")
|
194
|
+
if endid != nil
|
195
|
+
host = host.slice(0,endid)
|
196
|
+
end
|
197
|
+
|
182
198
|
http = Net::HTTP.new(host, port, *proxy_settings)
|
183
199
|
http.set_debug_output(STDOUT) if @debug
|
184
200
|
http.use_ssl = @use_ssl
|
data/lib/sndacs/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -10,8 +10,8 @@ end
|
|
10
10
|
module Sndacs
|
11
11
|
|
12
12
|
# Default configurations, see Sndacs::Config for more info
|
13
|
-
Config.access_key_id = '
|
14
|
-
Config.secret_access_key = '
|
13
|
+
Config.access_key_id = 'yourkey'
|
14
|
+
Config.secret_access_key = 'yoursecret'
|
15
15
|
Config.host = 'storage.grandcloud.cn'
|
16
16
|
Config.content_host = 'storage.sdcloud.cn'
|
17
17
|
Config.proxy = nil
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sndacs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- LI Daobing
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-08-29 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: proxies
|