README.md in storyblok-2.0.0 vs README.md in storyblok-2.0.1
- old
+ new
@@ -1,23 +1,36 @@
# About
-This is the Storyblok ruby client for easy access of the content delivery api.
+This is the Storyblok ruby client for easy access of the management and content delivery api.
## Install
```bash
gem 'storyblok'
```
-## Usage
+## Usage for the content delivery api
+By default the client loads the "draft" version of the Story. Be sure to set the version to "published" to get the published content only.
+
+```ruby
+# The draft mode is required for the preview
+Storyblok::Client.new(version: 'draft')
+
+# Requests only published stories
+Storyblok::Client.new(version: 'published')
+```
+
### Load a Story
```ruby
+# Without cache
client = Storyblok::Client.new(token: 'YOUR_TOKEN')
# Optionally set a cache client
-Storyblok::Cache.client = Redis.new(:url => 'redis://localhost:6379')
+redis = Redis.new(url: 'redis://localhost:6379')
+cache = Storyblok::Cache::Redis.new(redis: Redis.current)
+client = Storyblok::Client.new(cache: cache, token: 'YOUR_TOKEN')
# Get a story
client.story('home')
```
@@ -69,9 +82,54 @@
puts '</li>'
end
puts '</ul>'
```
+
+## How to flush the cache
+
+Following an example of how to flush the client cache:
+
+```ruby
+cache = Storyblok::Cache::Redis.new(redis: Redis.current)
+client = Storyblok::Client.new(cache: cache, token: 'YOUR_TOKEN')
+
+# Get a story and cache it
+client.story('home')
+
+# Flush the cache
+client.flush
+```
+
+## Usage for the management api
+
+### Initialize the client and load spaces
+
+```ruby
+client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
+
+# Get your spaces
+client.get('spaces')
+```
+
+### Create a story
+
+```ruby
+client.post("spaces/{space_id}/stories", {story: {name: 'new', slug: "new"}})
+```
+
+### Update a story
+
+```ruby
+client.put("spaces/{space_id}/stories/{story_id}", {story: {name: 'new', slug: "new"}})
+```
+
+### Delete a story
+
+```ruby
+client.delete("spaces/{space_id}/stories/{story_id}")
+```
+
### License
This project is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)