Skip to content

Commit dc55a40

Browse files
authored
Merge pull request #56 from appwrite/dev
feat: Ruby SDK update for version 21.1.0
2 parents e2f8ebb + 4f559ac commit dc55a40

File tree

13 files changed

+126
-68
lines changed

13 files changed

+126
-68
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Change Log
22

3+
## 21.1.0
4+
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.
13+
314
## 21.0.1
415

516
* Remove obsolete GitHub issue templates (bug.yaml, documentation.yaml, feature.yaml) to simplify repository maintenance.

appwrite.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |spec|
22

33
spec.name = 'appwrite'
4-
spec.version = '21.0.1'
4+
spec.version = '21.1.0'
55
spec.license = 'BSD-3-Clause'
66
spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API'
77
spec.author = 'Appwrite Team'

docs/examples/databases/list-documents.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ result = databases.list_documents(
1515
collection_id: '<COLLECTION_ID>',
1616
queries: [], # optional
1717
transaction_id: '<TRANSACTION_ID>', # optional
18-
total: false # optional
18+
total: false, # optional
19+
ttl: 0 # optional
1920
)
2021
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
health = Health.new(client)
12+
13+
result = health.get_console_pausing(
14+
threshold: null, # optional
15+
inactivity_days: null # optional
16+
)
17+
```

docs/examples/sites/create-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ sites = Sites.new(client)
1313
result = sites.create_deployment(
1414
site_id: '<SITE_ID>',
1515
code: InputFile.from_path('dir/file.png'),
16-
activate: false,
1716
install_command: '<INSTALL_COMMAND>', # optional
1817
build_command: '<BUILD_COMMAND>', # optional
19-
output_directory: '<OUTPUT_DIRECTORY>' # optional
18+
output_directory: '<OUTPUT_DIRECTORY>', # optional
19+
activate: false # optional
2020
)
2121
```

docs/examples/tablesdb/list-rows.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ result = tables_db.list_rows(
1515
table_id: '<TABLE_ID>',
1616
queries: [], # optional
1717
transaction_id: '<TRANSACTION_ID>', # optional
18-
total: false # optional
18+
total: false, # optional
19+
ttl: 0 # optional
1920
)
2021
```

lib/appwrite/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def initialize
1515
'x-sdk-name'=> 'Ruby',
1616
'x-sdk-platform'=> 'server',
1717
'x-sdk-language'=> 'ruby',
18-
'x-sdk-version'=> '21.0.1',
18+
'x-sdk-version'=> '21.1.0',
1919
'X-Appwrite-Response-Format' => '1.8.0'
2020
}
2121
@endpoint = 'https://cloud.appwrite.io/v1'

lib/appwrite/services/databases.rb

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def list_attributes(database_id:, collection_id:, queries: nil, total: nil)
614614
#
615615
#
616616
# @param [String] database_id Database ID.
617-
# @param [String] collection_id Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
617+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
618618
# @param [String] key Attribute Key.
619619
# @param [] required Is attribute required?
620620
# @param [] default Default value for attribute when not provided. Cannot be set when attribute is required.
@@ -2043,6 +2043,56 @@ def create_relationship_attribute(database_id:, collection_id:, related_collecti
20432043
)
20442044
end
20452045

2046+
#
2047+
# @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.
2048+
#
2049+
# Update relationship attribute. [Learn more about relationship
2050+
# attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
2051+
#
2052+
#
2053+
# @param [String] database_id Database ID.
2054+
# @param [String] collection_id Collection ID.
2055+
# @param [String] key Attribute Key.
2056+
# @param [RelationMutate] on_delete Constraints option
2057+
# @param [String] new_key New Attribute Key.
2058+
#
2059+
# @return [AttributeRelationship]
2060+
def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil)
2061+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'
2062+
.gsub('{databaseId}', database_id)
2063+
.gsub('{collectionId}', collection_id)
2064+
.gsub('{key}', key)
2065+
2066+
if database_id.nil?
2067+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
2068+
end
2069+
2070+
if collection_id.nil?
2071+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
2072+
end
2073+
2074+
if key.nil?
2075+
raise Appwrite::Exception.new('Missing required parameter: "key"')
2076+
end
2077+
2078+
api_params = {
2079+
onDelete: on_delete,
2080+
newKey: new_key,
2081+
}
2082+
2083+
api_headers = {
2084+
"content-type": 'application/json',
2085+
}
2086+
2087+
@client.call(
2088+
method: 'PATCH',
2089+
path: api_path,
2090+
headers: api_headers,
2091+
params: api_params,
2092+
response_type: Models::AttributeRelationship
2093+
)
2094+
end
2095+
20462096
#
20472097
# @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead.
20482098
#
@@ -2599,56 +2649,6 @@ def delete_attribute(database_id:, collection_id:, key:)
25992649
)
26002650
end
26012651

2602-
#
2603-
# @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.
2604-
#
2605-
# Update relationship attribute. [Learn more about relationship
2606-
# attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
2607-
#
2608-
#
2609-
# @param [String] database_id Database ID.
2610-
# @param [String] collection_id Collection ID.
2611-
# @param [String] key Attribute Key.
2612-
# @param [RelationMutate] on_delete Constraints option
2613-
# @param [String] new_key New Attribute Key.
2614-
#
2615-
# @return [AttributeRelationship]
2616-
def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil)
2617-
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'
2618-
.gsub('{databaseId}', database_id)
2619-
.gsub('{collectionId}', collection_id)
2620-
.gsub('{key}', key)
2621-
2622-
if database_id.nil?
2623-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
2624-
end
2625-
2626-
if collection_id.nil?
2627-
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
2628-
end
2629-
2630-
if key.nil?
2631-
raise Appwrite::Exception.new('Missing required parameter: "key"')
2632-
end
2633-
2634-
api_params = {
2635-
onDelete: on_delete,
2636-
newKey: new_key,
2637-
}
2638-
2639-
api_headers = {
2640-
"content-type": 'application/json',
2641-
}
2642-
2643-
@client.call(
2644-
method: 'PATCH',
2645-
path: api_path,
2646-
headers: api_headers,
2647-
params: api_params,
2648-
response_type: Models::AttributeRelationship
2649-
)
2650-
end
2651-
26522652
#
26532653
# @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead.
26542654
#
@@ -2660,9 +2660,10 @@ def update_relationship_attribute(database_id:, collection_id:, key:, on_delete:
26602660
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
26612661
# @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
26622662
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
2663+
# @param [Integer] ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
26632664
#
26642665
# @return [DocumentList]
2665-
def list_documents(database_id:, collection_id:, queries: nil, transaction_id: nil, total: nil)
2666+
def list_documents(database_id:, collection_id:, queries: nil, transaction_id: nil, total: nil, ttl: nil)
26662667
api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
26672668
.gsub('{databaseId}', database_id)
26682669
.gsub('{collectionId}', collection_id)
@@ -2679,6 +2680,7 @@ def list_documents(database_id:, collection_id:, queries: nil, transaction_id: n
26792680
queries: queries,
26802681
transactionId: transaction_id,
26812682
total: total,
2683+
ttl: ttl,
26822684
}
26832685

26842686
api_headers = {

lib/appwrite/services/health.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,34 @@ def get_certificate(domain: nil)
9898
)
9999
end
100100

101+
# Get console pausing health status. Monitors projects approaching the pause
102+
# threshold to detect potential issues with console access tracking.
103+
#
104+
#
105+
# @param [Integer] threshold Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10.
106+
# @param [Integer] inactivity_days Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7.
107+
#
108+
# @return [HealthStatus]
109+
def get_console_pausing(threshold: nil, inactivity_days: nil)
110+
api_path = '/health/console-pausing'
111+
112+
api_params = {
113+
threshold: threshold,
114+
inactivityDays: inactivity_days,
115+
}
116+
117+
api_headers = {
118+
}
119+
120+
@client.call(
121+
method: 'GET',
122+
path: api_path,
123+
headers: api_headers,
124+
params: api_params,
125+
response_type: Models::HealthStatus
126+
)
127+
end
128+
101129
# Check the Appwrite database servers are up and connection is successful.
102130
#
103131
#

lib/appwrite/services/messaging.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ def list_topic_logs(topic_id:, queries: nil, total: nil)
18021802
# Get a list of all subscribers from the current Appwrite project.
18031803
#
18041804
# @param [String] topic_id Topic ID. The topic ID subscribed to.
1805-
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled
1805+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: targetId, topicId, userId, providerType
18061806
# @param [String] search Search term to filter your list results. Max length: 256 chars.
18071807
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
18081808
#

0 commit comments

Comments
 (0)