Skip to content

Commit 33273d3

Browse files
committed
Upgraded to support Appwrite 0.8
1 parent 6310c67 commit 33273d3

37 files changed

+609
-28
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
api_key: $RUBYGEMS_TOKEN
1414
gem: appwrite
1515
on:
16-
tags: true
16+
tags: true

README.md

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Appwrite Ruby SDK
22

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.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)
57

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).**
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).**
79

810
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.
911
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/):
1921
gem install appwrite --save
2022
```
2123

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+
2291
## Contribution
2392

2493
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.

appwrite.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Gem::Specification.new do |s|
22

33
s.name = 'appwrite'
4-
s.version = '2.0.2'
4+
s.version = '2.1.0'
55
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"
66
s.author = 'Appwrite Team'
77
s.homepage = 'https://appwrite.io/support'
88
s.email = 'team@appwrite.io'
99
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
1010

11-
end
11+
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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_j_w_t('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
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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_j_w_t('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
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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_j_w_t('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
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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_j_w_t('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

docs/examples/account/delete.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9+
;
10+
11+
account = Appwrite::Account.new(client);
12+
13+
response = account.delete();
14+
15+
puts response

docs/examples/account/get-logs.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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_j_w_t('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

docs/examples/account/get-prefs.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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_j_w_t('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 commit comments

Comments
 (0)