appwrite 1.0.11 → 2.1.2

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +16 -0
  3. data/Gemfile +1 -0
  4. data/LICENSE +1 -1
  5. data/README.md +72 -5
  6. data/appwrite.gemspec +3 -5
  7. data/docs/examples/account/create-recovery.md +15 -0
  8. data/docs/examples/account/create-verification.md +15 -0
  9. data/docs/examples/account/delete-session.md +15 -0
  10. data/docs/examples/account/delete-sessions.md +15 -0
  11. data/docs/examples/account/delete.md +15 -0
  12. data/docs/examples/account/get-logs.md +15 -0
  13. data/docs/examples/account/get-prefs.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/{database/get-collection-logs.md → avatars/get-initials.md} +2 -2
  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-execution.md +15 -0
  27. data/docs/examples/functions/create-tag.md +15 -0
  28. data/docs/examples/functions/create.md +15 -0
  29. data/docs/examples/functions/delete-tag.md +15 -0
  30. data/docs/examples/functions/delete.md +15 -0
  31. data/docs/examples/functions/get-execution.md +15 -0
  32. data/docs/examples/functions/get-tag.md +15 -0
  33. data/docs/examples/functions/get.md +15 -0
  34. data/docs/examples/functions/list-executions.md +15 -0
  35. data/docs/examples/functions/list-tags.md +15 -0
  36. data/docs/examples/functions/list.md +15 -0
  37. data/docs/examples/functions/update-tag.md +15 -0
  38. data/docs/examples/functions/update.md +15 -0
  39. data/docs/examples/locale/get-languages.md +15 -0
  40. data/docs/examples/storage/create-file.md +1 -1
  41. data/docs/examples/teams/delete-membership.md +1 -1
  42. data/docs/examples/teams/update-membership-roles.md +15 -0
  43. data/docs/examples/teams/update-membership-status.md +15 -0
  44. data/docs/examples/users/delete.md +15 -0
  45. data/docs/examples/users/update-status.md +1 -1
  46. data/lib/appwrite.rb +5 -0
  47. data/lib/appwrite/client.rb +46 -5
  48. data/lib/appwrite/exception.rb +14 -0
  49. data/lib/appwrite/file.rb +23 -0
  50. data/lib/appwrite/services/account.rb +280 -0
  51. data/lib/appwrite/services/avatars.rb +133 -34
  52. data/lib/appwrite/services/database.rb +199 -67
  53. data/lib/appwrite/services/functions.rb +357 -0
  54. data/lib/appwrite/services/health.rb +12 -24
  55. data/lib/appwrite/services/locale.rb +16 -12
  56. data/lib/appwrite/services/storage.rb +124 -35
  57. data/lib/appwrite/services/teams.rb +187 -34
  58. data/lib/appwrite/services/users.rb +115 -31
  59. metadata +44 -11
@@ -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,44 @@ 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
 
75
+ def delete(user_id:)
76
+ if user_id.nil?
77
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
78
+ end
79
+
80
+ path = '/users/{userId}'
81
+ .gsub('{userId}', user_id)
82
+
83
+ params = {}
84
+
85
+ return @client.call('delete', path, {
86
+ 'content-type' => 'application/json',
87
+ }, params);
88
+ end
89
+
45
90
  def get_logs(user_id:)
91
+ if user_id.nil?
92
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
93
+ end
94
+
46
95
  path = '/users/{userId}/logs'
47
96
  .gsub('{userId}', user_id)
48
97
 
49
- params = {
50
- }
98
+ params = {}
51
99
 
52
100
  return @client.call('get', path, {
53
101
  'content-type' => 'application/json',
@@ -55,11 +103,14 @@ module Appwrite
55
103
  end
56
104
 
57
105
  def get_prefs(user_id:)
106
+ if user_id.nil?
107
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
108
+ end
109
+
58
110
  path = '/users/{userId}/prefs'
59
111
  .gsub('{userId}', user_id)
60
112
 
61
- params = {
62
- }
113
+ params = {}
63
114
 
64
115
  return @client.call('get', path, {
65
116
  'content-type' => 'application/json',
@@ -67,12 +118,22 @@ module Appwrite
67
118
  end
68
119
 
69
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
+
70
129
  path = '/users/{userId}/prefs'
71
130
  .gsub('{userId}', user_id)
72
131
 
73
- params = {
74
- 'prefs': prefs
75
- }
132
+ params = {}
133
+
134
+ if !prefs.nil?
135
+ params[:prefs] = prefs
136
+ end
76
137
 
77
138
  return @client.call('patch', path, {
78
139
  'content-type' => 'application/json',
@@ -80,11 +141,14 @@ module Appwrite
80
141
  end
81
142
 
82
143
  def get_sessions(user_id:)
144
+ if user_id.nil?
145
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
146
+ end
147
+
83
148
  path = '/users/{userId}/sessions'
84
149
  .gsub('{userId}', user_id)
85
150
 
86
- params = {
87
- }
151
+ params = {}
88
152
 
89
153
  return @client.call('get', path, {
90
154
  'content-type' => 'application/json',
@@ -92,11 +156,14 @@ module Appwrite
92
156
  end
93
157
 
94
158
  def delete_sessions(user_id:)
159
+ if user_id.nil?
160
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
161
+ end
162
+
95
163
  path = '/users/{userId}/sessions'
96
164
  .gsub('{userId}', user_id)
97
165
 
98
- params = {
99
- }
166
+ params = {}
100
167
 
101
168
  return @client.call('delete', path, {
102
169
  'content-type' => 'application/json',
@@ -104,12 +171,19 @@ module Appwrite
104
171
  end
105
172
 
106
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
+
107
182
  path = '/users/{userId}/sessions/{sessionId}'
108
183
  .gsub('{userId}', user_id)
109
184
  .gsub('{sessionId}', session_id)
110
185
 
111
- params = {
112
- }
186
+ params = {}
113
187
 
114
188
  return @client.call('delete', path, {
115
189
  'content-type' => 'application/json',
@@ -117,12 +191,22 @@ module Appwrite
117
191
  end
118
192
 
119
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
+
120
202
  path = '/users/{userId}/status'
121
203
  .gsub('{userId}', user_id)
122
204
 
123
- params = {
124
- 'status': status
125
- }
205
+ params = {}
206
+
207
+ if !status.nil?
208
+ params[:status] = status
209
+ end
126
210
 
127
211
  return @client.call('patch', path, {
128
212
  'content-type' => 'application/json',
metadata CHANGED
@@ -1,43 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appwrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appwrite Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-30 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
- email: team@localhost.test
14
+ email: team@appwrite.io
15
15
  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
27
43
  - docs/examples/avatars/get-flag.md
28
44
  - docs/examples/avatars/get-image.md
45
+ - docs/examples/avatars/get-initials.md
29
46
  - docs/examples/avatars/get-q-r.md
30
47
  - docs/examples/database/create-collection.md
31
48
  - docs/examples/database/create-document.md
32
49
  - docs/examples/database/delete-collection.md
33
50
  - docs/examples/database/delete-document.md
34
- - docs/examples/database/get-collection-logs.md
35
51
  - docs/examples/database/get-collection.md
36
52
  - docs/examples/database/get-document.md
37
53
  - docs/examples/database/list-collections.md
38
54
  - docs/examples/database/list-documents.md
39
55
  - docs/examples/database/update-collection.md
40
56
  - docs/examples/database/update-document.md
57
+ - docs/examples/functions/create-execution.md
58
+ - docs/examples/functions/create-tag.md
59
+ - docs/examples/functions/create.md
60
+ - docs/examples/functions/delete-tag.md
61
+ - docs/examples/functions/delete.md
62
+ - docs/examples/functions/get-execution.md
63
+ - docs/examples/functions/get-tag.md
64
+ - docs/examples/functions/get.md
65
+ - docs/examples/functions/list-executions.md
66
+ - docs/examples/functions/list-tags.md
67
+ - docs/examples/functions/list.md
68
+ - docs/examples/functions/update-tag.md
69
+ - docs/examples/functions/update.md
41
70
  - docs/examples/health/get-anti-virus.md
42
71
  - docs/examples/health/get-cache.md
43
72
  - docs/examples/health/get-d-b.md
@@ -55,6 +84,7 @@ files:
55
84
  - docs/examples/locale/get-countries-phones.md
56
85
  - docs/examples/locale/get-countries.md
57
86
  - docs/examples/locale/get-currencies.md
87
+ - docs/examples/locale/get-languages.md
58
88
  - docs/examples/locale/get.md
59
89
  - docs/examples/storage/create-file.md
60
90
  - docs/examples/storage/delete-file.md
@@ -71,10 +101,13 @@ files:
71
101
  - docs/examples/teams/get-memberships.md
72
102
  - docs/examples/teams/get.md
73
103
  - docs/examples/teams/list.md
104
+ - docs/examples/teams/update-membership-roles.md
105
+ - docs/examples/teams/update-membership-status.md
74
106
  - docs/examples/teams/update.md
75
107
  - docs/examples/users/create.md
76
108
  - docs/examples/users/delete-session.md
77
109
  - docs/examples/users/delete-sessions.md
110
+ - docs/examples/users/delete.md
78
111
  - docs/examples/users/get-logs.md
79
112
  - docs/examples/users/get-prefs.md
80
113
  - docs/examples/users/get-sessions.md
@@ -84,9 +117,13 @@ files:
84
117
  - docs/examples/users/update-status.md
85
118
  - lib/appwrite.rb
86
119
  - lib/appwrite/client.rb
120
+ - lib/appwrite/exception.rb
121
+ - lib/appwrite/file.rb
87
122
  - lib/appwrite/service.rb
123
+ - lib/appwrite/services/account.rb
88
124
  - lib/appwrite/services/avatars.rb
89
125
  - lib/appwrite/services/database.rb
126
+ - lib/appwrite/services/functions.rb
90
127
  - lib/appwrite/services/health.rb
91
128
  - lib/appwrite/services/locale.rb
92
129
  - lib/appwrite/services/storage.rb
@@ -110,13 +147,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
147
  - !ruby/object:Gem::Version
111
148
  version: '0'
112
149
  requirements: []
113
- rubygems_version: 3.0.3
150
+ rubygems_version: 3.0.8
114
151
  signing_key:
115
152
  specification_version: 4
116
- summary: Appwrite is an open-source backend as a service server that abstract and
117
- simplify complex and repetitive development tasks behind a very simple to use REST
118
- API. Appwrite aims to help you develop your apps faster and in a more secure way.
119
- Use the Ruby SDK to integrate your app with the Appwrite server to easily start
120
- interacting with all of Appwrite backend APIs and tools. For full API documentation
121
- and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
153
+ summary: Appwrite is an open-source self-hosted backend server that abstract and simplify
154
+ complex and repetitive development tasks behind a very simple REST API
122
155
  test_files: []