Skip to content

feat: Ruby SDK update for version 26.0.0#67

Merged
ChiragAgg5k merged 3 commits into
mainfrom
dev
Jul 13, 2026
Merged

feat: Ruby SDK update for version 26.0.0#67
ChiragAgg5k merged 3 commits into
mainfrom
dev

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Jul 13, 2026

Copy link
Copy Markdown
Member

This PR contains updates to the SDK for version 26.0.0.

What's Changed

  • Breaking: Removed Health service and all health models and enums
  • Breaking: Removed Usage service and UsageEvent/UsageGauge models
  • Breaking: Removed Messaging log methods list_message_logs, list_provider_logs, list_subscriber_logs, list_topic_logs
  • Breaking: Removed OS, client, and device fields plus countryCode/countryName from ActivityEvent (country remains)
  • Added: Client#set_bearer for OAuth access token authentication
  • Added: Organization get, update, delete, and membership CRUD methods
  • Added: Query.vector_dot, Query.vector_cosine, Query.vector_euclidean query helpers
  • Added: Project#update_o_auth2_appwrite and Project#update_deny_corporate_email_policy methods
  • Added: OAuth2 server device-flow params (verification_url, user_code_length, device_code_duration, default_scopes)
  • Added: optional params new_specification (restorations), token (deployment download), type (list specifications), specification (TablesDB create)
  • Added: Organization, BillingPlan, AdditionalResource, Program, OAuth2Appwrite, PolicyDenyCorporateEmail models
  • Added: DatabaseStatus, BillingPlanGroup, ProjectOAuth2OidcPrompt enums and APPWRITE OAuth provider
  • Added: Locale geolocation/ISP fields, Membership#user_accessed_at, Block#mode, BackupPolicy#type, Database#status
  • Added: User email classification fields (email_is_free, email_is_disposable, email_is_corporate)
  • Added: new key scopes (stages.*, project.oauth2.*, organization.*, dedicatedDatabases.execute)

@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown

Greptile Summary

This PR updates the Ruby SDK to version 26.0.0. It removes the Health and Usage services entirely (along with all associated models and enums), adds a new Organization service with membership CRUD, introduces billing-plan and OAuth2 models, adds vector query helpers, and threads accept: application/json through all API call headers.

  • Breaking removals: Health service + all health models/enums, Usage service + UsageEvent/UsageGauge models, and several Messaging log methods are deleted and documented in the CHANGELOG.
  • New additions: Organization CRUD, BillingPlan / UsageBillingPlan / AdditionalResource / Program / OAuth2Appwrite models, DatabaseStatus / BillingPlanGroup / ProjectOAuth2OidcPrompt enums, and Client#set_bearer (now correctly prepends \"Bearer \").
  • BillingPlan.from calls UsageBillingPlan.from(map: map[\"usage\"]) and BillingPlanAddon.from(map: map[\"addons\"]) without nil guards, unlike limits, program, and dedicated_databases in the same method \u2014 a potential crash if the API omits those fields.

Confidence Score: 4/5

Safe to merge after resolving the nil-guard omission in BillingPlan.from; all other changes are additive or intentional removals.

The main concern is BillingPlan.from calling UsageBillingPlan.from and BillingPlanAddon.from without nil guards — the same file already applies nil guards to limits, program, and dedicated_databases, making the omission look unintentional. If the Appwrite API can ever return a billing plan without a usage or addons field, deserialization crashes at runtime with NoMethodError. Everything else looks correct and well-documented.

lib/appwrite/models/billing_plan.rb — the from method needs nil guards on usage, addons, and supported_addons to match the pattern used for limits, program, and dedicated_databases.

Important Files Changed

Filename Overview
lib/appwrite.rb Major require reshuffling: removes Health and Usage service/model/enum requires, adds new billing, organization, OAuth2, and enum requires. All deletions are intentional for the 26.0.0 major version bump.
lib/appwrite/client.rb Adds set_bearer with correct "Bearer #{value}" prefix, bumps SDK version to 26.0.0, and shortens impersonation docstrings. The Bearer implementation now correctly follows RFC 6750.
lib/appwrite/models/billing_plan.rb New 379-line model for billing plans. BillingPlan.from calls UsageBillingPlan.from and BillingPlanAddon.from without nil guards, which will crash with NoMethodError if the API omits those fields — inconsistent with the nil guards already applied to limits, program, and dedicated_databases in the same method.
lib/appwrite/models/database.rb Adds optional status field with nil-safe construction; validate_status uses string concatenation pattern rather than string interpolation.
lib/appwrite/query.rb Adds vector_dot, vector_cosine, and vector_euclidean query helpers following the same pattern as existing geo queries. Also adds missing newline at end of file.
lib/appwrite/models/usage_billing_plan.rb New model replacing UsageEvent/UsageGauge. Deserializes 11 nested AdditionalResource fields without nil guards — safe as long as the API always populates all fields, but fragile if any (e.g., credits) is absent.
lib/appwrite/services/organization.rb Adds full Organization CRUD (get, update, delete) and membership management methods with proper headers and parameter validation.
lib/appwrite/models/o_auth2_appwrite.rb New OAuth2Appwrite model with id, enabled, client_id, and client_secret fields. Standard from/to_map pattern, looks correct.
lib/appwrite/models/user.rb Adds email classification fields (email_canonical, email_is_free, email_is_disposable, email_is_corporate, email_is_canonical) following existing patterns correctly.

Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
lib/appwrite/models/billing_plan.rb:255-256
**Missing nil guard on `usage` and `addons` nested deserialization**

`UsageBillingPlan.from(map: map["usage"])` and `BillingPlanAddon.from(map: map["addons"])` are called unconditionally. Inside `UsageBillingPlan.from`, every field immediately accesses `map["bandwidth"]`, `map["credits"]`, etc. — so if `map["usage"]` is `nil` (or if any sub-field like `"credits"` is absent), Ruby raises `NoMethodError: undefined method '[]' for nil:NilClass`. The same file already applies nil guards to `limits`, `program`, and `dedicated_databases` (e.g. `map["limits"].nil? ? nil : BillingPlanLimits.from(...)`) — the same pattern should apply here for consistency and safety.

Reviews (3): Last reviewed commit: "chore: update Ruby SDK to 26.0.0" | Re-trigger Greptile

Comment thread lib/appwrite/client.rb
Comment on lines +47 to +58
api_params = {
name: name,
}

api_headers = {
"X-Appwrite-Project": @client.get_config('project'),
"content-type": 'application/json',
"accept": 'application/json',
}

@client.call(
method: 'PUT',

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 Spurious content-type: application/json on bodyless DELETE

The delete() and delete_membership() methods set "content-type": 'application/json' in their headers but send no body. The fetch method in client.rb will serialize {} as the request payload for non-GET requests when content-type is application/json, meaning a "{}" body is sent on every DELETE request. This is redundant and inconsistent with DELETE semantics; removing the content-type header from these methods would be cleaner.

Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/appwrite/services/organization.rb
Line: 47-58

Comment:
**Spurious `content-type: application/json` on bodyless DELETE**

The `delete()` and `delete_membership()` methods set `"content-type": 'application/json'` in their headers but send no body. The `fetch` method in `client.rb` will serialize `{}` as the request payload for non-GET requests when `content-type` is `application/json`, meaning a `"{}"` body is sent on every DELETE request. This is redundant and inconsistent with DELETE semantics; removing the `content-type` header from these methods would be cleaner.

How can I resolve this? If you propose a fix, please make it concise.

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!

Fix in Claude Code Fix in Codex

Comment thread lib/appwrite/models/billing_plan.rb
Comment on lines +255 to +256
usage: UsageBillingPlan.from(map: map["usage"]),
addons: BillingPlanAddon.from(map: map["addons"]),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Missing nil guard on usage and addons nested deserialization

UsageBillingPlan.from(map: map["usage"]) and BillingPlanAddon.from(map: map["addons"]) are called unconditionally. Inside UsageBillingPlan.from, every field immediately accesses map["bandwidth"], map["credits"], etc. — so if map["usage"] is nil (or if any sub-field like "credits" is absent), Ruby raises NoMethodError: undefined method '[]' for nil:NilClass. The same file already applies nil guards to limits, program, and dedicated_databases (e.g. map["limits"].nil? ? nil : BillingPlanLimits.from(...)) — the same pattern should apply here for consistency and safety.

Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/appwrite/models/billing_plan.rb
Line: 255-256

Comment:
**Missing nil guard on `usage` and `addons` nested deserialization**

`UsageBillingPlan.from(map: map["usage"])` and `BillingPlanAddon.from(map: map["addons"])` are called unconditionally. Inside `UsageBillingPlan.from`, every field immediately accesses `map["bandwidth"]`, `map["credits"]`, etc. — so if `map["usage"]` is `nil` (or if any sub-field like `"credits"` is absent), Ruby raises `NoMethodError: undefined method '[]' for nil:NilClass`. The same file already applies nil guards to `limits`, `program`, and `dedicated_databases` (e.g. `map["limits"].nil? ? nil : BillingPlanLimits.from(...)`) — the same pattern should apply here for consistency and safety.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code Fix in Codex

@ChiragAgg5k
ChiragAgg5k merged commit db88228 into main Jul 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants