<commit_before>[![Travis Badge](https://travis-ci.org/sendgrid/sendgrid-ruby.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-ruby)


**This library allows you to quickly and easily use the SendGrid Web API via Ruby.**

# Announcements

**BREAKING CHANGE as of 2016.06.14**

Version `2.0.0` is a breaking change for the entire library.

Version 2.0.0 brings you full support for all Web API v3 endpoints. We
have the following resources to get you started quickly:

-   [SendGrid
    Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html)
-   [Usage
    Documentation](https://github.com/sendgrid/sendgrid-ruby/tree/master/USAGE.md)
-   [Example
    Code](https://github.com/sendgrid/sendgrid-ruby/tree/master/examples)

Thank you for your continued support!

All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-ruby/blob/master/CHANGELOG.md).

# Installation

## Setup Environment Variables

First, get your free SendGrid account [here](https://sendgrid.com/free?source=sendgrid-ruby).

Next, update your environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys).

```bash
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env
```
## Install Package

Add this line to your application's Gemfile:

```bash
gem 'sendgrid-ruby'
```

And then execute:

```bash
bundle
```

Or install it yourself using:

```bash
gem install sendgrid-ruby
```

## Dependencies

- The SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-ruby)
- [Ruby-HTTP-Client](https://github.com/sendgrid/ruby-http-client)

# Quick Start

## Hello Email

```ruby
require 'sendgrid-ruby'
include SendGrid

from = Email.new(email: '<EMAIL>')
subject = 'Hello World from the SendGrid Ruby Library'
to = Email.new(email: '<EMAIL>')
content = Content.new(type: 'text/plain', value: 'some text here')
mail = Mail.new(from, subject, to, content)

sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client.mail._('send').post(request_body: mail.to_json)
puts response.status_code
puts response.body
puts response.headers
```

## General v3 Web API Usage

```ruby
require 'sendgrid-ruby'
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client.api_keys.get()
puts response.status_code
puts response.body
puts response.headers
```

# Usage

- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html)
- [Usage Docs](https://github.com/sendgrid/sendgrid-ruby/tree/master/USAGE.md)
- [Example Code](https://github.com/sendgrid/sendgrid-ruby/tree/master/examples)

# Helpers

-[Mail](https://github.com/sendgrid/sendgrid-ruby/tree/master/lib/sendgrid/helpers/mail)
-[Settings](https://github.com/sendgrid/sendgrid-ruby/tree/master/lib/sendgrid/helpers/settings)<commit_msg>readme formatting<commit_after>[![Travis Badge](https://travis-ci.org/sendgrid/sendgrid-ruby.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-ruby)


**This library allows you to quickly and easily use the SendGrid Web API via Ruby.**

# Announcements

**BREAKING CHANGE as of 2016.06.14**

Version `2.0.0` is a breaking change for the entire library.

Version 2.0.0 brings you full support for all Web API v3 endpoints. We
have the following resources to get you started quickly:

-   [SendGrid
    Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html)
-   [Usage
    Documentation](https://github.com/sendgrid/sendgrid-ruby/tree/master/USAGE.md)
-   [Example
    Code](https://github.com/sendgrid/sendgrid-ruby/tree/master/examples)

Thank you for your continued support!

All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-ruby/blob/master/CHANGELOG.md).

# Installation

## Setup Environment Variables

First, get your free SendGrid account [here](https://sendgrid.com/free?source=sendgrid-ruby).

Next, update your environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys).

```bash
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env
```
## Install Package

Add this line to your application's Gemfile:

```bash
gem 'sendgrid-ruby'
```

And then execute:

```bash
bundle
```

Or install it yourself using:

```bash
gem install sendgrid-ruby
```

## Dependencies

- The SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-ruby)
- [Ruby-HTTP-Client](https://github.com/sendgrid/ruby-http-client)

# Quick Start

## Hello Email

```ruby
require 'sendgrid-ruby'
include SendGrid

from = Email.new(email: '<EMAIL>')
subject = 'Hello World from the SendGrid Ruby Library'
to = Email.new(email: '<EMAIL>')
content = Content.new(type: 'text/plain', value: 'some text here')
mail = Mail.new(from, subject, to, content)

sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client.mail._('send').post(request_body: mail.to_json)
puts response.status_code
puts response.body
puts response.headers
```

## General v3 Web API Usage

```ruby
require 'sendgrid-ruby'
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client.api_keys.get()
puts response.status_code
puts response.body
puts response.headers
```

# Usage

- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html)
- [Usage Docs](https://github.com/sendgrid/sendgrid-ruby/tree/master/USAGE.md)
- [Example Code](https://github.com/sendgrid/sendgrid-ruby/tree/master/examples)

# Helpers

- [Mail](https://github.com/sendgrid/sendgrid-ruby/tree/master/lib/sendgrid/helpers/mail)
- [Settings](https://github.com/sendgrid/sendgrid-ruby/tree/master/lib/sendgrid/helpers/settings)
{'fraction_non_alphanumeric': 0.14444059577416002, 'fraction_numerical': 0.005888465535157603, 'mean_word_length': 4.965909090909091, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 30, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '549025', 'n_tokens_mistral': 2034, 'n_tokens_neox': 1929, 'n_words': 434}