files.com 1.1.719 → 1.1.720

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.
@@ -1,141 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Files
4
- class Project
5
- attr_reader :options, :attributes
6
-
7
- def initialize(attributes = {}, options = {})
8
- @attributes = attributes || {}
9
- @options = options || {}
10
- end
11
-
12
- # int64 - Project ID
13
- def id
14
- @attributes[:id]
15
- end
16
-
17
- def id=(value)
18
- @attributes[:id] = value
19
- end
20
-
21
- # string - Global access settings
22
- def global_access
23
- @attributes[:global_access]
24
- end
25
-
26
- def global_access=(value)
27
- @attributes[:global_access] = value
28
- end
29
-
30
- # Parameters:
31
- # global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
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: global_access must be an String") if params[:global_access] and !params[:global_access].is_a?(String)
38
- raise MissingParameterError.new("Parameter missing: id") unless params[:id]
39
- raise MissingParameterError.new("Parameter missing: global_access") unless params[:global_access]
40
-
41
- Api.send_request("/projects/#{@attributes[:id]}", :patch, params, @options)
42
- end
43
-
44
- def delete(params = {})
45
- params ||= {}
46
- params[:id] = @attributes[:id]
47
- raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
48
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
49
- raise MissingParameterError.new("Parameter missing: id") unless params[:id]
50
-
51
- Api.send_request("/projects/#{@attributes[:id]}", :delete, params, @options)
52
- end
53
-
54
- def destroy(params = {})
55
- delete(params)
56
- nil
57
- end
58
-
59
- def save
60
- if @attributes[:id]
61
- new_obj = update(@attributes)
62
- else
63
- new_obj = Project.create(@attributes, @options)
64
- end
65
-
66
- @attributes = new_obj.attributes
67
- true
68
- end
69
-
70
- # Parameters:
71
- # 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.
72
- # per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
73
- def self.list(params = {}, options = {})
74
- raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
75
- raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
76
-
77
- List.new(Project, params) do
78
- Api.send_request("/projects", :get, params, options)
79
- end
80
- end
81
-
82
- def self.all(params = {}, options = {})
83
- list(params, options)
84
- end
85
-
86
- # Parameters:
87
- # id (required) - int64 - Project ID.
88
- def self.find(id, params = {}, options = {})
89
- params ||= {}
90
- params[:id] = id
91
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
92
- raise MissingParameterError.new("Parameter missing: id") unless params[:id]
93
-
94
- response, options = Api.send_request("/projects/#{params[:id]}", :get, params, options)
95
- Project.new(response.data, options)
96
- end
97
-
98
- def self.get(id, params = {}, options = {})
99
- find(id, params, options)
100
- end
101
-
102
- # Parameters:
103
- # global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
104
- def self.create(params = {}, options = {})
105
- raise InvalidParameterError.new("Bad parameter: global_access must be an String") if params[:global_access] and !params[:global_access].is_a?(String)
106
- raise MissingParameterError.new("Parameter missing: global_access") unless params[:global_access]
107
-
108
- response, options = Api.send_request("/projects", :post, params, options)
109
- Project.new(response.data, options)
110
- end
111
-
112
- # Parameters:
113
- # global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
114
- def self.update(id, params = {}, options = {})
115
- params ||= {}
116
- params[:id] = id
117
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
118
- raise InvalidParameterError.new("Bad parameter: global_access must be an String") if params[:global_access] and !params[:global_access].is_a?(String)
119
- raise MissingParameterError.new("Parameter missing: id") unless params[:id]
120
- raise MissingParameterError.new("Parameter missing: global_access") unless params[:global_access]
121
-
122
- response, options = Api.send_request("/projects/#{params[:id]}", :patch, params, options)
123
- Project.new(response.data, options)
124
- end
125
-
126
- def self.delete(id, params = {}, options = {})
127
- params ||= {}
128
- params[:id] = id
129
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
130
- raise MissingParameterError.new("Parameter missing: id") unless params[:id]
131
-
132
- Api.send_request("/projects/#{params[:id]}", :delete, params, options)
133
- nil
134
- end
135
-
136
- def self.destroy(id, params = {}, options = {})
137
- delete(id, params, options)
138
- nil
139
- end
140
- end
141
- end