brick_ftp 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -2
- data/lib/brick_ftp/client.rb +74 -30
- 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: 67e27256028d06b5cb9167defaf94070389e78c7
|
4
|
+
data.tar.gz: 5375380bdd23e8bb8c9e06fe40269783e360ae0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9120b3055417d1a7980ed09330934f89eab65f78a767a488662d8abcf022bea2b29945c09e706bbbfbd10427545c7eda980ea24f901fb60707a34f6873f1d221
|
7
|
+
data.tar.gz: d35bb41e786805d6006bfa3ccf3685cbdf8db0e1398bd525d21bf8e5e6ba817d9e98dc4c7719582086488b92a85e20fb430568941da91e09fea536511f40eae6
|
data/CHANGELOG.md
CHANGED
@@ -2,16 +2,28 @@ Changelog
|
|
2
2
|
====
|
3
3
|
|
4
4
|
|
5
|
-
[unreleased](https://github.com/koshigoe/brick_ftp/compare/v0.
|
5
|
+
[unreleased](https://github.com/koshigoe/brick_ftp/compare/v0.5.0...master)
|
6
6
|
----
|
7
7
|
|
8
|
-
[Full Changelog](https://github.com/koshigoe/brick_ftp/compare/v0.
|
8
|
+
[Full Changelog](https://github.com/koshigoe/brick_ftp/compare/v0.5.0...master)
|
9
9
|
|
10
10
|
### Enhancements:
|
11
11
|
|
12
12
|
### Fixed Bugs:
|
13
13
|
|
14
14
|
|
15
|
+
[v0.5.0](https://github.com/koshigoe/brick_ftp/compare/v0.4.2...v0.5.0)
|
16
|
+
----
|
17
|
+
|
18
|
+
[Full Changelog](https://github.com/koshigoe/brick_ftp/compare/v0.4.2...v0.5.0)
|
19
|
+
|
20
|
+
### Enhancements:
|
21
|
+
|
22
|
+
- [#65](https://github.com/koshigoe/brick_ftp/pull/65) Allow to specify resource as ID
|
23
|
+
|
24
|
+
### Fixed Bugs:
|
25
|
+
|
26
|
+
|
15
27
|
[0.4.2](https://github.com/koshigoe/brick_ftp/compare/v0.4.1...v0.4.2)
|
16
28
|
----
|
17
29
|
|
data/lib/brick_ftp/client.rb
CHANGED
@@ -38,19 +38,19 @@ module BrickFTP
|
|
38
38
|
|
39
39
|
# Update an existing user.
|
40
40
|
# @see https://brickftp.com/ja/docs/rest-api/users/
|
41
|
-
# @param
|
41
|
+
# @param user_or_id [BrickFTP::API::User, Integer] user object or user id.
|
42
42
|
# @param attributes [Hash] User's attributes.
|
43
43
|
# @return [BrickFTP::API::User] user object.
|
44
|
-
def update_user(
|
45
|
-
|
44
|
+
def update_user(user_or_id, attributes)
|
45
|
+
instantize_user(user_or_id).update(attributes)
|
46
46
|
end
|
47
47
|
|
48
48
|
# Delete a user.
|
49
49
|
# @see https://brickftp.com/ja/docs/rest-api/users/
|
50
|
-
# @param
|
50
|
+
# @param user_or_id [BrickFTP::API::User, Integer] user object or user id.
|
51
51
|
# @return [Boolean] return true.
|
52
|
-
def delete_user(
|
53
|
-
|
52
|
+
def delete_user(user_or_id)
|
53
|
+
instantize_user(user_or_id).destroy
|
54
54
|
end
|
55
55
|
|
56
56
|
# List all groups on the current site.
|
@@ -76,19 +76,19 @@ module BrickFTP
|
|
76
76
|
|
77
77
|
# Update an existing group.
|
78
78
|
# @see https://brickftp.com/ja/docs/rest-api/groups/
|
79
|
-
# @param
|
79
|
+
# @param group_or_id [BrickFTP::API::Group, Integer] group object or group id.
|
80
80
|
# @param attributes [Hash] Group's attributes.
|
81
81
|
# @return [BrickFTP::API::Group] group object.
|
82
|
-
def update_group(
|
83
|
-
|
82
|
+
def update_group(group_or_id, attributes)
|
83
|
+
instantize_group(group_or_id).update(attributes)
|
84
84
|
end
|
85
85
|
|
86
86
|
# Delete a group.
|
87
87
|
# @see https://brickftp.com/ja/docs/rest-api/groups/
|
88
|
-
# @param
|
88
|
+
# @param group_or_id [BrickFTP::API::Group, Integer] group object or group id.
|
89
89
|
# @return [Boolean] return true.
|
90
|
-
def delete_group(
|
91
|
-
|
90
|
+
def delete_group(group_or_id)
|
91
|
+
instantize_group(group_or_id).destroy
|
92
92
|
end
|
93
93
|
|
94
94
|
# List all permissions on the current site.
|
@@ -106,10 +106,10 @@ module BrickFTP
|
|
106
106
|
|
107
107
|
# Delete a permission.
|
108
108
|
# @see https://brickftp.com/ja/docs/rest-api/permissions/
|
109
|
-
# @param
|
109
|
+
# @param permission_or_id [BrickFTP::API::Permission, Integer] permission object or permission id.
|
110
110
|
# @return [Boolean] return true.
|
111
|
-
def delete_permission(
|
112
|
-
|
111
|
+
def delete_permission(permission_or_id)
|
112
|
+
instantize_permission(permission_or_id).destroy
|
113
113
|
end
|
114
114
|
|
115
115
|
# List all notifications on the current site.
|
@@ -127,10 +127,10 @@ module BrickFTP
|
|
127
127
|
|
128
128
|
# Delete a notification.
|
129
129
|
# @see https://brickftp.com/ja/docs/rest-api/notifications/
|
130
|
-
# @param
|
130
|
+
# @param notification_or_id [BrickFTP::API::Notification, Integer] notification object or notification id.
|
131
131
|
# @return [Boolean] return true.
|
132
|
-
def delete_notification(
|
133
|
-
|
132
|
+
def delete_notification(notification_or_id)
|
133
|
+
instantize_notification(notification_or_id).destroy
|
134
134
|
end
|
135
135
|
|
136
136
|
# Show the entire history for the current site.
|
@@ -215,10 +215,10 @@ module BrickFTP
|
|
215
215
|
|
216
216
|
# Delete a bundle.
|
217
217
|
# @see https://brickftp.com/ja/docs/rest-api/bundles/
|
218
|
-
# @param
|
218
|
+
# @param bundle_or_id [BrickFTP::API::Bundle, Integer] bundle object or bundle id.
|
219
219
|
# @return [Boolean] return true.
|
220
|
-
def delete_bundle(
|
221
|
-
|
220
|
+
def delete_bundle(bundle_or_id)
|
221
|
+
instantize_bundle(bundle_or_id).destroy
|
222
222
|
end
|
223
223
|
|
224
224
|
# List the contents of a bundle.
|
@@ -265,19 +265,19 @@ module BrickFTP
|
|
265
265
|
|
266
266
|
# Update an existing behavior.
|
267
267
|
# @see https://brickftp.com/ja/docs/rest-api/behaviors/
|
268
|
-
# @param
|
268
|
+
# @param behavior_or_id [BrickFTP::API::Behavior, Integer] behavior object or behavior id.
|
269
269
|
# @param attributes [Hash] Behavior's attributes.
|
270
270
|
# @return [BrickFTP::API::Behavior] behavior object.
|
271
|
-
def update_behavior(
|
272
|
-
|
271
|
+
def update_behavior(behavior_or_id, attributes)
|
272
|
+
instantize_behavior(behavior_or_id).update(attributes)
|
273
273
|
end
|
274
274
|
|
275
275
|
# Delete a behavior.
|
276
276
|
# @see https://brickftp.com/ja/docs/rest-api/behaviors/
|
277
|
-
# @param
|
277
|
+
# @param behavior_or_id [BrickFTP::API::Behavior, Integer] behavior object or behavior id.
|
278
278
|
# @return [Boolean] return true.
|
279
|
-
def delete_behavior(
|
280
|
-
|
279
|
+
def delete_behavior(behavior_or_id)
|
280
|
+
instantize_behavior(behavior_or_id).destroy
|
281
281
|
end
|
282
282
|
|
283
283
|
# shows the behaviors that apply to the given path.
|
@@ -344,11 +344,11 @@ module BrickFTP
|
|
344
344
|
|
345
345
|
# Delete a file.
|
346
346
|
# @see https://brickftp.com/ja/docs/rest-api/file-operations/
|
347
|
-
# @param
|
347
|
+
# @param file_or_path [BrickFTP::API::File, String] file object or file(folder) path.
|
348
348
|
# @param recursive: [Boolean]
|
349
349
|
# @return [Boolean] return true.
|
350
|
-
def delete_file(
|
351
|
-
|
350
|
+
def delete_file(file_or_path, recursive: false)
|
351
|
+
instantize_file(file_or_path).destroy(recursive: recursive)
|
352
352
|
end
|
353
353
|
|
354
354
|
# Upload file.
|
@@ -365,5 +365,49 @@ module BrickFTP
|
|
365
365
|
def site_usage
|
366
366
|
BrickFTP::API::SiteUsage.find
|
367
367
|
end
|
368
|
+
|
369
|
+
private
|
370
|
+
|
371
|
+
def instantize_user(user_or_id)
|
372
|
+
return user_or_id if user_or_id.is_a?(BrickFTP::API::User)
|
373
|
+
|
374
|
+
BrickFTP::API::User.new(id: user_or_id)
|
375
|
+
end
|
376
|
+
|
377
|
+
def instantize_group(group_or_id)
|
378
|
+
return group_or_id if group_or_id.is_a?(BrickFTP::API::Group)
|
379
|
+
|
380
|
+
BrickFTP::API::Group.new(id: group_or_id)
|
381
|
+
end
|
382
|
+
|
383
|
+
def instantize_permission(permission_or_id)
|
384
|
+
return permission_or_id if permission_or_id.is_a?(BrickFTP::API::Permission)
|
385
|
+
|
386
|
+
BrickFTP::API::Permission.new(id: permission_or_id)
|
387
|
+
end
|
388
|
+
|
389
|
+
def instantize_notification(notification_or_id)
|
390
|
+
return notification_or_id if notification_or_id.is_a?(BrickFTP::API::Notification)
|
391
|
+
|
392
|
+
BrickFTP::API::Notification.new(id: notification_or_id)
|
393
|
+
end
|
394
|
+
|
395
|
+
def instantize_bundle(bundle_or_id)
|
396
|
+
return bundle_or_id if bundle_or_id.is_a?(BrickFTP::API::Bundle)
|
397
|
+
|
398
|
+
BrickFTP::API::Bundle.new(id: bundle_or_id)
|
399
|
+
end
|
400
|
+
|
401
|
+
def instantize_behavior(behavior_or_id)
|
402
|
+
return behavior_or_id if behavior_or_id.is_a?(BrickFTP::API::Behavior)
|
403
|
+
|
404
|
+
BrickFTP::API::Behavior.new(id: behavior_or_id)
|
405
|
+
end
|
406
|
+
|
407
|
+
def instantize_file(file_or_path)
|
408
|
+
return file_or_path if file_or_path.is_a?(BrickFTP::API::File)
|
409
|
+
|
410
|
+
BrickFTP::API::File.new(path: file_or_path)
|
411
|
+
end
|
368
412
|
end
|
369
413
|
end
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- koshigoe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|