<commit_before># Blog API

This is an example application showing how to use [grape](https://github.com/intridea/grape) to create a simple API using entities. 
This sample show cases how to create a simple API without authentication, caching, custom 
errors and such other things to build a robust public API.

I wrote the sample because I was unable to find a sample to cover the basics of grape.

## Environment

The sample was developed using the following software. If your software is different, the 
sample may still work, but there is no guarantee. 

1. Rails 3.2.8
2. ruby 1.9.3p194
3. OS X 10.8.1 (aka Mountain Lion)
4. Grape (0.2.1) 

## Setup

Install the gems

```bash
bundle install
```

Create and migrate the database

```bash
rake db:migrate
```

## Running the sample

You can run the server using the built-in rails server

```bash
rails server
```

## Usage

Getting all the weblogs

```bash
curl -i http://localhost:3000/weblogs
```

Creating a weblog 

```bash
curl -d '{"title": "Dummy"}'  -X POST -H Content-Type:application/json http://localhost:3000/weblogs
```  

Deleting a weblog <commit_msg>Added the missing instruction to the readme file to seed the database<commit_after># Blog API

This is an example application showing how to use [grape](https://github.com/intridea/grape) to create a simple API using entities. 
This sample show cases how to create a simple API without authentication, caching, custom 
errors and such other things to build a robust public API.

I wrote the sample because I was unable to find a sample to cover the basics of grape.

## Environment

The sample was developed using the following software. If your software is different, the 
sample may still work, but there is no guarantee. 

1. Rails 3.2.8
2. ruby 1.9.3p194
3. OS X 10.8.1 (aka Mountain Lion)
4. Grape (0.2.1) 

## Setup

Install the gems

```bash
bundle install
```

Create and migrate the database

```bash
rake db:migrate
```

Seed the database

```bash
rake db:seed
```

## Running the sample

You can run the server using the built-in rails server

```bash
rails server
```

## Usage

Getting all the weblogs

```bash
curl -i http://localhost:3000/weblogs
```

Creating a weblog 

```bash
curl -d '{"title": "Dummy"}'  -X POST -H Content-Type:application/json http://localhost:3000/weblogs
```  

Deleting a weblog 
{'fraction_non_alphanumeric': 0.09269542930371637, 'fraction_numerical': 0.02392140111063648, 'mean_word_length': 3.8488612836438922, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '7259072', 'n_tokens_mistral': 796, 'n_tokens_neox': 698, 'n_words': 335}