<commit_before># Shipping Materials

Shipping Materials provides a simple DSL for grouping and sorting a collection
of orders and their items and creating print materials for them.  So far this
includes packing slips and CSVs for label makers.

## Installation

    $ gem install shipping_materials

## Dependencies

`wkhtmltopdf` if used for PDF generation.  The call to it is made as a linux
command therefore this plugin will not work on Windows yet.
    
`gzip` is used for the zip functionality.

## Usage

### Setup

There is a little bit of configuration you are going to want to do first and
that is to add a save_path.

```ruby
  ShippingMaterials.config do |config|
    config.save_path = 'local/save/path'
  end
```

If you would like to use S3, add the following:

```ruby
  ShippingMaterials.config do |config|
    config.s3_bucket            = 'bucket.domain.com'
    config.s3_access_key_id     = ENV['AWS_ACCESS_KEY']
    config.s3_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
  end
```

### The Packager

The DSL is provided via the ShippingMaterials::Packager class.

```ruby
  packager = ShippingMaterials::Packager.new
```

The Packager's `#package` method takes a collection of objects of the same
type.

```ruby
  orders = Order.where(state: 'placed')

  packager.package :orders do<commit_msg>Fix README<commit_after># Shipping Materials

Shipping Materials provides a simple DSL for grouping and sorting a collection
of orders and their items and creating print materials for them.  So far this
includes packing slips and CSVs for label makers.

## Installation

    $ gem install shipping_materials

## Dependencies

`wkhtmltopdf` if used for PDF generation.  The call to it is made as a linux
command therefore this plugin will not work on Windows yet.
    
`gzip` is used for the zip functionality.

## Usage

### Setup

There is a little bit of configuration you are going to want to do first and
that is to add a save_path.

```ruby
  ShippingMaterials.config do |config|
    config.save_path = 'local/save/path'
  end
```

If you would like to use S3, add the following:

```ruby
  ShippingMaterials.config do |config|
    config.s3_bucket            = 'bucket.domain.com'
    config.s3_access_key_id     = ENV['AWS_ACCESS_KEY']
    config.s3_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
  end
```

### The Packager

The DSL is provided via the ShippingMaterials::Packager class.

```ruby
  packager = ShippingMaterials::Packager.new
```

The Packager's `#package` method takes a collection of objects of the same
type.

```ruby
  orders = Order.where(state: 'placed')

  packager.package orders do
{'fraction_non_alphanumeric': 0.07625189681335356, 'fraction_numerical': 0.0030349013657056147, 'mean_word_length': 3.919776119402985, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6450835', 'n_tokens_mistral': 840, 'n_tokens_neox': 767, 'n_words': 318}