README.md in materialist-3.2.0 vs README.md in materialist-3.3.0

- old
+ new

@@ -73,12 +73,13 @@ end ``` - `topics` (only when using in `.subscribe`): A string array of topics to be used. If not provided nothing would be materialized. -- `sidekiq_options` (optional, default: `{ retry: 10 }`) -- See [Sidekiq docs](https://github.com/mperham/sidekiq/wiki/Advanced-Options#workers) for list of optiosn +- `sidekiq_options` (optional, default: `{ retry: 10 }`) -- See [Sidekiq docs](https://github.com/mperham/sidekiq/wiki/Advanced-Options#workers) for list of options - `metrics_client` (optional) -- You can pass your `STATSD` instance +- `notice_error` (optional) -- You can pass a lambda accepting two parameters (`exception` and `event`) -- Typical use case is to enrich error and send to NewRelic APM ### Routemaster Configuration First you need an "event handler": @@ -158,12 +159,12 @@ Here is what each part of the DSL mean: #### `sidekiq_options <options>` allows to override options for the Sidekiq job which does the materialization. -Typically it will specify which queue to put the job on or how many times -should the job try to retry. These options override the options specified in +Typically it will specify which queue to put the job on or how many times +should the job try to retry. These options override the options specified in `Materialist.configuration.sidekiq_options`. #### `persist_to <model_name>` describes the name of the active record model to be used. If missing, materialist skips materialising the resource itself, but will continue @@ -177,9 +178,17 @@ #### `capture <key>, as: <column> (default: key)` describes mapping a resource key to a database column. #### `capture_link_href <key>, as: <column>` describes mapping a link href (as it appears on the hateous response) to a database column. + +You can optionally provide a block for parsing the url: + +```ruby +capture_link_href :rider, as: :rider_id do |url| + url.split('/').last +end +``` #### `link <key>, enable_caching: <enable_caching> (default: false)` describes materializing from a relation of the resource. This can be nested to any depth as shown above. When inside the block of a `link` any other part of DSL can be used and will be evaluated in the context of the relation resource.