Repository navigation
Document rejected on block writes and own templates for template_id - #42
Conversation
The API drops the attributes and the mobile keys that the block type does not declare. The write still succeeds, and the response has rejected with the dropped keys. The SDK returns the body as it is. These specs check that create_block and update_block return rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Insert, update and validate a block can return rejected. It has a message and the keys that the API dropped. Validate returns it only when the block is valid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
template_id accepts a simple editor template from the shared gallery, or a template that you saved from your own email with create_template. Describe editor without the comparison to the drag-and-drop builder. Say that editor is not available on every plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Low risk] The change is docs, specs and fixtures only, with no runtime code and no dependency version moved, so the risk rests on the diff alone. The API behaviour it documents (the SummaryDocuments rejected block keys and own templates for template_id This is a docs and specs change on top of #40. It adds What's good
Review context · 0/5 commands
Reviews (1) · Last reviewed commit: "docs: say that template_id accepts your..." · claude-sonnet-5-5 |
Why?
The API changed for two features of #40:
rejected. The API drops the attributes and themobilekeys that the block type does not declare. The write still succeeds, andrejectedhas amessageand thekeysthat the API dropped.template_idofCampaigns#createnow also accepts a simple editor template that you saved from your own email. Before, it accepted only a template from the shared gallery.The SDK returns the response body as it is, so
rejectedalready gets to the caller. This PR adds the docs and specs for it, and corrects thetemplate_idandeditordocs.This PR is stacked on #40. Merge it after #40, or retarget it to
mainwhen #40 merges.Changes
rejectedon block writes (lib/mailerlite/emails/emails.rb,README.md)create_blockandupdate_block: the docs say when the response hasrejected, and what it contains. The README examples printrejected.keyswhen it is present.validate_block: the docs say that a valid block can haverejected, and that the response has norejectedwhenvalidisfalse.move_blockdoes not change, because the API does not returnrejectedfor a move.create_blockandupdate_block, with the new fixturesemail_block_created_rejected.jsonandemail_block_updated_rejected.json.template_idandeditor(lib/mailerlite/campaigns/campaigns.rb,README.md)template_idis a template from the shared gallery, or a template that you saved withEmails#create_template. Without it, the email starts from the default blank template.editorno longer compares the simple editor with the drag-and-drop builder. The docs now say thateditoris not available on every plan.template_idneedseditor: "simple", and all emails of a campaign must have the sameeditorandtemplate_id.CHANGELOG.md: one entry under "Unreleased" for therejecteddocs.Compatibility
Docs and specs only. No method signature, return value or behavior changes.
Tests
Errno::ENOENT, because the fixtures did not exist. They passed after the fixtures were added. These specs cannot fail because of the SDK code, because the SDK already returns the body as it is. They document the shape and protect it from a future change that filters the body.rspec spec/*rspec.rb(248 examples) passes on Ruby 3.1. RuboCop finds no new offenses.create_blockwitheditor_content.attrs.onclickreturned201withrejected.keys["editor_content.attrs.onclick"].update_blockwitheditor_content.mobile.onclickreturned200withrejected.keys["editor_content.mobile.onclick"]. Clean content returned norejected.validate_blockreturnedrejectedfor a valid block, and norejectedfor an invalid block.Campaigns#createwitheditor: "simple"and thetemplate_idfromcreate_templatereturned201.How to test
rspec spec/*rspec.rb.editor: MailerLite::Campaigns::EDITOR_SIMPLE, and get the email ID.editor_content: { attrs: { onclick: 'x' }, content: [{ type: 'text', text: 'Hi' }] }.["editor_content.attrs.onclick"].editor: MailerLite::Campaigns::EDITOR_SIMPLEandtemplate_idset to theidof the template. Make sure that the response is201.How to release
Release this with #40. It needs no separate release.
Rollback
No data or configuration changes. To roll back, revert the merge commit.
🤖 Generated with Claude Code