A Ruby gem for interacting with the MailUp REST API.
Install the gem directly:
geminstallmailupOr, add this line to your application's Gemfile:
gem'mailup'Be sure that you have OAuth2 tokens for the MailUp REST API before using this gem. If you are using Omniauth, there is a MailUp strategy available.
Once you've gone through the OAuth process, and you have obtained your tokens, you need to provide your client_id, client_secret and OAuth2 tokens in a credentials hash to get started.
require'mailup'credentials={client_id: ENV['MAILUP_CLIENT_ID'],client_secret: ENV['MAILUP_CLIENT_SECRET'],oauth: {token: "...",refresh_token: "...",expires_at: 1234567890}}mailup=MailUp::API.new(credentials)Check out the console methods API documentation for more information.
lists=mailup.console.user.listslists['Items'].first['Name']# => "Test List"list_id=lists['Items'].first['idList'].to_i# => 1list=mailup.console.list(list_id)groups=list.groups(pageNumber: 1,pageSize: 25)groups['IsPaginated']# => truegroups['PageNumber']# => 1groups['PageSize']# => 25groups['Skipped']# => 25groups['TotalElementsCount']# => 35groups['Items'].size# => 10Check out the email statistics API documentation for more information.
views_count=mailup.stats.message(17).views_count# => 250fields=mailup.stats.recipient(5).fields# => {"IsPaginated"=>true, "Items"=>[{"Description"=>"AllOrderedProductIDs", "Id"=>26}, ...], ...}