Skip to content

Commit

Permalink
Merge pull request #24 from appwrite/dev
Browse files Browse the repository at this point in the history
fix: minor bugs
  • Loading branch information
abnegate authored May 17, 2024
2 parents 11b3b91 + 41b53b2 commit db9ee84
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 22 deletions.
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.5.4-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.5.6-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 = '11.0.1'
spec.version = '11.0.2'
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
3 changes: 2 additions & 1 deletion docs/examples/messaging/update-email.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ result = messaging.update_email(
html: false, # optional
cc: [], # optional
bcc: [], # optional
scheduled_at: '' # optional
scheduled_at: '', # optional
attachments: [] # optional
)
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'=> '11.0.1',
'x-sdk-version'=> '11.0.2',
'X-Appwrite-Response-Format' => '1.5.0'
}
@endpoint = 'https://cloud.appwrite.io/v1'
Expand Down
2 changes: 1 addition & 1 deletion lib/appwrite/enums/credit_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module CreditCard
AMERICAN_EXPRESS = 'amex'
ARGENCARD = 'argencard'
CABAL = 'cabal'
CONSOSUD = 'censosud'
CENCOSUD = 'cencosud'
DINERS_CLUB = 'diners'
DISCOVER = 'discover'
ELO = 'elo'
Expand Down
1 change: 1 addition & 0 deletions lib/appwrite/enums/flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ module Flag
PALAU = 'pw'
PAPUA_NEW_GUINEA = 'pg'
POLAND = 'pl'
FRENCH_POLYNESIA = 'pf'
NORTH_KOREA = 'kp'
PORTUGAL = 'pt'
PARAGUAY = 'py'
Expand Down
1 change: 1 addition & 0 deletions lib/appwrite/enums/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Runtime
PYTHON_3_10 = 'python-3.10'
PYTHON_3_11 = 'python-3.11'
PYTHON_3_12 = 'python-3.12'
PYTHON_ML_3_11 = 'python-ml-3.11'
DENO_1_40 = 'deno-1.40'
DART_2_15 = 'dart-2.15'
DART_2_16 = 'dart-2.16'
Expand Down
11 changes: 8 additions & 3 deletions lib/appwrite/models/mfa_factors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,35 @@ class MfaFactors
attr_reader :totp
attr_reader :phone
attr_reader :email
attr_reader :recovery_code

def initialize(
totp:,
phone:,
email:
email:,
recovery_code:
)
@totp = totp
@phone = phone
@email = email
@recovery_code = recovery_code
end

def self.from(map:)
MfaFactors.new(
totp: map["totp"],
phone: map["phone"],
email: map["email"]
email: map["email"],
recovery_code: map["recoveryCode"]
)
end

def to_map
{
"totp": @totp,
"phone": @phone,
"email": @email
"email": @email,
"recoveryCode": @recovery_code
}
end
end
Expand Down
5 changes: 5 additions & 0 deletions lib/appwrite/models/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Models
class Session
attr_reader :id
attr_reader :created_at
attr_reader :updated_at
attr_reader :user_id
attr_reader :expire
attr_reader :provider
Expand Down Expand Up @@ -35,6 +36,7 @@ class Session
def initialize(
id:,
created_at:,
updated_at:,
user_id:,
expire:,
provider:,
Expand Down Expand Up @@ -64,6 +66,7 @@ def initialize(
)
@id = id
@created_at = created_at
@updated_at = updated_at
@user_id = user_id
@expire = expire
@provider = provider
Expand Down Expand Up @@ -96,6 +99,7 @@ def self.from(map:)
Session.new(
id: map["$id"],
created_at: map["$createdAt"],
updated_at: map["$updatedAt"],
user_id: map["userId"],
expire: map["expire"],
provider: map["provider"],
Expand Down Expand Up @@ -129,6 +133,7 @@ def to_map
{
"$id": @id,
"$createdAt": @created_at,
"$updatedAt": @updated_at,
"userId": @user_id,
"expire": @expire,
"provider": @provider,
Expand Down
9 changes: 4 additions & 5 deletions lib/appwrite/services/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def update_mfa(mfa:)

# Add an authenticator app to be used as an MFA factor. Verify the
# authenticator using the [verify
# authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
# authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
# method.
#
# @param [AuthenticatorType] type Type of authenticator. Must be `totp`
Expand Down Expand Up @@ -298,8 +298,8 @@ def create_mfa_authenticator(type:)


# Verify an authenticator app after adding it using the [add
# authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
# method.
# authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
# method. add
#
# @param [AuthenticatorType] type Type of authenticator.
# @param [String] otp Valid verification token.
Expand Down Expand Up @@ -340,7 +340,7 @@ def update_mfa_authenticator(type:, otp:)
# @param [AuthenticatorType] type Type of authenticator.
# @param [String] otp Valid verification token.
#
# @return [User]
# @return []
def delete_mfa_authenticator(type:, otp:)
api_path = '/account/mfa/authenticators/{type}'
.gsub('{type}', type)
Expand All @@ -366,7 +366,6 @@ def delete_mfa_authenticator(type:, otp:)
path: api_path,
headers: api_headers,
params: api_params,
response_type: Models::User
)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/appwrite/services/avatars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_browser(code:, width: nil, height: nil, quality: nil)
# of image returned is 100x100px.
#
#
# @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
# @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
# @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
# @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
# @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
Expand Down
10 changes: 6 additions & 4 deletions lib/appwrite/services/messaging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def list_messages(queries: nil, search: nil)
# @param [Array] targets List of Targets IDs.
# @param [Array] cc Array of target IDs to be added as CC.
# @param [Array] bcc Array of target IDs to be added as BCC.
# @param [Array] attachments Array of compound bucket IDs to file IDs to be attached to the email.
# @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>.
# @param [] draft Is message a draft
# @param [] html Is content of type HTML
# @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
Expand Down Expand Up @@ -109,9 +109,10 @@ def create_email(message_id:, subject:, content:, topics: nil, users: nil, targe
# @param [Array] cc Array of target IDs to be added as CC.
# @param [Array] bcc Array of target IDs to be added as BCC.
# @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
# @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>.
#
# @return [Message]
def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: nil, content: nil, draft: nil, html: nil, cc: nil, bcc: nil, scheduled_at: nil)
def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: nil, content: nil, draft: nil, html: nil, cc: nil, bcc: nil, scheduled_at: nil, attachments: nil)
api_path = '/messaging/messages/email/{messageId}'
.gsub('{messageId}', message_id)

Expand All @@ -130,6 +131,7 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni
cc: cc,
bcc: bcc,
scheduledAt: scheduled_at,
attachments: attachments,
}

api_headers = {
Expand All @@ -156,7 +158,7 @@ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: ni
# @param [Array] targets List of Targets IDs.
# @param [Hash] data Additional Data for push notification.
# @param [String] action Action for push notification.
# @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage.
# @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.
# @param [String] icon Icon for push notification. Available only for Android and Web Platform.
# @param [String] sound Sound for push notification. Available only for Android and IOS Platform.
# @param [String] color Color for push notification. Available only for Android Platform.
Expand Down Expand Up @@ -225,7 +227,7 @@ def create_push(message_id:, title:, body:, topics: nil, users: nil, targets: ni
# @param [String] body Body for push notification.
# @param [Hash] data Additional Data for push notification.
# @param [String] action Action for push notification.
# @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage.
# @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.
# @param [String] icon Icon for push notification. Available only for Android and Web platforms.
# @param [String] sound Sound for push notification. Available only for Android and iOS platforms.
# @param [String] color Color for push notification. Available only for Android platforms.
Expand Down
8 changes: 4 additions & 4 deletions lib/appwrite/services/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1454,11 +1454,11 @@ def delete_target(user_id:, target_id:)
end


# Returns a token with a secret key for creating a session. If the provided
# user ID has not be registered, a new user will be created. Use the returned
# user ID and secret and submit a request to the [PUT
# /account/sessions/custom](https://appwrite.io/docs/references/cloud/client-web/account#updateCustomSession)
# Returns a token with a secret key for creating a session. Use the user ID
# and secret and submit a request to the [PUT
# /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
# endpoint to complete the login process.
#
#
# @param [String] user_id User ID.
# @param [Integer] length Token length in characters. The default length is 6 characters
Expand Down

0 comments on commit db9ee84

Please sign in to comment.