Skip to content

Commit bfd053b

Browse files
committed
feat: update Ruby SDK to 21.1.0
* Added `DocumentsDB` API and examples. * Updated README badge to API version 1.9.0.
1 parent 4f559ac commit bfd053b

117 files changed

Lines changed: 5230 additions & 47 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22

33
## 21.1.0
44

5-
* Added get_console_pausing health endpoint to monitor console pausing.
6-
* Added ttl parameter for cached responses in list_documents and list_rows.
7-
* Made activate parameter optional in Sites.create_deployment.
8-
* Updated collection_id doc to reference collection instead of table.
9-
* Added update_relationship_attribute API to update relationship attributes.
10-
* Updated team roles length limit docstrings from 32 to 81 chars.
11-
* Updated subscriber list docs to reflect new query filters.
12-
* Added Ruby example for health get_console_pausing.
5+
* Added `DocumentsDB` API and examples.
6+
* Updated README badge to API version 1.9.0.
137

148
## 21.0.1
159

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite Ruby SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.8.1-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.9.0-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

docs/examples/databases/create-index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ result = databases.create_index(
1515
database_id: '<DATABASE_ID>',
1616
collection_id: '<COLLECTION_ID>',
1717
key: '',
18-
type: IndexType::KEY,
18+
type: DatabasesIndexType::KEY,
1919
attributes: [],
2020
orders: [OrderBy::ASC], # optional
2121
lengths: [] # optional

docs/examples/databases/upsert-documents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include Appwrite
66
client = Client.new
77
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
88
.set_project('<YOUR_PROJECT_ID>') # Your project ID
9-
.set_key('<YOUR_API_KEY>') # Your secret API key
9+
.set_session('') # The user session to authenticate with
1010

1111
databases = Databases.new(client)
1212

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
```ruby
2+
require 'appwrite'
3+
4+
include Appwrite
5+
include Appwrite::Permission
6+
include Appwrite::Role
7+
8+
client = Client.new
9+
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
10+
.set_project('<YOUR_PROJECT_ID>') # Your project ID
11+
.set_key('<YOUR_API_KEY>') # Your secret API key
12+
13+
documents_db = DocumentsDB.new(client)
14+
15+
result = documents_db.create_collection(
16+
database_id: '<DATABASE_ID>',
17+
collection_id: '<COLLECTION_ID>',
18+
name: '<NAME>',
19+
permissions: [Permission.read(Role.any())], # optional
20+
document_security: false, # optional
21+
enabled: false, # optional
22+
attributes: [], # optional
23+
indexes: [] # optional
24+
)
25+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
```ruby
2+
require 'appwrite'
3+
4+
include Appwrite
5+
include Appwrite::Permission
6+
include Appwrite::Role
7+
8+
client = Client.new
9+
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
10+
.set_project('<YOUR_PROJECT_ID>') # Your project ID
11+
.set_session('') # The user session to authenticate with
12+
13+
documents_db = DocumentsDB.new(client)
14+
15+
result = documents_db.create_document(
16+
database_id: '<DATABASE_ID>',
17+
collection_id: '<COLLECTION_ID>',
18+
document_id: '<DOCUMENT_ID>',
19+
data: {
20+
"username" => "walter.obrien",
21+
"email" => "walter.obrien@example.com",
22+
"fullName" => "Walter O'Brien",
23+
"age" => 30,
24+
"isAdmin" => false
25+
},
26+
permissions: [Permission.read(Role.any())] # optional
27+
)
28+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
```ruby
2+
require 'appwrite'
3+
4+
include Appwrite
5+
6+
client = Client.new
7+
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
8+
.set_project('<YOUR_PROJECT_ID>') # Your project ID
9+
.set_session('') # The user session to authenticate with
10+
11+
documents_db = DocumentsDB.new(client)
12+
13+
result = documents_db.create_documents(
14+
database_id: '<DATABASE_ID>',
15+
collection_id: '<COLLECTION_ID>',
16+
documents: []
17+
)
18+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
```ruby
2+
require 'appwrite'
3+
4+
include Appwrite
5+
include Appwrite::Enums
6+
7+
client = Client.new
8+
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
9+
.set_project('<YOUR_PROJECT_ID>') # Your project ID
10+
.set_key('<YOUR_API_KEY>') # Your secret API key
11+
12+
documents_db = DocumentsDB.new(client)
13+
14+
result = documents_db.create_index(
15+
database_id: '<DATABASE_ID>',
16+
collection_id: '<COLLECTION_ID>',
17+
key: '',
18+
type: DocumentsDBIndexType::KEY,
19+
attributes: [],
20+
orders: [OrderBy::ASC], # optional
21+
lengths: [] # optional
22+
)
23+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
```ruby
2+
require 'appwrite'
3+
4+
include Appwrite
5+
6+
client = Client.new
7+
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
8+
.set_project('<YOUR_PROJECT_ID>') # Your project ID
9+
.set_key('<YOUR_API_KEY>') # Your secret API key
10+
11+
documents_db = DocumentsDB.new(client)
12+
13+
result = documents_db.create_operations(
14+
transaction_id: '<TRANSACTION_ID>',
15+
operations: [
16+
{
17+
"action": "create",
18+
"databaseId": "<DATABASE_ID>",
19+
"collectionId": "<COLLECTION_ID>",
20+
"documentId": "<DOCUMENT_ID>",
21+
"data": {
22+
"name": "Walter O'Brien"
23+
}
24+
}
25+
] # optional
26+
)
27+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
```ruby
2+
require 'appwrite'
3+
4+
include Appwrite
5+
6+
client = Client.new
7+
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
8+
.set_project('<YOUR_PROJECT_ID>') # Your project ID
9+
.set_key('<YOUR_API_KEY>') # Your secret API key
10+
11+
documents_db = DocumentsDB.new(client)
12+
13+
result = documents_db.create_transaction(
14+
ttl: 60 # optional
15+
)
16+
```

0 commit comments

Comments
 (0)