Sha256: f4e03a836fa4e272aa95a13f087be465d32ba558c8291b79c8a0d6e59f2e7f0c

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

# Mailstro Client for Ruby

TODO: Write a gem description

## Installation

1.  Add the `mailstro` gem to your `Gemfile`

    ```ruby
    gem "mailstro"
    ```

2.  Install the gem

    ```shell
    bundle install
    ```

3.  Configure the mailstro module with your API key.

    In rails apps, put this code to a new file at `config/initializers/mailstro.rb`

    ```ruby
    require 'mailstro'

    Mailstro.configure do |config|
      config.api_key = "YOUR_API_KEY_HERE"
    end
    ```

## Usage

Sending a basic email.

```ruby
Mailstro.deliver(
  :to            => 'shanon@mailstroapp.com',
  :template_name => :welcome,
  :template_data => {
    :coupon_code => 'THANKS01'
  }
)
```

Sending an email to a list of users, with subscription management.

```ruby
Mailstro.subscribe('jack@mailstroapp.com', :build_watchers, project_id)

Mailstro.deliver(
  :to            => [:build_watchers, project_id]
  :template_name => :build_failure,
  :template_data => {
    :commit => '575ca555c23eca098202'
  }
)

Mailstro.unsubscribe('jack@mailstroapp.com', :build_watchers, project_id)
```

## RSpec Test Mode

Require the mailstro spec helper to automatically enable test mode.

```ruby
require 'mailsto/rspec'
```

Verify emails are being sent with simple matchers.

```ruby
Mailstro.deliver(
  :to            => 'shanon@mailstroapp.com',
  :template_name => :welcome,
)

Mailstro.should have_delivered(:welcome)

Mailstro.should have_subscribed('a@a.com', :watchers, 2)
Mailstro.should have_unsubscribed('a@a.com', :watchers, 2)
```


## Contributing

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mailstro-0.0.7 Readme.md