appwrite 2.0.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +16 -0
- data/README.md +72 -3
- data/appwrite.gemspec +1 -1
- data/docs/examples/account/create-recovery.md +15 -0
- data/docs/examples/account/create-verification.md +15 -0
- data/docs/examples/account/delete-session.md +15 -0
- data/docs/examples/account/delete-sessions.md +15 -0
- data/docs/examples/account/delete.md +15 -0
- data/docs/examples/account/get-logs.md +15 -0
- data/docs/examples/account/get-prefs.md +15 -0
- data/docs/examples/account/get-sessions.md +15 -0
- data/docs/examples/account/get.md +15 -0
- data/docs/examples/account/update-email.md +15 -0
- data/docs/examples/account/update-name.md +15 -0
- data/docs/examples/account/update-password.md +15 -0
- data/docs/examples/account/update-prefs.md +15 -0
- data/docs/examples/account/update-recovery.md +15 -0
- data/docs/examples/account/update-verification.md +15 -0
- data/docs/examples/avatars/get-q-r.md +1 -1
- data/docs/examples/database/create-document.md +1 -1
- data/docs/examples/database/update-collection.md +1 -1
- data/docs/examples/database/update-document.md +1 -1
- data/docs/examples/functions/create.md +1 -1
- data/docs/examples/health/get-d-b.md +1 -1
- data/docs/examples/locale/get-countries-e-u.md +1 -1
- data/docs/examples/storage/create-file.md +1 -1
- data/docs/examples/teams/delete-membership.md +1 -1
- data/docs/examples/teams/update-membership-roles.md +15 -0
- data/docs/examples/teams/update-membership-status.md +15 -0
- data/docs/examples/users/{delete-user.md → delete.md} +1 -1
- data/docs/examples/users/update-status.md +1 -1
- data/lib/appwrite.rb +2 -0
- data/lib/appwrite/client.rb +21 -5
- data/lib/appwrite/exception.rb +14 -0
- data/lib/appwrite/services/account.rb +280 -0
- data/lib/appwrite/services/avatars.rb +125 -42
- data/lib/appwrite/services/database.rb +199 -53
- data/lib/appwrite/services/functions.rb +223 -60
- data/lib/appwrite/services/health.rb +13 -25
- data/lib/appwrite/services/locale.rb +8 -15
- data/lib/appwrite/services/storage.rb +123 -33
- data/lib/appwrite/services/teams.rb +187 -38
- data/lib/appwrite/services/users.rb +106 -34
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ff4eead29ef5fcae244fbcc93ee35d51d26c04d44f6cae00bde1a35d7cd4590
|
4
|
+
data.tar.gz: 0fee5b3c85b96692adcf9c29b024986bce8c5ff7fd935b4d9e67e1fea48685f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ee92d121c635eb76a2f872a8446d2516925b353fbb97fa3dba0c342730fe131cf537bfe49aece631442ab37704b624d8dd4e02a14d9fe9ca645038ee0501eae
|
7
|
+
data.tar.gz: 3e0f8d737f3340996e1b2414991a143863c5e76c61edbd688d165cd98909394aa5dbd4ab92791b925659325e41899fb9d25d9f5c8be4cca5efb299ae17863a64
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# Appwrite Ruby SDK
|
2
2
|
|
3
|
-
![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?
|
4
|
-
![Version](https://img.shields.io/badge/api%20version-0.
|
3
|
+
![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square)
|
4
|
+
![Version](https://img.shields.io/badge/api%20version-0.8.0-blue.svg?style=flat-square)
|
5
|
+
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
|
6
|
+
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
|
5
7
|
|
6
|
-
**This SDK is compatible with Appwrite server version 0.
|
8
|
+
**This SDK is compatible with Appwrite server version 0.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/releases).**
|
7
9
|
|
8
10
|
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
9
11
|
Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
@@ -19,6 +21,73 @@ To install via [Gem](https://rubygems.org/):
|
|
19
21
|
gem install appwrite --save
|
20
22
|
```
|
21
23
|
|
24
|
+
|
25
|
+
## Getting Started
|
26
|
+
|
27
|
+
### Init your SDK
|
28
|
+
Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from project's API keys section.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require 'appwrite'
|
32
|
+
|
33
|
+
client = Appwrite::Client.new()
|
34
|
+
|
35
|
+
client
|
36
|
+
.set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint
|
37
|
+
.set_project(ENV["APPWRITE_PROJECT"]) # Your project ID
|
38
|
+
.set_key(ENV["APPWRITE_SECRET"]) # Your secret API key
|
39
|
+
.setSelfSigned() # Use only on dev mode with a self-signed SSL cert
|
40
|
+
;
|
41
|
+
```
|
42
|
+
|
43
|
+
### Make Your First Request
|
44
|
+
Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
users = Appwrite::Users.new(client);
|
48
|
+
|
49
|
+
result = users.create(email: 'email@example.com', password: 'password');
|
50
|
+
```
|
51
|
+
|
52
|
+
### Full Example
|
53
|
+
```ruby
|
54
|
+
require 'appwrite'
|
55
|
+
|
56
|
+
client = Appwrite::Client.new()
|
57
|
+
|
58
|
+
client
|
59
|
+
.set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint
|
60
|
+
.set_project(ENV["APPWRITE_PROJECT"]) # Your project ID
|
61
|
+
.set_key(ENV["APPWRITE_SECRET"]) # Your secret API key
|
62
|
+
.setSelfSigned() # Use only on dev mode with a self-signed SSL cert
|
63
|
+
;
|
64
|
+
|
65
|
+
users = Appwrite::Users.new(client);
|
66
|
+
|
67
|
+
result = users.create(email: 'email@example.com', password: 'password');
|
68
|
+
```
|
69
|
+
|
70
|
+
### Error Handling
|
71
|
+
The Appwrite Ruby SDK raises `Appwrite::Exception` object with `message`, `code` and `response` properties. You can handle any errors by catching `Appwrite::Exception` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
users = Appwrite::Users.new(client);
|
75
|
+
|
76
|
+
begin
|
77
|
+
result = users.create(email: 'email@example.com', password: 'password');
|
78
|
+
rescue Appwrite::Exception => error
|
79
|
+
puts error.message
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
### Learn more
|
84
|
+
You can use followng resources to learn more and get help
|
85
|
+
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
|
86
|
+
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
87
|
+
- 💬 [Discord Community](https://appwrite.io/discord)
|
88
|
+
- 🚂 [Appwrite Ruby Playground](https://github.com/appwrite/playground-for-ruby)
|
89
|
+
|
90
|
+
|
22
91
|
## Contribution
|
23
92
|
|
24
93
|
This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.
|
data/appwrite.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'appwrite'
|
4
|
-
s.version = '2.
|
4
|
+
s.version = '2.2.0'
|
5
5
|
s.summary = "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API"
|
6
6
|
s.author = 'Appwrite Team'
|
7
7
|
s.homepage = 'https://appwrite.io/support'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.create_recovery(email: 'email@example.com', url: 'https://example.com');
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.create_verification(url: 'https://example.com');
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.delete_session(session_id: '[SESSION_ID]');
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.delete_sessions();
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.delete();
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.get_logs();
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.get_prefs();
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.get_sessions();
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.get();
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.update_email(email: 'email@example.com', password: 'password');
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.update_name(name: '[NAME]');
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.update_password(password: 'password');
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.update_prefs(prefs: {});
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.update_recovery(user_id: '[USER_ID]', secret: '[SECRET]', password: 'password', password_again: 'password');
|
14
|
+
|
15
|
+
puts response
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'appwrite'
|
2
|
+
|
3
|
+
client = Appwrite::Client.new()
|
4
|
+
|
5
|
+
client
|
6
|
+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
|
7
|
+
.set_project('5df5acd0d48c2') # Your project ID
|
8
|
+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
9
|
+
;
|
10
|
+
|
11
|
+
account = Appwrite::Account.new(client);
|
12
|
+
|
13
|
+
response = account.update_verification(user_id: '[USER_ID]', secret: '[SECRET]');
|
14
|
+
|
15
|
+
puts response
|
@@ -10,6 +10,6 @@ client
|
|
10
10
|
|
11
11
|
database = Appwrite::Database.new(client);
|
12
12
|
|
13
|
-
response = database.create_document(collection_id: '[COLLECTION_ID]', data: {}
|
13
|
+
response = database.create_document(collection_id: '[COLLECTION_ID]', data: {});
|
14
14
|
|
15
15
|
puts response
|
@@ -10,6 +10,6 @@ client
|
|
10
10
|
|
11
11
|
database = Appwrite::Database.new(client);
|
12
12
|
|
13
|
-
response = database.update_collection(collection_id: '[COLLECTION_ID]', name: '[NAME]'
|
13
|
+
response = database.update_collection(collection_id: '[COLLECTION_ID]', name: '[NAME]');
|
14
14
|
|
15
15
|
puts response
|
@@ -10,6 +10,6 @@ client
|
|
10
10
|
|
11
11
|
database = Appwrite::Database.new(client);
|
12
12
|
|
13
|
-
response = database.update_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]', data: {}
|
13
|
+
response = database.update_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]', data: {});
|
14
14
|
|
15
15
|
puts response
|