<commit_before># Striped

A clean, stripped-down implementation of Ruby bindings for the Stripe API.

[![Build Status](https://travis-ci.org/craiglittle/striped.png?branch=master)][build_status]
[![Dependency Status](https://gemnasium.com/craiglittle/striped.png)][dependencies]
[![Coverage Status](https://coveralls.io/repos/craiglittle/striped/badge.png?branch=master)][coverage_status]

[build_status]: https://travis-ci.org/craiglittle/striped
[dependencies]: https://gemnasium.com/craiglittle/striped
[coverage_status]: https://coveralls.io/r/craiglittle/striped


## Why?

* A simple codebase that leverages modern gems
* Complete test coverage
* Minimize number of HTTP requests to get stuff done


## Installation
```ruby
gem install striped
```


## Configuration

```ruby
Striped.api_key     = '<KEY>'
Striped.api_version = '2013-02-13'
```


## Usage

### Charges

```ruby
Striped.charge.create(
  amount:      400,
  currency:    'usd',
  card:        'tok_Di6658V24SxcHz',
  description: 'Charge for <EMAIL>'
)

Striped.charge('ch_1bJAHzdT333Rq1').fetch

Striped.charge('ch_1bJAHzdT333Rq1').refund

Striped.charge('ch_1bJAHzdT333Rq1').capture

Striped.charge.all(count: 3)

```

### Customers

```ruby
Striped.customer.create(
  description: 'Customer for <EMAIL>',
  card:        'tok_Di6658V24SxcHz'
)

Striped.customer('cus_1bJAvgSTOS4jUc').fetch

Striped.customer('cus_1bJAvgSTOS4jUc').update(
  description: 'Customer for <EMAIL>',
  card:        'tok_Di6658V24SxcHz'
)

Striped.customer('cus_1bJAvgSTOS4jUc').delete

Striped.customer.all
```

### Subscriptions

```ruby
Striped.customer('cus_1bJAvgSTOS4jUc').subscription.update(
  plan:    'basic',
  prorate: true
)

Striped.customer('cus_1bJAvgSTOS4jUc').subscription.cancel

Striped.plan.create(
  amount:   2000,
  interval: 'month',
  name:     'Amazing Gold Plan',
  currency: 'usd',
  id:       'gold'
)

Striped.plan('gold').fetch

Striped.plan('gold').update(name: 'New plan name')<commit_msg>Add 'Plans' section to README<commit_after># Striped

A clean, stripped-down implementation of Ruby bindings for the Stripe API.

[![Build Status](https://travis-ci.org/craiglittle/striped.png?branch=master)][build_status]
[![Dependency Status](https://gemnasium.com/craiglittle/striped.png)][dependencies]
[![Coverage Status](https://coveralls.io/repos/craiglittle/striped/badge.png?branch=master)][coverage_status]

[build_status]: https://travis-ci.org/craiglittle/striped
[dependencies]: https://gemnasium.com/craiglittle/striped
[coverage_status]: https://coveralls.io/r/craiglittle/striped


## Why?

* A simple codebase that leverages modern gems
* Complete test coverage
* Minimize number of HTTP requests to get stuff done


## Installation
```ruby
gem install striped
```


## Configuration

```ruby
Striped.api_key     = '<KEY>'
Striped.api_version = '2013-02-13'
```


## Usage

### Charges

```ruby
Striped.charge.create(
  amount:      400,
  currency:    'usd',
  card:        'tok_Di6658V24SxcHz',
  description: 'Charge for <EMAIL>'
)

Striped.charge('ch_1bJAHzdT333Rq1').fetch

Striped.charge('ch_1bJAHzdT333Rq1').refund

Striped.charge('ch_1bJAHzdT333Rq1').capture

Striped.charge.all(count: 3)

```

### Customers

```ruby
Striped.customer.create(
  description: 'Customer for <EMAIL>',
  card:        'tok_Di6658V24SxcHz'
)

Striped.customer('cus_1bJAvgSTOS4jUc').fetch

Striped.customer('cus_1bJAvgSTOS4jUc').update(
  description: 'Customer for <EMAIL>',
  card:        'tok_Di6658V24SxcHz'
)

Striped.customer('cus_1bJAvgSTOS4jUc').delete

Striped.customer.all
```

### Subscriptions

```ruby
Striped.customer('cus_1bJAvgSTOS4jUc').subscription.update(
  plan:    'basic',
  prorate: true
)

Striped.customer('cus_1bJAvgSTOS4jUc').subscription.cancel

Striped.plan.create(
  amount:   2000,
  interval: 'month',
  name:     'Amazing Gold Plan',
  currency: 'usd',
  id:       'gold'
)
```

### Plans

Striped.plan('gold').fetch

Striped.plan('gold').update(name: 'New plan name')
{'fraction_non_alphanumeric': 0.1509433962264151, 'fraction_numerical': 0.029685534591194968, 'mean_word_length': 5.015128593040847, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 12, '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': '6996712', 'n_tokens_mistral': 1663, 'n_tokens_neox': 1522, 'n_words': 244}