Coder Social home page Coder Social logo

bronto-ruby's Introduction

Bronto

This is a handy library that wraps the Bronto SOAP API.

Installation

Add this line to your application's Gemfile:

gem 'bronto'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bronto

Usage

Let's setup some contacts, add them to a list, and then send them a message.

  1. Require the library and specify the API Key on the Base class:

    require 'bronto'
    Bronto::Base.api_key = "..."
    
  2. Create two contacts:

    contact_1 = Bronto::Contact.new(email: "[email protected]")
    contact_2 = Bronto::Contact.new(email: "[email protected]")
    
    puts contact_1.id
    # => nil
    
    puts contact_2.id
    # => nil
    
    # You can save multiple objects with one API call using the class `save` method.
    Bronto::Contact.save(contact_1, contact_2)
    
    # Both contacts should now have ids.
    puts contact_1.id
    # => "32da24c..."
    
    puts contact_2.id
    # => "98cd453..."
    
  3. Create a list and the contacts:

    list = Bronto::List.new(name: "A Test List", label: "This is a test list.")
    list.save
    
    list.add_to_list(contact_1, contact_2)
    
  4. Create a new message and add content:

    message = Bronto::Message.new(name: "Test Message")
    message.add_content("html", "HTML Subject", "HTML Content")
    message.add_content("text", "Text Subject", "Text Content")
    message.save
    
  5. Create a new delivery with a message and recipients and send it ASAP:

    delivery = Bronto::Delivery.new(start: Time.now, type: "normal", from_name: "Test", from_email: "[email protected]")
    delivery.message_id = message.id
    delivery.add_recipient(list)
    delivery.save
    

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

bronto-ruby's People

Contributors

martingordon avatar thede avatar jordan-brough avatar fantgeass avatar ponny avatar pospischil avatar awwafe avatar urimikhli avatar athal7 avatar rnhurt avatar dkoslow avatar

Watchers

Stuart McKeown avatar  avatar Volodymyr Myskov avatar Tran Ngoc Sam avatar Ruslan avatar  avatar James Cloos avatar Nikola_Balent avatar Sergey Chernyakov avatar Nigel Sheridan-Smith avatar Sergei Smagin avatar André Oliveira avatar João Saraiva avatar Maxim Davydov avatar Nikita Skazki avatar  avatar Artur avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.