Coder Social home page Coder Social logo

transporter's Introduction

Transporter

Deliver packages in multiple ways simultaneously (email, jabber, campfire, irc, etc.)

API

require "transporter"

module Transporter
  class Email < Service
    validate_config do |config|
      config.has_keys      :from, :to, :host, :user, :password, :port, :auth
      config.key_is_one_of :auth, %w(plain auth some other)
      [:to, :from].each do |key|
        config.key_matches key,   /--some complicated email regexp--/
      end
    end

    def deliver(message)
      # Send your email
      #
      # In this method you have available `message.short` (usable for short
      # messages such as twitter, or email subjects) and `message.full`
      # usable for longer chunks of text, as an email body.
      #
      # And you have access to `config`, where all your pre-validated config
      # values live (including default values set on the class, this hash is
      # a merged representations of te two.
    end
  end

  register :email, Email
end

How to use

You probably want one of the child projects of this one, where the different implementations provide you with specific implementations. However, the way to use this is as follows:

Transporter.deliver(
  :message => {
    :short => "cuack!",
    :full => "double cuack" 
  },
  :using => {
    :email => {
      :to => "...", :from => "...", ...
    },
    :jabber => {
      :to => "...", :from => "...", ...
    }
  }

Where each key of the ‘:using` hash depends on what implementations you loaded. (`Transporter::Email`, `Transporter::Jabber`, etc). Refer to their specific documentations for the full list of configuration values in each.

The ‘:short` message is used in messages like twitter, IM, or as an email subject. The `:full` message is used

List of implementations

  • Example

transporter's People

Contributors

foca avatar

Stargazers

 avatar  avatar Nikhil Murthy avatar kazuyoshi tlacaelel avatar Pedro Visintin avatar Karel Minarik avatar  avatar Cristi Balan avatar Simon Rozet avatar Chris Wanstrath avatar

Watchers

James Cloos 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.