Class: Files::Automation
- Inherits:
-
Object
- Object
- Files::Automation
- Defined in:
- lib/files.com/models/automation.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: source - string - Source Path destination - string - DEPRECATED: Destination Path.
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - int64 - Automation ID.
- .get(id, params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: cursor - string - Used for pagination.
-
.update(id, params = {}, options = {}) ⇒ Object
Parameters: source - string - Source Path destination - string - DEPRECATED: Destination Path.
Instance Method Summary collapse
-
#automation ⇒ Object
string - Automation type.
- #automation=(value) ⇒ Object
- #delete(params = {}) ⇒ Object
-
#deleted ⇒ Object
boolean - Indicates if the automation has been deleted.
- #deleted=(value) ⇒ Object
-
#description ⇒ Object
string - Description for the this Automation.
- #description=(value) ⇒ Object
-
#destination ⇒ Object
string - DEPRECATED: Destination Path.
- #destination=(value) ⇒ Object
-
#destination_replace_from ⇒ Object
string - If set, this string in the destination path will be replaced with the value in ‘destination_replace_to`.
- #destination_replace_from=(value) ⇒ Object
-
#destination_replace_to ⇒ Object
string - If set, this string will replace the value ‘destination_replace_from` in the destination filename.
- #destination_replace_to=(value) ⇒ Object
-
#destinations ⇒ Object
array - Destination Path.
- #destinations=(value) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#disabled ⇒ Object
boolean - If true, this automation will not run.
- #disabled=(value) ⇒ Object
-
#group_ids ⇒ Object
array - IDs of Groups for the Automation (i.e. who to Request File from).
- #group_ids=(value) ⇒ Object
-
#id ⇒ Object
int64 - Automation ID.
- #id=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ Automation
constructor
A new instance of Automation.
-
#interval ⇒ Object
string - If trigger is ‘daily`, this specifies how often to run this automation.
- #interval=(value) ⇒ Object
-
#last_modified_at ⇒ Object
date-time - Time when automation was last modified.
- #last_modified_at=(value) ⇒ Object
-
#name ⇒ Object
string - Name for this automation.
- #name=(value) ⇒ Object
-
#path ⇒ Object
string - Path on which this Automation runs.
- #path=(value) ⇒ Object
-
#recurring_day ⇒ Object
int64 - If trigger type is ‘daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
- #recurring_day=(value) ⇒ Object
- #save ⇒ Object
-
#schedule ⇒ Object
object - If trigger is ‘custom_schedule`, Custom schedule description for when the automation should be run.
- #schedule=(value) ⇒ Object
-
#source ⇒ Object
string - Source Path.
- #source=(value) ⇒ Object
-
#sync_ids ⇒ Object
array - IDs of remote sync folder behaviors to run by this Automation.
- #sync_ids=(value) ⇒ Object
-
#trigger ⇒ Object
string - How this automation is triggered to run.
- #trigger=(value) ⇒ Object
-
#trigger_actions ⇒ Object
array - If trigger is ‘action`, this is the list of action types on which to trigger the automation.
- #trigger_actions=(value) ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: source - string - Source Path destination - string - DEPRECATED: Destination Path.
-
#user_id ⇒ Object
int64 - User ID of the Automation’s creator.
- #user_id=(value) ⇒ Object
-
#user_ids ⇒ Object
array - IDs of Users for the Automation (i.e. who to Request File from).
- #user_ids=(value) ⇒ Object
-
#value ⇒ Object
object - A Hash of attributes specific to the automation type.
- #value=(value) ⇒ Object
-
#webhook_url ⇒ Object
string - If trigger is ‘webhook`, this is the URL of the webhook to trigger the Automation.
- #webhook_url=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ Automation
Returns a new instance of Automation.
7 8 9 10 |
# File 'lib/files.com/models/automation.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/automation.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/automation.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
324 325 326 |
# File 'lib/files.com/models/automation.rb', line 324 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
source - string - Source Path
destination - string - DEPRECATED: Destination Path. Use `destinations` instead.
destinations - array(string) - A list of String destination paths or Hash of folder_path and optional file_path.
destination_replace_from - string - If set, this string in the destination path will be replaced with the value in `destination_replace_to`.
destination_replace_to - string - If set, this string will replace the value `destination_replace_from` in the destination filename. You can use special patterns here.
interval - string - How often to run this automation? One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`
path - string - Path on which this Automation runs. Supports globs.
sync_ids - string - A list of sync IDs the automation is associated with. If sent as a string, it should be comma-delimited.
user_ids - string - A list of user IDs the automation is associated with. If sent as a string, it should be comma-delimited.
group_ids - string - A list of group IDs the automation is associated with. If sent as a string, it should be comma-delimited.
schedule - object - Custom schedule for running this automation.
description - string - Description for the this Automation.
disabled - boolean - If true, this automation will not run.
name - string - Name for this automation.
trigger - string - How this automation is triggered to run. One of: `realtime`, `daily`, `custom_schedule`, `webhook`, `email`, or `action`.
trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
value - object - A Hash of attributes specific to the automation type.
recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
automation (required) - string - Automation type
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/files.com/models/automation.rb', line 364 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: source must be an String") if params[:source] and !params[:source].is_a?(String) raise InvalidParameterError.new("Bad parameter: destination must be an String") if params[:destination] and !params[:destination].is_a?(String) raise InvalidParameterError.new("Bad parameter: destinations must be an Array") if params[:destinations] and !params[:destinations].is_a?(Array) raise InvalidParameterError.new("Bad parameter: destination_replace_from must be an String") if params[:destination_replace_from] and !params[:destination_replace_from].is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_to must be an String") if params[:destination_replace_to] and !params[:destination_replace_to].is_a?(String) raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String) raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String) raise InvalidParameterError.new("Bad parameter: sync_ids must be an String") if params[:sync_ids] and !params[:sync_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params[:user_ids] and !params[:user_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params[:group_ids] and !params[:group_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: schedule must be an Hash") if params[:schedule] and !params[:schedule].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String) raise InvalidParameterError.new("Bad parameter: trigger_actions must be an Array") if params[:trigger_actions] and !params[:trigger_actions].is_a?(Array) raise InvalidParameterError.new("Bad parameter: value must be an Hash") if params[:value] and !params[:value].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: automation must be an String") if params[:automation] and !params[:automation].is_a?(String) raise MissingParameterError.new("Parameter missing: automation") unless params[:automation] response, = Api.send_request("/automations", :post, params, ) Automation.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
437 438 439 440 441 442 443 444 445 |
# File 'lib/files.com/models/automation.rb', line 437 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] response, = Api.send_request("/automations/#{params[:id]}", :delete, params, ) response.data end |
.destroy(id, params = {}, options = {}) ⇒ Object
447 448 449 |
# File 'lib/files.com/models/automation.rb', line 447 def self.destroy(id, params = {}, = {}) delete(id, params, ) end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - int64 - Automation ID.
330 331 332 333 334 335 336 337 338 |
# File 'lib/files.com/models/automation.rb', line 330 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("/automations/#{params[:id]}", :get, params, ) Automation.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
340 341 342 |
# File 'lib/files.com/models/automation.rb', line 340 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 (e.g. `sort_by[automation]=desc`). Valid fields are `automation`, `disabled`, `last_modified_at` or `name`.
automation - string - If set, return records where the specified field is equal to the supplied value.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `disabled`, `last_modified_at` or `automation`. Valid field combinations are `[ automation, disabled ]` and `[ disabled, automation ]`.
filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `last_modified_at`.
filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `last_modified_at`.
filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `last_modified_at`.
filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `last_modified_at`.
with_deleted - boolean - Set to true to include deleted automations in the results.
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/files.com/models/automation.rb', line 308 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: automation must be an String") if params[:automation] and !params[:automation].is_a?(String) raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params[:filter_gt] and !params[:filter_gt].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params[:filter_gteq] and !params[:filter_gteq].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params[:filter_lt] and !params[:filter_lt].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params[:filter_lteq] and !params[:filter_lteq].is_a?(Hash) List.new(Automation, params) do Api.send_request("/automations", :get, params, ) end end |
.update(id, params = {}, options = {}) ⇒ Object
Parameters:
source - string - Source Path
destination - string - DEPRECATED: Destination Path. Use `destinations` instead.
destinations - array(string) - A list of String destination paths or Hash of folder_path and optional file_path.
destination_replace_from - string - If set, this string in the destination path will be replaced with the value in `destination_replace_to`.
destination_replace_to - string - If set, this string will replace the value `destination_replace_from` in the destination filename. You can use special patterns here.
interval - string - How often to run this automation? One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`
path - string - Path on which this Automation runs. Supports globs.
sync_ids - string - A list of sync IDs the automation is associated with. If sent as a string, it should be comma-delimited.
user_ids - string - A list of user IDs the automation is associated with. If sent as a string, it should be comma-delimited.
group_ids - string - A list of group IDs the automation is associated with. If sent as a string, it should be comma-delimited.
schedule - object - Custom schedule for running this automation.
description - string - Description for the this Automation.
disabled - boolean - If true, this automation will not run.
name - string - Name for this automation.
trigger - string - How this automation is triggered to run. One of: `realtime`, `daily`, `custom_schedule`, `webhook`, `email`, or `action`.
trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
value - object - A Hash of attributes specific to the automation type.
recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
automation - string - Automation type
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
# File 'lib/files.com/models/automation.rb', line 409 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: source must be an String") if params[:source] and !params[:source].is_a?(String) raise InvalidParameterError.new("Bad parameter: destination must be an String") if params[:destination] and !params[:destination].is_a?(String) raise InvalidParameterError.new("Bad parameter: destinations must be an Array") if params[:destinations] and !params[:destinations].is_a?(Array) raise InvalidParameterError.new("Bad parameter: destination_replace_from must be an String") if params[:destination_replace_from] and !params[:destination_replace_from].is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_to must be an String") if params[:destination_replace_to] and !params[:destination_replace_to].is_a?(String) raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String) raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String) raise InvalidParameterError.new("Bad parameter: sync_ids must be an String") if params[:sync_ids] and !params[:sync_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params[:user_ids] and !params[:user_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params[:group_ids] and !params[:group_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: schedule must be an Hash") if params[:schedule] and !params[:schedule].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String) raise InvalidParameterError.new("Bad parameter: trigger_actions must be an Array") if params[:trigger_actions] and !params[:trigger_actions].is_a?(Array) raise InvalidParameterError.new("Bad parameter: value must be an Hash") if params[:value] and !params[:value].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: automation must be an String") if params[:automation] and !params[:automation].is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/automations/#{params[:id]}", :patch, params, ) Automation.new(response.data, ) end |
Instance Method Details
#automation ⇒ Object
string - Automation type
22 23 24 |
# File 'lib/files.com/models/automation.rb', line 22 def automation @attributes[:automation] end |
#automation=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/automation.rb', line 26 def automation=(value) @attributes[:automation] = value end |
#delete(params = {}) ⇒ Object
274 275 276 277 278 279 280 281 282 |
# File 'lib/files.com/models/automation.rb', line 274 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("/automations/#{@attributes[:id]}", :delete, params, @options) end |
#deleted ⇒ Object
boolean - Indicates if the automation has been deleted.
31 32 33 |
# File 'lib/files.com/models/automation.rb', line 31 def deleted @attributes[:deleted] end |
#deleted=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/automation.rb', line 35 def deleted=(value) @attributes[:deleted] = value end |
#description ⇒ Object
string - Description for the this Automation.
130 131 132 |
# File 'lib/files.com/models/automation.rb', line 130 def description @attributes[:description] end |
#description=(value) ⇒ Object
134 135 136 |
# File 'lib/files.com/models/automation.rb', line 134 def description=(value) @attributes[:description] = value end |
#destination ⇒ Object
string - DEPRECATED: Destination Path. Use ‘destinations` instead.
220 221 222 |
# File 'lib/files.com/models/automation.rb', line 220 def destination @attributes[:destination] end |
#destination=(value) ⇒ Object
224 225 226 |
# File 'lib/files.com/models/automation.rb', line 224 def destination=(value) @attributes[:destination] = value end |
#destination_replace_from ⇒ Object
string - If set, this string in the destination path will be replaced with the value in ‘destination_replace_to`.
112 113 114 |
# File 'lib/files.com/models/automation.rb', line 112 def destination_replace_from @attributes[:destination_replace_from] end |
#destination_replace_from=(value) ⇒ Object
116 117 118 |
# File 'lib/files.com/models/automation.rb', line 116 def destination_replace_from=(value) @attributes[:destination_replace_from] = value end |
#destination_replace_to ⇒ Object
string - If set, this string will replace the value ‘destination_replace_from` in the destination filename. You can use special patterns here.
121 122 123 |
# File 'lib/files.com/models/automation.rb', line 121 def destination_replace_to @attributes[:destination_replace_to] end |
#destination_replace_to=(value) ⇒ Object
125 126 127 |
# File 'lib/files.com/models/automation.rb', line 125 def destination_replace_to=(value) @attributes[:destination_replace_to] = value end |
#destinations ⇒ Object
array - Destination Path
103 104 105 |
# File 'lib/files.com/models/automation.rb', line 103 def destinations @attributes[:destinations] end |
#destinations=(value) ⇒ Object
107 108 109 |
# File 'lib/files.com/models/automation.rb', line 107 def destinations=(value) @attributes[:destinations] = value end |
#destroy(params = {}) ⇒ Object
284 285 286 |
# File 'lib/files.com/models/automation.rb', line 284 def destroy(params = {}) delete(params) end |
#disabled ⇒ Object
boolean - If true, this automation will not run.
40 41 42 |
# File 'lib/files.com/models/automation.rb', line 40 def disabled @attributes[:disabled] end |
#disabled=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/automation.rb', line 44 def disabled=(value) @attributes[:disabled] = value end |
#group_ids ⇒ Object
array - IDs of Groups for the Automation (i.e. who to Request File from)
184 185 186 |
# File 'lib/files.com/models/automation.rb', line 184 def group_ids @attributes[:group_ids] end |
#group_ids=(value) ⇒ Object
188 189 190 |
# File 'lib/files.com/models/automation.rb', line 188 def group_ids=(value) @attributes[:group_ids] = value end |
#id ⇒ Object
int64 - Automation ID
13 14 15 |
# File 'lib/files.com/models/automation.rb', line 13 def id @attributes[:id] end |
#id=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/automation.rb', line 17 def id=(value) @attributes[:id] = value end |
#interval ⇒ Object
string - If trigger is ‘daily`, this specifies how often to run this automation. One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`
58 59 60 |
# File 'lib/files.com/models/automation.rb', line 58 def interval @attributes[:interval] end |
#interval=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/automation.rb', line 62 def interval=(value) @attributes[:interval] = value end |
#last_modified_at ⇒ Object
date-time - Time when automation was last modified. Does not change for name or description updates.
67 68 69 |
# File 'lib/files.com/models/automation.rb', line 67 def last_modified_at @attributes[:last_modified_at] end |
#last_modified_at=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/automation.rb', line 71 def last_modified_at=(value) @attributes[:last_modified_at] = value end |
#name ⇒ Object
string - Name for this automation.
76 77 78 |
# File 'lib/files.com/models/automation.rb', line 76 def name @attributes[:name] end |
#name=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/automation.rb', line 80 def name=(value) @attributes[:name] = value end |
#path ⇒ Object
string - Path on which this Automation runs. Supports globs. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
148 149 150 |
# File 'lib/files.com/models/automation.rb', line 148 def path @attributes[:path] end |
#path=(value) ⇒ Object
152 153 154 |
# File 'lib/files.com/models/automation.rb', line 152 def path=(value) @attributes[:path] = value end |
#recurring_day ⇒ Object
int64 - If trigger type is ‘daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
139 140 141 |
# File 'lib/files.com/models/automation.rb', line 139 def recurring_day @attributes[:recurring_day] end |
#recurring_day=(value) ⇒ Object
143 144 145 |
# File 'lib/files.com/models/automation.rb', line 143 def recurring_day=(value) @attributes[:recurring_day] = value end |
#save ⇒ Object
288 289 290 291 292 293 294 295 |
# File 'lib/files.com/models/automation.rb', line 288 def save if @attributes[:id] update(@attributes) else new_obj = Automation.create(@attributes, @options) @attributes = new_obj.attributes end end |
#schedule ⇒ Object
object - If trigger is ‘custom_schedule`, Custom schedule description for when the automation should be run.
85 86 87 |
# File 'lib/files.com/models/automation.rb', line 85 def schedule @attributes[:schedule] end |
#schedule=(value) ⇒ Object
89 90 91 |
# File 'lib/files.com/models/automation.rb', line 89 def schedule=(value) @attributes[:schedule] = value end |
#source ⇒ Object
string - Source Path
94 95 96 |
# File 'lib/files.com/models/automation.rb', line 94 def source @attributes[:source] end |
#source=(value) ⇒ Object
98 99 100 |
# File 'lib/files.com/models/automation.rb', line 98 def source=(value) @attributes[:source] = value end |
#sync_ids ⇒ Object
array - IDs of remote sync folder behaviors to run by this Automation
166 167 168 |
# File 'lib/files.com/models/automation.rb', line 166 def sync_ids @attributes[:sync_ids] end |
#sync_ids=(value) ⇒ Object
170 171 172 |
# File 'lib/files.com/models/automation.rb', line 170 def sync_ids=(value) @attributes[:sync_ids] = value end |
#trigger ⇒ Object
string - How this automation is triggered to run. One of: ‘realtime`, `daily`, `custom_schedule`, `webhook`, `email`, or `action`.
49 50 51 |
# File 'lib/files.com/models/automation.rb', line 49 def trigger @attributes[:trigger] end |
#trigger=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/automation.rb', line 53 def trigger=(value) @attributes[:trigger] = value end |
#trigger_actions ⇒ Object
array - If trigger is ‘action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
202 203 204 |
# File 'lib/files.com/models/automation.rb', line 202 def trigger_actions @attributes[:trigger_actions] end |
#trigger_actions=(value) ⇒ Object
206 207 208 |
# File 'lib/files.com/models/automation.rb', line 206 def trigger_actions=(value) @attributes[:trigger_actions] = value end |
#update(params = {}) ⇒ Object
Parameters:
source - string - Source Path
destination - string - DEPRECATED: Destination Path. Use `destinations` instead.
destinations - array(string) - A list of String destination paths or Hash of folder_path and optional file_path.
destination_replace_from - string - If set, this string in the destination path will be replaced with the value in `destination_replace_to`.
destination_replace_to - string - If set, this string will replace the value `destination_replace_from` in the destination filename. You can use special patterns here.
interval - string - How often to run this automation? One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`
path - string - Path on which this Automation runs. Supports globs.
sync_ids - string - A list of sync IDs the automation is associated with. If sent as a string, it should be comma-delimited.
user_ids - string - A list of user IDs the automation is associated with. If sent as a string, it should be comma-delimited.
group_ids - string - A list of group IDs the automation is associated with. If sent as a string, it should be comma-delimited.
schedule - object - Custom schedule for running this automation.
description - string - Description for the this Automation.
disabled - boolean - If true, this automation will not run.
name - string - Name for this automation.
trigger - string - How this automation is triggered to run. One of: `realtime`, `daily`, `custom_schedule`, `webhook`, `email`, or `action`.
trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
value - object - A Hash of attributes specific to the automation type.
recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
automation - string - Automation type
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/files.com/models/automation.rb', line 248 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: source must be an String") if params[:source] and !params[:source].is_a?(String) raise InvalidParameterError.new("Bad parameter: destination must be an String") if params[:destination] and !params[:destination].is_a?(String) raise InvalidParameterError.new("Bad parameter: destinations must be an Array") if params[:destinations] and !params[:destinations].is_a?(Array) raise InvalidParameterError.new("Bad parameter: destination_replace_from must be an String") if params[:destination_replace_from] and !params[:destination_replace_from].is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_to must be an String") if params[:destination_replace_to] and !params[:destination_replace_to].is_a?(String) raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String) raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String) raise InvalidParameterError.new("Bad parameter: sync_ids must be an String") if params[:sync_ids] and !params[:sync_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params[:user_ids] and !params[:user_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params[:group_ids] and !params[:group_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String) raise InvalidParameterError.new("Bad parameter: trigger_actions must be an Array") if params[:trigger_actions] and !params[:trigger_actions].is_a?(Array) raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: automation must be an String") if params[:automation] and !params[:automation].is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/automations/#{@attributes[:id]}", :patch, params, @options) end |
#user_id ⇒ Object
int64 - User ID of the Automation’s creator.
157 158 159 |
# File 'lib/files.com/models/automation.rb', line 157 def user_id @attributes[:user_id] end |
#user_id=(value) ⇒ Object
161 162 163 |
# File 'lib/files.com/models/automation.rb', line 161 def user_id=(value) @attributes[:user_id] = value end |
#user_ids ⇒ Object
array - IDs of Users for the Automation (i.e. who to Request File from)
175 176 177 |
# File 'lib/files.com/models/automation.rb', line 175 def user_ids @attributes[:user_ids] end |
#user_ids=(value) ⇒ Object
179 180 181 |
# File 'lib/files.com/models/automation.rb', line 179 def user_ids=(value) @attributes[:user_ids] = value end |
#value ⇒ Object
object - A Hash of attributes specific to the automation type.
211 212 213 |
# File 'lib/files.com/models/automation.rb', line 211 def value @attributes[:value] end |
#value=(value) ⇒ Object
215 216 217 |
# File 'lib/files.com/models/automation.rb', line 215 def value=(value) @attributes[:value] = value end |
#webhook_url ⇒ Object
string - If trigger is ‘webhook`, this is the URL of the webhook to trigger the Automation.
193 194 195 |
# File 'lib/files.com/models/automation.rb', line 193 def webhook_url @attributes[:webhook_url] end |
#webhook_url=(value) ⇒ Object
197 198 199 |
# File 'lib/files.com/models/automation.rb', line 197 def webhook_url=(value) @attributes[:webhook_url] = value end |