Class: Files::History
- Inherits:
-
Object
- Object
- Files::History
- Defined in:
- lib/files.com/models/history.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
-
.list(params = {}, options = {}) ⇒ Object
Parameters: start_at - string - Leave blank or set to a date/time to filter earlier entries.
-
.list_for_file(path, params = {}, options = {}) ⇒ Object
Parameters: start_at - string - Leave blank or set to a date/time to filter earlier entries.
-
.list_for_folder(path, params = {}, options = {}) ⇒ Object
Parameters: start_at - string - Leave blank or set to a date/time to filter earlier entries.
-
.list_for_user(user_id, params = {}, options = {}) ⇒ Object
Parameters: start_at - string - Leave blank or set to a date/time to filter earlier entries.
-
.list_logins(params = {}, options = {}) ⇒ Object
Parameters: start_at - string - Leave blank or set to a date/time to filter earlier entries.
Instance Method Summary collapse
-
#action ⇒ Object
string - Type of action.
-
#destination ⇒ Object
string - The destination path for this action, if applicable.
-
#display ⇒ Object
string - Friendly displayed output.
-
#failure_type ⇒ Object
string - Failure type.
-
#id ⇒ Object
int64 - Action ID.
-
#initialize(attributes = {}, options = {}) ⇒ History
constructor
A new instance of History.
-
#interface ⇒ Object
string - Interface on which this action occurred.
-
#ip ⇒ Object
string - IP Address that performed this action.
-
#path ⇒ Object
string - Path This must be slash-delimited, but it must neither start nor end with a slash.
-
#source ⇒ Object
string - The source path for this action, if applicable.
-
#targets ⇒ Object
array - Targets.
-
#user_id ⇒ Object
int64 - User ID.
-
#username ⇒ Object
string - Username.
-
#when ⇒ Object
date-time - Action occurrence date/time.
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ History
Returns a new instance of History.
7 8 9 10 |
# File 'lib/files.com/models/history.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/history.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/history.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
224 225 226 |
# File 'lib/files.com/models/history.rb', line 224 def self.all(params = {}, = {}) list(params, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
start_at - string - Leave blank or set to a date/time to filter earlier entries.
end_at - string - Leave blank or set to a date/time to filter later entries.
display - string - Display format. Leave blank or set to `full` or `parent`.
page - int64 - Current page number.
per_page - int64 - 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.
cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
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`, `path`, `created_at`, `folder` or `user_id`.
filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `user_id`, `folder` or `path`.
filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `user_id`, `folder` or `path`.
filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `user_id`, `folder` or `path`.
filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `user_id`, `folder` or `path`.
filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `user_id`, `folder` or `path`.
filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `user_id`, `folder` or `path`.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/files.com/models/history.rb', line 203 def self.list(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String) raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String) raise InvalidParameterError.new("Bad parameter: display must be an String") if params.dig(:display) and !params.dig(:display).is_a?(String) 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: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String) raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash) List.new(Action, params) do Api.send_request("/history", :get, params, ) end end |
.list_for_file(path, params = {}, options = {}) ⇒ Object
Parameters:
start_at - string - Leave blank or set to a date/time to filter earlier entries.
end_at - string - Leave blank or set to a date/time to filter later entries.
display - string - Display format. Leave blank or set to `full` or `parent`.
page - int64 - Current page number.
per_page - int64 - 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.
cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
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 `user_id` and `created_at`.
path (required) - string - Path to operate on.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/files.com/models/history.rb', line 87 def self.list_for_file(path, params = {}, = {}) params ||= {} params[:path] = path raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String) raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String) raise InvalidParameterError.new("Bad parameter: display must be an String") if params.dig(:display) and !params.dig(:display).is_a?(String) 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: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String) raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String) raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path) List.new(Action, params) do Api.send_request("/history/files/#{params[:path]}", :get, params, ) end end |
.list_for_folder(path, params = {}, options = {}) ⇒ Object
Parameters:
start_at - string - Leave blank or set to a date/time to filter earlier entries.
end_at - string - Leave blank or set to a date/time to filter later entries.
display - string - Display format. Leave blank or set to `full` or `parent`.
page - int64 - Current page number.
per_page - int64 - 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.
cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
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 `user_id` and `created_at`.
path (required) - string - Path to operate on.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/files.com/models/history.rb', line 116 def self.list_for_folder(path, params = {}, = {}) params ||= {} params[:path] = path raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String) raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String) raise InvalidParameterError.new("Bad parameter: display must be an String") if params.dig(:display) and !params.dig(:display).is_a?(String) 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: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String) raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String) raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path) List.new(Action, params) do Api.send_request("/history/folders/#{params[:path]}", :get, params, ) end end |
.list_for_user(user_id, params = {}, options = {}) ⇒ Object
Parameters:
start_at - string - Leave blank or set to a date/time to filter earlier entries.
end_at - string - Leave blank or set to a date/time to filter later entries.
display - string - Display format. Leave blank or set to `full` or `parent`.
page - int64 - Current page number.
per_page - int64 - 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.
cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
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 `user_id` and `created_at`.
user_id (required) - int64 - User ID.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/files.com/models/history.rb', line 145 def self.list_for_user(user_id, params = {}, = {}) params ||= {} params[:user_id] = user_id raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String) raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String) raise InvalidParameterError.new("Bad parameter: display must be an String") if params.dig(:display) and !params.dig(:display).is_a?(String) 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: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String) raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer) raise MissingParameterError.new("Parameter missing: user_id") unless params.dig(:user_id) List.new(Action, params) do Api.send_request("/history/users/#{params[:user_id]}", :get, params, ) end end |
.list_logins(params = {}, options = {}) ⇒ Object
Parameters:
start_at - string - Leave blank or set to a date/time to filter earlier entries.
end_at - string - Leave blank or set to a date/time to filter later entries.
display - string - Display format. Leave blank or set to `full` or `parent`.
page - int64 - Current page number.
per_page - int64 - 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.
cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
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 `user_id` and `created_at`.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/files.com/models/history.rb', line 173 def self.list_logins(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String) raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String) raise InvalidParameterError.new("Bad parameter: display must be an String") if params.dig(:display) and !params.dig(:display).is_a?(String) 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: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String) raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash) List.new(Action, params) do Api.send_request("/history/login", :get, params, ) end end |
Instance Method Details
#action ⇒ Object
string - Type of action
63 64 65 |
# File 'lib/files.com/models/history.rb', line 63 def action @attributes[:action] end |
#destination ⇒ Object
string - The destination path for this action, if applicable
28 29 30 |
# File 'lib/files.com/models/history.rb', line 28 def destination @attributes[:destination] end |
#display ⇒ Object
string - Friendly displayed output
33 34 35 |
# File 'lib/files.com/models/history.rb', line 33 def display @attributes[:display] end |
#failure_type ⇒ Object
string - Failure type. If action was a user login or session failure, why did it fail?
68 69 70 |
# File 'lib/files.com/models/history.rb', line 68 def failure_type @attributes[:failure_type] end |
#id ⇒ Object
int64 - Action ID
13 14 15 |
# File 'lib/files.com/models/history.rb', line 13 def id @attributes[:id] end |
#interface ⇒ Object
string - Interface on which this action occurred.
73 74 75 |
# File 'lib/files.com/models/history.rb', line 73 def interface @attributes[:interface] end |
#ip ⇒ Object
string - IP Address that performed this action
38 39 40 |
# File 'lib/files.com/models/history.rb', line 38 def ip @attributes[:ip] end |
#path ⇒ Object
string - Path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
18 19 20 |
# File 'lib/files.com/models/history.rb', line 18 def path @attributes[:path] end |
#source ⇒ Object
string - The source path for this action, if applicable
43 44 45 |
# File 'lib/files.com/models/history.rb', line 43 def source @attributes[:source] end |
#targets ⇒ Object
array - Targets
48 49 50 |
# File 'lib/files.com/models/history.rb', line 48 def targets @attributes[:targets] end |
#user_id ⇒ Object
int64 - User ID
53 54 55 |
# File 'lib/files.com/models/history.rb', line 53 def user_id @attributes[:user_id] end |
#username ⇒ Object
string - Username
58 59 60 |
# File 'lib/files.com/models/history.rb', line 58 def username @attributes[:username] end |
#when ⇒ Object
date-time - Action occurrence date/time
23 24 25 |
# File 'lib/files.com/models/history.rb', line 23 def when @attributes[:when] end |