Library that implements the Apsis API in Ruby in regards to administrating subscribers and such for newsletters.
aos = ApsisOnSteroids.new(
api_key: "[your api key]"
)
aos.mailing_lists
aos.create_mailing_list(
Name: "my_awesome_list",
FromName: "Kasper Johansen",
FromEmail: "[email protected]",
CharacterSet: "utf-8"
)
mlist = aos.mailing_list_by_name("test_list")
mlist.delete
sub = mlist.subscriber_by_email("[email protected]")
sub = aos.subscriber_by_email("[email protected]")
mlist.create_subscribers(
[
{
Email: "[email protected]",
Name: "Some Name"
},{
Email: "[email protected]",
Name: "Some Name"
}
]
)
mlist.count_subscribers #=> 105
puts "Details: #{sub.details}"
sub.update(Email: "[email protected]")
mlist.remove_subscriber(sub)
list = mlist.subscribers
list.each do |sub|
# do something
end
aos.subscribers do |sub|
# do something
end
Bundle various field names in same request (which means they are already preloaded and won't cause an extra request each time you ask for the fields)
aos.subscribers(field_names: ["MyData1", "MyData2"]) do |sub|
# do something
end
aos.subscribers(all_demographics: true) do |sub|
# do something
end
date_from = Date.new(2014, 6, 17)
date_to = Date.new(2014, 6, 24)
sendings = apsis.sendings_by_date_interval(@date_from, @date_to).to_a
sendings.opens(count: true) #=> 5
sendings.bounces(count: true) #=> 1
sendings.clicks(count: true) #=> 3
sendings.opt_outs(count: true) #=> 1
sendings.clicks.each do |click|
puts "ClickData: #{click.data_hash}"
end
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
- Fork the project.
- Start a feature/bugfix branch.
- Commit and push until you are happy with your contribution.
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright (c) 2013 kaspernj. See LICENSE.txt for further details.