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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 198dc4d1f0e1e4e54d6fc3a657ff3f178bd29223
4
- data.tar.gz: 9d7ec78b7a4962011c97452652cebbe1ab93c5ea
3
+ metadata.gz: 3f72f787154323bf71db253479add1ae727d50dc
4
+ data.tar.gz: c4cef1a4a3144b8335b08434b2f7a624d5f98ca2
5
5
  SHA512:
6
- metadata.gz: aa690b6d0c45c151e6d5f53de44313dbcbd1dc435fd866349cb724258f81d5fdafdc9e215b065e69b90e392d7c4633b14c24998cf62739dc404537366954f45f
7
- data.tar.gz: c91092878c30d9d73e933dd2061c0a71dfd5b3764e213ebec3fefea835bb90bee7323a3aff3e3b0113fe9e6ee1f80b56c85441d3c59d6d80c198ca9ffab5dd2b
6
+ metadata.gz: e3d30929cf2fabbac4b340f739b3b78491df2f3186f42392fae5c7d8afbe15aabe97f7623cde45c5e54f8b3cd3a83f434aad5bcdccf28ad6946033f99e0f2014
7
+ data.tar.gz: f601b717e76175f5de9af387d4fd65d2ec63a3c910779c16f3cbfc8ad0245931e4b770f43ce69d3fd103092c34df15877da5889cc5329645feade3abd26a0dec
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module BrickFTP
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
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.5
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-17 00:00:00.000000000 Z
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler