files.com 1.0.91
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTORS +4 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +82 -0
- data/LICENSE +21 -0
- data/README.md +119 -0
- data/Rakefile +12 -0
- data/SECURITY.md +24 -0
- data/_VERSION +1 -0
- data/bin/files +8 -0
- data/bin/files-console +16 -0
- data/docs/account_line_item.md +41 -0
- data/docs/action.md +37 -0
- data/docs/api_key.md +202 -0
- data/docs/app.md +57 -0
- data/docs/as2_key.md +133 -0
- data/docs/auto.md +11 -0
- data/docs/automation.md +190 -0
- data/docs/behavior.md +208 -0
- data/docs/bundle.md +252 -0
- data/docs/bundle_download.md +35 -0
- data/docs/clickwrap.md +143 -0
- data/docs/dns_record.md +35 -0
- data/docs/errors.md +17 -0
- data/docs/file.md +204 -0
- data/docs/file_action.md +126 -0
- data/docs/file_comment.md +116 -0
- data/docs/file_comment_reaction.md +62 -0
- data/docs/file_part_upload.md +37 -0
- data/docs/file_utils.md +4 -0
- data/docs/folder.md +90 -0
- data/docs/group.md +153 -0
- data/docs/group_user.md +124 -0
- data/docs/history.md +171 -0
- data/docs/history_export.md +174 -0
- data/docs/image.md +13 -0
- data/docs/invoice.md +72 -0
- data/docs/invoice_line_item.md +27 -0
- data/docs/ip_address.md +55 -0
- data/docs/lock.md +98 -0
- data/docs/message.md +147 -0
- data/docs/message_comment.md +132 -0
- data/docs/message_comment_reaction.md +94 -0
- data/docs/message_reaction.md +94 -0
- data/docs/notification.md +177 -0
- data/docs/payment.md +72 -0
- data/docs/payment_line_item.md +19 -0
- data/docs/permission.md +95 -0
- data/docs/preview.md +19 -0
- data/docs/project.md +121 -0
- data/docs/public_ip_address.md +13 -0
- data/docs/public_key.md +133 -0
- data/docs/remote_server.md +356 -0
- data/docs/request.md +100 -0
- data/docs/session.md +78 -0
- data/docs/site.md +448 -0
- data/docs/sso_strategy.md +114 -0
- data/docs/status.md +21 -0
- data/docs/style.md +93 -0
- data/docs/usage_daily_snapshot.md +45 -0
- data/docs/usage_snapshot.md +53 -0
- data/docs/user.md +535 -0
- data/docs/user_cipher_use.md +41 -0
- data/docs/user_request.md +93 -0
- data/files.com.gemspec +22 -0
- data/lib/files.com.rb +184 -0
- data/lib/files.com/api.rb +38 -0
- data/lib/files.com/api_client.rb +340 -0
- data/lib/files.com/errors.rb +41 -0
- data/lib/files.com/list.rb +95 -0
- data/lib/files.com/models/account_line_item.rb +82 -0
- data/lib/files.com/models/action.rb +77 -0
- data/lib/files.com/models/api_key.rb +270 -0
- data/lib/files.com/models/app.rb +101 -0
- data/lib/files.com/models/as2_key.rb +179 -0
- data/lib/files.com/models/auto.rb +17 -0
- data/lib/files.com/models/automation.rb +304 -0
- data/lib/files.com/models/behavior.rb +266 -0
- data/lib/files.com/models/bundle.rb +371 -0
- data/lib/files.com/models/bundle_download.rb +49 -0
- data/lib/files.com/models/clickwrap.rb +197 -0
- data/lib/files.com/models/dir.rb +3 -0
- data/lib/files.com/models/dns_record.rb +51 -0
- data/lib/files.com/models/errors.rb +22 -0
- data/lib/files.com/models/file.rb +968 -0
- data/lib/files.com/models/file_action.rb +126 -0
- data/lib/files.com/models/file_comment.rb +146 -0
- data/lib/files.com/models/file_comment_reaction.rb +100 -0
- data/lib/files.com/models/file_part_upload.rb +82 -0
- data/lib/files.com/models/file_utils.rb +118 -0
- data/lib/files.com/models/folder.rb +357 -0
- data/lib/files.com/models/group.rb +208 -0
- data/lib/files.com/models/group_user.rb +171 -0
- data/lib/files.com/models/history.rb +228 -0
- data/lib/files.com/models/history_export.rb +353 -0
- data/lib/files.com/models/image.rb +22 -0
- data/lib/files.com/models/invoice.rb +117 -0
- data/lib/files.com/models/invoice_line_item.rb +57 -0
- data/lib/files.com/models/ip_address.rb +66 -0
- data/lib/files.com/models/lock.rb +173 -0
- data/lib/files.com/models/message.rb +201 -0
- data/lib/files.com/models/message_comment.rb +165 -0
- data/lib/files.com/models/message_comment_reaction.rb +128 -0
- data/lib/files.com/models/message_reaction.rb +128 -0
- data/lib/files.com/models/notification.rb +263 -0
- data/lib/files.com/models/payment.rb +117 -0
- data/lib/files.com/models/payment_line_item.rb +37 -0
- data/lib/files.com/models/permission.rb +172 -0
- data/lib/files.com/models/preview.rb +37 -0
- data/lib/files.com/models/project.rb +140 -0
- data/lib/files.com/models/public_ip_address.rb +22 -0
- data/lib/files.com/models/public_key.rb +179 -0
- data/lib/files.com/models/remote_server.rb +680 -0
- data/lib/files.com/models/request.rb +179 -0
- data/lib/files.com/models/session.rb +247 -0
- data/lib/files.com/models/site.rb +733 -0
- data/lib/files.com/models/sso_strategy.rb +227 -0
- data/lib/files.com/models/status.rb +37 -0
- data/lib/files.com/models/style.rb +131 -0
- data/lib/files.com/models/usage_daily_snapshot.rb +66 -0
- data/lib/files.com/models/usage_snapshot.rb +96 -0
- data/lib/files.com/models/user.rb +876 -0
- data/lib/files.com/models/user_cipher_use.rb +63 -0
- data/lib/files.com/models/user_request.rb +127 -0
- data/lib/files.com/response.rb +25 -0
- data/lib/files.com/sizable_io.rb +32 -0
- data/lib/files.com/system_profiler.rb +56 -0
- data/lib/files.com/util.rb +106 -0
- data/lib/files.com/version.rb +5 -0
- data/spec/list_spec.rb +214 -0
- data/spec/models/file_spec.rb +68 -0
- data/spec/models/folder_spec.rb +40 -0
- data/spec/spec_helper.rb +36 -0
- data/test.sh +8 -0
- data/test/test.rb +75 -0
- metadata +235 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class InvoiceLineItem
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# double - Invoice line item amount
|
13
|
+
def amount
|
14
|
+
@attributes[:amount]
|
15
|
+
end
|
16
|
+
|
17
|
+
# date-time - Invoice line item created at date/time
|
18
|
+
def created_at
|
19
|
+
@attributes[:created_at]
|
20
|
+
end
|
21
|
+
|
22
|
+
# string - Invoice line item description
|
23
|
+
def description
|
24
|
+
@attributes[:description]
|
25
|
+
end
|
26
|
+
|
27
|
+
# string - Invoice line item type
|
28
|
+
def type
|
29
|
+
@attributes[:type]
|
30
|
+
end
|
31
|
+
|
32
|
+
# date-time - Invoice line item service end date/time
|
33
|
+
def service_end_at
|
34
|
+
@attributes[:service_end_at]
|
35
|
+
end
|
36
|
+
|
37
|
+
# date-time - Invoice line item service start date/time
|
38
|
+
def service_start_at
|
39
|
+
@attributes[:service_start_at]
|
40
|
+
end
|
41
|
+
|
42
|
+
# date-time - Invoice line item updated date/time
|
43
|
+
def updated_at
|
44
|
+
@attributes[:updated_at]
|
45
|
+
end
|
46
|
+
|
47
|
+
# string - Plan name
|
48
|
+
def plan
|
49
|
+
@attributes[:plan]
|
50
|
+
end
|
51
|
+
|
52
|
+
# string - Site name
|
53
|
+
def site
|
54
|
+
@attributes[:site]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class IpAddress
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# string - Unique label for list; used by Zapier and other integrations.
|
13
|
+
def id
|
14
|
+
@attributes[:id]
|
15
|
+
end
|
16
|
+
|
17
|
+
# string - The object that this public IP address list is associated with.
|
18
|
+
def associated_with
|
19
|
+
@attributes[:associated_with]
|
20
|
+
end
|
21
|
+
|
22
|
+
# int64 - Group ID
|
23
|
+
def group_id
|
24
|
+
@attributes[:group_id]
|
25
|
+
end
|
26
|
+
|
27
|
+
# array - A list of IP addresses.
|
28
|
+
def ip_addresses
|
29
|
+
@attributes[:ip_addresses]
|
30
|
+
end
|
31
|
+
|
32
|
+
# Parameters:
|
33
|
+
# page - int64 - Current page number.
|
34
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
35
|
+
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
36
|
+
def self.list(params = {}, options = {})
|
37
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
38
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
39
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
40
|
+
|
41
|
+
response, options = Api.send_request("/ip_addresses", :get, params, options)
|
42
|
+
response.data.map do |entity_data|
|
43
|
+
IpAddress.new(entity_data, options)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.all(params = {}, options = {})
|
48
|
+
list(params, options)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Parameters:
|
52
|
+
# page - int64 - Current page number.
|
53
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
54
|
+
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
55
|
+
def self.get_reserved(params = {}, options = {})
|
56
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
57
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
58
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
59
|
+
|
60
|
+
response, options = Api.send_request("/ip_addresses/reserved", :get, params, options)
|
61
|
+
response.data.map do |entity_data|
|
62
|
+
PublicIpAddress.new(entity_data, options)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class Lock
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# string - Path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
13
|
+
def path
|
14
|
+
@attributes[:path]
|
15
|
+
end
|
16
|
+
|
17
|
+
def path=(value)
|
18
|
+
@attributes[:path] = value
|
19
|
+
end
|
20
|
+
|
21
|
+
# int64 - Lock timeout
|
22
|
+
def timeout
|
23
|
+
@attributes[:timeout]
|
24
|
+
end
|
25
|
+
|
26
|
+
def timeout=(value)
|
27
|
+
@attributes[:timeout] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
# string - Lock depth (0 or infinity)
|
31
|
+
def depth
|
32
|
+
@attributes[:depth]
|
33
|
+
end
|
34
|
+
|
35
|
+
def depth=(value)
|
36
|
+
@attributes[:depth] = value
|
37
|
+
end
|
38
|
+
|
39
|
+
# string - Owner of lock. This can be any arbitrary string.
|
40
|
+
def owner
|
41
|
+
@attributes[:owner]
|
42
|
+
end
|
43
|
+
|
44
|
+
def owner=(value)
|
45
|
+
@attributes[:owner] = value
|
46
|
+
end
|
47
|
+
|
48
|
+
# string - Lock scope(shared or exclusive)
|
49
|
+
def scope
|
50
|
+
@attributes[:scope]
|
51
|
+
end
|
52
|
+
|
53
|
+
def scope=(value)
|
54
|
+
@attributes[:scope] = value
|
55
|
+
end
|
56
|
+
|
57
|
+
# string - Lock token. Use to release lock.
|
58
|
+
def token
|
59
|
+
@attributes[:token]
|
60
|
+
end
|
61
|
+
|
62
|
+
def token=(value)
|
63
|
+
@attributes[:token] = value
|
64
|
+
end
|
65
|
+
|
66
|
+
# string - Lock type
|
67
|
+
def type
|
68
|
+
@attributes[:type]
|
69
|
+
end
|
70
|
+
|
71
|
+
def type=(value)
|
72
|
+
@attributes[:type] = value
|
73
|
+
end
|
74
|
+
|
75
|
+
# int64 - Lock creator user ID
|
76
|
+
def user_id
|
77
|
+
@attributes[:user_id]
|
78
|
+
end
|
79
|
+
|
80
|
+
def user_id=(value)
|
81
|
+
@attributes[:user_id] = value
|
82
|
+
end
|
83
|
+
|
84
|
+
# string - Lock creator username
|
85
|
+
def username
|
86
|
+
@attributes[:username]
|
87
|
+
end
|
88
|
+
|
89
|
+
def username=(value)
|
90
|
+
@attributes[:username] = value
|
91
|
+
end
|
92
|
+
|
93
|
+
# Parameters:
|
94
|
+
# token (required) - string - Lock token
|
95
|
+
def delete(params = {})
|
96
|
+
params ||= {}
|
97
|
+
params[:path] = @attributes[:path]
|
98
|
+
raise MissingParameterError.new("Current object doesn't have a path") unless @attributes[:path]
|
99
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
100
|
+
raise InvalidParameterError.new("Bad parameter: token must be an String") if params.dig(:token) and !params.dig(:token).is_a?(String)
|
101
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
102
|
+
raise MissingParameterError.new("Parameter missing: token") unless params.dig(:token)
|
103
|
+
|
104
|
+
Api.send_request("/locks/#{@attributes[:path]}", :delete, params, @options)
|
105
|
+
end
|
106
|
+
|
107
|
+
def destroy(params = {})
|
108
|
+
delete(params)
|
109
|
+
end
|
110
|
+
|
111
|
+
def save
|
112
|
+
if @attributes[:path]
|
113
|
+
raise NotImplementedError.new("The Lock object doesn't support updates.")
|
114
|
+
else
|
115
|
+
new_obj = Lock.create(@attributes, @options)
|
116
|
+
@attributes = new_obj.attributes
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Parameters:
|
121
|
+
# page - int64 - Current page number.
|
122
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
123
|
+
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
124
|
+
# path (required) - string - Path to operate on.
|
125
|
+
# include_children - boolean - Include locks from children objects?
|
126
|
+
def self.list_for(path, params = {}, options = {})
|
127
|
+
params ||= {}
|
128
|
+
params[:path] = path
|
129
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
130
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
131
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
132
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
133
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
134
|
+
|
135
|
+
response, options = Api.send_request("/locks/#{params[:path]}", :get, params, options)
|
136
|
+
response.data.map do |entity_data|
|
137
|
+
Lock.new(entity_data, options)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# Parameters:
|
142
|
+
# path (required) - string - Path
|
143
|
+
# timeout - int64 - Lock timeout length
|
144
|
+
def self.create(path, params = {}, options = {})
|
145
|
+
params ||= {}
|
146
|
+
params[:path] = path
|
147
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
148
|
+
raise InvalidParameterError.new("Bad parameter: timeout must be an Integer") if params.dig(:timeout) and !params.dig(:timeout).is_a?(Integer)
|
149
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
150
|
+
|
151
|
+
response, options = Api.send_request("/locks/#{params[:path]}", :post, params, options)
|
152
|
+
Lock.new(response.data, options)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Parameters:
|
156
|
+
# token (required) - string - Lock token
|
157
|
+
def self.delete(path, params = {}, options = {})
|
158
|
+
params ||= {}
|
159
|
+
params[:path] = path
|
160
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
161
|
+
raise InvalidParameterError.new("Bad parameter: token must be an String") if params.dig(:token) and !params.dig(:token).is_a?(String)
|
162
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
163
|
+
raise MissingParameterError.new("Parameter missing: token") unless params.dig(:token)
|
164
|
+
|
165
|
+
response, _options = Api.send_request("/locks/#{params[:path]}", :delete, params, options)
|
166
|
+
response.data
|
167
|
+
end
|
168
|
+
|
169
|
+
def self.destroy(path, params = {}, options = {})
|
170
|
+
delete(path, params, options)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class Message
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# int64 - Message ID
|
13
|
+
def id
|
14
|
+
@attributes[:id]
|
15
|
+
end
|
16
|
+
|
17
|
+
def id=(value)
|
18
|
+
@attributes[:id] = value
|
19
|
+
end
|
20
|
+
|
21
|
+
# string - Message subject.
|
22
|
+
def subject
|
23
|
+
@attributes[:subject]
|
24
|
+
end
|
25
|
+
|
26
|
+
def subject=(value)
|
27
|
+
@attributes[:subject] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
# string - Message body.
|
31
|
+
def body
|
32
|
+
@attributes[:body]
|
33
|
+
end
|
34
|
+
|
35
|
+
def body=(value)
|
36
|
+
@attributes[:body] = value
|
37
|
+
end
|
38
|
+
|
39
|
+
# array - Comments.
|
40
|
+
def comments
|
41
|
+
@attributes[:comments]
|
42
|
+
end
|
43
|
+
|
44
|
+
def comments=(value)
|
45
|
+
@attributes[:comments] = value
|
46
|
+
end
|
47
|
+
|
48
|
+
# int64 - User ID. Provide a value of `0` to operate the current session's user.
|
49
|
+
def user_id
|
50
|
+
@attributes[:user_id]
|
51
|
+
end
|
52
|
+
|
53
|
+
def user_id=(value)
|
54
|
+
@attributes[:user_id] = value
|
55
|
+
end
|
56
|
+
|
57
|
+
# int64 - Project to which the message should be attached.
|
58
|
+
def project_id
|
59
|
+
@attributes[:project_id]
|
60
|
+
end
|
61
|
+
|
62
|
+
def project_id=(value)
|
63
|
+
@attributes[:project_id] = value
|
64
|
+
end
|
65
|
+
|
66
|
+
# Parameters:
|
67
|
+
# project_id (required) - int64 - Project to which the message should be attached.
|
68
|
+
# subject (required) - string - Message subject.
|
69
|
+
# body (required) - string - Message body.
|
70
|
+
def update(params = {})
|
71
|
+
params ||= {}
|
72
|
+
params[:id] = @attributes[:id]
|
73
|
+
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
74
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
75
|
+
raise InvalidParameterError.new("Bad parameter: project_id must be an Integer") if params.dig(:project_id) and !params.dig(:project_id).is_a?(Integer)
|
76
|
+
raise InvalidParameterError.new("Bad parameter: subject must be an String") if params.dig(:subject) and !params.dig(:subject).is_a?(String)
|
77
|
+
raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
|
78
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
79
|
+
raise MissingParameterError.new("Parameter missing: project_id") unless params.dig(:project_id)
|
80
|
+
raise MissingParameterError.new("Parameter missing: subject") unless params.dig(:subject)
|
81
|
+
raise MissingParameterError.new("Parameter missing: body") unless params.dig(:body)
|
82
|
+
|
83
|
+
Api.send_request("/messages/#{@attributes[:id]}", :patch, params, @options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def delete(params = {})
|
87
|
+
params ||= {}
|
88
|
+
params[:id] = @attributes[:id]
|
89
|
+
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
90
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
91
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
92
|
+
|
93
|
+
Api.send_request("/messages/#{@attributes[:id]}", :delete, params, @options)
|
94
|
+
end
|
95
|
+
|
96
|
+
def destroy(params = {})
|
97
|
+
delete(params)
|
98
|
+
end
|
99
|
+
|
100
|
+
def save
|
101
|
+
if @attributes[:id]
|
102
|
+
update(@attributes)
|
103
|
+
else
|
104
|
+
new_obj = Message.create(@attributes, @options)
|
105
|
+
@attributes = new_obj.attributes
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Parameters:
|
110
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
111
|
+
# page - int64 - Current page number.
|
112
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
113
|
+
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
114
|
+
# project_id (required) - int64 - Project for which to return messages.
|
115
|
+
def self.list(params = {}, options = {})
|
116
|
+
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
|
117
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
118
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
119
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
120
|
+
raise InvalidParameterError.new("Bad parameter: project_id must be an Integer") if params.dig(:project_id) and !params.dig(:project_id).is_a?(Integer)
|
121
|
+
raise MissingParameterError.new("Parameter missing: project_id") unless params.dig(:project_id)
|
122
|
+
|
123
|
+
response, options = Api.send_request("/messages", :get, params, options)
|
124
|
+
response.data.map do |entity_data|
|
125
|
+
Message.new(entity_data, options)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.all(params = {}, options = {})
|
130
|
+
list(params, options)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Parameters:
|
134
|
+
# id (required) - int64 - Message ID.
|
135
|
+
def self.find(id, params = {}, options = {})
|
136
|
+
params ||= {}
|
137
|
+
params[:id] = id
|
138
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
139
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
140
|
+
|
141
|
+
response, options = Api.send_request("/messages/#{params[:id]}", :get, params, options)
|
142
|
+
Message.new(response.data, options)
|
143
|
+
end
|
144
|
+
|
145
|
+
def self.get(id, params = {}, options = {})
|
146
|
+
find(id, params, options)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Parameters:
|
150
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
151
|
+
# project_id (required) - int64 - Project to which the message should be attached.
|
152
|
+
# subject (required) - string - Message subject.
|
153
|
+
# body (required) - string - Message body.
|
154
|
+
def self.create(params = {}, options = {})
|
155
|
+
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
|
156
|
+
raise InvalidParameterError.new("Bad parameter: project_id must be an Integer") if params.dig(:project_id) and !params.dig(:project_id).is_a?(Integer)
|
157
|
+
raise InvalidParameterError.new("Bad parameter: subject must be an String") if params.dig(:subject) and !params.dig(:subject).is_a?(String)
|
158
|
+
raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
|
159
|
+
raise MissingParameterError.new("Parameter missing: project_id") unless params.dig(:project_id)
|
160
|
+
raise MissingParameterError.new("Parameter missing: subject") unless params.dig(:subject)
|
161
|
+
raise MissingParameterError.new("Parameter missing: body") unless params.dig(:body)
|
162
|
+
|
163
|
+
response, options = Api.send_request("/messages", :post, params, options)
|
164
|
+
Message.new(response.data, options)
|
165
|
+
end
|
166
|
+
|
167
|
+
# Parameters:
|
168
|
+
# project_id (required) - int64 - Project to which the message should be attached.
|
169
|
+
# subject (required) - string - Message subject.
|
170
|
+
# body (required) - string - Message body.
|
171
|
+
def self.update(id, params = {}, options = {})
|
172
|
+
params ||= {}
|
173
|
+
params[:id] = id
|
174
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
175
|
+
raise InvalidParameterError.new("Bad parameter: project_id must be an Integer") if params.dig(:project_id) and !params.dig(:project_id).is_a?(Integer)
|
176
|
+
raise InvalidParameterError.new("Bad parameter: subject must be an String") if params.dig(:subject) and !params.dig(:subject).is_a?(String)
|
177
|
+
raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
|
178
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
179
|
+
raise MissingParameterError.new("Parameter missing: project_id") unless params.dig(:project_id)
|
180
|
+
raise MissingParameterError.new("Parameter missing: subject") unless params.dig(:subject)
|
181
|
+
raise MissingParameterError.new("Parameter missing: body") unless params.dig(:body)
|
182
|
+
|
183
|
+
response, options = Api.send_request("/messages/#{params[:id]}", :patch, params, options)
|
184
|
+
Message.new(response.data, options)
|
185
|
+
end
|
186
|
+
|
187
|
+
def self.delete(id, params = {}, options = {})
|
188
|
+
params ||= {}
|
189
|
+
params[:id] = id
|
190
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
191
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
192
|
+
|
193
|
+
response, _options = Api.send_request("/messages/#{params[:id]}", :delete, params, options)
|
194
|
+
response.data
|
195
|
+
end
|
196
|
+
|
197
|
+
def self.destroy(id, params = {}, options = {})
|
198
|
+
delete(id, params, options)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|