Sha256: 053e36f0937f647a335dddaf5483766b26511130c5a577096b546f57d23cd7e7

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

# Render

Create and test API requests simply with schemas.

```ruby
Render.load_schemas!("spec/schemas") # JSON schema directory
Render::Graph.new(:film, { endpoint: "http://films.local/films" }).render
# or stub out schema-specific data
Render.live = false
Render::Graph.new(:film).render
```

*Use with caution* (Render is under initial development) by updating your Gemfile:

    gem "render"

## Caveats

- Render will modify ::Hash and ::Enumerable to provide symbolize/stringify keys methods.

## Usage

*Autoload schemas*

```ruby
Render.load_schemas!("path/to/json/schemas")
Render::Graph.new(:schema_title, { endpoint: "http://films.local/films" }).render
```

*Variable interpolation*

```ruby
api_endpoint = "http://films.local/films/:id?:client_token"
env_specific_client_token = "token"

graph = Render::Graph.new(:schema_title, { endpoint: api_endpoint, client_token: env_specific_client_token })
graph.render({ id: "an-id" }) # makes request to "http://films.local/films/an-id?client_token=token"
```

Check out the examples in [integration tests](spec/integration/).

## Roadmap

1. Custom HTTP headers (e.g. { pragma: "no-cache", host: "dont_redirect_to_www.site.com" })
2. Enhanced Attribute metadata (e.g. minlength)
3. Parental params from root-level array
4. Deep merge in #render for faux values

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
render-0.0.4 readme.md
render-0.0.3 readme.md