better_ross 0.0.4 → 0.1.0

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ross/client.rb +24 -4
  3. data/ross.gemspec +2 -2
  4. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1f1d2390671663b426392fce34c982614ce9110
4
- data.tar.gz: a94351861b7ed3b6bd668f02a35ac03e35f2d39c
3
+ metadata.gz: 8063a3d10f0ef6275b0e7d18fce5c88822726f5e
4
+ data.tar.gz: 96975a08762a2ad2e0ff756e432adcc7ac2c1e07
5
5
  SHA512:
6
- metadata.gz: 0e04beaec8462b1ade61b1b7ccbfb7cdfd58863ab3ce5d68df70cdd66b1f6120f6f6997e5dbf7641da28d387b2e2e1931f8747afdf269d67be61b5bc067a5d8b
7
- data.tar.gz: 73b092e5b364abba6aeb95b0a205655465a5273b8cff0bb4588eec4eea278034d37b1b4d3cb91df59f619f1a784351c8fcc0a627794b304ac406693aa692eb52
6
+ metadata.gz: 90ff25d5a0a1432fbd3a15d7004db28df3cfd9b8634a4a3f8e773c201de7b311252327e7fb6075944d0fb7e69c5d55781da84d2c4fe3427ca6eaeca3ced8dce0
7
+ data.tar.gz: 012bb2f1757ba97632e3d9b3c4ae3f9642b1401adaf29419d08b26d18d79def22b6386df9d3ab75f670c0421ad777338cf45ade77466de90e67d0482f1b81fdf
data/lib/ross/client.rb CHANGED
@@ -33,14 +33,34 @@ module ROSS
33
33
 
34
34
  def delete(path)
35
35
  date = Time.now.gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT")
36
- content_type = nil
37
36
  headers = {
38
- "Authorization" => auth_sign("DELETE", path, date, content_type),
39
- "Content-Type" => content_type,
37
+ "Authorization" => auth_sign("DELETE", path, date),
38
+ "Content-Type" => nil,
40
39
  "Date" => date,
41
40
  "Host" => @aliyun_host
42
41
  }
43
- RestClient.delete(request_url(path), headers)
42
+ response = RestClient.delete(request_url(path), headers)
43
+ end
44
+
45
+ def head(path)
46
+ date = Time.now.gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT")
47
+ headers = {
48
+ "Authorization" => auth_sign("HEAD", path, date),
49
+ "Content-Type" => nil,
50
+ "Date" => date,
51
+ "Host" => @aliyun_host
52
+ }
53
+ response = RestClient.head(request_url(path), headers)
54
+ end
55
+
56
+ def exists?(path)
57
+ begin
58
+ head(path)
59
+ rescue RestClient::ResourceNotFound
60
+ false
61
+ else
62
+ true
63
+ end
44
64
  end
45
65
 
46
66
  def copy(sour_path, dest_path)
data/ross.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'better_ross'
4
- s.version = '0.0.4'
4
+ s.version = '0.1.0'
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.summary = "ROSS is a ruby client for aliyun oss"
7
- s.authors = ["Fizz Wu"]
7
+ s.authors = ["Fizz Wu", "Binz"]
8
8
  s.email = "fizzwu@gmail.com"
9
9
  s.files = `git ls-files`.split("\n")
10
10
 
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_ross
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fizz Wu
8
+ - Binz
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []