files.com 1.1.266 → 1.1.268

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,148 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class SyncRun
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - SyncRun ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ # int64 - ID of the Sync this run belongs to
18
+ def sync_id
19
+ @attributes[:sync_id]
20
+ end
21
+
22
+ # int64 - Site ID
23
+ def site_id
24
+ @attributes[:site_id]
25
+ end
26
+
27
+ # string - Status of the sync run (success, failure, partial_failure, in_progress, skipped)
28
+ def status
29
+ @attributes[:status]
30
+ end
31
+
32
+ # string - Type of remote server used, if any
33
+ def remote_server_type
34
+ @attributes[:remote_server_type]
35
+ end
36
+
37
+ # string - Log or summary body for this run
38
+ def body
39
+ @attributes[:body]
40
+ end
41
+
42
+ # array(array) - Array of errors encountered during the run
43
+ def event_errors
44
+ @attributes[:event_errors]
45
+ end
46
+
47
+ # int64 - Total bytes synced in this run
48
+ def bytes_synced
49
+ @attributes[:bytes_synced]
50
+ end
51
+
52
+ # int64 - Number of files compared
53
+ def compared_files
54
+ @attributes[:compared_files]
55
+ end
56
+
57
+ # int64 - Number of folders compared
58
+ def compared_folders
59
+ @attributes[:compared_folders]
60
+ end
61
+
62
+ # int64 - Number of files that errored
63
+ def errored_files
64
+ @attributes[:errored_files]
65
+ end
66
+
67
+ # int64 - Number of files successfully synced
68
+ def successful_files
69
+ @attributes[:successful_files]
70
+ end
71
+
72
+ # float - Total runtime in seconds
73
+ def runtime
74
+ @attributes[:runtime]
75
+ end
76
+
77
+ # string - S3 path to the main log file
78
+ def s3_body_path
79
+ @attributes[:s3_body_path]
80
+ end
81
+
82
+ # string - S3 path to the internal log file
83
+ def s3_internal_body_path
84
+ @attributes[:s3_internal_body_path]
85
+ end
86
+
87
+ # date-time - When this run was completed
88
+ def completed_at
89
+ @attributes[:completed_at]
90
+ end
91
+
92
+ # boolean - Whether notifications were sent for this run
93
+ def notified
94
+ @attributes[:notified]
95
+ end
96
+
97
+ # date-time - When this run was created
98
+ def created_at
99
+ @attributes[:created_at]
100
+ end
101
+
102
+ # date-time - When this run was last updated
103
+ def updated_at
104
+ @attributes[:updated_at]
105
+ end
106
+
107
+ # Parameters:
108
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
109
+ # 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.
110
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
111
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `sync_id`, `created_at` or `status`.
112
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `status` and `sync_id`. Valid field combinations are `[ sync_id, status ]`.
113
+ # sync_id (required) - int64 - ID of the Sync this run belongs to
114
+ def self.list(params = {}, options = {})
115
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)
116
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
117
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
118
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
119
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
120
+ raise InvalidParameterError.new("Bad parameter: sync_id must be an Integer") if params[:sync_id] and !params[:sync_id].is_a?(Integer)
121
+ raise MissingParameterError.new("Parameter missing: sync_id") unless params[:sync_id]
122
+
123
+ List.new(SyncRun, params) do
124
+ Api.send_request("/sync_runs", :get, params, options)
125
+ end
126
+ end
127
+
128
+ def self.all(params = {}, options = {})
129
+ list(params, options)
130
+ end
131
+
132
+ # Parameters:
133
+ # id (required) - int64 - Sync Run ID.
134
+ def self.find(id, params = {}, options = {})
135
+ params ||= {}
136
+ params[:id] = id
137
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
138
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
139
+
140
+ response, options = Api.send_request("/sync_runs/#{params[:id]}", :get, params, options)
141
+ SyncRun.new(response.data, options)
142
+ end
143
+
144
+ def self.get(id, params = {}, options = {})
145
+ find(id, params, options)
146
+ end
147
+ end
148
+ end