brick_ftp 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brick_ftp/api/base.rb +5 -1
- data/lib/brick_ftp/client.rb +3 -2
- data/lib/brick_ftp/http_client.rb +8 -8
- data/lib/brick_ftp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f72f787154323bf71db253479add1ae727d50dc
|
4
|
+
data.tar.gz: c4cef1a4a3144b8335b08434b2f7a624d5f98ca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3d30929cf2fabbac4b340f739b3b78491df2f3186f42392fae5c7d8afbe15aabe97f7623cde45c5e54f8b3cd3a83f434aad5bcdccf28ad6946033f99e0f2014
|
7
|
+
data.tar.gz: f601b717e76175f5de9af387d4fd65d2ec63a3c910779c16f3cbfc8ad0245931e4b770f43ce69d3fd103092c34df15877da5889cc5329645feade3abd26a0dec
|
data/lib/brick_ftp/api/base.rb
CHANGED
@@ -55,10 +55,14 @@ module BrickFTP
|
|
55
55
|
self
|
56
56
|
end
|
57
57
|
|
58
|
-
def destroy
|
58
|
+
def destroy(recursive: false)
|
59
|
+
headers = {}
|
60
|
+
headers['Depth'] = 'infinity' if recursive
|
61
|
+
|
59
62
|
BrickFTP::HTTPClient.new.send(
|
60
63
|
self.class.endpoints[:delete][:http_method],
|
61
64
|
self.class.api_path_for(:delete, self),
|
65
|
+
headers: headers,
|
62
66
|
)
|
63
67
|
true
|
64
68
|
end
|
data/lib/brick_ftp/client.rb
CHANGED
@@ -342,9 +342,10 @@ module BrickFTP
|
|
342
342
|
# Delete a file.
|
343
343
|
# @see https://brickftp.com/ja/docs/rest-api/file-operations/
|
344
344
|
# @param file [BrickFTP::API::File] file object.
|
345
|
+
# @param recursive: [Boolean]
|
345
346
|
# @return [Boolean] return true.
|
346
|
-
def delete_file(file)
|
347
|
-
file.destroy
|
347
|
+
def delete_file(file, recursive: false)
|
348
|
+
file.destroy(recursive: recursive)
|
348
349
|
end
|
349
350
|
|
350
351
|
# Upload file.
|
@@ -34,8 +34,8 @@ module BrickFTP
|
|
34
34
|
@conn.read_timeout = BrickFTP.config.read_timeout
|
35
35
|
end
|
36
36
|
|
37
|
-
def get(path, params: {})
|
38
|
-
case res = request(:get, path, params: params)
|
37
|
+
def get(path, params: {}, headers: {})
|
38
|
+
case res = request(:get, path, params: params, headers: headers)
|
39
39
|
when Net::HTTPSuccess
|
40
40
|
res.body.nil? || res.body.empty? ? {} : JSON.parse(res.body)
|
41
41
|
else
|
@@ -44,8 +44,8 @@ module BrickFTP
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def post(path, params: {})
|
48
|
-
case res = request(:post, path, params: params)
|
47
|
+
def post(path, params: {}, headers: {})
|
48
|
+
case res = request(:post, path, params: params, headers: headers)
|
49
49
|
when Net::HTTPSuccess, Net::HTTPCreated
|
50
50
|
res.body.nil? || res.body.empty? ? {} : JSON.parse(res.body)
|
51
51
|
else
|
@@ -54,8 +54,8 @@ module BrickFTP
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def put(path, params: {})
|
58
|
-
case res = request(:put, path, params: params)
|
57
|
+
def put(path, params: {}, headers: {})
|
58
|
+
case res = request(:put, path, params: params, headers: headers)
|
59
59
|
when Net::HTTPSuccess
|
60
60
|
res.body.nil? || res.body.empty? ? {} : JSON.parse(res.body)
|
61
61
|
else
|
@@ -64,8 +64,8 @@ module BrickFTP
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
def delete(path, params: {})
|
68
|
-
case res = request(:delete, path, params: params)
|
67
|
+
def delete(path, params: {}, headers: {})
|
68
|
+
case res = request(:delete, path, params: params, headers: headers)
|
69
69
|
when Net::HTTPSuccess
|
70
70
|
true
|
71
71
|
else
|
data/lib/brick_ftp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brick_ftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- koshigoe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|