Repository navigation
ENGL-663: Catch up the Ruby SDK with the public API - #41
kavanpancholi merged 9 commits into
Conversation
[Medium risk] The new spec support file requires 'webmock/rspec' and the account says WebMock is now loaded globally, which blocks real connections for the whole suite, but the Gemfile is not in the changed files and the review did not check that webmock is a declared development dependency or that existing specs still pass. Risk rests on the change's public-interface edits: Groups#get_subscribers and Segments#list move params from a JSON body to the query string, and Subscribers#fetch changes filter … FindingsEarlier findings (1 dismissed)
SummaryAdds Ruby SDK automation endpoints and fixes misplaced GET params New What's good
Review context · 0/5 commands
No agent named again is on, so every agent that applies ran. Reviews (3) · Last reviewed commit: "Cover Array filter values on subscriber..." · claude-sonnet-5-5 |
|
@mailerlite-kritika review again |
Why?
The Ruby SDK was behind the public API. It could read automations but not build, change or control them. Some list calls also sent their params where the API never reads them. This catches it up with every subscribers, groups, segments, fields and automations endpoint on ENGL-663, and fixes the known Ruby bugs from the card.
Changes
Groups#get_subscribersandSegments#listsent their params as a JSON body on a GET, so the API ignored them. They now go in the query string.Automations#get_subscriber_activitysentfilter[keyword], which the API rejects with a 400. It now sends the documentedfilter[search]. An oldfilter[:keyword]value is sent asfilter[search]too.Segments#get_subscribersonly sentafter, so paging always returned page 1. It now takescursor:.afteris still sent unchanged for anyone who passes it.Subscribers#fetchsends itsfilter[...]keys in the caller's order. The API only appliesstart_date,end_dateandsort=signup_datewhen the first filter is form, site, page, import or post, so a fixed order withstatusfirst made those params do nothing. Array filter values are now sent comma-separated, as the API documents.include,sort, dates,with_fieldsand the other filters), subscriber create (resubscribe,double_optin,notes), group subscribers (include), segment list (sort), segment update (filter), automation list (sort,with_stepsand filters), automation activity (sort, andwith_subscribers, sent only when true because the API turns it on for any value).Subscribers#activity_log,Groups#import_subscribers, and automationcreate,update,delete,copy,enable,disable,test,add_subscribers,readdand the three activity actions.Automationsstays under the rubocop class length limit:AutomationTriggers,AutomationSteps,AutomationEmails,AutomationTemplates,AutomationReports.MailerLite::QueryParamsholds the query building the new methods share: boolean to1/0, filter keys and comma-joined arrays, report params, and the URI.No existing method signature changed and nothing was removed.
client.rbis untouched.The e-commerce automation reports (
monthly-totals/ecommerce,order-activity,ecommerce-overview-stats) are not in this PR, because the open e-commerce PR #39 adds them.Endpoint checklist
"Live call" means the method was called once against a local API on a test account, and the effect was read back with a separate request: the rename stored, the subscriber in the group, the test email delivered, page 2 different from page 1, and so on.
Subscribers
POST /subscribersSubscribers#create (resubscribe, double_optin, notes)POST /subscribers (notes stored)Subscribers#create notesGET /subscribers/{subscriber}Subscribers#getPUT /subscribers/{subscriber}Subscribers#updateGET /subscribers/{subscriber}/activity-logSubscribers#activity_logGET /subscribers/import/{import}Subscribers#get_single_importGET /subscribersSubscribers#fetch (filters, sort, include, with_fields, cursor)POST /subscribers/{subscriber}/forgetSubscribers#forgetDELETE /subscribers/{subscriber}Subscribers#deleteGroups
POST /groupsGroups#createGET /groupsGroups#getPUT /groups/{group}Groups#updatePOST /subscribers/{subscriber}/groups/{group}Groups#assign_subscriberDELETE /subscribers/{subscriber}/groups/{group}Groups#unassign_subscriberPOST /groups/{group}/import-subscribersGroups#import_subscribersGET /groups/{group}/subscribersGroups#get_subscribers (query string, include, cursor)DELETE /groups/{group}Groups#deleteSegments
GET /segmentsSegments#list (query string, sort)PUT /segments/{segment}Segments#update (name, filter)GET /segments/{segment}/subscribersSegments#get_subscribers (cursor, after)DELETE /segments/{segment}Segments#deleteFields
POST /fieldsFields#createGET /fieldsFields#getPUT /fields/{field}Fields#updateDELETE /fields/{field}Fields#deleteAutomations
segment setup (tinker)n/aPOST /automationsAutomations#createPUT /automations/{automation}Automations#updatePOST /automations/{automation}/testAutomations#testPOST /automations/{automation}/enableAutomations#enablePOST /automations/{automation}/add-subscribersAutomations#add_subscribersGET /automations/{automation}/activityAutomations#get_subscriber_activity (filter[search], old filter[:keyword], sort)POST /automations/{automation}/activity/add-to-groupAutomations#add_activity_to_groupPOST /automations/{automation}/activity/skip-delayAutomations#skip_activity_delayPOST /automations/{automation}/activity/cancel-automationAutomations#cancel_activityPOST /automations/{automation}/readdAutomations#readdPOST /automations/{automation}/copyAutomations#copyPOST /automations/{automation}/disableAutomations#disableDELETE /automations/{automation}Automations#deleteAutomation triggers
POST /automations/{automation}/triggersAutomationTriggers#createPUT /automations/{automation}/triggers/{trigger}AutomationTriggers#updateGET /automations/{automation}/triggersAutomationTriggers#listGET /automations/{automation}/triggers/{trigger}AutomationTriggers#fetchDELETE /automations/{automation}/triggers/{trigger}AutomationTriggers#deleteAutomation steps
POST /automations/{automation}/stepsAutomationSteps#create (email, delay, email, action)GET /automations/{automation}/steps/indexAutomationSteps#listGET /automations/{automation}/steps/{step}AutomationSteps#fetchPUT /automations/{automation}/steps/{step}AutomationSteps#updatePOST /automations/{automation}/steps/{step}/copyAutomationSteps#copyPOST /automations/{automation}/steps/reorderAutomationSteps#reorderDELETE /automations/{automation}/steps/{step}AutomationSteps#deletePUT /automations/{automation}/steps/{step}/select-ab-test-winnerAutomationSteps#select_ab_test_winnerAutomation emails
PUT /automations/{automation}/emails/{email}/contentAutomationEmails#update_contentGET /automations/{automation}/emails/{email}/contentAutomationEmails#contentGET /automations/{automation}/emails/{email}/report-statsAutomationEmails#report_statsGET /automations/{automation}/emails/{email}/unsubscribe-reasonsAutomationEmails#unsubscribe_reasonsAutomation templates
GET /automation-templatesAutomationTemplates#listPOST /automations/select-template/{automationTemplate}AutomationTemplates#select_templateAutomation reports
GET /automations/{automation}/steps/run-countsAutomationReports#step_run_countsGET /automations/{automation}/steps/run-counts/{step}AutomationReports#step_run_countGET /automations/{automation}/triggers/run-countsAutomationReports#trigger_run_countsGET /automations/{automation}/triggers/run-counts/{trigger}AutomationReports#trigger_run_countGET /automations/{automation}/ab-steps-statsAutomationReports#ab_steps_statsGET /automations/{automation}/activity/steps/{step}/subscribersAutomationReports#step_subscribersGET /automations/{automation}/activity/triggers/{trigger}/subscribersAutomationReports#trigger_subscribersGET /automations/{automation}/monthly-totals/emailAutomationReports#email_monthly_totalsGET /automations/{automation}/monthly-totals/ecommerce(none)GET /automations/{automation}/order-activity(none)GET /automations/{automation}/emails/{email}/ecommerce-overview-stats(none)GET /automations/{automation}/ab-steps-stats (with an A/B step)AutomationReports#ab_steps_statsGET /automations/{automation}/ab-steps-stats/{step}AutomationReports#ab_step_statsRisks
Low risk. The changes are additive, apart from the fixes in Changes 1 and 2, which change what the SDK sends:
filter[:keyword]on automation activity now goes out asfilter[search]. Before, it always got a 400. A value that is not an email now gets a 422 instead.statuswithformnow gets the date range andsignup_datesort they asked for.Performance impact
None. Each method makes one request.
Security impact
No security impact. No auth or transport change.
How to QA
No QA needed on the app. This is a library change, and nothing in the MailerLite app changes. Reviewers can run the specs (
bundle exec rspec spec/*rspec.rb).Verified before review: 68 of 71 live calls passed. The other 3 are the e-commerce reports that PR #39 adds. What a local run cannot show:
start_dateandend_date.add-subscribersruns are not trigger runs.Specs:
99 examples, 0 failures. Rubocop: no new offenses (the 8 it reports are the existing gemspec ones).How to release
Standard gem release. The CHANGELOG has an Unreleased entry. The open simple-editor PR #40 also adds a block at the top of the CHANGELOG, so whichever merges second has a small conflict there.
Rollback strategy
Primary rollback method: revert
Code changes
Database migrations
Data modifications
External dependencies
Configuration changes:
Screenshots, recordings
N/A, library change.
I used AI to generate parts of this PR
Yes
Docs
The PR adheres to Pull Request guidelines.
See mandatory MailerLite PR rules and flow for more information.