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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b656d8cd5e37c875f295d2e0c7b53a2319a202065dc28e3fb0c73c6d4a5c73a
4
- data.tar.gz: 8e6d0b772542e847ebaae1f25461e2051f0cc2680f96d6c4f9a4b8ddab271ba5
3
+ metadata.gz: 7af7a36b8f84e4c0cc14fe71d566d3a12f838319c77024e486eaede9ecb4f6bf
4
+ data.tar.gz: '008f87179f1bbccfb26a44be5b8d57b3784ba9512aa500c59c7d91b7e915ca47'
5
5
  SHA512:
6
- metadata.gz: 95197a1c5cc2a86f227a6bc0997274078403e908270be825799a628b07f426a519b02ace27ec54db7914b000d65aec5a4cf73922f61721d12ad35bcf0c4df539
7
- data.tar.gz: 6813fbc37180cd4f878da5de97ebfe63f9add2200e97d0f0924fd58a25d00a5ff09f054874915d97270ca458e06ffd73b346900d3486fac902d7c1301f035fed
6
+ metadata.gz: 97a422d4d22aad866049e1dd30609515806e7691ebb4d33a1fc54aeb123af7a8afd7f4bd3e08282a411ef5a6410a7ad4ecf9840fe9e82213df0b6ba56877511c
7
+ data.tar.gz: cf27ec1ea058dad70e0445c604e6b4661491dd19641c3ece83b5b8cd77e40f8061bfaf35dc206de8d8765587775fdf7279d38c388a0f860a8c004729bb5c7b15
data/.travis.yml CHANGED
@@ -13,4 +13,4 @@ jobs:
13
13
  api_key: $RUBYGEMS_TOKEN
14
14
  gem: appwrite
15
15
  on:
16
- tags: true
16
+ tags: true
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'mime-types', '~> 3.1'
3
+ gem 'mime-types', '~> 3.3.1'
4
4
  gemspec
data/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # Appwrite Ruby SDK
2
2
 
3
- ![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?v=1)
4
- ![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1)
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.9.0-blue.svg?style=flat-square)
5
+ [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
6
+ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
7
+ [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
5
8
 
6
- **This SDK is compatible with Appwrite server version 0.7.0. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/releases).**
9
+ **This SDK is compatible with Appwrite server version 0.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/releases).**
7
10
 
8
- 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
- Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
10
- For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
11
+ 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. Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
11
12
 
12
13
  ![Appwrite](https://appwrite.io/images/github.png)
13
14
 
@@ -19,6 +20,73 @@ To install via [Gem](https://rubygems.org/):
19
20
  gem install appwrite --save
20
21
  ```
21
22
 
23
+
24
+ ## Getting Started
25
+
26
+ ### Init your SDK
27
+ Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key from project's API keys section.
28
+
29
+ ```ruby
30
+ require 'appwrite'
31
+
32
+ client = Appwrite::Client.new()
33
+
34
+ client
35
+ .set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint
36
+ .set_project(ENV["APPWRITE_PROJECT"]) # Your project ID
37
+ .set_key(ENV["APPWRITE_SECRET"]) # Your secret API key
38
+ .setSelfSigned() # Use only on dev mode with a self-signed SSL cert
39
+ ;
40
+ ```
41
+
42
+ ### Make Your First Request
43
+ 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](https://appwrite.io/docs) section.
44
+
45
+ ```ruby
46
+ users = Appwrite::Users.new(client);
47
+
48
+ result = users.create(email: 'email@example.com', password: 'password');
49
+ ```
50
+
51
+ ### Full Example
52
+ ```ruby
53
+ require 'appwrite'
54
+
55
+ client = Appwrite::Client.new()
56
+
57
+ client
58
+ .set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint
59
+ .set_project(ENV["APPWRITE_PROJECT"]) # Your project ID
60
+ .set_key(ENV["APPWRITE_SECRET"]) # Your secret API key
61
+ .setSelfSigned() # Use only on dev mode with a self-signed SSL cert
62
+ ;
63
+
64
+ users = Appwrite::Users.new(client);
65
+
66
+ result = users.create(email: 'email@example.com', password: 'password');
67
+ ```
68
+
69
+ ### Error Handling
70
+ 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.
71
+
72
+ ```ruby
73
+ users = Appwrite::Users.new(client);
74
+
75
+ begin
76
+ result = users.create(email: 'email@example.com', password: 'password');
77
+ rescue Appwrite::Exception => error
78
+ puts error.message
79
+ end
80
+ ```
81
+
82
+ ### Learn more
83
+ You can use following resources to learn more and get help
84
+ - 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
85
+ - 📜 [Appwrite Docs](https://appwrite.io/docs)
86
+ - 💬 [Discord Community](https://appwrite.io/discord)
87
+ - 🚂 [Appwrite Ruby Playground](https://github.com/appwrite/playground-for-ruby)
88
+
89
+
22
90
  ## Contribution
23
91
 
24
92
  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,11 +1,11 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'appwrite'
4
- s.version = '2.0.2'
4
+ s.version = '2.3.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'
8
8
  s.email = 'team@appwrite.io'
9
9
  s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
10
10
 
11
- end
11
+ end
@@ -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_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.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
  avatars = Appwrite::Avatars.new(client);
12
12
 
13
- response = avatars.get_q_r(text: '[TEXT]');
13
+ response = avatars.get_qr(text: '[TEXT]');
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.create_document(collection_id: '[COLLECTION_ID]', data: {}, read: [], write: []);
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]', read: [], write: []);
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: {}, read: [], write: []);
13
+ response = database.update_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]', data: {});
14
14
 
15
15
  puts response