<commit_before># Cerulean

## API DSL for Rails

Cerulean is a reasonably unopinionated DSL for writing APIs in Rails. 

## Installation

Add a reference to Cerulean in your `Gemfile`:

```ruby
gem 'cerulean'
```

Include Cerulean in your base controller class:

```ruby
class ApplicationController < ActionController::API
  include Cerulean
end
```

Or include it in individual controllers as-needed:

```ruby
class PostsController < ApplicationController
  include Cerulean
end
```

## Use

### Defining Endpoints

Cerulean provides methods for `get`, `post`, `put`, and `delete`.

The basic structure of a request looks like this:

```ruby
get :index do
  request do
    # ...
  end
end
```

### Params

Cerulen provides basic parameter validation for a variety of common data types.

Request parameters are defined in a `params` block:

```ruby
get :show do
  params do
    param :id, Integer, required: true
  end
  request do
    # ...
  end
end
```

While the raw params can still be accessed inside of your request block via the `params` variable, when declaring a `params` block for an endpoint, you should use `declared` instead.

For example, for the above endpoint, you could access the `id` via `declared[:id]`.

The following param types are supported:

* `String`
* `Integer`
* `Float`
* `Boolean`
* `Date`
* `DateTime`

Arrays are also supported using `Array[Foo]` where `Foo` is one of the primitive types listed above.

### Presenters

TODO

### Forms

TODO<commit_msg>Updates documentation.<commit_after># Cerulean

## API DSL for Rails

Cerulean is a reasonably unopinionated DSL for writing APIs in Rails. 

## Installation

Add a reference to Cerulean in your `Gemfile`:

```ruby
gem 'cerulean'
```

Include Cerulean in your base controller class:

```ruby
class ApplicationController < ActionController::API
  include Cerulean
end
```

Or include it in individual controllers as-needed:

```ruby
class PostsController < ApplicationController
  include Cerulean
end
```

## Use

### Defining Endpoints

Cerulean provides methods for `get`, `post`, `put`, and `delete`.

The basic structure of a request looks like this:

```ruby
get :index do
  request do
    # ...
  end
end
```

### Params

Cerulen provides basic parameter validation for a variety of common data types.

Request parameters are defined in a `params` block:

```ruby
get :show do
  params do
    param :id, Integer, required: true
  end
  request do
    # ...
  end
end
```

While the raw params can still be accessed inside of your request block via the `params` variable, when declaring a `params` block for an endpoint, you should use `declared` instead.

For example, for the above endpoint, you could access the `id` via `declared[:id]`.

The following param types are supported:

* `String`
* `Integer`
* `Float`
* `Boolean`
* `Date`
* `DateTime`

Arrays are also supported using `Array[Foo]` where `Foo` is one of the primitive types listed above.

#### Validations

* `min`
* `max`
* `required`
* `values`
* `default`

### Presenters

TODO

### Forms

TODO
{'fraction_non_alphanumeric': 0.09888670595939751, 'fraction_numerical': 0.0, 'mean_word_length': 4.117252931323283, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2382683', 'n_tokens_mistral': 970, 'n_tokens_neox': 909, 'n_words': 402}