-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
609 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ jobs: | |
api_key: $RUBYGEMS_TOKEN | ||
gem: appwrite | ||
on: | ||
tags: true | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
# Appwrite Ruby SDK | ||
|
||
![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?v=1) | ||
![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) | ||
![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square) | ||
![Version](https://img.shields.io/badge/api%20version-0.8.0-blue.svg?style=flat-square) | ||
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io) | ||
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) | ||
|
||
**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).** | ||
**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).** | ||
|
||
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. | ||
|
@@ -19,6 +21,73 @@ To install via [Gem](https://rubygems.org/): | |
gem install appwrite --save | ||
``` | ||
|
||
|
||
## Getting Started | ||
|
||
### Init your SDK | ||
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. | ||
|
||
```ruby | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint | ||
.set_project(ENV["APPWRITE_PROJECT"]) # Your project ID | ||
.set_key(ENV["APPWRITE_SECRET"]) # Your secret API key | ||
.setSelfSigned() # Use only on dev mode with a self-signed SSL cert | ||
; | ||
``` | ||
|
||
### Make Your First Request | ||
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. | ||
|
||
```ruby | ||
users = Appwrite::Users.new(client); | ||
|
||
result = users.create(email: '[email protected]', password: 'password'); | ||
``` | ||
|
||
### Full Example | ||
```ruby | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint | ||
.set_project(ENV["APPWRITE_PROJECT"]) # Your project ID | ||
.set_key(ENV["APPWRITE_SECRET"]) # Your secret API key | ||
.setSelfSigned() # Use only on dev mode with a self-signed SSL cert | ||
; | ||
|
||
users = Appwrite::Users.new(client); | ||
|
||
result = users.create(email: '[email protected]', password: 'password'); | ||
``` | ||
|
||
### Error Handling | ||
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. | ||
|
||
```ruby | ||
users = Appwrite::Users.new(client); | ||
|
||
begin | ||
result = users.create(email: '[email protected]', password: 'password'); | ||
rescue Appwrite::Exception => error | ||
puts error.message | ||
end | ||
``` | ||
|
||
### Learn more | ||
You can use followng resources to learn more and get help | ||
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) | ||
- 📜 [Appwrite Docs](https://appwrite.io/docs) | ||
- 💬 [Discord Community](https://appwrite.io/discord) | ||
- 🚂 [Appwrite Ruby Playground](https://github.com/appwrite/playground-for-ruby) | ||
|
||
|
||
## Contribution | ||
|
||
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
Gem::Specification.new do |s| | ||
|
||
s.name = 'appwrite' | ||
s.version = '2.0.2' | ||
s.version = '2.1.0' | ||
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" | ||
s.author = 'Appwrite Team' | ||
s.homepage = 'https://appwrite.io/support' | ||
s.email = '[email protected]' | ||
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.create_recovery(email: '[email protected]', url: 'https://example.com'); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.create_verification(url: 'https://example.com'); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.delete_session(session_id: '[SESSION_ID]'); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.delete_sessions(); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.delete(); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.get_logs(); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.get_prefs(); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.get_sessions(); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.get(); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.update_email(email: '[email protected]', password: 'password'); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.update_name(name: '[NAME]'); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.update_password(password: 'password'); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.update_prefs(prefs: {}); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.update_recovery(user_id: '[USER_ID]', secret: '[SECRET]', password: 'password', password_again: 'password'); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'appwrite' | ||
|
||
client = Appwrite::Client.new() | ||
|
||
client | ||
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint | ||
.set_project('5df5acd0d48c2') # Your project ID | ||
.set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token | ||
; | ||
|
||
account = Appwrite::Account.new(client); | ||
|
||
response = account.update_verification(user_id: '[USER_ID]', secret: '[SECRET]'); | ||
|
||
puts response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.