First create a client instance:
client = Mailtrain.new "https://xxxx.your.mailtrain.url", "your_access_token"
Then you can subscribe or unsubscribe from a list:
> client.subscribe list_id, "[email protected]", "My First Name", "My Last Name", "UTC", false, true
=> true
> client.unsubscribe list_id, "[email protected]"
=> false
> client.error
=> Invalid email address
subscribe required: list_id, email optional: first_name, last_name, timezone(default UTC), force_subscribe(default false), require_confirmation(default true)
unsubscribe required: list_id, email
To get blacklist:
> client.blacklist 0, 10000, "[email protected]"
=> {:total=>2, :start=>0, :limit=>10000, :emails=>["demo@demo", "test@test"]}
To get active subscriber count of a list:
> client.block email
=> true
> client.unblock email
=> true