# About This is the Storyblok ruby client for easy access of the management and content delivery api. ## Install ```bash gem 'storyblok' ``` ## 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 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') ``` ### Load a list of Stories ```ruby # Get all Stories that start with news client.stories({ :starts_with => 'news' }) ``` ### Load a list of datasource entries ```ruby # Get all label datasource entries client.datasource_entries({ :datasource => 'labels' }) ``` ### Load a list of tags ```ruby # Get all Tags that within the folder news client.tags({ :starts_with => 'news' }) ``` ## Generate a navigation tree ```ruby tree = client.tree puts '