files.com 1.1.431 → 1.1.432

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,144 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class Workspace
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Workspace ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ def id=(value)
18
+ @attributes[:id] = value
19
+ end
20
+
21
+ # string - Workspace name
22
+ def name
23
+ @attributes[:name]
24
+ end
25
+
26
+ def name=(value)
27
+ @attributes[:name] = value
28
+ end
29
+
30
+ # Parameters:
31
+ # name - string - Workspace name
32
+ def update(params = {})
33
+ params ||= {}
34
+ params[:id] = @attributes[:id]
35
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
36
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
37
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
38
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
39
+
40
+ Api.send_request("/workspaces/#{@attributes[:id]}", :patch, params, @options)
41
+ end
42
+
43
+ def delete(params = {})
44
+ params ||= {}
45
+ params[:id] = @attributes[:id]
46
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
47
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
48
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
49
+
50
+ Api.send_request("/workspaces/#{@attributes[:id]}", :delete, params, @options)
51
+ end
52
+
53
+ def destroy(params = {})
54
+ delete(params)
55
+ nil
56
+ end
57
+
58
+ def save
59
+ if @attributes[:id]
60
+ new_obj = update(@attributes)
61
+ else
62
+ new_obj = Workspace.create(@attributes, @options)
63
+ end
64
+
65
+ @attributes = new_obj.attributes
66
+ true
67
+ end
68
+
69
+ # Parameters:
70
+ # 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.
71
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
72
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `name`.
73
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `name`.
74
+ # filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `name`.
75
+ def self.list(params = {}, options = {})
76
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
77
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
78
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
79
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
80
+ raise InvalidParameterError.new("Bad parameter: filter_prefix must be an Hash") if params[:filter_prefix] and !params[:filter_prefix].is_a?(Hash)
81
+
82
+ List.new(Workspace, params) do
83
+ Api.send_request("/workspaces", :get, params, options)
84
+ end
85
+ end
86
+
87
+ def self.all(params = {}, options = {})
88
+ list(params, options)
89
+ end
90
+
91
+ # Parameters:
92
+ # id (required) - int64 - Workspace ID.
93
+ def self.find(id, params = {}, options = {})
94
+ params ||= {}
95
+ params[:id] = id
96
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
97
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
98
+
99
+ response, options = Api.send_request("/workspaces/#{params[:id]}", :get, params, options)
100
+ Workspace.new(response.data, options)
101
+ end
102
+
103
+ def self.get(id, params = {}, options = {})
104
+ find(id, params, options)
105
+ end
106
+
107
+ # Parameters:
108
+ # name - string - Workspace name
109
+ def self.create(params = {}, options = {})
110
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
111
+
112
+ response, options = Api.send_request("/workspaces", :post, params, options)
113
+ Workspace.new(response.data, options)
114
+ end
115
+
116
+ # Parameters:
117
+ # name - string - Workspace name
118
+ def self.update(id, params = {}, options = {})
119
+ params ||= {}
120
+ params[:id] = id
121
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
122
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
123
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
124
+
125
+ response, options = Api.send_request("/workspaces/#{params[:id]}", :patch, params, options)
126
+ Workspace.new(response.data, options)
127
+ end
128
+
129
+ def self.delete(id, params = {}, options = {})
130
+ params ||= {}
131
+ params[:id] = id
132
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
133
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
134
+
135
+ Api.send_request("/workspaces/#{params[:id]}", :delete, params, options)
136
+ nil
137
+ end
138
+
139
+ def self.destroy(id, params = {}, options = {})
140
+ delete(id, params, options)
141
+ nil
142
+ end
143
+ end
144
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Files
4
- VERSION = "1.1.431"
4
+ VERSION = "1.1.432"
5
5
  end
data/lib/files.com.rb CHANGED
@@ -142,6 +142,7 @@ require "files.com/models/user_request"
142
142
  require "files.com/models/user_sftp_client_use"
143
143
  require "files.com/models/web_dav_action_log"
144
144
  require "files.com/models/webhook_test"
145
+ require "files.com/models/workspace"
145
146
 
146
147
  require "files.com/models/dir"
147
148
  require "files.com/models/file_utils"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: files.com
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.431
4
+ version: 1.1.432
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com
@@ -267,6 +267,7 @@ files:
267
267
  - docs/user_sftp_client_use.md
268
268
  - docs/web_dav_action_log.md
269
269
  - docs/webhook_test.md
270
+ - docs/workspace.md
270
271
  - files.com.gemspec
271
272
  - lib/files.com.rb
272
273
  - lib/files.com/api.rb
@@ -385,6 +386,7 @@ files:
385
386
  - lib/files.com/models/user_sftp_client_use.rb
386
387
  - lib/files.com/models/web_dav_action_log.rb
387
388
  - lib/files.com/models/webhook_test.rb
389
+ - lib/files.com/models/workspace.rb
388
390
  - lib/files.com/path_util.rb
389
391
  - lib/files.com/response.rb
390
392
  - lib/files.com/sizable_io.rb