For more information about MailerLite API, please visit the following link:
API keys are a quick way to implement machine-to-machine authentication without any direct inputs from a human beyond initial setup.
For more information how to obtain an API key visit the following link
- MailerLite Ruby SDK
- Getting started
- Table of Contents
- Installation
- Usage
- Subscribers
- Groups
- Segments
- Fields
- Automations
- Campaigns
- Emails
- Get an email
- Get the HTML of an email
- Get a block
- Insert a block
- Update a block
- Delete a block
- Move a block
- Validate a block
- Update the design settings
- Validate the design settings
- Save an email as a template
- List the versions of an email
- Save a version of an email
- Restore a version of an email
- Retry a write with an idempotency key
- Brand styles
- Files
- Forms
- Batching
- Webhooks
- Timezones
- Campaign languages
- E-commerce
gem install mailerlite-rubyYou will have to initalize it in your Ruby file with require "mailerlite-ruby".
This SDK requires that you have the MAILERLITE_API_TOKEN environment variable set. You can set this variable in a .env file or enable it system-wide (useful for Docker/Kubernetes). The example of how MAILERLITE_API_TOKEN should look like is in .env.example.
If you want to use dotenv to manage your environment variables, you can configure the mailerlite gem to load dotenv:
MailerLite.configure do |config|
config.use_dotenv = true
endrequire "mailerlite-ruby"
# Intialize the class
subscribers = MailerLite::Subscribers.new
subscribers.fetch(filter: { status: 'active' }, cursor: 'cursor')require "mailerlite-ruby"
# Intialize the class
subscribers = MailerLite::Subscribers.new
subscribers.create(email:'some@email.com', fields: {'name': 'John', 'last_name': 'Doe'}, ip_address:'1.2.3.4', optin_ip:'1.2.3.4')require "mailerlite-ruby"
# Intialize the class
subscribers = MailerLite::Subscribers.new
subscribers.update('some@email.com', fields: {'name': 'John', 'last_name': 'Doe'}, ip_address:'1.2.3.4', optin_ip:'1.2.3.4')require "mailerlite-ruby"
# Intialize the class
subscribers = MailerLite::Subscribers.new
subscribers.get('some@email.com')require "mailerlite-ruby"
# Intialize the class
subscribers = MailerLite::Subscribers.new
subscriber_id = 1234567890
subscribers.delete(subscriber_id)require "mailerlite-ruby"
# Intialize the class
groups = MailerLite::Groups.new
groups.get(limit:10, page:1, filter:{'name': 'My'}, sort:'name')require "mailerlite-ruby"
# Intialize the class
groups = MailerLite::Groups.new
groups.create(name:'Group Name')require "mailerlite-ruby"
# Intialize the class
groups = MailerLite::Groups.new
groups.update(group_id:1234567, name:'My New Group')require "mailerlite-ruby"
# Intialize the class
groups = MailerLite::Groups.new
group_id = 1234567
groups.delete(group_id)require "mailerlite-ruby"
# Initialize the class
groups = MailerLite::Groups.new
groups.get_subscribers(group_id: 1234567, cursor: 'cursor', limit: 10, filter: { 'status': 'active' })require "mailerlite-ruby"
# Intialize the class
groups = MailerLite::Groups.new
groups.assign_subscriber(subscriber:111222, group_id:1234567)require "mailerlite-ruby"
# Intialize the class
groups = MailerLite::Groups.new
groups.unassign_subscriber(subscriber:111222, group_id:1234567)require "mailerlite-ruby"
# Intialize the class
segments = MailerLite::Segments.new
segments.list(limit:10, page:1)require "mailerlite-ruby"
# Intialize the class
segments = MailerLite::Segments.new
segments.update(segment_id: 123456, name:'My New Segment Name')require "mailerlite-ruby"
# Intialize the class
segments = MailerLite::Segments.new
segment_id = 123456
segments.delete(segment_id)require "mailerlite-ruby"
# Intialize the class
segments = MailerLite::Segments.new
segments.get_subscribers(segment_id:123456, limit:10, filter:{'status': 'active'})require "mailerlite-ruby"
# Intialize the class
fields = MailerLite::Fields.new
fields.get(limit:10, page:1, sort:'name', filter:{'keyword': 'abc', 'type': 'text'})require "mailerlite-ruby"
# Intialize the class
fields = MailerLite::Fields.new
fields.create(name:'My Field', type:'text')require "mailerlite-ruby"
# Intialize the class
fields = MailerLite::Fields.new
fields.update(field_id:123345, name:'My New Field')require "mailerlite-ruby"
# Intialize the class
fields = MailerLite::Fields.new
field_id = 123456
fields.delete(field_id)require "mailerlite-ruby"
# Intialize the class
automations = MailerLite::Automations.new
automations.get(limit:10, page:1, filter:{'status': true, 'name': 'some name', 'group': 123456})require "mailerlite-ruby"
# Intialize the class
automations = MailerLite::Automations.new
automation_id = 123456
automations.fetch(automation_id)require "mailerlite-ruby"
# Intialize the class
automations = MailerLite::Automations.new
automations.get_subscriber_activity(automation_id:123456, page:1, limit:10, filter:{'status': 'active', 'date_from': '2022-12-20', 'date_to': '2022-12-31'})require "mailerlite-ruby"
# Intialize the class
campaigns = MailerLite::Campaigns.new
campaigns.get(limit:10, page:1, filter:{'status': 'ready', 'type': 'regular'})require "mailerlite-ruby"
# Intialize the class
campaigns = MailerLite::Campaigns.new
campaigns.fetch(campaign_id:123456)require "mailerlite-ruby"
# Intialize the class
campaigns = MailerLite::Campaigns.new
campaigns.create(
name: "Test Campaign",
language_id: 1,
type: "regular",
emails: [{
"subject": "This is a test campaign",
"from_name": "Test Man",
"from": "testuser@mailerlite.com",
"content": "Hi there, this is a test campaign!"
}]
)To build the email with the simple editor, set editor to MailerLite::Campaigns::EDITOR_SIMPLE, and do not send content. Then edit the email with the email methods.
template_idis optional. It is the simple editor template that the email starts from: a template from the shared gallery, or a template that you saved from your own email withcreate_template(theidin its response). It needseditor. Without it, the email starts from the default blank template. The API copies the template into the new email and does not change the template.- All emails of a campaign must have the same
editorandtemplate_id. - Only
createacceptseditorandtemplate_id.updatedoes not.
require "mailerlite-ruby"
# Initialize the class
campaigns = MailerLite::Campaigns.new
response = campaigns.create(
name: "Test Campaign",
type: "regular",
emails: [{
subject: "This is a test campaign",
from_name: "Test Man",
from: "testuser@mailerlite.com",
editor: MailerLite::Campaigns::EDITOR_SIMPLE
}]
)
email_id = JSON.parse(response.body)['data']['emails'][0]['id']require "mailerlite-ruby"
# Intialize the class
campaigns = MailerLite::Campaigns.new
campaigns.update(
campaign_id: 1233455,
name: "New Campaign Name",
language_id: 2,
emails: [{
"subject": "This is a test campaign",
"from_name": "Test Man",
"from": "testuser@mailerlite.com",
"content": "Hi there, this is a test campaign!"
}]
)require "mailerlite-ruby"
# Intialize the class
campaigns = MailerLite::Campaigns.new
campaigns.schedule(
campaign_id: 123456,
delivery: "scheduled",
schedule: {
"date": "2022-12-31",
"hours": "22",
"minutes": "00"
}
)require "mailerlite-ruby"
# Intialize the class
campaigns = MailerLite::Campaigns.new
campaign_id = 123456
campaigns.cancel(campaign_id)require "mailerlite-ruby"
# Intialize the class
campaigns = MailerLite::Campaigns.new
campaign_id = 123456
campaigns.delete(campaign_id)require "mailerlite-ruby"
# Intialize the class
campaigns = MailerLite::Campaigns.new
campaign_id = 123456
campaigns.activity(campaign_id)These methods edit emails built with the simple editor. To create such an email, create a campaign with the simple editor. The ID of the email is in data.emails[0].id of the response.
- IDs are strings of digits. You can also give them as integers. An empty ID raises
MailerLite::EmptyIdError, and an ID that does not contain only digits raisesMailerLite::InvalidIdError. The SDK sends no request in these cases. - The SDK checks only the IDs in the URL path, and the settings of
update_settings: they must be a Hash without anetagkey. The SDK sends all other values as you give them, and the API checks them. For a value that is not valid, the API returns422with theerrorsfor each field. - The methods return an
HTTP::Response, like the other methods. Useresponse.codefor the status code,response.headersfor the headers andJSON.parse(response.body)for the body. - The methods do not raise an error for a
4xxor5xxstatus.response.api_errorisnilfor a2xxstatus. For other statuses, it is aMailerLite::ApiErrorwithstatus,code,etag,api_messageanderrors. You can raise it. - Each write needs the etag from the last response for the email, and returns a new etag. The etag covers the whole email, so send the writes to one email one after another.
- If the email changed after you read it, the write returns
409, andresponse.api_error.codeisMailerLite::Emails::VERSION_CONFLICT. Thenresponse.api_error.etagis the current etag. Get the email again, and then send the write again with the current etag. - The keys of
editor_contentare camelCase, for exampletextAlign. The SDK sends them as you give them.
Returns the email with its settings and blocks, and the etag of the email.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.get('123456')
body = JSON.parse(response.body)
email = body['data']
etag = body['etag']Returns the HTML that the email sends. The API can return a temporary 503 error. If it does, try again later.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.get_html('123456')
html = JSON.parse(response.body)['data']['html'] if response.code == 200Returns the block and its place in the email: placement has the IDs of the blocks after and before it, or nil.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.get_block(email_id: '123456', block_id: '57')
block = JSON.parse(response.body)['data']Use the block types in MailerLite::Emails::BlockType. editor_content can be empty. Without placement, the API puts the block at the end of the email. The positions are in MailerLite::Emails::BlockPosition. The BEFORE and AFTER positions also need a block_id. The SDK sends placement as you give it.
The API drops the attributes and the mobile keys that the block type does not declare, and the write still succeeds. Then the response has rejected with a message and the keys that the API dropped, for example editor_content.attrs.onclick. When the API drops nothing, the response has no rejected.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
email_id = '123456'
etag = JSON.parse(emails.get(email_id).body)['etag']
response = emails.create_block(
email_id: email_id,
etag: etag,
type: MailerLite::Emails::BlockType::PARAGRAPH,
editor_content: { attrs: { textAlign: 'left' }, content: [{ type: 'text', text: 'Hello' }] },
placement: { position: MailerLite::Emails::BlockPosition::AT_START }
)
body = JSON.parse(response.body)
block_id = body['data']['id']
etag = body['etag']
puts body['rejected']['keys'] if body['rejected']The new editor_content replaces the whole content of the block. The API removes the keys that you do not send.
The API drops the attributes and the mobile keys that the block type does not declare, and the write still succeeds. Then the response has rejected with a message and the keys that the API dropped, for example editor_content.mobile.onclick. When the API drops nothing, the response has no rejected.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.update_block(
email_id: '123456',
block_id: '57',
etag: 'etag-from-the-last-response',
editor_content: { attrs: { textAlign: 'center' }, content: [{ type: 'text', text: 'Hello again' }] }
)
body = JSON.parse(response.body)
etag = body['etag']
puts body['rejected']['keys'] if body['rejected']Also deletes the blocks in it. The response has only the new etag.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.delete_block(email_id: '123456', block_id: '57', etag: 'etag-from-the-last-response')
etag = JSON.parse(response.body)['etag']The BEFORE and AFTER positions also need a block_id. The SDK sends placement as you give it.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.move_block(
email_id: '123456',
block_id: '57',
etag: 'etag-from-the-last-response',
placement: { position: MailerLite::Emails::BlockPosition::AFTER, block_id: '12' }
)
etag = JSON.parse(response.body)['etag']Checks a block before you insert it. It needs no email and no etag. An invalid block is not an error: the response has valid set to false and the errors for each field.
If a valid block has attributes or mobile keys that the block type does not declare, the response has rejected with a message and these keys. Insert and update drop these keys. When valid is false, the response has no rejected.
The block in this example is not valid, because sideways is not a valid textAlign. The response has valid: false and errors.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.validate_block(
type: MailerLite::Emails::BlockType::PARAGRAPH,
editor_content: { attrs: { textAlign: 'sideways' } }
)
body = JSON.parse(response.body)
puts body['errors'] unless body['valid']Send only the keys to change, in the shape of settings in the email. The groups are brand, layout, typography, button and footer.
- The SDK sends exactly the keys of the Hash. A key that is not in the Hash does not change.
- To unset a brand colour, send an empty string. The API stores the value empty, and the email then uses the account value.
- To unset a footer text, send an empty editor document:
{ editor_content: {} }or{ editor_content: { content: [] } }. - Other colours, sizes,
button.border_radiusandbrand.stylecannot be empty. An empty string gives a422error. - Send all style values as strings, for example
'16'and not16. - The API stores each value that you send, also a value that the email inherits from your account. Then the email no longer follows your account for that value.
footer.social_linksreplaces the whole list. Keep thelink_idof each link to keep its click history.brand.modeis one ofMailerLite::Emails::BrandMode. To apply a preset palette, send itsidentifierfrom the brand styles inbrand.style.- Do not put
etagin the settings. Use theetagargument. - If the API removed unsafe values, the response has
rejectedwith the keys of these values.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.update_settings(
email_id: '123456',
etag: 'etag-from-the-last-response',
settings: {
brand: { mode: MailerLite::Emails::BrandMode::CUSTOM, background_color: '#f4f4f4' },
typography: { paragraph: { p1: { size: '18' } } }
}
)
body = JSON.parse(response.body)
etag = body['etag']
puts body['rejected']['keys'] if body['rejected']Checks a change with the rules of the update, and saves nothing. It needs no etag. Invalid settings are not an error: the response has valid set to false and the errors for each field.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.validate_settings(email_id: '123456', settings: { button: { border_radius: '8' } })
body = JSON.parse(response.body)
puts body['errors'] unless body['valid']Copies the email to a new template. The API cannot delete templates.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.create_template(email_id: '123456', name: 'Monthly newsletter')
template_id = JSON.parse(response.body)['data']['id']A version is a saved copy of the content and the settings of an email. The list starts with the newest version. current marks the version that the email has now.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.list_versions('123456', page: 1, limit: 10)
versions = JSON.parse(response.body)['data']Writes through the API do not save versions. If nothing changed after the last version, the API saves no new version and returns the last version. response.code is 201 for a new version and 200 for the last version.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.create_version('123456')
version_id = JSON.parse(response.body)['data']['id']
is_new = response.code == 201Puts the email back to the version, and returns the full email with the new etag. Before the restore, the API saves the current state as a version, so you can undo the restore.
require "mailerlite-ruby"
# Initialize the class
emails = MailerLite::Emails.new
response = emails.restore_version(email_id: '123456', version_id: '901', etag: 'etag-from-the-last-response')
etag = JSON.parse(response.body)['etag']If a write fails with a network error, you do not know if the API did the write. Give the write an idempotency_key, and send it again with the same key and the same arguments. If the first request was a success, the API returns the stored response and does not do the write two times. Then response.idempotent_replay? is true.
- Use a new key for each write. The API keeps a key for 24 hours.
- The key must be 1 to 255 printable ASCII characters. The SDK sends the key as you give it. For a key that is not valid, the API returns
400. - The same key with different arguments returns
422. If the first request is still running, the API returns409without acode. - These methods accept a key:
create_block,update_block,delete_block,move_block,update_settings,create_template,create_versionandrestore_version.
require "mailerlite-ruby"
require "securerandom"
# Initialize the class
emails = MailerLite::Emails.new
args = {
email_id: '123456',
etag: 'etag-from-the-last-response',
type: MailerLite::Emails::BlockType::DIVIDER,
editor_content: {},
idempotency_key: SecureRandom.uuid
}
begin
response = emails.create_block(**args)
rescue HTTP::ConnectionError, HTTP::TimeoutError
# Network error: send the write again with the same key and the same arguments.
response = emails.create_block(**args)
end
error = response.api_error
raise error if error
puts JSON.parse(response.body)['data']['id'], response.idempotent_replay?Returns the palettes of your account: brand (your brand styles, or nil if your account has none), default and the presets. Match a palette on its identifier, not on its name. To apply a preset to an email, update the design settings with { brand: { style: identifier } }.
require "mailerlite-ruby"
# Initialize the class
brand_styles = MailerLite::BrandStyles.new
response = brand_styles.get
identifiers = JSON.parse(response.body)['data']['presets'].map { |preset| preset['identifier'] }Returns the files of your media library. Use their url in image blocks. width and height are nil for files that are not images.
filter:name(a part of the file name) andtype(one ofMailerLite::Files::FileType).sort: one ofMailerLite::Files::FileSort. The default is newest first.- The SDK does not send
nilvalues.
require "mailerlite-ruby"
# Initialize the class
files = MailerLite::Files.new
response = files.list(
filter: { name: 'summer sale', type: MailerLite::Files::FileType::IMAGE },
sort: MailerLite::Files::FileSort::SIZE_DESC,
page: 1,
limit: 25
)
urls = JSON.parse(response.body)['data'].map { |file| file['url'] }require "mailerlite-ruby"
# Intialize the class
forms = MailerLite::Forms.new
forms.list(limit:10, page:1, sort:'name', filter:{'name': 'form name'})require "mailerlite-ruby"
# Intialize the class
forms = MailerLite::Forms.new
form_id = 123456
forms.fetch(form_id)require "mailerlite-ruby"
# Intialize the class
forms = MailerLite::Forms.new
forms.update(form_id:123456, name: 'My form Name')require "mailerlite-ruby"
# Intialize the class
forms = MailerLite::Forms.new
form_id = 123456
forms.delete(form_id)require "mailerlite-ruby"
# Intialize the class
forms = MailerLite::Forms.new
forms.fetch_subscribers(form_id:123345, page:1, limit:10, filter:{'status': 'active'})require "mailerlite-ruby"
# Intialize the class
batch = MailerLite::Batch.new
batch.request(
requests: [
{ method: 'GET', path: 'api/subscribers/list' },
{ method: 'GET', path: 'api/campaigns/list' }
]
)require "mailerlite-ruby"
# Intialize the class
subscribers = MailerLite::Subscribers.new
webhooks.list()require "mailerlite-ruby"
# Intialize the class
subscribers = MailerLite::Subscribers.new
webhook_id = 123456
webhooks.get(webhook_id)require "mailerlite-ruby"
# Intialize the class
webhooks = MailerLite::Webhooks.new
webhooks.create(
events:[
'subscriber.created',
'subscriber.updated',
'subscriber.unsubscribed'
],
url:'https://my-url.com',
name: 'Webhook name'
)require "mailerlite-ruby"
# Intialize the class
webhooks = MailerLite::Webhooks.new
webhooks.update(
webhook_id: 123456,
events:[
'subscriber.created',
'subscriber.updated',
'subscriber.unsubscribed'
],
url:'https://my-url.com',
name: 'Webhook name',
enabled: false
)require "mailerlite-ruby"
# Intialize the class
webhooks = MailerLite::Webhooks.new
webhook_id = 123456
webhooks.delete(webhook_id)require "mailerlite-ruby"
# Intialize the class
timezones = MailerLite::Timezones.new
timezones.list()require "mailerlite-ruby"
# Intialize the class
campaigns = MailerLite::Campaigns.new
campaigns.languages()require "mailerlite-ruby"
shops = MailerLite::Ecommerce::Shops.new
shops.list(limit: 25)
shops.get('shop_id')
shops.create({ name: 'My shop', url: 'https://shop.example.com', currency: 'EUR' })
shops.update(shop_id: 'shop_id', params: { name: 'New name' })
shops.delete('shop_id')products = MailerLite::Ecommerce::Products.new
products.list(shop_id: 'shop_id', filter: { enabled: true }, sort: '-created_at')
products.get(shop_id: 'shop_id', product_id: 'product_id')
products.create(shop_id: 'shop_id', params: { name: 'Red T-shirt', price: 19.99 })
products.update(shop_id: 'shop_id', product_id: 'product_id', params: { price: 24.99 })
products.delete(shop_id: 'shop_id', product_id: 'product_id')
products.change_status(shop_id: 'shop_id', product_id: 'product_id', enabled: false)
products.assign_categories(shop_id: 'shop_id', product_id: 'product_id', category_ids: ['category_id'], replace: true)
variants = MailerLite::Ecommerce::ProductVariants.new
variants.list(shop_id: 'shop_id', product_id: 'product_id')
variants.sync(shop_id: 'shop_id', product_id: 'product_id', variants: [{ name: 'Large', attributes: { size: 'L' }, resource_id: 'variant-l' }])
variants.update(shop_id: 'shop_id', product_id: 'product_id', variant_id: 'variant_id', params: { name: 'Extra large', attributes: { size: 'XL' } })
variants.delete(shop_id: 'shop_id', product_id: 'product_id', variant_id: 'variant_id')categories = MailerLite::Ecommerce::Categories.new
categories.list(shop_id: 'shop_id')
categories.get(shop_id: 'shop_id', category_id: 'category_id')
categories.create(shop_id: 'shop_id', params: { name: 'Hats' })
categories.update(shop_id: 'shop_id', category_id: 'category_id', params: { name: 'Caps' })
categories.delete(shop_id: 'shop_id', category_id: 'category_id')
categories.products(shop_id: 'shop_id', category_id: 'category_id')
categories.assign_product(shop_id: 'shop_id', category_id: 'category_id', product_id: 'product_id')
categories.unassign_product(shop_id: 'shop_id', category_id: 'category_id', product_id: 'product_id')customers = MailerLite::Ecommerce::Customers.new
customers.list(shop_id: 'shop_id', filter: { email: 'customer@example.com' })
customers.create(shop_id: 'shop_id', params: { email: 'customer@example.com', create_subscriber: true })
customers.update(shop_id: 'shop_id', customer_id: 'customer_id', params: { name: 'Jane' })
customers.delete(shop_id: 'shop_id', customer_id: 'customer_id')
orders = MailerLite::Ecommerce::Orders.new
orders.list(shop_id: 'shop_id', filter: { attributed: true, email_id: 'email_id' })
orders.create(shop_id: 'shop_id', params: {
customer: { email: 'customer@example.com' },
cart: { items: [{ ecommerce_product_id: 'product_id', quantity: 1, price: 19.99 }] },
status: 'complete'
})
orders.update(shop_id: 'shop_id', order_id: 'order_id', params: { status: 'complete' })
orders.delete(shop_id: 'shop_id', order_id: 'order_id')
carts = MailerLite::Ecommerce::Carts.new
carts.list(shop_id: 'shop_id')
carts.update(shop_id: 'shop_id', cart_id: 'cart_id', params: { checkout_url: 'https://shop.example.com/cart' })
cart_items = MailerLite::Ecommerce::CartItems.new
cart_items.list(shop_id: 'shop_id', cart_id: 'cart_id')
cart_items.update(shop_id: 'shop_id', cart_id: 'cart_id', item_id: 'item_id', params: { quantity: 2 })
cart_items.delete(shop_id: 'shop_id', cart_id: 'cart_id', item_id: 'item_id')imports = MailerLite::Ecommerce::Imports.new
imports.products(shop_id: 'shop_id', products: [{ name: 'Red T-shirt', price: 19.99 }])
imports.categories(shop_id: 'shop_id', categories: [{ name: 'Hats' }])
imports.customers(shop_id: 'shop_id', customers: [{ email: 'customer@example.com' }])MailerLite::Ecommerce::Shops.new.stats(shop_id: 'shop_id', start_date: '2026-10-01', end_date: '2026-10-31')
campaigns = MailerLite::Campaigns.new
campaigns.ecommerce_stats(campaign_id: 'campaign_id', shop_id: 'shop_id')
campaigns.ecommerce_orders(campaign_id: 'campaign_id', shop_id: 'shop_id')
subscribers = MailerLite::Subscribers.new
subscribers.ecommerce_stats(subscriber_id: 'subscriber_id', shop_id: 'shop_id')
subscribers.ecommerce_orders(subscriber_id: 'subscriber_id', shop_id: 'shop_id')
automations = MailerLite::Automations.new
automations.ecommerce_stats(automation_id: 'automation_id')
automations.email_ecommerce_stats(automation_id: 'automation_id', email_id: 'email_id')
automations.ecommerce_orders(automation_id: 'automation_id', time_frame: 'all_time')
MailerLite::Ecommerce::Settings.new.getbundle i
bundle exec rspec spec/*rspec.rbTo run tests you would need to install gems using bundle and then run rspec via bundle to run all tests. The fixtures for the test have been recorded using vcr and are available in the ./fixtures directory
bundle i
bundle exec yardoc 'lib/**/*.rb'This will generate html docs in the doc directory which can be opened up in any browser. Navigate to index.html and open it up.
