Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite Ruby SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.4.2-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.4.12-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
Expand Down
2 changes: 1 addition & 1 deletion appwrite.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |spec|

spec.name = 'appwrite'
spec.version = '10.0.0'
spec.version = '10.1.0'
spec.license = 'BSD-3-Clause'
spec.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'
spec.author = 'Appwrite Team'
Expand Down
14 changes: 14 additions & 0 deletions docs/examples/health/get-queue-builds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'Appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key

health = Health.new(client)

response = health.get_queue_builds()

puts response.inspect
14 changes: 14 additions & 0 deletions docs/examples/health/get-queue-databases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'Appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key

health = Health.new(client)

response = health.get_queue_databases()

puts response.inspect
14 changes: 14 additions & 0 deletions docs/examples/health/get-queue-deletes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'Appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key

health = Health.new(client)

response = health.get_queue_deletes()

puts response.inspect
14 changes: 14 additions & 0 deletions docs/examples/health/get-queue-mails.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'Appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key

health = Health.new(client)

response = health.get_queue_mails()

puts response.inspect
14 changes: 14 additions & 0 deletions docs/examples/health/get-queue-messaging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'Appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key

health = Health.new(client)

response = health.get_queue_messaging()

puts response.inspect
14 changes: 14 additions & 0 deletions docs/examples/health/get-queue-migrations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'Appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key

health = Health.new(client)

response = health.get_queue_migrations()

puts response.inspect
2 changes: 1 addition & 1 deletion lib/appwrite/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize
'x-sdk-name'=> 'Ruby',
'x-sdk-platform'=> 'server',
'x-sdk-language'=> 'ruby',
'x-sdk-version'=> '10.0.0',
'x-sdk-version'=> '10.1.0',
'X-Appwrite-Response-Format' => '1.4.0'
}
@endpoint = 'https://HOSTNAME/v1'
Expand Down
8 changes: 4 additions & 4 deletions lib/appwrite/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def is_not_null(attribute)
end

def between(attribute, start, ending)
return add_query(attribute, "between", [start, ending])
return "between(\"#{attribute}\", #{parse_values(start)}, #{parse_values(ending)})"
end

def starts_with(attribute, value)
Expand Down Expand Up @@ -81,13 +81,13 @@ def offset(offset)

def add_query(attribute, method, value)
if value.is_a?(Array)
"#{method}(\"#{attribute}\", [#{value.map {|item| parseValues(item)}.join(',')}])"
"#{method}(\"#{attribute}\", [#{value.map {|item| parse_values(item)}.join(',')}])"
else
return "#{method}(\"#{attribute}\", [#{parseValues(value)}])"
return "#{method}(\"#{attribute}\", [#{parse_values(value)}])"
end
end

def parseValues(value)
def parse_values(value)
return value.is_a?(String) ? "\"#{value}\"" : value
end
end
Expand Down
26 changes: 15 additions & 11 deletions lib/appwrite/services/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def update_password(password:, old_password: nil)
# Update the currently logged in user's phone number. After updating the
# phone number, the phone verification status will be reset. A confirmation
# SMS is not sent automatically, however you can use the [POST
# /account/verification/phone](/docs/client/account#accountCreatePhoneVerification)
# /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification)
# endpoint to send a confirmation SMS.
#
# @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
Expand Down Expand Up @@ -321,9 +321,9 @@ def update_prefs(prefs:)
# app password reset URL with the secret key and email address values
# attached to the URL query string. Use the query string params to submit a
# request to the [PUT
# /account/recovery](/docs/client/account#accountUpdateRecovery) endpoint to
# complete the process. The verification link sent to the user's email
# address is valid for 1 hour.
# /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery)
# endpoint to complete the process. The verification link sent to the user's
# email address is valid for 1 hour.
#
# @param [String] email User email.
# @param [String] url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
Expand Down Expand Up @@ -362,7 +362,8 @@ def create_recovery(email:, url:)
# Use this endpoint to complete the user account password reset. Both the
# **userId** and **secret** arguments will be passed as query parameters to
# the redirect URL you have provided when sending your request to the [POST
# /account/recovery](/docs/client/account#accountCreateRecovery) endpoint.
# /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery)
# endpoint.
#
# Please note that in order to avoid a [Redirect
# Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
Expand Down Expand Up @@ -530,7 +531,8 @@ def update_session(session_id:)
# Logout the user. Use 'current' as the session ID to logout on this device,
# use a session ID to logout on another device. If you're looking to logout
# the user on all devices, use [Delete
# Sessions](/docs/client/account#accountDeleteSessions) instead.
# Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
# instead.
#
# @param [String] session_id Session ID. Use the string 'current' to delete the current device session.
#
Expand Down Expand Up @@ -592,8 +594,8 @@ def update_status()
# should redirect the user back to your app and allow you to complete the
# verification process by verifying both the **userId** and **secret**
# parameters. Learn more about how to [complete the verification
# process](/docs/client/account#accountUpdateEmailVerification). The
# verification link sent to the user's email address is valid for 7 days.
# process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
# The verification link sent to the user's email address is valid for 7 days.
#
# Please note that in order to avoid a [Redirect
# Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
Expand Down Expand Up @@ -670,10 +672,12 @@ def update_verification(user_id:, secret:)

# Use this endpoint to send a verification SMS to the currently logged in
# user. This endpoint is meant for use after updating a user's phone number
# using the [accountUpdatePhone](/docs/client/account#accountUpdatePhone)
# using the
# [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
# endpoint. Learn more about how to [complete the verification
# process](/docs/client/account#accountUpdatePhoneVerification). The
# verification code sent to the user's phone number is valid for 15 minutes.
# process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
# The verification code sent to the user's phone number is valid for 15
# minutes.
#
#
# @return [Token]
Expand Down
7 changes: 4 additions & 3 deletions lib/appwrite/services/avatars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ def initialize(client)

# You can use this endpoint to show different browser icons to your users.
# The code argument receives the browser code as it appears in your user [GET
# /account/sessions](/docs/client/account#accountGetSessions) endpoint. Use
# width, height and quality arguments to change the output settings.
# /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
# endpoint. Use width, height and quality arguments to change the output
# settings.
#
# When one dimension is specified and the other is 0, the image is scaled
# with preserved aspect ratio. If both dimensions are 0, the API provides an
Expand Down Expand Up @@ -127,7 +128,7 @@ def get_favicon(url:)
# You can use this endpoint to show different country flags icons to your
# users. The code argument receives the 2 letter country code. Use width,
# height and quality arguments to change the output settings. Country codes
# follow the [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) standard.
# follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
#
# When one dimension is specified and the other is 0, the image is scaled
# with preserved aspect ratio. If both dimensions are 0, the API provides an
Expand Down
24 changes: 12 additions & 12 deletions lib/appwrite/services/databases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ def list_collections(database_id:, queries: nil, search: nil)

# Create a new Collection. Before using this route, you should create a new
# database resource using either a [server
# integration](/docs/server/databases#databasesCreateCollection) API or
# directly from your database console.
# integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
# API or directly from your database console.
#
# @param [String] database_id Database ID.
# @param [String] collection_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
# @param [String] name Collection name. Max length: 128 chars.
# @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](/docs/permissions).
# @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).
# @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
# @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
# @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
#
# @return [Collection]
Expand Down Expand Up @@ -302,8 +302,8 @@ def get_collection(database_id:, collection_id:)
# @param [String] database_id Database ID.
# @param [String] collection_id Collection ID.
# @param [String] name Collection name. Max length: 128 chars.
# @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).
# @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).
# @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
# @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
# @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
#
# @return [Collection]
Expand Down Expand Up @@ -1223,7 +1223,7 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:)


# Create relationship attribute. [Learn more about relationship
# attributes](/docs/databases-relationships#relationship-attributes).
# attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
#
#
# @param [String] database_id Database ID.
Expand Down Expand Up @@ -1589,7 +1589,7 @@ def delete_attribute(database_id:, collection_id:, key:)


# Update relationship attribute. [Learn more about relationship
# attributes](/docs/databases-relationships#relationship-attributes).
# attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
#
#
# @param [String] database_id Database ID.
Expand Down Expand Up @@ -1675,14 +1675,14 @@ def list_documents(database_id:, collection_id:, queries: nil)

# Create a new Document. Before using this route, you should create a new
# collection resource using either a [server
# integration](/docs/server/databases#databasesCreateCollection) API or
# directly from your database console.
# integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
# API or directly from your database console.
#
# @param [String] database_id Database ID.
# @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). Make sure to define attributes before creating documents.
# @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
# @param [Hash] data Document data as JSON object.
# @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](/docs/permissions).
# @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
#
# @return [Document]
def create_document(database_id:, collection_id:, document_id:, data:, permissions: nil)
Expand Down Expand Up @@ -1778,7 +1778,7 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil)
# @param [String] collection_id Collection ID.
# @param [String] document_id Document ID.
# @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated.
# @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).
# @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
#
# @return [Document]
def update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil)
Expand Down
10 changes: 6 additions & 4 deletions lib/appwrite/services/functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def list(queries: nil, search: nil)


# Create a new function. You can pass a list of
# [permissions](/docs/permissions) to allow different project users or team
# with access to execute the function using the client API.
# [permissions](https://appwrite.io/docs/permissions) to allow different
# project users or team with access to execute the function using the client
# API.
#
# @param [String] function_id Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
# @param [String] name Function name. Max length: 128 chars.
Expand Down Expand Up @@ -303,7 +304,7 @@ def list_deployments(function_id:, queries: nil, search: nil)
# This endpoint accepts a tar.gz file compressed with your code. Make sure to
# include any dependencies your code has within the compressed file. You can
# learn more about code packaging in the [Appwrite Cloud Functions
# tutorial](/docs/functions).
# tutorial](https://appwrite.io/docs/functions).
#
# Use the "command" param to set the entrypoint used to execute your code.
#
Expand Down Expand Up @@ -507,7 +508,8 @@ def create_build(function_id:, deployment_id:, build_id:)
end


#
# Get a Deployment's contents by its unique ID. This endpoint supports range
# requests for partial or streaming file download.
#
# @param [String] function_id Function ID.
# @param [String] deployment_id Deployment ID.
Expand Down
Loading