files.com 1.0.231 → 1.0.232

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,176 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Files
4
- class As2Key
5
- attr_reader :options, :attributes
6
-
7
- def initialize(attributes = {}, options = {})
8
- @attributes = attributes || {}
9
- @options = options || {}
10
- end
11
-
12
- # int64 - AS2 Key ID
13
- def id
14
- @attributes[:id]
15
- end
16
-
17
- def id=(value)
18
- @attributes[:id] = value
19
- end
20
-
21
- # string - AS2 Partnership Name
22
- def as2_partnership_name
23
- @attributes[:as2_partnership_name]
24
- end
25
-
26
- def as2_partnership_name=(value)
27
- @attributes[:as2_partnership_name] = value
28
- end
29
-
30
- # date-time - AS2 Key created at date/time
31
- def created_at
32
- @attributes[:created_at]
33
- end
34
-
35
- # string - Public key fingerprint
36
- def fingerprint
37
- @attributes[:fingerprint]
38
- end
39
-
40
- def fingerprint=(value)
41
- @attributes[:fingerprint] = value
42
- end
43
-
44
- # int64 - User ID. Provide a value of `0` to operate the current session's user.
45
- def user_id
46
- @attributes[:user_id]
47
- end
48
-
49
- def user_id=(value)
50
- @attributes[:user_id] = value
51
- end
52
-
53
- # string - Actual contents of Public key.
54
- def public_key
55
- @attributes[:public_key]
56
- end
57
-
58
- def public_key=(value)
59
- @attributes[:public_key] = value
60
- end
61
-
62
- # Parameters:
63
- # as2_partnership_name (required) - string - AS2 Partnership Name
64
- def update(params = {})
65
- params ||= {}
66
- params[:id] = @attributes[:id]
67
- raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
68
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
69
- raise InvalidParameterError.new("Bad parameter: as2_partnership_name must be an String") if params.dig(:as2_partnership_name) and !params.dig(:as2_partnership_name).is_a?(String)
70
- raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
71
- raise MissingParameterError.new("Parameter missing: as2_partnership_name") unless params.dig(:as2_partnership_name)
72
-
73
- Api.send_request("/as2_keys/#{@attributes[:id]}", :patch, params, @options)
74
- end
75
-
76
- def delete(params = {})
77
- params ||= {}
78
- params[:id] = @attributes[:id]
79
- raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
80
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
81
- raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
82
-
83
- Api.send_request("/as2_keys/#{@attributes[:id]}", :delete, params, @options)
84
- end
85
-
86
- def destroy(params = {})
87
- delete(params)
88
- end
89
-
90
- def save
91
- if @attributes[:id]
92
- update(@attributes)
93
- else
94
- new_obj = As2Key.create(@attributes, @options)
95
- @attributes = new_obj.attributes
96
- end
97
- end
98
-
99
- # Parameters:
100
- # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
101
- # cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
102
- # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
103
- def self.list(params = {}, options = {})
104
- raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
105
- raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
106
- raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
107
-
108
- List.new(As2Key, params) do
109
- Api.send_request("/as2_keys", :get, params, options)
110
- end
111
- end
112
-
113
- def self.all(params = {}, options = {})
114
- list(params, options)
115
- end
116
-
117
- # Parameters:
118
- # id (required) - int64 - As2 Key ID.
119
- def self.find(id, params = {}, options = {})
120
- params ||= {}
121
- params[:id] = id
122
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
123
- raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
124
-
125
- response, options = Api.send_request("/as2_keys/#{params[:id]}", :get, params, options)
126
- As2Key.new(response.data, options)
127
- end
128
-
129
- def self.get(id, params = {}, options = {})
130
- find(id, params, options)
131
- end
132
-
133
- # Parameters:
134
- # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
135
- # as2_partnership_name (required) - string - AS2 Partnership Name
136
- # public_key (required) - string - Actual contents of Public key.
137
- def self.create(params = {}, options = {})
138
- raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
139
- raise InvalidParameterError.new("Bad parameter: as2_partnership_name must be an String") if params.dig(:as2_partnership_name) and !params.dig(:as2_partnership_name).is_a?(String)
140
- raise InvalidParameterError.new("Bad parameter: public_key must be an String") if params.dig(:public_key) and !params.dig(:public_key).is_a?(String)
141
- raise MissingParameterError.new("Parameter missing: as2_partnership_name") unless params.dig(:as2_partnership_name)
142
- raise MissingParameterError.new("Parameter missing: public_key") unless params.dig(:public_key)
143
-
144
- response, options = Api.send_request("/as2_keys", :post, params, options)
145
- As2Key.new(response.data, options)
146
- end
147
-
148
- # Parameters:
149
- # as2_partnership_name (required) - string - AS2 Partnership Name
150
- def self.update(id, params = {}, options = {})
151
- params ||= {}
152
- params[:id] = id
153
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
154
- raise InvalidParameterError.new("Bad parameter: as2_partnership_name must be an String") if params.dig(:as2_partnership_name) and !params.dig(:as2_partnership_name).is_a?(String)
155
- raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
156
- raise MissingParameterError.new("Parameter missing: as2_partnership_name") unless params.dig(:as2_partnership_name)
157
-
158
- response, options = Api.send_request("/as2_keys/#{params[:id]}", :patch, params, options)
159
- As2Key.new(response.data, options)
160
- end
161
-
162
- def self.delete(id, params = {}, options = {})
163
- params ||= {}
164
- params[:id] = id
165
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
166
- raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
167
-
168
- response, _options = Api.send_request("/as2_keys/#{params[:id]}", :delete, params, options)
169
- response.data
170
- end
171
-
172
- def self.destroy(id, params = {}, options = {})
173
- delete(id, params, options)
174
- end
175
- end
176
- end