appwrite 2.0.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +16 -0
  3. data/README.md +72 -3
  4. data/appwrite.gemspec +1 -1
  5. data/docs/examples/account/create-recovery.md +15 -0
  6. data/docs/examples/account/create-verification.md +15 -0
  7. data/docs/examples/account/delete-session.md +15 -0
  8. data/docs/examples/account/delete-sessions.md +15 -0
  9. data/docs/examples/account/delete.md +15 -0
  10. data/docs/examples/account/get-logs.md +15 -0
  11. data/docs/examples/account/get-prefs.md +15 -0
  12. data/docs/examples/account/get-sessions.md +15 -0
  13. data/docs/examples/account/get.md +15 -0
  14. data/docs/examples/account/update-email.md +15 -0
  15. data/docs/examples/account/update-name.md +15 -0
  16. data/docs/examples/account/update-password.md +15 -0
  17. data/docs/examples/account/update-prefs.md +15 -0
  18. data/docs/examples/account/update-recovery.md +15 -0
  19. data/docs/examples/account/update-verification.md +15 -0
  20. data/docs/examples/avatars/get-q-r.md +1 -1
  21. data/docs/examples/database/create-document.md +1 -1
  22. data/docs/examples/database/update-collection.md +1 -1
  23. data/docs/examples/database/update-document.md +1 -1
  24. data/docs/examples/functions/create.md +1 -1
  25. data/docs/examples/health/get-d-b.md +1 -1
  26. data/docs/examples/locale/get-countries-e-u.md +1 -1
  27. data/docs/examples/storage/create-file.md +1 -1
  28. data/docs/examples/teams/delete-membership.md +1 -1
  29. data/docs/examples/teams/update-membership-roles.md +15 -0
  30. data/docs/examples/teams/update-membership-status.md +15 -0
  31. data/docs/examples/users/{delete-user.md → delete.md} +1 -1
  32. data/docs/examples/users/update-status.md +1 -1
  33. data/lib/appwrite.rb +2 -0
  34. data/lib/appwrite/client.rb +21 -5
  35. data/lib/appwrite/exception.rb +14 -0
  36. data/lib/appwrite/services/account.rb +280 -0
  37. data/lib/appwrite/services/avatars.rb +125 -42
  38. data/lib/appwrite/services/database.rb +199 -53
  39. data/lib/appwrite/services/functions.rb +223 -60
  40. data/lib/appwrite/services/health.rb +13 -25
  41. data/lib/appwrite/services/locale.rb +8 -15
  42. data/lib/appwrite/services/storage.rb +123 -33
  43. data/lib/appwrite/services/teams.rb +187 -38
  44. data/lib/appwrite/services/users.rb +106 -34
  45. metadata +24 -4
@@ -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,22 @@ 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
138
210
 
139
211
  return @client.call('patch', path, {
140
212
  '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.0
4
+ version: 2.2.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-11 00:00:00.000000000 Z
11
+ date: 2021-06-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: team@appwrite.io
@@ -16,11 +16,27 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
+ - ".travis.yml"
19
20
  - CHANGELOG.md
20
21
  - Gemfile
21
22
  - LICENSE
22
23
  - README.md
23
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-sessions.md
33
+ - docs/examples/account/get.md
34
+ - docs/examples/account/update-email.md
35
+ - docs/examples/account/update-name.md
36
+ - docs/examples/account/update-password.md
37
+ - docs/examples/account/update-prefs.md
38
+ - docs/examples/account/update-recovery.md
39
+ - docs/examples/account/update-verification.md
24
40
  - docs/examples/avatars/get-browser.md
25
41
  - docs/examples/avatars/get-credit-card.md
26
42
  - docs/examples/avatars/get-favicon.md
@@ -85,11 +101,13 @@ files:
85
101
  - docs/examples/teams/get-memberships.md
86
102
  - docs/examples/teams/get.md
87
103
  - docs/examples/teams/list.md
104
+ - docs/examples/teams/update-membership-roles.md
105
+ - docs/examples/teams/update-membership-status.md
88
106
  - docs/examples/teams/update.md
89
107
  - docs/examples/users/create.md
90
108
  - docs/examples/users/delete-session.md
91
109
  - docs/examples/users/delete-sessions.md
92
- - docs/examples/users/delete-user.md
110
+ - docs/examples/users/delete.md
93
111
  - docs/examples/users/get-logs.md
94
112
  - docs/examples/users/get-prefs.md
95
113
  - docs/examples/users/get-sessions.md
@@ -99,8 +117,10 @@ files:
99
117
  - docs/examples/users/update-status.md
100
118
  - lib/appwrite.rb
101
119
  - lib/appwrite/client.rb
120
+ - lib/appwrite/exception.rb
102
121
  - lib/appwrite/file.rb
103
122
  - lib/appwrite/service.rb
123
+ - lib/appwrite/services/account.rb
104
124
  - lib/appwrite/services/avatars.rb
105
125
  - lib/appwrite/services/database.rb
106
126
  - lib/appwrite/services/functions.rb
@@ -127,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
147
  - !ruby/object:Gem::Version
128
148
  version: '0'
129
149
  requirements: []
130
- rubygems_version: 3.0.3
150
+ rubygems_version: 3.0.8
131
151
  signing_key:
132
152
  specification_version: 4
133
153
  summary: Appwrite is an open-source self-hosted backend server that abstract and simplify