Class: Files::History

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/history.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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 = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/history.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/history.rb', line 5

def options
  @options
end

Class Method Details

.all(params = {}, options = {}) ⇒ Object



201
202
203
# File 'lib/files.com/models/history.rb', line 201

def self.all(params = {}, options = {})
  list(params, options)
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`.
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 `path`, `folder`, `user_id` or `created_at`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `user_id`, `folder` or `path`.
filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`.


186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/files.com/models/history.rb', line 186

def self.list(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params[:start_at] and !params[:start_at].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params[:end_at] and !params[:end_at].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: display must be an String") if params[:display] and !params[:display].is_a?(String)
  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)
  raise InvalidParameterError.new("Bad parameter: filter_prefix must be an Hash") if params[:filter_prefix] and !params[:filter_prefix].is_a?(Hash)

  List.new(Action, params) do
    Api.send_request("/history", :get, params, options)
  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`.
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 `user_id`, `created_at` or `site_id`.
path (required) - string - Path to operate on.


90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/files.com/models/history.rb', line 90

def self.list_for_file(path, params = {}, options = {})
  params ||= {}
  params[:path] = path
  raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params[:start_at] and !params[:start_at].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params[:end_at] and !params[:end_at].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: display must be an String") if params[:display] and !params[:display].is_a?(String)
  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: path must be an String") if params[:path] and !params[:path].is_a?(String)
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]

  List.new(Action, params) do
    Api.send_request("/history/files/#{params[:path]}", :get, params, options)
  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`.
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 `user_id`, `created_at` or `site_id`.
path (required) - string - Path to operate on.


115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/files.com/models/history.rb', line 115

def self.list_for_folder(path, params = {}, options = {})
  params ||= {}
  params[:path] = path
  raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params[:start_at] and !params[:start_at].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params[:end_at] and !params[:end_at].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: display must be an String") if params[:display] and !params[:display].is_a?(String)
  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: path must be an String") if params[:path] and !params[:path].is_a?(String)
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]

  List.new(Action, params) do
    Api.send_request("/history/folders/#{params[:path]}", :get, params, options)
  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`.
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 `user_id`, `created_at` or `site_id`.
user_id (required) - int64 - User ID.


140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/files.com/models/history.rb', line 140

def self.list_for_user(user_id, params = {}, options = {})
  params ||= {}
  params[:user_id] = user_id
  raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params[:start_at] and !params[:start_at].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params[:end_at] and !params[:end_at].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: display must be an String") if params[:display] and !params[:display].is_a?(String)
  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: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: user_id") unless params[:user_id]

  List.new(Action, params) do
    Api.send_request("/history/users/#{params[:user_id]}", :get, params, options)
  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`.
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 `user_id`, `created_at` or `site_id`.


164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/files.com/models/history.rb', line 164

def self.list_logins(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params[:start_at] and !params[:start_at].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params[:end_at] and !params[:end_at].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: display must be an String") if params[:display] and !params[:display].is_a?(String)
  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)

  List.new(Action, params) do
    Api.send_request("/history/login", :get, params, options)
  end
end

Instance Method Details

#actionObject

string - Type of action



68
69
70
# File 'lib/files.com/models/history.rb', line 68

def action
  @attributes[:action]
end

#destinationObject

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

#displayObject

string - Friendly displayed output



33
34
35
# File 'lib/files.com/models/history.rb', line 33

def display
  @attributes[:display]
end

#failure_typeObject

string - Failure type. If action was a user login or session failure, why did it fail?



73
74
75
# File 'lib/files.com/models/history.rb', line 73

def failure_type
  @attributes[:failure_type]
end

#idObject

int64 - Action ID



13
14
15
# File 'lib/files.com/models/history.rb', line 13

def id
  @attributes[:id]
end

#interfaceObject

string - Interface on which this action occurred.



78
79
80
# File 'lib/files.com/models/history.rb', line 78

def interface
  @attributes[:interface]
end

#ipObject

string - IP Address that performed this action



38
39
40
# File 'lib/files.com/models/history.rb', line 38

def ip
  @attributes[:ip]
end

#pathObject

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

#sourceObject

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

#targetsObject

array(object) - Targets



48
49
50
# File 'lib/files.com/models/history.rb', line 48

def targets
  @attributes[:targets]
end

#user_idObject

int64 - User ID



53
54
55
# File 'lib/files.com/models/history.rb', line 53

def user_id
  @attributes[:user_id]
end

#user_is_from_parent_siteObject

boolean - true if this change was performed by a user on a parent site.



63
64
65
# File 'lib/files.com/models/history.rb', line 63

def user_is_from_parent_site
  @attributes[:user_is_from_parent_site]
end

#usernameObject

string - Username



58
59
60
# File 'lib/files.com/models/history.rb', line 58

def username
  @attributes[:username]
end

#whenObject

date-time - Action occurrence date/time



23
24
25
# File 'lib/files.com/models/history.rb', line 23

def when
  @attributes[:when]
end