appwrite 2.0.2 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile +1 -1
  4. data/README.md +74 -6
  5. data/appwrite.gemspec +2 -2
  6. data/docs/examples/account/create-recovery.md +15 -0
  7. data/docs/examples/account/create-verification.md +15 -0
  8. data/docs/examples/account/delete-session.md +15 -0
  9. data/docs/examples/account/delete-sessions.md +15 -0
  10. data/docs/examples/account/delete.md +15 -0
  11. data/docs/examples/account/get-logs.md +15 -0
  12. data/docs/examples/account/get-prefs.md +15 -0
  13. data/docs/examples/account/get-session.md +15 -0
  14. data/docs/examples/account/get-sessions.md +15 -0
  15. data/docs/examples/account/get.md +15 -0
  16. data/docs/examples/account/update-email.md +15 -0
  17. data/docs/examples/account/update-name.md +15 -0
  18. data/docs/examples/account/update-password.md +15 -0
  19. data/docs/examples/account/update-prefs.md +15 -0
  20. data/docs/examples/account/update-recovery.md +15 -0
  21. data/docs/examples/account/update-verification.md +15 -0
  22. data/docs/examples/avatars/get-q-r.md +1 -1
  23. data/docs/examples/database/create-document.md +1 -1
  24. data/docs/examples/database/update-collection.md +1 -1
  25. data/docs/examples/database/update-document.md +1 -1
  26. data/docs/examples/functions/create.md +1 -1
  27. data/docs/examples/health/get-d-b.md +1 -1
  28. data/docs/examples/locale/get-countries-e-u.md +1 -1
  29. data/docs/examples/storage/create-file.md +1 -1
  30. data/docs/examples/teams/delete-membership.md +1 -1
  31. data/docs/examples/teams/update-membership-roles.md +15 -0
  32. data/docs/examples/teams/update-membership-status.md +15 -0
  33. data/docs/examples/users/{delete-user.md → delete.md} +1 -1
  34. data/docs/examples/users/update-status.md +1 -1
  35. data/docs/examples/users/update-verification.md +15 -0
  36. data/lib/appwrite.rb +2 -0
  37. data/lib/appwrite/client.rb +21 -5
  38. data/lib/appwrite/exception.rb +14 -0
  39. data/lib/appwrite/services/account.rb +295 -0
  40. data/lib/appwrite/services/avatars.rb +125 -42
  41. data/lib/appwrite/services/database.rb +199 -53
  42. data/lib/appwrite/services/functions.rb +223 -60
  43. data/lib/appwrite/services/health.rb +13 -25
  44. data/lib/appwrite/services/locale.rb +8 -15
  45. data/lib/appwrite/services/storage.rb +127 -33
  46. data/lib/appwrite/services/teams.rb +187 -38
  47. data/lib/appwrite/services/users.rb +129 -34
  48. metadata +24 -3
@@ -1,29 +1,56 @@
1
1
  module Appwrite
2
2
  class Users < Service
3
3
 
4
- def list(search: '', limit: 25, offset: 0, order_type: 'ASC')
4
+ def list(search: nil, limit: nil, offset: nil, order_type: nil)
5
5
  path = '/users'
6
6
 
7
- params = {
8
- 'search': search,
9
- 'limit': limit,
10
- 'offset': offset,
11
- 'orderType': order_type
12
- }
7
+ params = {}
8
+
9
+ if !search.nil?
10
+ params[:search] = search
11
+ end
12
+
13
+ if !limit.nil?
14
+ params[:limit] = limit
15
+ end
16
+
17
+ if !offset.nil?
18
+ params[:offset] = offset
19
+ end
20
+
21
+ if !order_type.nil?
22
+ params[:orderType] = order_type
23
+ end
13
24
 
14
25
  return @client.call('get', path, {
15
26
  'content-type' => 'application/json',
16
27
  }, params);
17
28
  end
18
29
 
19
- def create(email:, password:, name: '')
30
+ def create(email:, password:, name: nil)
31
+ if email.nil?
32
+ raise Appwrite::Exception.new('Missing required parameter: "email"')
33
+ end
34
+
35
+ if password.nil?
36
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
37
+ end
38
+
20
39
  path = '/users'
21
40
 
22
- params = {
23
- 'email': email,
24
- 'password': password,
25
- 'name': name
26
- }
41
+ params = {}
42
+
43
+ if !email.nil?
44
+ params[:email] = email
45
+ end
46
+
47
+ if !password.nil?
48
+ params[:password] = password
49
+ end
50
+
51
+ if !name.nil?
52
+ params[:name] = name
53
+ end
27
54
 
28
55
  return @client.call('post', path, {
29
56
  'content-type' => 'application/json',
@@ -31,23 +58,29 @@ module Appwrite
31
58
  end
32
59
 
33
60
  def get(user_id:)
61
+ if user_id.nil?
62
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
63
+ end
64
+
34
65
  path = '/users/{userId}'
35
66
  .gsub('{userId}', user_id)
36
67
 
37
- params = {
38
- }
68
+ params = {}
39
69
 
40
70
  return @client.call('get', path, {
41
71
  'content-type' => 'application/json',
42
72
  }, params);
43
73
  end
44
74
 
45
- def delete_user(user_id:)
75
+ def delete(user_id:)
76
+ if user_id.nil?
77
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
78
+ end
79
+
46
80
  path = '/users/{userId}'
47
81
  .gsub('{userId}', user_id)
48
82
 
49
- params = {
50
- }
83
+ params = {}
51
84
 
52
85
  return @client.call('delete', path, {
53
86
  'content-type' => 'application/json',
@@ -55,11 +88,14 @@ module Appwrite
55
88
  end
56
89
 
57
90
  def get_logs(user_id:)
91
+ if user_id.nil?
92
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
93
+ end
94
+
58
95
  path = '/users/{userId}/logs'
59
96
  .gsub('{userId}', user_id)
60
97
 
61
- params = {
62
- }
98
+ params = {}
63
99
 
64
100
  return @client.call('get', path, {
65
101
  'content-type' => 'application/json',
@@ -67,11 +103,14 @@ module Appwrite
67
103
  end
68
104
 
69
105
  def get_prefs(user_id:)
106
+ if user_id.nil?
107
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
108
+ end
109
+
70
110
  path = '/users/{userId}/prefs'
71
111
  .gsub('{userId}', user_id)
72
112
 
73
- params = {
74
- }
113
+ params = {}
75
114
 
76
115
  return @client.call('get', path, {
77
116
  'content-type' => 'application/json',
@@ -79,12 +118,22 @@ module Appwrite
79
118
  end
80
119
 
81
120
  def update_prefs(user_id:, prefs:)
121
+ if user_id.nil?
122
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
123
+ end
124
+
125
+ if prefs.nil?
126
+ raise Appwrite::Exception.new('Missing required parameter: "prefs"')
127
+ end
128
+
82
129
  path = '/users/{userId}/prefs'
83
130
  .gsub('{userId}', user_id)
84
131
 
85
- params = {
86
- 'prefs': prefs
87
- }
132
+ params = {}
133
+
134
+ if !prefs.nil?
135
+ params[:prefs] = prefs
136
+ end
88
137
 
89
138
  return @client.call('patch', path, {
90
139
  'content-type' => 'application/json',
@@ -92,11 +141,14 @@ module Appwrite
92
141
  end
93
142
 
94
143
  def get_sessions(user_id:)
144
+ if user_id.nil?
145
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
146
+ end
147
+
95
148
  path = '/users/{userId}/sessions'
96
149
  .gsub('{userId}', user_id)
97
150
 
98
- params = {
99
- }
151
+ params = {}
100
152
 
101
153
  return @client.call('get', path, {
102
154
  'content-type' => 'application/json',
@@ -104,11 +156,14 @@ module Appwrite
104
156
  end
105
157
 
106
158
  def delete_sessions(user_id:)
159
+ if user_id.nil?
160
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
161
+ end
162
+
107
163
  path = '/users/{userId}/sessions'
108
164
  .gsub('{userId}', user_id)
109
165
 
110
- params = {
111
- }
166
+ params = {}
112
167
 
113
168
  return @client.call('delete', path, {
114
169
  'content-type' => 'application/json',
@@ -116,12 +171,19 @@ module Appwrite
116
171
  end
117
172
 
118
173
  def delete_session(user_id:, session_id:)
174
+ if user_id.nil?
175
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
176
+ end
177
+
178
+ if session_id.nil?
179
+ raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
180
+ end
181
+
119
182
  path = '/users/{userId}/sessions/{sessionId}'
120
183
  .gsub('{userId}', user_id)
121
184
  .gsub('{sessionId}', session_id)
122
185
 
123
- params = {
124
- }
186
+ params = {}
125
187
 
126
188
  return @client.call('delete', path, {
127
189
  'content-type' => 'application/json',
@@ -129,12 +191,45 @@ module Appwrite
129
191
  end
130
192
 
131
193
  def update_status(user_id:, status:)
194
+ if user_id.nil?
195
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
196
+ end
197
+
198
+ if status.nil?
199
+ raise Appwrite::Exception.new('Missing required parameter: "status"')
200
+ end
201
+
132
202
  path = '/users/{userId}/status'
133
203
  .gsub('{userId}', user_id)
134
204
 
135
- params = {
136
- 'status': status
137
- }
205
+ params = {}
206
+
207
+ if !status.nil?
208
+ params[:status] = status
209
+ end
210
+
211
+ return @client.call('patch', path, {
212
+ 'content-type' => 'application/json',
213
+ }, params);
214
+ end
215
+
216
+ def update_verification(user_id:, email_verification:)
217
+ if user_id.nil?
218
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
219
+ end
220
+
221
+ if email_verification.nil?
222
+ raise Appwrite::Exception.new('Missing required parameter: "emailVerification"')
223
+ end
224
+
225
+ path = '/users/{userId}/verification'
226
+ .gsub('{userId}', user_id)
227
+
228
+ params = {}
229
+
230
+ if !email_verification.nil?
231
+ params[:emailVerification] = email_verification
232
+ end
138
233
 
139
234
  return @client.call('patch', path, {
140
235
  'content-type' => 'application/json',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appwrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appwrite Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-26 00:00:00.000000000 Z
11
+ date: 2021-07-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: team@appwrite.io
@@ -22,6 +22,22 @@ files:
22
22
  - LICENSE
23
23
  - README.md
24
24
  - appwrite.gemspec
25
+ - docs/examples/account/create-recovery.md
26
+ - docs/examples/account/create-verification.md
27
+ - docs/examples/account/delete-session.md
28
+ - docs/examples/account/delete-sessions.md
29
+ - docs/examples/account/delete.md
30
+ - docs/examples/account/get-logs.md
31
+ - docs/examples/account/get-prefs.md
32
+ - docs/examples/account/get-session.md
33
+ - docs/examples/account/get-sessions.md
34
+ - docs/examples/account/get.md
35
+ - docs/examples/account/update-email.md
36
+ - docs/examples/account/update-name.md
37
+ - docs/examples/account/update-password.md
38
+ - docs/examples/account/update-prefs.md
39
+ - docs/examples/account/update-recovery.md
40
+ - docs/examples/account/update-verification.md
25
41
  - docs/examples/avatars/get-browser.md
26
42
  - docs/examples/avatars/get-credit-card.md
27
43
  - docs/examples/avatars/get-favicon.md
@@ -86,11 +102,13 @@ files:
86
102
  - docs/examples/teams/get-memberships.md
87
103
  - docs/examples/teams/get.md
88
104
  - docs/examples/teams/list.md
105
+ - docs/examples/teams/update-membership-roles.md
106
+ - docs/examples/teams/update-membership-status.md
89
107
  - docs/examples/teams/update.md
90
108
  - docs/examples/users/create.md
91
109
  - docs/examples/users/delete-session.md
92
110
  - docs/examples/users/delete-sessions.md
93
- - docs/examples/users/delete-user.md
111
+ - docs/examples/users/delete.md
94
112
  - docs/examples/users/get-logs.md
95
113
  - docs/examples/users/get-prefs.md
96
114
  - docs/examples/users/get-sessions.md
@@ -98,10 +116,13 @@ files:
98
116
  - docs/examples/users/list.md
99
117
  - docs/examples/users/update-prefs.md
100
118
  - docs/examples/users/update-status.md
119
+ - docs/examples/users/update-verification.md
101
120
  - lib/appwrite.rb
102
121
  - lib/appwrite/client.rb
122
+ - lib/appwrite/exception.rb
103
123
  - lib/appwrite/file.rb
104
124
  - lib/appwrite/service.rb
125
+ - lib/appwrite/services/account.rb
105
126
  - lib/appwrite/services/avatars.rb
106
127
  - lib/appwrite/services/database.rb
107
128
  - lib/appwrite/services/functions.rb