<commit_before>Description
===========

Boutique is a Sinatra module for selling digital goods.  Still under development.

Installation
============

    % gem install boutique

Setup a `config.ru` file and run it like any other Sinatra application.  You
can configure what products you sell here:

    require 'rubygems'
    require 'boutique'

    Boutique.configure do |c|
      c.store_path    'boutique'
      c.download_path 'download'
      c.paypal_key    'paypalapikey'
      c.db_username   'username'
      c.db_password   'password'
    end

    Boutique.product('icon-set') do |p|
      p.file        '/home/hugh/icon-set.tgz'
      p.price       10.5
      p.return_url  'http://zincmade.com/'
    end

    run Boutique::App

With the settings above, a normal flow would look like:

1. On your site, link the user to `/boutique/icon-set/` to purchase
2. User is redirected to paypal
3. After completing paypal, user is redirected to 
   `http://zincmade.com/?f=id-longhash`
4. On this page, issue an AJAX request to `/boutique/purchases/id-longhash`.
   The `download` field of the JSON will include the download URL.

Usage
=====

The web application is for customers, to get information about your products use
the included command line application.

    % boutique --list
    % boutique --stats key --after date --before date
    % boutique --clean

Development
===========

The `config.ru` is for local development.  Start the server via `shotgun`
command.  Tests are setup to run individually via `ruby test/*_test.rb` or
run them all via `rake`.

TODO
====

* boutique command line
* initial migration support
* email customer
* email exceptions to developer

License<commit_msg>Better instructions.<commit_after>Description
===========

Boutique is a Sinatra module for selling digital goods.  Still under development.

Installation
============

    % gem install boutique

You'll need some private/public certificates:

    % openssl genrsa -out private.pem 1024
    % openssl req -new -key private.pem -x509 -days 365 -out public.pem

You can download PayPal's public certificate under `My Account > Encrypted
Payment Settings`.  Click the download button for PayPal Public Certificate.
Rename this certificate to something like `paypal.pem`.

Setup a `config.ru` file and run it like any other Sinatra application.  You
can configure what products you sell here:

    require 'rubygems'
    require 'boutique'

    Boutique.configure do |c|
      c.pem_private    '/path/to/private.pem'
      c.pem_public     '/path/to/public.pem'
      c.pem_paypal     '/path/to/paypal.pem'
      c.download_dir   '/path/to/download'
      c.download_path  '/download'
      c.db_adapter     'mysql'
      c.db_host        'localhost'
      c.db_username    'root'
      c.db_password    '<PASSWORD>'
      c.db_database    'boutique'
      c.pp_email       '<EMAIL>'
      c.pp_url         'http://https://www.sandbox.paypal.com/cgi-bin/webscr'
    end

    Boutique.product('icon-set') do |p|
      p.name       'Icon Set'
      p.files      '/path/to/icon-set.tgz'  # array for multiple files
      p.price      10.5
      p.return_url 'http://zincmade.com/thankyou'
    end

    run Boutique::App

Now setup the database tables:

    % boutique --migrate

With the settings above, a normal flow would look like:

1. On your site, link the user to `/boutique/buy/icon-set/` to purchase
2. User is redirected to paypal
3. After completing paypal, user is redirected to 
   `http://zincmade.com/thankyou?b=order-id`
4. On this page, issue an AJAX request to `/boutique/purchases/order-id`.
   The `downloads` field of the JSON will include the download URLs.

Usage
=====

The web application is for customers, to get information about your products use
the included command line application.

    % boutique --stats productcode
    % boutique --expire
    % boutique --expire id
    % boutique --remove id

Development
===========

Tests are setup to run individually via `ruby test/*_test.rb` or run them all
via `rake`.

TODO
====

* record names/emails of purchases from paypal
* handle download expiration
* boutique command line
* initial migration support
* email customer
* email exceptions to developer

License
{'fraction_non_alphanumeric': 0.10113421550094517, 'fraction_numerical': 0.005671077504725898, 'mean_word_length': 2.9671977507029053, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6139451', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1269, 'n_words': 464}