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
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## 25.1.0

* Added: `createSesProvider` and `updateSesProvider` to `messaging`
* Added: `updateOAuth2Server` to `project` for OAuth2 server settings
* Added: `updatePasswordStrengthPolicy` and `PolicyPasswordStrength` to `project`
* Added: `getAuditsDB` health check to `health`
* Added: `password-strength` to `ProjectPolicyId`
* Added: `apps.read` and `apps.write` to `ProjectKeyScopes`


## 25.0.0

* Breaking: Removed `githubImagine` and `googleImagine` from `ProjectOAuthProviderId`
Expand All @@ -8,7 +18,7 @@
* Added: `Organization` service for managing projects and API keys
* Added: `PolicyDenyAliasedEmail`, `PolicyDenyDisposableEmail`, and `PolicyDenyFreeEmail` policy models
* Added: `deny-aliased-email`, `deny-disposable-email`, and `deny-free-email` to `ProjectPolicyId`
* Added: `BrowserTheme`, `HealthQueueName`, `OrganizationKeyScopes`, and `Region` enums
* Replaced: `BrowserTheme`, `HealthQueueName`, `OrganizationKeyScopes`, and `Region` enums
* Added: `dart-3.12` and `flutter-3.44` runtimes
* Added: `ProjectList` model and new attributes on `Function`, `Site`, and `UsageGauge`
* Updated: `functions`, `sites`, `usage`, `health`, and `avatars` services
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 = '25.0.0'
spec.version = '25.1.0'
spec.license = 'BSD-3-Clause'
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'
spec.author = 'Appwrite Team'
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/update-password.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ account = Account.new(client)

result = account.update_password(
password: '',
old_password: 'password' # optional
old_password: '<OLD_PASSWORD>' # optional
)
```
14 changes: 14 additions & 0 deletions docs/examples/health/get-audits-db.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

health = Health.new(client)

result = health.get_audits_db()
```
25 changes: 25 additions & 0 deletions docs/examples/messaging/create-ses-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

messaging = Messaging.new(client)

result = messaging.create_ses_provider(
provider_id: '<PROVIDER_ID>',
name: '<NAME>',
access_key: '<ACCESS_KEY>', # optional
secret_key: '<SECRET_KEY>', # optional
region: '<REGION>', # optional
from_name: '<FROM_NAME>', # optional
from_email: 'email@example.com', # optional
reply_to_name: '<REPLY_TO_NAME>', # optional
reply_to_email: 'email@example.com', # optional
enabled: false # optional
)
```
25 changes: 25 additions & 0 deletions docs/examples/messaging/update-ses-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

messaging = Messaging.new(client)

result = messaging.update_ses_provider(
provider_id: '<PROVIDER_ID>',
name: '<NAME>', # optional
enabled: false, # optional
access_key: '<ACCESS_KEY>', # optional
secret_key: '<SECRET_KEY>', # optional
region: '<REGION>', # optional
from_name: '<FROM_NAME>', # optional
from_email: 'email@example.com', # optional
reply_to_name: '<REPLY_TO_NAME>', # optional
reply_to_email: '<REPLY_TO_EMAIL>' # optional
)
```
23 changes: 23 additions & 0 deletions docs/examples/project/update-o-auth-2-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

project = Project.new(client)

result = project.update_o_auth2_server(
enabled: false,
authorization_url: 'https://example.com',
scopes: [], # optional
access_token_duration: 60, # optional
refresh_token_duration: 60, # optional
public_access_token_duration: 60, # optional
public_refresh_token_duration: 60, # optional
confidential_pkce: false # optional
)
```
20 changes: 20 additions & 0 deletions docs/examples/project/update-password-strength-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

project = Project.new(client)

result = project.update_password_strength_policy(
min: 8, # optional
uppercase: false, # optional
lowercase: false, # optional
number: false, # optional
symbols: false # optional
)
```
1 change: 1 addition & 0 deletions lib/appwrite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
require_relative 'appwrite/models/o_auth2_provider_list'
require_relative 'appwrite/models/policy_password_dictionary'
require_relative 'appwrite/models/policy_password_history'
require_relative 'appwrite/models/policy_password_strength'
require_relative 'appwrite/models/policy_password_personal_data'
Comment on lines 188 to 190

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The new policy_password_strength require is inserted out of alphabetical order — personal_data (p) should precede strength (s). While Ruby's require order doesn't affect correctness here, the existing file follows strict alphabetical ordering for requires and this breaks that convention.

Suggested change
require_relative 'appwrite/models/policy_password_history'
require_relative 'appwrite/models/policy_password_strength'
require_relative 'appwrite/models/policy_password_personal_data'
require_relative 'appwrite/models/policy_password_history'
require_relative 'appwrite/models/policy_password_personal_data'
require_relative 'appwrite/models/policy_password_strength'

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

require_relative 'appwrite/models/policy_session_alert'
require_relative 'appwrite/models/policy_session_duration'
Expand Down
22 changes: 19 additions & 3 deletions lib/appwrite/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ def initialize
'x-sdk-name'=> 'Ruby',
'x-sdk-platform'=> 'server',
'x-sdk-language'=> 'ruby',
'x-sdk-version'=> '25.0.0',
'x-sdk-version'=> '25.1.0',
'X-Appwrite-Response-Format' => '1.9.5'
}
@endpoint = 'https://cloud.appwrite.io/v1'
@config = {}
end

# Set Project
Expand All @@ -29,7 +30,7 @@ def initialize
#
# @return [self]
def set_project(value)
add_header('x-appwrite-project', value)
@config['project'] = value

self
end
Comment on lines 32 to 36

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Asymmetry between set_project and all other setters

Every other setter (set_key, set_jwt, set_locale, set_session, etc.) still calls add_header in addition to storing in @config, meaning those values are automatically present in every request via the default @headers. set_project now only stores in @config, so the X-Appwrite-Project header is absent from @headers and only appears in requests when a service method explicitly calls @client.get_config('project'). Any caller that uses client.get_headers (e.g., for debugging or testing) will no longer see the project ID there, and any call path that bypasses service-level api_headers would silently omit the project header.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Expand All @@ -43,6 +44,7 @@ def set_project(value)
# @return [self]
def set_key(value)
add_header('x-appwrite-key', value)
@config['key'] = value

self
end
Expand All @@ -56,6 +58,7 @@ def set_key(value)
# @return [self]
def set_jwt(value)
add_header('x-appwrite-jwt', value)
@config['jwt'] = value

self
end
Expand All @@ -67,6 +70,7 @@ def set_jwt(value)
# @return [self]
def set_locale(value)
add_header('x-appwrite-locale', value)
@config['locale'] = value

self
end
Expand All @@ -80,6 +84,7 @@ def set_locale(value)
# @return [self]
def set_session(value)
add_header('x-appwrite-session', value)
@config['session'] = value

self
end
Expand All @@ -93,6 +98,7 @@ def set_session(value)
# @return [self]
def set_forwarded_user_agent(value)
add_header('x-forwarded-user-agent', value)
@config['forwardeduseragent'] = value

self
end
Expand All @@ -106,6 +112,7 @@ def set_forwarded_user_agent(value)
# @return [self]
def set_dev_key(value)
add_header('x-appwrite-dev-key', value)
@config['devkey'] = value

self
end
Expand All @@ -119,6 +126,7 @@ def set_dev_key(value)
# @return [self]
def set_cookie(value)
add_header('cookie', value)
@config['cookie'] = value

self
end
Expand All @@ -132,6 +140,7 @@ def set_cookie(value)
# @return [self]
def set_impersonate_user_id(value)
add_header('x-appwrite-impersonate-user-id', value)
@config['impersonateuserid'] = value

self
end
Expand All @@ -145,6 +154,7 @@ def set_impersonate_user_id(value)
# @return [self]
def set_impersonate_user_email(value)
add_header('x-appwrite-impersonate-user-email', value)
@config['impersonateuseremail'] = value

self
end
Expand All @@ -158,10 +168,15 @@ def set_impersonate_user_email(value)
# @return [self]
def set_impersonate_user_phone(value)
add_header('x-appwrite-impersonate-user-phone', value)
@config['impersonateuserphone'] = value

self
end

def get_config(key)
@config[key] || ''
end

# Set endpoint.
#
# @param [String] endpoint The endpoint to set
Expand Down Expand Up @@ -223,7 +238,8 @@ def call(
params: {},
response_type: nil
)
uri = URI.parse(@endpoint + path + ((method == "GET" && params.length) ? '?' + encode(params) : ''))
separator = path.include?('?') ? '&' : '?'
uri = URI.parse(@endpoint + path + ((method == "GET" && params.length) ? separator + encode(params) : ''))

fetch(method, uri, headers, params, response_type)
end
Expand Down
2 changes: 2 additions & 0 deletions lib/appwrite/enums/project_key_scopes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ module ProjectKeyScopes
DOMAINS_READ = 'domains.read'
DOMAINS_WRITE = 'domains.write'
EVENTS_READ = 'events.read'
APPS_READ = 'apps.read'
APPS_WRITE = 'apps.write'
USAGE_READ = 'usage.read'
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/appwrite/enums/project_policy_id.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Enums
module ProjectPolicyId
PASSWORD_DICTIONARY = 'password-dictionary'
PASSWORD_HISTORY = 'password-history'
PASSWORD_STRENGTH = 'password-strength'
PASSWORD_PERSONAL_DATA = 'password-personal-data'
SESSION_ALERT = 'session-alert'
SESSION_DURATION = 'session-duration'
Expand Down
52 changes: 52 additions & 0 deletions lib/appwrite/models/policy_password_strength.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#frozen_string_literal: true

module Appwrite
module Models
class PolicyPasswordStrength
attr_reader :id
attr_reader :min
attr_reader :uppercase
attr_reader :lowercase
attr_reader :number
attr_reader :symbols

def initialize(
id:,
min:,
uppercase:,
lowercase:,
number:,
symbols:
)
@id = id
@min = min
@uppercase = uppercase
@lowercase = lowercase
@number = number
@symbols = symbols
end

def self.from(map:)
PolicyPasswordStrength.new(
id: map["$id"],
min: map["min"],
uppercase: map["uppercase"],
lowercase: map["lowercase"],
number: map["number"],
symbols: map["symbols"]
)
end

def to_map
{
"$id": @id,
"min": @min,
"uppercase": @uppercase,
"lowercase": @lowercase,
"number": @number,
"symbols": @symbols
}
end
end
end
end
Loading
Loading