Class: Files::UserLifecycleRule
- Inherits:
-
Object
- Object
- Files::UserLifecycleRule
- Defined in:
- lib/files.com/models/user_lifecycle_rule.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .all(params = {}, options = {}) ⇒ Object
-
.create(params = {}, options = {}) ⇒ Object
Parameters: action - string - Action to take on inactive users (disable or delete) apply_to_all_workspaces - boolean - If true, a default-workspace rule also applies to users in all workspaces.
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - int64 - User Lifecycle Rule ID.
- .get(id, params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: cursor - string - Used for pagination.
-
.update(id, params = {}, options = {}) ⇒ Object
Parameters: action - string - Action to take on inactive users (disable or delete) apply_to_all_workspaces - boolean - If true, a default-workspace rule also applies to users in all workspaces.
Instance Method Summary collapse
-
#action ⇒ Object
string - Action to take on inactive users (disable or delete).
- #action=(value) ⇒ Object
-
#apply_to_all_workspaces ⇒ Object
boolean - If true, a default-workspace rule also applies to users in all workspaces.
- #apply_to_all_workspaces=(value) ⇒ Object
-
#authentication_method ⇒ Object
string - User authentication method for which the rule will apply.
- #authentication_method=(value) ⇒ Object
- #delete(params = {}) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#group_ids ⇒ Object
array(int64) - Array of Group IDs to which the rule applies.
- #group_ids=(value) ⇒ Object
-
#id ⇒ Object
int64 - User Lifecycle Rule ID.
- #id=(value) ⇒ Object
-
#inactivity_days ⇒ Object
int64 - Number of days of inactivity before the rule applies.
- #inactivity_days=(value) ⇒ Object
-
#include_folder_admins ⇒ Object
boolean - If true, the rule will apply to folder admins.
- #include_folder_admins=(value) ⇒ Object
-
#include_site_admins ⇒ Object
boolean - If true, the rule will apply to site admins.
- #include_site_admins=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ UserLifecycleRule
constructor
A new instance of UserLifecycleRule.
-
#name ⇒ Object
string - User Lifecycle Rule name.
- #name=(value) ⇒ Object
-
#partner_tag ⇒ Object
string - If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule.
- #partner_tag=(value) ⇒ Object
- #save ⇒ Object
-
#site_id ⇒ Object
int64 - Site ID.
- #site_id=(value) ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: action - string - Action to take on inactive users (disable or delete) apply_to_all_workspaces - boolean - If true, a default-workspace rule also applies to users in all workspaces.
-
#user_state ⇒ Object
string - State of the users to apply the rule to (inactive or disabled).
- #user_state=(value) ⇒ Object
-
#user_tag ⇒ Object
string - If provided, only users with this tag will be affected by the rule.
- #user_tag=(value) ⇒ Object
-
#workspace_id ⇒ Object
int64 - Workspace ID.
- #workspace_id=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ UserLifecycleRule
Returns a new instance of UserLifecycleRule.
7 8 9 10 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
212 213 214 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 212 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
action - string - Action to take on inactive users (disable or delete)
apply_to_all_workspaces - boolean - If true, a default-workspace rule also applies to users in all workspaces.
authentication_method - string - User authentication method for which the rule will apply.
group_ids - array(int64) - Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
inactivity_days - int64 - Number of days of inactivity before the rule applies
include_site_admins - boolean - If true, the rule will apply to site admins.
include_folder_admins - boolean - If true, the rule will apply to folder admins.
name - string - User Lifecycle Rule name
partner_tag - string - If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
user_state - string - State of the users to apply the rule to (inactive or disabled)
user_tag - string - If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
workspace_id - int64 - Workspace ID. `0` means the default workspace.
245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 245 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: action must be an String") if params[:action] and !params[:action].is_a?(String) raise InvalidParameterError.new("Bad parameter: authentication_method must be an String") if params[:authentication_method] and !params[:authentication_method].is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an Array") if params[:group_ids] and !params[:group_ids].is_a?(Array) raise InvalidParameterError.new("Bad parameter: inactivity_days must be an Integer") if params[:inactivity_days] and !params[:inactivity_days].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: partner_tag must be an String") if params[:partner_tag] and !params[:partner_tag].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_state must be an String") if params[:user_state] and !params[:user_state].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_tag must be an String") if params[:user_tag] and !params[:user_tag].is_a?(String) raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer) response, = Api.send_request("/user_lifecycle_rules", :post, params, ) UserLifecycleRule.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
292 293 294 295 296 297 298 299 300 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 292 def self.delete(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/user_lifecycle_rules/#{params[:id]}", :delete, params, ) nil end |
.destroy(id, params = {}, options = {}) ⇒ Object
302 303 304 305 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 302 def self.destroy(id, params = {}, = {}) delete(id, params, ) nil end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - int64 - User Lifecycle Rule ID.
218 219 220 221 222 223 224 225 226 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 218 def self.find(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/user_lifecycle_rules/#{params[:id]}", :get, params, ) UserLifecycleRule.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
228 229 230 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 228 def self.get(id, params = {}, = {}) find(id, params, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id` and `workspace_id`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `workspace_id`.
201 202 203 204 205 206 207 208 209 210 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 201 def self.list(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash) List.new(UserLifecycleRule, params) do Api.send_request("/user_lifecycle_rules", :get, params, ) end end |
.update(id, params = {}, options = {}) ⇒ Object
Parameters:
action - string - Action to take on inactive users (disable or delete)
apply_to_all_workspaces - boolean - If true, a default-workspace rule also applies to users in all workspaces.
authentication_method - string - User authentication method for which the rule will apply.
group_ids - array(int64) - Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
inactivity_days - int64 - Number of days of inactivity before the rule applies
include_site_admins - boolean - If true, the rule will apply to site admins.
include_folder_admins - boolean - If true, the rule will apply to folder admins.
name - string - User Lifecycle Rule name
partner_tag - string - If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
user_state - string - State of the users to apply the rule to (inactive or disabled)
user_tag - string - If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
workspace_id - int64 - Workspace ID. `0` means the default workspace.
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 273 def self.update(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: action must be an String") if params[:action] and !params[:action].is_a?(String) raise InvalidParameterError.new("Bad parameter: authentication_method must be an String") if params[:authentication_method] and !params[:authentication_method].is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an Array") if params[:group_ids] and !params[:group_ids].is_a?(Array) raise InvalidParameterError.new("Bad parameter: inactivity_days must be an Integer") if params[:inactivity_days] and !params[:inactivity_days].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: partner_tag must be an String") if params[:partner_tag] and !params[:partner_tag].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_state must be an String") if params[:user_state] and !params[:user_state].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_tag must be an String") if params[:user_tag] and !params[:user_tag].is_a?(String) raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/user_lifecycle_rules/#{params[:id]}", :patch, params, ) UserLifecycleRule.new(response.data, ) end |
Instance Method Details
#action ⇒ Object
string - Action to take on inactive users (disable or delete)
40 41 42 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 40 def action @attributes[:action] end |
#action=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 44 def action=(value) @attributes[:action] = value end |
#apply_to_all_workspaces ⇒ Object
boolean - If true, a default-workspace rule also applies to users in all workspaces.
76 77 78 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 76 def apply_to_all_workspaces @attributes[:apply_to_all_workspaces] end |
#apply_to_all_workspaces=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 80 def apply_to_all_workspaces=(value) @attributes[:apply_to_all_workspaces] = value end |
#authentication_method ⇒ Object
string - User authentication method for which the rule will apply.
22 23 24 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 22 def authentication_method @attributes[:authentication_method] end |
#authentication_method=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 26 def authentication_method=(value) @attributes[:authentication_method] = value end |
#delete(params = {}) ⇒ Object
170 171 172 173 174 175 176 177 178 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 170 def delete(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/user_lifecycle_rules/#{@attributes[:id]}", :delete, params, @options) end |
#destroy(params = {}) ⇒ Object
180 181 182 183 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 180 def destroy(params = {}) delete(params) nil end |
#group_ids ⇒ Object
array(int64) - Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
31 32 33 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 31 def group_ids @attributes[:group_ids] end |
#group_ids=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 35 def group_ids=(value) @attributes[:group_ids] = value end |
#id ⇒ Object
int64 - User Lifecycle Rule ID
13 14 15 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 13 def id @attributes[:id] end |
#id=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 17 def id=(value) @attributes[:id] = value end |
#inactivity_days ⇒ Object
int64 - Number of days of inactivity before the rule applies
49 50 51 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 49 def inactivity_days @attributes[:inactivity_days] end |
#inactivity_days=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 53 def inactivity_days=(value) @attributes[:inactivity_days] = value end |
#include_folder_admins ⇒ Object
boolean - If true, the rule will apply to folder admins.
58 59 60 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 58 def include_folder_admins @attributes[:include_folder_admins] end |
#include_folder_admins=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 62 def include_folder_admins=(value) @attributes[:include_folder_admins] = value end |
#include_site_admins ⇒ Object
boolean - If true, the rule will apply to site admins.
67 68 69 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 67 def include_site_admins @attributes[:include_site_admins] end |
#include_site_admins=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 71 def include_site_admins=(value) @attributes[:include_site_admins] = value end |
#name ⇒ Object
string - User Lifecycle Rule name
85 86 87 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 85 def name @attributes[:name] end |
#name=(value) ⇒ Object
89 90 91 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 89 def name=(value) @attributes[:name] = value end |
#partner_tag ⇒ Object
string - If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
94 95 96 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 94 def partner_tag @attributes[:partner_tag] end |
#partner_tag=(value) ⇒ Object
98 99 100 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 98 def partner_tag=(value) @attributes[:partner_tag] = value end |
#save ⇒ Object
185 186 187 188 189 190 191 192 193 194 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 185 def save if @attributes[:id] new_obj = update(@attributes) else new_obj = UserLifecycleRule.create(@attributes, @options) end @attributes = new_obj.attributes true end |
#site_id ⇒ Object
int64 - Site ID
103 104 105 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 103 def site_id @attributes[:site_id] end |
#site_id=(value) ⇒ Object
107 108 109 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 107 def site_id=(value) @attributes[:site_id] = value end |
#update(params = {}) ⇒ Object
Parameters:
action - string - Action to take on inactive users (disable or delete)
apply_to_all_workspaces - boolean - If true, a default-workspace rule also applies to users in all workspaces.
authentication_method - string - User authentication method for which the rule will apply.
group_ids - array(int64) - Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
inactivity_days - int64 - Number of days of inactivity before the rule applies
include_site_admins - boolean - If true, the rule will apply to site admins.
include_folder_admins - boolean - If true, the rule will apply to folder admins.
name - string - User Lifecycle Rule name
partner_tag - string - If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
user_state - string - State of the users to apply the rule to (inactive or disabled)
user_tag - string - If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
workspace_id - int64 - Workspace ID. `0` means the default workspace.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 151 def update(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: action must be an String") if params[:action] and !params[:action].is_a?(String) raise InvalidParameterError.new("Bad parameter: authentication_method must be an String") if params[:authentication_method] and !params[:authentication_method].is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an Array") if params[:group_ids] and !params[:group_ids].is_a?(Array) raise InvalidParameterError.new("Bad parameter: inactivity_days must be an Integer") if params[:inactivity_days] and !params[:inactivity_days].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: partner_tag must be an String") if params[:partner_tag] and !params[:partner_tag].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_state must be an String") if params[:user_state] and !params[:user_state].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_tag must be an String") if params[:user_tag] and !params[:user_tag].is_a?(String) raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/user_lifecycle_rules/#{@attributes[:id]}", :patch, params, @options) end |
#user_state ⇒ Object
string - State of the users to apply the rule to (inactive or disabled)
121 122 123 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 121 def user_state @attributes[:user_state] end |
#user_state=(value) ⇒ Object
125 126 127 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 125 def user_state=(value) @attributes[:user_state] = value end |
#user_tag ⇒ Object
string - If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
130 131 132 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 130 def user_tag @attributes[:user_tag] end |
#user_tag=(value) ⇒ Object
134 135 136 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 134 def user_tag=(value) @attributes[:user_tag] = value end |
#workspace_id ⇒ Object
int64 - Workspace ID. ‘0` means the default workspace.
112 113 114 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 112 def workspace_id @attributes[:workspace_id] end |
#workspace_id=(value) ⇒ Object
116 117 118 |
# File 'lib/files.com/models/user_lifecycle_rule.rb', line 116 def workspace_id=(value) @attributes[:workspace_id] = value end |