feat: Ruby SDK update for version 26.0.0#67
Conversation
Greptile SummaryThis PR updates the Ruby SDK to version 26.0.0. It removes the
Confidence Score: 4/5Safe to merge after resolving the nil-guard omission in BillingPlan.from; all other changes are additive or intentional removals. The main concern is lib/appwrite/models/billing_plan.rb — the Important Files Changed
Prompt To Fix All With AIFix 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 |
| api_params = { | ||
| name: name, | ||
| } | ||
|
|
||
| api_headers = { | ||
| "X-Appwrite-Project": @client.get_config('project'), | ||
| "content-type": 'application/json', | ||
| "accept": 'application/json', | ||
| } | ||
|
|
||
| @client.call( | ||
| method: 'PUT', |
There was a problem hiding this 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.
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!
| usage: UsageBillingPlan.from(map: map["usage"]), | ||
| addons: BillingPlanAddon.from(map: map["addons"]), |
There was a problem hiding this 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.
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.
This PR contains updates to the SDK for version 26.0.0.
What's Changed
Healthservice and all health models and enumsUsageservice andUsageEvent/UsageGaugemodelsMessaginglog methodslist_message_logs,list_provider_logs,list_subscriber_logs,list_topic_logscountryCode/countryNamefromActivityEvent(countryremains)Client#set_bearerfor OAuth access token authenticationOrganizationget,update,delete, and membership CRUD methodsQuery.vector_dot,Query.vector_cosine,Query.vector_euclideanquery helpersProject#update_o_auth2_appwriteandProject#update_deny_corporate_email_policymethodsverification_url,user_code_length,device_code_duration,default_scopes)new_specification(restorations),token(deployment download),type(list specifications),specification(TablesDB create)Organization,BillingPlan,AdditionalResource,Program,OAuth2Appwrite,PolicyDenyCorporateEmailmodelsDatabaseStatus,BillingPlanGroup,ProjectOAuth2OidcPromptenums andAPPWRITEOAuth providerLocalegeolocation/ISP fields,Membership#user_accessed_at,Block#mode,BackupPolicy#type,Database#statusUseremail classification fields (email_is_free,email_is_disposable,email_is_corporate)stages.*,project.oauth2.*,organization.*,dedicatedDatabases.execute)