Project

office_boy

0.0
No release in over 3 years
Low commit activity in last 3 years
Wrapper for the Sendgrid API addressed to the technical bloggers
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.7, >= 3.7.0

Runtime

 Project Readme

Office Boy

Start with creating config/initializers/office_boy.rb initializer:

OfficeBoy.configure do |config|
  config.sendgrid_api_key = 'api_key'

  # Contact lists
  config.lists = {
    blog_subscribers: '38bbd55-4ac9-31'
  }

  # Transactional templates
  config.templates = {
    welcome_subscriber: 'd-6955c2836821d0'
  }
end

Adding subscribers

contact_attributes = {
  'first_name' => 'John',
  'last_name' => 'Doe',
  'email' => 'johndoe@somedomain.com'
}

OfficeBoy.add_subscriber(
  list: :blog_subscribers,
  attributes: contact_attributes
)

Removing subscribers

OfficeBoy.remove_subscriber(
  list: :blog_subscribers,
  email: 'johndoe@somedomain.com'
)

Sending e-mails

OfficeBoy.deliver(
  template: :welcome_subscriber,
  attributes: {
    from_email: 'your email',
    from_name: 'your name',
    to_email: 'johndoe@somedomain.com',
    to_name: 'John Doe',
    subject: 'Welcome on my list!',
    dynamic_template_data: {
      first_name: 'John'
    }
  }
)