Class: Files::SyncRun

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ SyncRun

Returns a new instance of SyncRun.



7
8
9
10
# File 'lib/files.com/models/sync_run.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/sync_run.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

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



148
149
150
# File 'lib/files.com/models/sync_run.rb', line 148

def self.all(params = {}, options = {})
  list(params, options)
end

.find(id, params = {}, options = {}) ⇒ Object

Parameters:

id (required) - int64 - Sync Run ID.


154
155
156
157
158
159
160
161
162
# File 'lib/files.com/models/sync_run.rb', line 154

def self.find(id, params = {}, options = {})
  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, options = Api.send_request("/sync_runs/#{params[:id]}", :get, params, options)
  SyncRun.new(response.data, options)
end

.get(id, params = {}, options = {}) ⇒ Object



164
165
166
# File 'lib/files.com/models/sync_run.rb', line 164

def self.get(id, params = {}, options = {})
  find(id, params, options)
end

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

Parameters:

user_id - int64 - User ID.  Provide a value of `0` to operate the current session's user.
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`, `workspace_id`, `sync_id`, `created_at` or `status`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `created_at`, `status`, `dry_run`, `workspace_id`, `src_remote_server_type`, `dest_remote_server_type` or `sync_id`. Valid field combinations are `[ status, created_at ]`, `[ workspace_id, created_at ]`, `[ src_remote_server_type, created_at ]`, `[ dest_remote_server_type, created_at ]`, `[ sync_id, created_at ]`, `[ workspace_id, status ]`, `[ src_remote_server_type, status ]`, `[ dest_remote_server_type, status ]`, `[ sync_id, status ]`, `[ workspace_id, src_remote_server_type ]`, `[ workspace_id, dest_remote_server_type ]`, `[ workspace_id, sync_id ]`, `[ workspace_id, status, created_at ]`, `[ src_remote_server_type, status, created_at ]`, `[ dest_remote_server_type, status, created_at ]`, `[ sync_id, status, created_at ]`, `[ workspace_id, src_remote_server_type, created_at ]`, `[ workspace_id, dest_remote_server_type, created_at ]`, `[ workspace_id, sync_id, created_at ]`, `[ workspace_id, src_remote_server_type, status ]`, `[ workspace_id, dest_remote_server_type, status ]`, `[ workspace_id, sync_id, status ]`, `[ workspace_id, src_remote_server_type, status, created_at ]`, `[ workspace_id, dest_remote_server_type, status, created_at ]` or `[ workspace_id, sync_id, status, created_at ]`.
filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`.
filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`.
filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`.
filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.


132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/files.com/models/sync_run.rb', line 132

def self.list(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)
  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_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(SyncRun, params) do
    Api.send_request("/sync_runs", :get, params, options)
  end
end

Instance Method Details

#bodyObject

string - Log or summary body for this run



18
19
20
# File 'lib/files.com/models/sync_run.rb', line 18

def body
  @attributes[:body]
end

#bytes_syncedObject

int64 - Total bytes synced in this run



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

def bytes_synced
  @attributes[:bytes_synced]
end

#compared_filesObject

int64 - Number of files compared



28
29
30
# File 'lib/files.com/models/sync_run.rb', line 28

def compared_files
  @attributes[:compared_files]
end

#compared_foldersObject

int64 - Number of folders compared



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

def compared_folders
  @attributes[:compared_folders]
end

#completed_atObject

date-time - When this run was completed



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

def completed_at
  @attributes[:completed_at]
end

#created_atObject

date-time - When this run was created



43
44
45
# File 'lib/files.com/models/sync_run.rb', line 43

def created_at
  @attributes[:created_at]
end

#dest_remote_server_typeObject

string - Destination remote server type, if any



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

def dest_remote_server_type
  @attributes[:dest_remote_server_type]
end

#dry_runObject

boolean - Whether this run was a dry run (no actual changes made)



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

def dry_run
  @attributes[:dry_run]
end

#errored_filesObject

int64 - Number of files that errored



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

def errored_files
  @attributes[:errored_files]
end

#estimated_bytes_countObject

int64 - Estimated bytes count for this run



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

def estimated_bytes_count
  @attributes[:estimated_bytes_count]
end

#event_errorsObject

array(string) - Array of errors encountered during the run



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

def event_errors
  @attributes[:event_errors]
end

#idObject

int64 - SyncRun ID



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

def id
  @attributes[:id]
end

#log_urlObject

string - Link to external log file.



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

def log_url
  @attributes[:log_url]
end

#runtimeObject

double - Total runtime in seconds



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

def runtime
  @attributes[:runtime]
end

#site_idObject

int64 - Site ID



83
84
85
# File 'lib/files.com/models/sync_run.rb', line 83

def site_id
  @attributes[:site_id]
end

#src_remote_server_typeObject

string - Source remote server type, if any



93
94
95
# File 'lib/files.com/models/sync_run.rb', line 93

def src_remote_server_type
  @attributes[:src_remote_server_type]
end

#statusObject

string - Status of the sync run (success, failure, partial_failure, in_progress, skipped)



98
99
100
# File 'lib/files.com/models/sync_run.rb', line 98

def status
  @attributes[:status]
end

#successful_filesObject

int64 - Number of files successfully synced



103
104
105
# File 'lib/files.com/models/sync_run.rb', line 103

def successful_files
  @attributes[:successful_files]
end

#sync_idObject

int64 - ID of the Sync this run belongs to



108
109
110
# File 'lib/files.com/models/sync_run.rb', line 108

def sync_id
  @attributes[:sync_id]
end

#sync_nameObject

string - Name of the Sync this run belongs to



113
114
115
# File 'lib/files.com/models/sync_run.rb', line 113

def sync_name
  @attributes[:sync_name]
end

#updated_atObject

date-time - When this run was last updated



118
119
120
# File 'lib/files.com/models/sync_run.rb', line 118

def updated_at
  @attributes[:updated_at]
end

#workspace_idObject

int64 - Workspace ID



88
89
90
# File 'lib/files.com/models/sync_run.rb', line 88

def workspace_id
  @attributes[:workspace_id]
end