sndacs 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sndacs (0.0.1)
4
+ sndacs (0.1.0)
5
5
  proxies (~> 0.2.0)
6
6
 
7
7
  GEM
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Sndacs
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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 = '7EDX20CJ54PA31INPXTD469MR'
14
- Config.secret_access_key = 'NzljZWE0MzgtNGQ0Yi00ZGZiLWI0YzMtOTQzODE2MTkzN2Nk'
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
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-07-12 00:00:00 Z
18
+ date: 2012-08-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: proxies