files.com 1.0.100 → 1.0.101

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
  SHA256:
3
- metadata.gz: de1ee65d3dc0f22e11043ad9510774254de6242cfed0379e7889891d7d4e01f7
4
- data.tar.gz: f84015f3af4655695eaa9707376de457cf54cf79499c73bace3875dbbc355c6c
3
+ metadata.gz: e715ef5d2664eec58ebfa067ff3014018b9f386cfc149a8238e2e9d8bb549331
4
+ data.tar.gz: d135e40db26bd6c064822453b2999d4f33ea2df40c93096496acc7e4f8db2919
5
5
  SHA512:
6
- metadata.gz: bb0c1c342f5d9417ef8ecb3124256c9dbd00207002f343db51a96798ce5b6ef074e02f08c86521a678b8e09ac6ddc51cde6985d6f83a1d1cf7414d8819158b1e
7
- data.tar.gz: 19ec076e011a1d909ef6fd63e36a02063414e39928aff129741be4a972f68df8737990ce07c44952f4e7fedc4a3ea786459c29f025ce5d83ce15ef9558b5508a
6
+ metadata.gz: 5afec2ddef519a7a3c72659adf683d9a2ec227de7bfb511fbe850cda970b25c5055c661bff8ec5a0b42bef24f56a9d91224accc4c9600c885ea21542daacaaff
7
+ data.tar.gz: 920892400a280447dc341b269e0c48d2f15284e326869ccf4f7a2e64f0a2ed9c3c7a2db356cc40671ad3ce4b3ac0ce7272bc5f0647dffac8ea43229f5f2f0e51
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.100
1
+ 1.0.101
@@ -30,7 +30,7 @@
30
30
  ## List Permissions
31
31
 
32
32
  ```
33
- Files::Permission.list(path,
33
+ Files::Permission.list(
34
34
  page: 1,
35
35
  per_page: 1,
36
36
  group_id: 1,
@@ -63,7 +63,7 @@ Files::Permission.list(path,
63
63
  ## Create Permission
64
64
 
65
65
  ```
66
- Files::Permission.create(path,
66
+ Files::Permission.create(
67
67
  group_id: 1,
68
68
  permission: "full",
69
69
  recursive: true,
@@ -93,3 +93,18 @@ Files::Permission.delete(id)
93
93
  ### Parameters
94
94
 
95
95
  * `id` (int64): Required - Permission ID.
96
+
97
+
98
+ ---
99
+
100
+ ## Delete Permission
101
+
102
+ ```
103
+ permission = Files::Permission.list_for(path).first
104
+
105
+ permission.delete
106
+ ```
107
+
108
+ ### Parameters
109
+
110
+ * `id` (int64): Required - Permission ID.
@@ -28,7 +28,7 @@
28
28
  ## List Requests
29
29
 
30
30
  ```
31
- Files::Request.list(path,
31
+ Files::Request.list(
32
32
  page: 1,
33
33
  per_page: 1,
34
34
  mine: true
@@ -51,7 +51,7 @@ Files::Request.list(path,
51
51
  ## List Requests
52
52
 
53
53
  ```
54
- Files::Request.find_folder(path,
54
+ Files::Request.get_folder(path,
55
55
  page: 1,
56
56
  per_page: 1,
57
57
  mine: true
@@ -74,7 +74,8 @@ Files::Request.find_folder(path,
74
74
  ## Create Request
75
75
 
76
76
  ```
77
- Files::Request.create(path,
77
+ Files::Request.create(
78
+ path: "path",
78
79
  destination: "destination"
79
80
  )
80
81
  ```
@@ -98,3 +99,18 @@ Files::Request.delete(id)
98
99
  ### Parameters
99
100
 
100
101
  * `id` (int64): Required - Request ID.
102
+
103
+
104
+ ---
105
+
106
+ ## Delete Request
107
+
108
+ ```
109
+ request = Files::Request.list_for(path).first
110
+
111
+ request.delete
112
+ ```
113
+
114
+ ### Parameters
115
+
116
+ * `id` (int64): Required - Request ID.
@@ -873,12 +873,8 @@ module Files
873
873
  end
874
874
 
875
875
  def save
876
- if @attributes[:path]
877
- update(@attributes)
878
- else
879
- new_obj = File.create(@attributes, @options)
880
- @attributes = new_obj.attributes
881
- end
876
+ new_obj = File.create(path, @attributes, @options)
877
+ @attributes = new_obj.attributes
882
878
  end
883
879
 
884
880
  # Download file
@@ -304,12 +304,8 @@ module Files
304
304
  end
305
305
 
306
306
  def save
307
- if @attributes[:path]
308
- raise NotImplementedError.new("The Folder object doesn't support updates.")
309
- else
310
- new_obj = Folder.create(@attributes, @options)
311
- @attributes = new_obj.attributes
312
- end
307
+ new_obj = Folder.create(path, @attributes, @options)
308
+ @attributes = new_obj.attributes
313
309
  end
314
310
 
315
311
  # Parameters:
@@ -109,12 +109,8 @@ module Files
109
109
  end
110
110
 
111
111
  def save
112
- if @attributes[:path]
113
- raise NotImplementedError.new("The Lock object doesn't support updates.")
114
- else
115
- new_obj = Lock.create(@attributes, @options)
116
- @attributes = new_obj.attributes
117
- end
112
+ new_obj = Lock.create(path, @attributes, @options)
113
+ @attributes = new_obj.attributes
118
114
  end
119
115
 
120
116
  # Parameters:
@@ -81,8 +81,22 @@ module Files
81
81
  @attributes[:recursive] = value
82
82
  end
83
83
 
84
+ def delete(params = {})
85
+ params ||= {}
86
+ params[:id] = @attributes[:id]
87
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
88
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
89
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
90
+
91
+ Api.send_request("/permissions/#{@attributes[:id]}", :delete, params, @options)
92
+ end
93
+
94
+ def destroy(params = {})
95
+ delete(params)
96
+ end
97
+
84
98
  def save
85
- if @attributes[:path]
99
+ if @attributes[:id]
86
100
  raise NotImplementedError.new("The Permission object doesn't support updates.")
87
101
  else
88
102
  new_obj = Permission.create(@attributes, @options)
@@ -106,9 +120,7 @@ module Files
106
120
  # group_id - string - DEPRECATED: Group ID. If provided, will scope permissions to this group. Use `filter[group_id]` instead.`
107
121
  # user_id - string - DEPRECATED: User ID. If provided, will scope permissions to this user. Use `filter[user_id]` instead.`
108
122
  # include_groups - boolean - If searching by user or group, also include user's permissions that are inherited from its groups?
109
- def self.list(path, params = {}, options = {})
110
- params ||= {}
111
- params[:path] = path
123
+ def self.list(params = {}, options = {})
112
124
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
113
125
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
114
126
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
@@ -129,8 +141,8 @@ module Files
129
141
  end
130
142
  end
131
143
 
132
- def self.all(path, params = {}, options = {})
133
- list(path, params, options)
144
+ def self.all(params = {}, options = {})
145
+ list(params, options)
134
146
  end
135
147
 
136
148
  # Parameters:
@@ -140,9 +152,7 @@ module Files
140
152
  # recursive - boolean - Apply to subfolders recursively?
141
153
  # user_id - int64 - User ID. Provide `username` or `user_id`
142
154
  # username - string - User username. Provide `username` or `user_id`
143
- def self.create(path, params = {}, options = {})
144
- params ||= {}
145
- params[:path] = path
155
+ def self.create(params = {}, options = {})
146
156
  raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
147
157
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
148
158
  raise InvalidParameterError.new("Bad parameter: permission must be an String") if params.dig(:permission) and !params.dig(:permission).is_a?(String)
@@ -153,8 +163,6 @@ module Files
153
163
  Permission.new(response.data, options)
154
164
  end
155
165
 
156
- # Parameters:
157
- # id (required) - int64 - Permission ID.
158
166
  def self.delete(id, params = {}, options = {})
159
167
  params ||= {}
160
168
  params[:id] = id
@@ -81,8 +81,22 @@ module Files
81
81
  @attributes[:group_ids] = value
82
82
  end
83
83
 
84
+ def delete(params = {})
85
+ params ||= {}
86
+ params[:id] = @attributes[:id]
87
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
88
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
89
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
90
+
91
+ Api.send_request("/requests/#{@attributes[:id]}", :delete, params, @options)
92
+ end
93
+
94
+ def destroy(params = {})
95
+ delete(params)
96
+ end
97
+
84
98
  def save
85
- if @attributes[:path]
99
+ if @attributes[:id]
86
100
  raise NotImplementedError.new("The Request object doesn't support updates.")
87
101
  else
88
102
  new_obj = Request.create(@attributes, @options)
@@ -98,9 +112,7 @@ module Files
98
112
  # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id`, `folder_id` or `destination`.
99
113
  # mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
100
114
  # path - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
101
- def self.list(path, params = {}, options = {})
102
- params ||= {}
103
- params[:path] = path
115
+ def self.list(params = {}, options = {})
104
116
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
105
117
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
106
118
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
@@ -113,8 +125,8 @@ module Files
113
125
  end
114
126
  end
115
127
 
116
- def self.all(path, params = {}, options = {})
117
- list(path, params, options)
128
+ def self.all(params = {}, options = {})
129
+ list(params, options)
118
130
  end
119
131
 
120
132
  # Parameters:
@@ -125,7 +137,7 @@ module Files
125
137
  # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id`, `folder_id` or `destination`.
126
138
  # mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
127
139
  # path (required) - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
128
- def self.find_folder(path, params = {}, options = {})
140
+ def self.get_folder(path, params = {}, options = {})
129
141
  params ||= {}
130
142
  params[:path] = path
131
143
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
@@ -146,9 +158,7 @@ module Files
146
158
  # destination (required) - string - Destination filename (without extension) to request.
147
159
  # user_ids - string - A list of user IDs to request the file from. If sent as a string, it should be comma-delimited.
148
160
  # group_ids - string - A list of group IDs to request the file from. If sent as a string, it should be comma-delimited.
149
- def self.create(path, params = {}, options = {})
150
- params ||= {}
151
- params[:path] = path
161
+ def self.create(params = {}, options = {})
152
162
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
153
163
  raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String)
154
164
  raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String)
@@ -160,8 +170,6 @@ module Files
160
170
  Request.new(response.data, options)
161
171
  end
162
172
 
163
- # Parameters:
164
- # id (required) - int64 - Request ID.
165
173
  def self.delete(id, params = {}, options = {})
166
174
  params ||= {}
167
175
  params[:id] = id
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: files.com
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.100
4
+ version: 1.0.101
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-31 00:00:00.000000000 Z
11
+ date: 2020-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable