/mailjetter

A Mailjet ruby library

Primary LanguageRubyMIT LicenseMIT

mailjetter

Access Mailjet API from ruby with mailjetter

Installation

Add mailjetter in your Gemfile

gem 'mailjetter', :git => 'git://github.com/holinnn/mailjetter.git'

Configuration (optional)

Mailjetter.configure do |config|
  config.use_https = true
  config.api_key = 'Your api key'
  config.secret_key = 'Your secret key'
end

Usage

api = Mailjetter::Api.new
api.user_infos
=> {"infos"=>{"username"=>"", "firstname"=>"", "lastname"=>"", "company_name"=>"", "locale"=>"fr_FR", "contact_phone"=>nil}}
api.lists_contacts(:id => 639)
=> {"status"=>"OK", "total_cnt"=>"1", "result"=>[{"id"=>"8225160", "last_activity"=>"0", "sent"=>"0", "email"=>"user@host.com"}]}

Or (if not configured)

api = Mailjetter::Api.new('Your api key', 'Your secret key')
api.user_infos
=> {"infos"=>{"username"=>"", "firstname"=>"", "lastname"=>"", "company_name"=>"", "locale"=>"fr_FR", "contact_phone"=>nil}}

It tries to guess the HTTP method to use based on the name of the method you call, if you want to force the request type just add it after the parameters :

api.lists_contacts({:id => 639}, 'Get')

Copyright © 2011 Holinnn. See LICENSE.txt for further details.