https://mobileaws.atlassian.net/browse/CLOUD-2712#1
Open
dlopezallcode wants to merge 1 commit intomainfrom
Open
https://mobileaws.atlassian.net/browse/CLOUD-2712#1dlopezallcode wants to merge 1 commit intomainfrom
dlopezallcode wants to merge 1 commit intomainfrom
Conversation
8fb55ec to
d35a52c
Compare
d35a52c to
cb15071
Compare
criscantillo
approved these changes
Apr 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
The Ruby SDK has been brought to complete parity with the reference Java SDK. Critical hardcoded URL bugs were fixed, Webhook CRUD was completed, and Contact Service and MD5 caching in MMS were added. The SDK passes 60/60 unit tests.
Implemented Changes
1. Hardcoded URL Fix in Email Service (
lib/ccai/email/email_service.rb) 🔴Before: the service had a hardcoded
BASE_URLconstant pointing to the test environment, completely ignoring client configuration.After: uses
@client.email_base_urldynamically, which comes fromConfigwith correct test/prod switching. Also fixed:AccountIdandClientIdare now passed correctly.?send=truefrom endpoint (not required by API).Originheader.2. Hardcoded Base URL Fix in Client (
lib/ccai/client.rb) 🔴Before: the default of
base_urlpointed tohttps://core-test-cloudcontactai.allcode.com/api(test environment).After: the default now points to
https://core.cloudcontactai.com/api(production). Test environment is activated explicitly withuse_test_environment: true.3. Test/Prod Environment Switching (
lib/ccai/client.rb,lib/ccai.rb)Before: no formal mechanism to alternate between environments.
After (
Config):use_test_environment: false(default)true:base_url,email_base_url,files_base_urlpoint to*-test-cloudcontactai.allcode.comdomainsCCAI_BASE_URL,CCAI_EMAIL_BASE_URL,CCAI_FILES_BASE_URLbase_url,email_base_url,files_base_url,test_environment?4. Complete Webhook CRUD (
lib/ccai/webhook_service.rb)Before: the service existed but was incomplete (register, update, list, delete were missing) and
verify_signaturehad an incorrect test.After:
register(config)—POST /v1/client/{clientId}/integration(sends array[{...}], returns first element)update(id, config)— POST to same endpoint withidconverted tointin payloadlist—GET /v1/client/{clientId}/integrationdelete(id)—DELETE /v1/client/{clientId}/integration/{id}parse_event(json_payload)— decodes JSON locallyverify_signature— already existed; test was fixed to use real HMAC instead of fake signatureDocumented traps:
[{...}]not{...}.5. New Service: Contact (
lib/ccai/contact/contact_service.rb)Before: the SDK had no contact management support.
After:
set_do_not_text(do_not_text, contact_id: nil, phone: nil)— SMS opt-out / opt-inEndpoint:
PUT /account/do-not-textRegistered in
Clientas@contact.6. MD5 Cache in MMS (
lib/ccai/sms/mms_service.rb)Before:
send_with_image()always uploaded the image without checking for duplicates.After:
md5_file(file_path)private — usesDigest::MD5.file(file_path).hexdigestcheck_file_uploaded(file_key)public — queriesGET /clients/{clientId}/storedUrl?fileKey={fileKey}send_with_image()rewritten: computes MD5 → constructs{clientId}/campaign/{md5}.{ext}→ checks if exists → if yes, skips upload → sendsget_signed_upload_url()now uses@client.files_base_urlinstead of hardcoded URLCompatibility Notes
sms,mmsdo not change in their public interface — backward compatible.use_test_environment: trueis the parameter to maintain previous behavior if any user needs it.