Repository navigation
Mailing Lists - Add Mailgun::MailingLists wrapper - #401
Merged
Merged
Conversation
- Add Mailgun::MailingLists covering all 14 v3 mailing list endpoints: lists (list, list_pages, create, get, update, remove), members (list_members, list_members_pages, get_member, create_member, update_member, remove_member) and bulk uploads (create_members for JSON, import_members for CSV) - Member vars and bulk members can be passed as Ruby objects; they are JSON-encoded for the API - Addresses keep @ and + in the path; characters that would break it (/ ? # % and whitespace) are percent-encoded - Methods require a v3 client and raise ParameterError on a missing list or member address - Switch the list and list member integration specs to the wrapper, replaying the existing cassettes; add unit specs for the endpoints without recordings (paging, member listing, bulk uploads) - Add docs/MailingLists.md and link it from the README
- Cover list_pages, list_members, list_members_pages, create_members and import_members with a new integration spec recorded against the live API (cassette mailing_lists); remove the unit specs - The recording also checks a member address with a plus sign and that vars sent as a Hash come back as a Hash - Argument and API version checks move into the integration spec - Docs: a bulk upload response reports members_count from before the upload - The cassette is scrubbed like the existing ones (key, auth header, test domain); the X-Mailgun-Key-Id header value is replaced too
Keep one name per operation, as in Domains and AnalyticsTags: drop get_lists, delete, add_member and delete_member.
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.
Adds a
Mailgun::MailingListswrapper for the v3 Mailing Lists API. Until now the gem only had the double opt-in helper, so managing lists and members meant calling the raw client.Methods
list,list_pages,create,get,update,removelist_members,list_members_pages,get_member,create_member,update_member,remove_membercreate_members(JSON, up to 1,000 members),import_members(CSV file path or IO)DomainsandTemplates:listmethods returnitems,create/updatereturn the response hash,removemethods return a boolean.varsand bulk member lists can be passed as Ruby hashes and arrays; they are JSON-encoded for the API.@and+in the path;/ ? # %and whitespace are percent-encoded.ParameterErrorwhen a list or member address is missing.docs/MailingLists.md, linked from the README.Testing
All 14 operations are covered by VCR integration specs; there are no unit specs.
mailing_listandlist_memberscassettes (9 operations).mailing_listsspec, recorded against the live API, coverslist_pages,list_members,list_members_pages,create_membersandimport_members. It also checks a member address with a+and thatvarssent as a Hash come back as a Hash.create_membersworks withmemberssent as a form field, as Mailgun's guides do (the OpenAPI spec lists it as a query parameter).X-Mailgun-Key-Idheader value is replaced with a placeholder as well.