readme.md in render-0.0.1 vs readme.md in render-0.0.2
- old
+ new
@@ -1,86 +1,45 @@
# Render
Create and test API requests simply with schemas.
```ruby
-Representation.load_schemas!("spec/schemas") # JSON schema directory
-Representation::Graph.new(:film, { endpoint: "http://films.local/films" }).pull
+Render.load_schemas!("spec/schemas") # JSON schema directory
+Render::Graph.new(:film, { endpoint: "http://films.local/films" }).render
# or stub out schema-specific data
-Representation.live = false
-Representation::Graph.new(:film).pull
+Render.live = false
+Render::Graph.new(:film).render
```
-*Use with caution* (Representation is under initial development) by updating your Gemfile:
+*Use with caution* (Render is under initial development) by updating your Gemfile:
- gem "representation"
+ gem "render"
-## Usage
+## Caveats
-Try out examples with `Representation.live = false`.
+- Render will modify ::Hash and ::Enumerable to provide symbolize/stringify keys methods.
-*Simple*
+## Usage
-```ruby
-schema = Representation::Schema.new({
- title: :film,
- type: Object,
- attributes: {
- id: { type: UUID },
- title: { type: String }
- }
-})
-
-options = {
- endpoint: "http://films.local/films/:id"
-}
-
-Representation::Graph.new(schema, options).pull({ id: "4cb6b490-d706-0130-2a93-7c6d628f9b06" })
-```
-
-*Nested*
-
-```ruby
-film_schema = Representation::Schema.new({
- title: :film,
- type: Object,
- attributes: {
- id: { type: UUID },
- title: { type: String }
- }
-})
-
-films_schema = Representation::Schema.new({
- title: :films,
- type: Array,
- elements: {
- title: :film,
- type: Object,
- attributes: {
- id: { type: UUID }
- }
- }
-})
-
-films_graph = Representation::Graph.new(films_schema, { endpoint: "http://films.local/films" })
-film_graph = Representation::Graph.new(film_schema, { endpoint: "http://films.local/films/:id", relationships: { id: :id } })
-films_graph.graphs << film_graph
-films_graph.pull
-```
*Autoload schemas*
```ruby
-Representation.load_schemas!("path/to/json/schemas")
-Representation::Graph.new(:schema_title, { endpoint: "http://films.local/films" }).pull
+Render.load_schemas!("path/to/json/schemas")
+Render::Graph.new(:schema_title, { endpoint: "http://films.local/films" }).render
```
*Variable interpolation*
```ruby
-options = { endpoint: "http://films.local/films/:id?:client_token", client_token: "token" }
-graph = Representation::Graph.new(:schema_title, options)
-graph.pull({ id: "an-id" })
+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/).
+
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)