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: automation (required) - string - Type of automation.
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - integer - Automation ID.
- .get(id, params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: page - integer - Current page number.
-
.update(id, params = {}, options = {}) ⇒ Object
Parameters: automation (required) - string - Type of automation.
Instance Method Summary collapse
-
#automation ⇒ Object
string - Automation type.
- #automation=(value) ⇒ Object
- #delete(params = {}) ⇒ Object
-
#destination ⇒ Object
string - 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
- #destroy(params = {}) ⇒ 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 - How often to run this automation? One of: ‘day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`.
- #interval=(value) ⇒ Object
-
#next_process_on ⇒ Object
string - Date this automation will next run.
- #next_process_on=(value) ⇒ Object
-
#path ⇒ Object
string - Path on which this Automation runs.
- #path=(value) ⇒ Object
-
#realtime ⇒ Object
boolean - Does this automation run in real time? This is a read-only property based on automation type.
- #realtime=(value) ⇒ Object
- #save ⇒ Object
-
#source ⇒ Object
string - Source Path.
- #source=(value) ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: automation (required) - string - Type of automation.
-
#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
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
197 198 199 |
# File 'lib/files.com/models/automation.rb', line 197 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
automation (required) - string - Type of automation. One of: `create_folder`, `request_file`, `request_move`
source - string - Source Path
destination - string - Destination 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.
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.
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/files.com/models/automation.rb', line 227 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: automation must be an String") if params.dig(:automation) and !params.dig(:automation).is_a?(String) raise InvalidParameterError.new("Bad parameter: source must be an String") if params.dig(:source) and !params.dig(:source).is_a?(String) raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_from must be an String") if params.dig(:destination_replace_from) and !params.dig(:destination_replace_from).is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_to must be an String") if params.dig(:destination_replace_to) and !params.dig(:destination_replace_to).is_a?(String) raise InvalidParameterError.new("Bad parameter: interval must be an String") if params.dig(:interval) and !params.dig(:interval).is_a?(String) raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String) raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params.dig(:group_ids) and !params.dig(:group_ids).is_a?(String) raise MissingParameterError.new("Parameter missing: automation") unless params.dig(:automation) response, = Api.send_request("/automations", :post, params, ) Automation.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
273 274 275 276 277 278 279 280 281 |
# File 'lib/files.com/models/automation.rb', line 273 def self.delete(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) response, = Api.send_request("/automations/#{params[:id]}", :delete, params, ) response.data end |
.destroy(id, params = {}, options = {}) ⇒ Object
283 284 285 |
# File 'lib/files.com/models/automation.rb', line 283 def self.destroy(id, params = {}, = {}) delete(id, params, ) end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - integer - Automation ID.
203 204 205 206 207 208 209 210 211 |
# File 'lib/files.com/models/automation.rb', line 203 def self.find(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) response, = Api.send_request("/automations/#{params[:id]}", :get, params, ) Automation.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
213 214 215 |
# File 'lib/files.com/models/automation.rb', line 213 def self.get(id, params = {}, = {}) find(id, params, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
page - integer - Current page number.
per_page - integer - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
automation - string - Type of automation to filter by.
187 188 189 190 191 192 193 194 195 |
# File 'lib/files.com/models/automation.rb', line 187 def self.list(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer) raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String) raise InvalidParameterError.new("Bad parameter: automation must be an String") if params.dig(:automation) and !params.dig(:automation).is_a?(String) response, = Api.send_request("/automations", :get, params, ) response.data.map { |object| Automation.new(object, ) } end |
.update(id, params = {}, options = {}) ⇒ Object
Parameters:
automation (required) - string - Type of automation. One of: `create_folder`, `request_file`, `request_move`
source - string - Source Path
destination - string - Destination 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.
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.
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/files.com/models/automation.rb', line 253 def self.update(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer) raise InvalidParameterError.new("Bad parameter: automation must be an String") if params.dig(:automation) and !params.dig(:automation).is_a?(String) raise InvalidParameterError.new("Bad parameter: source must be an String") if params.dig(:source) and !params.dig(:source).is_a?(String) raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_from must be an String") if params.dig(:destination_replace_from) and !params.dig(:destination_replace_from).is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_to must be an String") if params.dig(:destination_replace_to) and !params.dig(:destination_replace_to).is_a?(String) raise InvalidParameterError.new("Bad parameter: interval must be an String") if params.dig(:interval) and !params.dig(:interval).is_a?(String) raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String) raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params.dig(:group_ids) and !params.dig(:group_ids).is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) raise MissingParameterError.new("Parameter missing: automation") unless params.dig(:automation) 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
159 160 161 162 163 164 165 166 167 |
# File 'lib/files.com/models/automation.rb', line 159 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.dig(:id) and !params.dig(:id).is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) Api.send_request("/automations/#{@attributes[:id]}", :delete, params, @options) end |
#destination ⇒ Object
string - Destination Path
40 41 42 |
# File 'lib/files.com/models/automation.rb', line 40 def destination @attributes[:destination] end |
#destination=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/automation.rb', line 44 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`.
49 50 51 |
# File 'lib/files.com/models/automation.rb', line 49 def destination_replace_from @attributes[:destination_replace_from] end |
#destination_replace_from=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/automation.rb', line 53 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.
58 59 60 |
# File 'lib/files.com/models/automation.rb', line 58 def destination_replace_to @attributes[:destination_replace_to] end |
#destination_replace_to=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/automation.rb', line 62 def destination_replace_to=(value) @attributes[:destination_replace_to] = value end |
#destroy(params = {}) ⇒ Object
169 170 171 |
# File 'lib/files.com/models/automation.rb', line 169 def destroy(params = {}) delete(params) end |
#group_ids ⇒ Object
array - IDs of Groups for the Automation (i.e. who to Request File from)
121 122 123 |
# File 'lib/files.com/models/automation.rb', line 121 def group_ids @attributes[:group_ids] end |
#group_ids=(value) ⇒ Object
125 126 127 |
# File 'lib/files.com/models/automation.rb', line 125 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 - How often to run this automation? One of: ‘day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`
67 68 69 |
# File 'lib/files.com/models/automation.rb', line 67 def interval @attributes[:interval] end |
#interval=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/automation.rb', line 71 def interval=(value) @attributes[:interval] = value end |
#next_process_on ⇒ Object
string - Date this automation will next run.
76 77 78 |
# File 'lib/files.com/models/automation.rb', line 76 def next_process_on @attributes[:next_process_on] end |
#next_process_on=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/automation.rb', line 80 def next_process_on=(value) @attributes[:next_process_on] = 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.
85 86 87 |
# File 'lib/files.com/models/automation.rb', line 85 def path @attributes[:path] end |
#path=(value) ⇒ Object
89 90 91 |
# File 'lib/files.com/models/automation.rb', line 89 def path=(value) @attributes[:path] = value end |
#realtime ⇒ Object
boolean - Does this automation run in real time? This is a read-only property based on automation type.
94 95 96 |
# File 'lib/files.com/models/automation.rb', line 94 def realtime @attributes[:realtime] end |
#realtime=(value) ⇒ Object
98 99 100 |
# File 'lib/files.com/models/automation.rb', line 98 def realtime=(value) @attributes[:realtime] = value end |
#save ⇒ Object
173 174 175 176 177 178 179 180 |
# File 'lib/files.com/models/automation.rb', line 173 def save if @attributes[:id] update(@attributes) else new_obj = Automation.create(@attributes, @options) @attributes = new_obj.attributes end end |
#source ⇒ Object
string - Source Path
31 32 33 |
# File 'lib/files.com/models/automation.rb', line 31 def source @attributes[:source] end |
#source=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/automation.rb', line 35 def source=(value) @attributes[:source] = value end |
#update(params = {}) ⇒ Object
Parameters:
automation (required) - string - Type of automation. One of: `create_folder`, `request_file`, `request_move`
source - string - Source Path
destination - string - Destination 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.
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.
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/files.com/models/automation.rb', line 139 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.dig(:id) and !params.dig(:id).is_a?(Integer) raise InvalidParameterError.new("Bad parameter: automation must be an String") if params.dig(:automation) and !params.dig(:automation).is_a?(String) raise InvalidParameterError.new("Bad parameter: source must be an String") if params.dig(:source) and !params.dig(:source).is_a?(String) raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_from must be an String") if params.dig(:destination_replace_from) and !params.dig(:destination_replace_from).is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_to must be an String") if params.dig(:destination_replace_to) and !params.dig(:destination_replace_to).is_a?(String) raise InvalidParameterError.new("Bad parameter: interval must be an String") if params.dig(:interval) and !params.dig(:interval).is_a?(String) raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String) raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params.dig(:group_ids) and !params.dig(:group_ids).is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) raise MissingParameterError.new("Parameter missing: automation") unless params.dig(:automation) Api.send_request("/automations/#{@attributes[:id]}", :patch, params, @options) end |
#user_id ⇒ Object
int64 - User ID of the Automation’s creator.
103 104 105 |
# File 'lib/files.com/models/automation.rb', line 103 def user_id @attributes[:user_id] end |
#user_id=(value) ⇒ Object
107 108 109 |
# File 'lib/files.com/models/automation.rb', line 107 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)
112 113 114 |
# File 'lib/files.com/models/automation.rb', line 112 def user_ids @attributes[:user_ids] end |
#user_ids=(value) ⇒ Object
116 117 118 |
# File 'lib/files.com/models/automation.rb', line 116 def user_ids=(value) @attributes[:user_ids] = value end |