Yonoma Ruby Email Marketing SDK
Welcome to the Yonoma Ruby SDK! This gem provides a simple and efficient way to integrate with the Yonoma Email Marketing API.
Installation
Add this line to your application's Gemfile:
gem 'yonoma'Then execute:
bundle installOr install it yourself as:
gem install yonomaConfiguration
To configure the SDK, initialize it with your API key:
require 'yonoma'
Yonoma.api_key = 'api_key'Usage
Send your email:
response_email = Yonoma::Email.send({
"from_email":"updates@yonoma.io",
"to_email":"email@yourdomain.com",
"subject":"Welcome to Yonoma - You're In!",
"mail_template": "We're excited to welcome you to Yonoma! Your successful signup marks the beginning of what we hope will be an exceptional journey."
})
puts response_emailManaging Contacts
Create a Contact
response_contact = Yonoma::Contacts.create("List Id", {
"email" : "email@example.com",
"status": "Subscribed" | "Unsubscribed"
"firstName": string, //optional
"lastName": string, //optional
"phone": string, //optional
"gender": string, //optional
"address": string, //optional
"city": string, //optional
"state": string, //optional
"country": string, //optional
"zipcode": string, //optional
})
puts response_contactUnsubscribe a Contact
response_contact = Yonoma::Contacts.unsubscribe("List Id", "Contact Id", {
"status" : "Subscribed" | "Unsubscribed"
})
puts response_contactAdd a Tag to a Contact
response_add_tag = Yonoma::Contacts.addTag("Contact Id", {
"tag_id" : "Tag Id"
})
puts response_add_tagRemove a Tag from a Contact
response_remove_tag = Yonoma::Contacts.removeTag("Contact Id", {
"tag_id" : "Tag Id"
})
puts response_remove_tagManaging Tags
Create a Tag
response_add_tag = Yonoma::Tags.create({
"tag_name" : "Tag Name"
})
puts response_add_tagUpdate a Tag
response_update_tag = Yonoma::Tags.update("Tag Id", {
"tag_name" : "Tag Name"
})
puts response_update_tagDelete a Tag
response_del_tag = Yonoma::Tags.delete("Tag Id")
puts response_del_tagRetrieve a Specific Tag
response_tags_retrieve = Yonoma::Tags.retrieve("Tag Id")
puts response_tags_retrieveList All Tags
response_tags = Yonoma::Tags.list()
puts response_tagsManaging Lists
Create a List
response_add_list = Yonoma::Lists.create({
"list_name" : "List Name"
})
puts response_add_listUpdate a List
response_update_list = Yonoma::Lists.update("List Id", {
"list_name" : "List Name"
})
puts response_update_listDelete a List
response_del_list = Yonoma::Lists.delete("List Id")
puts response_del_listRetrieve a Specific List
response_list_retrieve = Yonoma::Lists.retrieve("List Id")
puts response_list_retrieveList All Lists
response_list = Yonoma::Lists.list()
puts response_list