From 41b53b280dd0e78a0ad631a9d6d9599e4a1d846e Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Fri, 17 May 2024 04:21:38 +0000 Subject: [PATCH] fix: minor bugs --- README.md | 2 +- appwrite.gemspec | 2 +- docs/examples/messaging/update-email.md | 3 ++- lib/appwrite/client.rb | 2 +- lib/appwrite/enums/credit_card.rb | 2 +- lib/appwrite/enums/flag.rb | 1 + lib/appwrite/enums/runtime.rb | 1 + lib/appwrite/models/mfa_factors.rb | 11 ++++++++--- lib/appwrite/models/session.rb | 5 +++++ lib/appwrite/services/account.rb | 9 ++++----- lib/appwrite/services/avatars.rb | 2 +- lib/appwrite/services/messaging.rb | 10 ++++++---- lib/appwrite/services/users.rb | 8 ++++---- 13 files changed, 36 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index d664721..1b6c7ad 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/appwrite.gemspec b/appwrite.gemspec index a065321..146b77c 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -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' diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index 7f09d47..a692c55 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -20,5 +20,6 @@ result = messaging.update_email( html: false, # optional cc: [], # optional bcc: [], # optional - scheduled_at: '' # optional + scheduled_at: '', # optional + attachments: [] # optional ) diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index 7cc168b..78584c2 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -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' diff --git a/lib/appwrite/enums/credit_card.rb b/lib/appwrite/enums/credit_card.rb index acaa384..931ae9c 100644 --- a/lib/appwrite/enums/credit_card.rb +++ b/lib/appwrite/enums/credit_card.rb @@ -4,7 +4,7 @@ module CreditCard AMERICAN_EXPRESS = 'amex' ARGENCARD = 'argencard' CABAL = 'cabal' - CONSOSUD = 'censosud' + CENCOSUD = 'cencosud' DINERS_CLUB = 'diners' DISCOVER = 'discover' ELO = 'elo' diff --git a/lib/appwrite/enums/flag.rb b/lib/appwrite/enums/flag.rb index 5cc43b1..8a92a40 100644 --- a/lib/appwrite/enums/flag.rb +++ b/lib/appwrite/enums/flag.rb @@ -142,6 +142,7 @@ module Flag PALAU = 'pw' PAPUA_NEW_GUINEA = 'pg' POLAND = 'pl' + FRENCH_POLYNESIA = 'pf' NORTH_KOREA = 'kp' PORTUGAL = 'pt' PARAGUAY = 'py' diff --git a/lib/appwrite/enums/runtime.rb b/lib/appwrite/enums/runtime.rb index 335d2df..75bbc0f 100644 --- a/lib/appwrite/enums/runtime.rb +++ b/lib/appwrite/enums/runtime.rb @@ -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' diff --git a/lib/appwrite/models/mfa_factors.rb b/lib/appwrite/models/mfa_factors.rb index 648a547..583bba0 100644 --- a/lib/appwrite/models/mfa_factors.rb +++ b/lib/appwrite/models/mfa_factors.rb @@ -6,22 +6,26 @@ 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 @@ -29,7 +33,8 @@ def to_map { "totp": @totp, "phone": @phone, - "email": @email + "email": @email, + "recoveryCode": @recovery_code } end end diff --git a/lib/appwrite/models/session.rb b/lib/appwrite/models/session.rb index 7299b60..6aa33b4 100644 --- a/lib/appwrite/models/session.rb +++ b/lib/appwrite/models/session.rb @@ -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 @@ -35,6 +36,7 @@ class Session def initialize( id:, created_at:, + updated_at:, user_id:, expire:, provider:, @@ -64,6 +66,7 @@ def initialize( ) @id = id @created_at = created_at + @updated_at = updated_at @user_id = user_id @expire = expire @provider = provider @@ -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"], @@ -129,6 +133,7 @@ def to_map { "$id": @id, "$createdAt": @created_at, + "$updatedAt": @updated_at, "userId": @user_id, "expire": @expire, "provider": @provider, diff --git a/lib/appwrite/services/account.rb b/lib/appwrite/services/account.rb index dfa1aab..e76dc69 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -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` @@ -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. @@ -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) @@ -366,7 +366,6 @@ def delete_mfa_authenticator(type:, otp:) path: api_path, headers: api_headers, params: api_params, - response_type: Models::User ) end diff --git a/lib/appwrite/services/avatars.rb b/lib/appwrite/services/avatars.rb index 350ffc0..5e49f03 100644 --- a/lib/appwrite/services/avatars.rb +++ b/lib/appwrite/services/avatars.rb @@ -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. diff --git a/lib/appwrite/services/messaging.rb b/lib/appwrite/services/messaging.rb index 342f471..49e952f 100644 --- a/lib/appwrite/services/messaging.rb +++ b/lib/appwrite/services/messaging.rb @@ -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 :. # @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. @@ -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 :. # # @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) @@ -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 = { @@ -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 :. # @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. @@ -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 :. # @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. diff --git a/lib/appwrite/services/users.rb b/lib/appwrite/services/users.rb index 3074e0c..c89b89f 100644 --- a/lib/appwrite/services/users.rb +++ b/lib/appwrite/services/users.rb @@ -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