<commit_before># TaxJar Ruby Gem

<a href="http://developers.taxjar.com"><img src="http://www.taxjar.com/img/TJ_logo_color_office_png.png" alt="TaxJar" width="220"></a>

A Ruby interface to the TaxJar API. TaxJar makes sales tax filing easier for online sellers and merchants. 
See local jurisdictional tax reports, get payment reminders, and more. You can use our API to access TaxJar API endpoints, 
which can get information on sales tax rates, categories or upload transactions.

* This wrapper supports 100% of the [TaxJar API Version 2](http://developers.taxjar.com/api/#introduction)
* Data returned from API calls are mapped into Ruby objects

## Gem Dependencies

Installing this gem also installs the following gems:

* [http](https://github.com/httprb/http.rb) Fast Ruby HTTP client with a chainable API and full streaming support.
* [addressable](https://github.com/sporkmonger/addressable) Replacement for the URI implementation that is part of Ruby's standard library. It more closely conforms to the relevant RFCs and adds support for IRIs and URI templates.
* [memoizable](https://github.com/dkubb/memoizable) Memoize method return values.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'taxjar-ruby', require: 'taxjar'
```

And then execute:

```shell
$ bundle install
```

Or install it yourself as:

```shell
$ gem install taxjar-ruby
```

## Quick Start Guide

First, [get an API key from TaxJar](https://app.taxjar.com/api_sign_up/plus/). Copy and paste in your API key:

```ruby
client = Taxjar::Client.new(api_key: 'YOUR KEY')
```

You are now ready to use TaxJar!

## Usage

### List all tax categories
```ruby
categories = client.categories
```

### List tax rates for a location (by zip/postal code)

```ruby
rates = client.rates_for_location('10001')
```

### Calculate Sales tax for an order

```ruby
order = client.tax_for_order({
    :to_country => 'US',
    :to_zip => '90002',
    :to_city => 'Los Angeles',
    :from_country => 'US',
    :from_zip => '92093',
    :from_city => 'San Diego',                
    :amount => 16.50,
    :shipping => 1.5,
    :line_items => [{:quantity => 1,
                     :product_identifier => '12-34243-9',
                     :unit_price => 15.0,
                     :product_tax_code => 31000}]
})
```

### Create order transaction

```ruby
order = client.create_order({
    :transaction_id => '123',
    :transaction_date => '2015/05/14',
    :to_country => 'US',
    :to_zip => '90002',<commit_msg>Add missing required params to examples in README<commit_after># TaxJar Ruby Gem

<a href="http://developers.taxjar.com"><img src="http://www.taxjar.com/img/TJ_logo_color_office_png.png" alt="TaxJar" width="220"></a>

A Ruby interface to the TaxJar API. TaxJar makes sales tax filing easier for online sellers and merchants. 
See local jurisdictional tax reports, get payment reminders, and more. You can use our API to access TaxJar API endpoints, 
which can get information on sales tax rates, categories or upload transactions.

* This wrapper supports 100% of the [TaxJar API Version 2](http://developers.taxjar.com/api/#introduction)
* Data returned from API calls are mapped into Ruby objects

## Gem Dependencies

Installing this gem also installs the following gems:

* [http](https://github.com/httprb/http.rb) Fast Ruby HTTP client with a chainable API and full streaming support.
* [addressable](https://github.com/sporkmonger/addressable) Replacement for the URI implementation that is part of Ruby's standard library. It more closely conforms to the relevant RFCs and adds support for IRIs and URI templates.
* [memoizable](https://github.com/dkubb/memoizable) Memoize method return values.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'taxjar-ruby', require: 'taxjar'
```

And then execute:

```shell
$ bundle install
```

Or install it yourself as:

```shell
$ gem install taxjar-ruby
```

## Quick Start Guide

First, [get an API key from TaxJar](https://app.taxjar.com/api_sign_up/plus/). Copy and paste in your API key:

```ruby
client = Taxjar::Client.new(api_key: 'YOUR KEY')
```

You are now ready to use TaxJar!

## Usage

### List all tax categories
```ruby
categories = client.categories
```

### List tax rates for a location (by zip/postal code)

```ruby
rates = client.rates_for_location('10001')
```

### Calculate Sales tax for an order

```ruby
order = client.tax_for_order({
    :to_country => 'US',
    :to_zip => '90002',
    :to_city => 'Los Angeles',
    :to_state => 'CA',
    :from_country => 'US',
    :from_zip => '92093',
    :from_city => 'San Diego',                
    :amount => 16.50,
    :shipping => 1.5,
    :line_items => [{:quantity => 1,
                     :product_identifier => '12-34243-9',
                     :unit_price => 15.0,
                     :product_tax_code => 31000}]
})
```

### Create order transaction

```ruby
order = client.create_order({
    :transaction_id => '123',
    :transaction_date => '2015/05/14',
    :to_country => 'US',
    :to_zip => '90002',
    :to_state => 'CA',
{'fraction_non_alphanumeric': 0.12922230950510605, 'fraction_numerical': 0.023959151610369208, 'mean_word_length': 3.7070240295748613, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 45, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, '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': '4116317', 'n_tokens_mistral': 1725, 'n_tokens_neox': 1556, 'n_words': 536}