{"id":13878820,"url":"https://github.com/storyblok/storyblok-ruby-client","last_synced_at":"2026-04-26T17:01:26.081Z","repository":{"id":17672602,"uuid":"82452252","full_name":"storyblok/storyblok-ruby-client","owner":"storyblok","description":"Storyblok ruby client for easy access of the content delivery api","archived":false,"fork":false,"pushed_at":"2025-03-12T20:50:23.000Z","size":173,"stargazers_count":24,"open_issues_count":6,"forks_count":11,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-01-13T23:59:08.308Z","etag":null,"topics":["ruby","ruby-gem","ruby-on-rails","sinatra","storyblok","storyblok-api-squad"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/storyblok.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-02-19T10:49:27.000Z","updated_at":"2025-10-15T20:35:30.000Z","dependencies_parsed_at":"2024-01-13T20:42:51.211Z","dependency_job_id":"cb8ca028-bdc5-41b8-9503-0b44cd586dda","html_url":"https://github.com/storyblok/storyblok-ruby-client","commit_stats":null,"previous_names":["storyblok/storyblok-ruby"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/storyblok/storyblok-ruby-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storyblok%2Fstoryblok-ruby-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storyblok%2Fstoryblok-ruby-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storyblok%2Fstoryblok-ruby-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storyblok%2Fstoryblok-ruby-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/storyblok","download_url":"https://codeload.github.com/storyblok/storyblok-ruby-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storyblok%2Fstoryblok-ruby-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32305039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby","ruby-gem","ruby-on-rails","sinatra","storyblok","storyblok-api-squad"],"created_at":"2024-08-06T08:02:01.109Z","updated_at":"2026-04-26T17:01:26.066Z","avatar_url":"https://github.com/storyblok.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\t\u003ca  href=\"https://www.storyblok.com?utm_source=github.com\u0026utm_medium=readme\u0026utm_campaign=storyblok-ruby\"  align=\"center\"\u003e\n\t\t\u003cimg  src=\"https://a.storyblok.com/f/88751/1776x360/95e296dafa/sb-ruby.png\"  alt=\"Storyblok Logo\"\u003e\n\t\u003c/a\u003e\n\t\u003ch1 align=\"center\"\u003eStoryblok Ruby Client\u003c/h1\u003e\n\t\u003cp align=\"center\"\u003eThis is the official \u003ca href=\"http://www.storyblok.com?utm_source=github.com\u0026utm_medium=readme\u0026utm_campaign=storyblok-ruby\" target=\"_blank\"\u003eStoryblok\u003c/a\u003e ruby client for easy access of the management and content delivery api.\u003c/p\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://codeclimate.com/github/storyblok/storyblok-ruby/test_coverage\"\u003e\n    \u003cimg src=\"https://api.codeclimate.com/v1/badges/76e7fcc8524d4fadeeee/test_coverage\" alt=\"Test Coverage\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.gg/jKrbAMz\"\u003e\n   \u003cimg src=\"https://img.shields.io/discord/700316478792138842?label=Join%20Our%20Discord%20Community\u0026style=appveyor\u0026logo=discord\u0026color=09b3af\"\u003e\n   \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/intent/follow?screen_name=storyblok\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Follow-%40storyblok-09b3af?style=appveyor\u0026logo=twitter\" alt=\"Follow @Storyblok\" /\u003e\n  \u003c/a\u003e\u003cbr/\u003e\n  \u003ca href=\"https://app.storyblok.com/#!/signup?utm_source=github.com\u0026utm_medium=readme\u0026utm_campaign=storyblok-ruby\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Try%20Storyblok-Free-09b3af?style=appveyor\u0026logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAHqADAAQAAAABAAAAHgAAAADpiRU/AAACRElEQVRIDWNgGGmAEd3D3Js3LPrP8D8WXZwSPiMjw6qvPoHhyGYwIXNAbGpbCjbzP0MYuj0YFqMroBV/wCxmIeSju64eDNzMBJUxvP/9i2Hnq5cM1devMnz984eQsQwETeRhYWHgIcJiXqC6VHlFBjUeXgav40cIWkz1oLYXFmGwFBImaDFBHyObcOzdW4aSq5eRhRiE2dgYlpuYoYSKJi8vw3GgWnyAJIs/AuPu4scPGObd/fqVQZ+PHy7+6udPOBsXgySLDfn5GRYYmaKYJcXBgWLpsx8/GPa8foWiBhuHJIsl2DkYQqWksZkDFgP5PObcKYYff//iVAOTIDlx/QPqRMb/YSYBaWlOToZIaVkGZmAZSQiQ5OPtwHwacuo4iplMQEu6tXUZMhSUGDiYmBjylFQYvv/7x9B04xqKOnQOyT5GN+Df//8M59ASXKyMHLoyDD5JPtbj42OYrm+EYgg70JfuYuIoYmLs7AwMjIzA+uY/zjAnyWJpDk6GOFnCvrn86SOwmsNtKciVFAc1ileBHFDC67lzG10Yg0+SjzF0ownsf/OaofvOLYaDQJoQIGix94ljv1gIZI8Pv38zPvj2lQWYf3HGKbpDCFp85v07NnRN1OBTPY6JdRSGxcCw2k6sZuLVMZ5AV4s1TozPnGGFKbz+/PE7IJsHmC//MDMyhXBw8e6FyRFLv3Z0/IKuFqvFyIqAzd1PwBzJw8jAGPfVx38JshwlbIygxmYY43/GQmpais0ODDHuzevLMARHBcgIAQAbOJHZW0/EyQAAAABJRU5ErkJggg==\" alt=\"Follow @Storyblok\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## 🚀 Usage\n\n### Install\n\n```bash\ngem 'storyblok'\n```\n\n### Usage for the content delivery api\n\nBy default the client loads the \"draft\" version of the Story. Be sure to set the version to \"published\" to get the published content only.\n\n```ruby\n# The draft mode is required for the preview\nStoryblok::Client.new(version: 'draft')\n\n# Requests only published stories\nStoryblok::Client.new(version: 'published')\n```\n\n#### Using the APIs on other regions\n\nYou should use the space access token with the `api_region` parameter whenever your space belongs to other server locations.\n\nAvailable regions: `eu`, `us`, `ca` and `ap`.\n\nExample on US region:\n\n```ruby\nclient = Storyblok::Client.new(token: 'YOUR_TOKEN', api_region: 'us')\n```\n\n#### Load a story\n\n```ruby\n# Without cache\nclient = Storyblok::Client.new(token: 'YOUR_TOKEN')\n\n# Optionally set a cache client\nredis = Redis.new(url: 'redis://localhost:6379')\ncache = Storyblok::Cache::Redis.new(redis: redis)\nclient = Storyblok::Client.new(cache: cache, token: 'YOUR_TOKEN')\n\n# Get a story\nclient.story('home')\n```\n\n#### Load a list of stories\n\n```ruby\n# Get all Stories that start with news\nclient.stories({\n  :starts_with =\u003e 'news'\n})\n```\n\n#### Load a list of datasource entries\n\n```ruby\n# Get all label datasource entries\nclient.datasource_entries({\n  :datasource =\u003e 'labels'\n})\n\n```\n\n#### Load a list of tags\n\n```ruby\n# Get all Tags that within the folder news\nclient.tags({\n  :starts_with =\u003e 'news'\n})\n\n```\n\n#### Load a list of links\n\n```ruby\nclient.links\n```\n\n### Generate a navigation tree\n\n```ruby\ntree = client.tree\n\nputs '\u003cul\u003e'\ntree.each do |key, item|\n  puts '\u003cli\u003e' + item['item']['name']\n\n  if !item['children'].empty?\n    puts '\u003cul\u003e'\n    item['children'].each do |key, inner_item|\n      puts '\u003cli\u003e' + inner_item['item']['name'] + '\u003c/li\u003e'\n    end\n    puts '\u003c/ul\u003e'\n  end\n\n  puts '\u003c/li\u003e'\nend\nputs '\u003c/ul\u003e'\n```\n\n#### Get the space info\n\n```ruby\nclient.space\n```\n\n### How to flush the cache\n\nFollowing an example of how to flush the client cache:\n\n```ruby\ncache = Storyblok::Cache::Redis.new(redis: Redis.current)\nclient = Storyblok::Client.new(cache: cache, token: 'YOUR_TOKEN')\n\n# Get a story and cache it\nclient.story('home')\n\n# Flush the cache\nclient.flush\n```\n\n### Usage for the management api\n\n#### Initialize the client and load spaces\n\n```ruby\nclient = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')\n\n# Get your spaces\nclient.get('spaces/')\n```\n\n#### Create a story\n\n```ruby\nclient.post(\"spaces/{space_id}/stories\", {story: {name: 'new', slug: \"new\"}})\n```\n\n#### Update a story\n\n```ruby\nclient.put(\"spaces/{space_id}/stories/{story_id}\", {story: {name: 'new', slug: \"new\"}})\n```\n\n#### Delete a story\n\n```ruby\nclient.delete(\"spaces/{space_id}/stories/{story_id}\")\n```\n\n### Rendering of richtext fields\n\nThis SDK comes with a rendering service for richtext fields of Storyblok to get html output.\n\n#### Rendering a richtext field\n\n```ruby\nclient.render(data.richtext_field)\n```\n\n#### Define a component renderer\n\nStoryblok's richtext field also let's you insert content blocks. To render these blocks you can define a Lambda.\n\n```ruby\n# Option 1: Define the resolver when initializing\nclient = Storyblok::Client.new(\n  component_resolver: -\u003e(component, data) {\n    case component\n    when 'button'\n      \"\u003cbutton\u003e#{data['text']}\u003c/button\u003e\"\n    when 'your_custom_component'\n      \"\u003cdiv class='welcome'\u003e#{data['welcome_text']}\u003c/div\u003e\"\n    end\n  }\n)\n\n# Option 2: Define the resolver afterwards\nclient.set_component_resolver(-\u003e(component, data) {\n  \"#{component}\"\n})\n```\n\n#### Contribute\n\nHow to build a gem file.\n\n~~~\ngem build storyblok.gemspec\ngem push storyblok-2.0.X.gem\n~~~\n\n#### Running Tests\nWe use [RSpec](http://rspec.info/) for testing.\n\n###### To run the whole test suite you will need export the environment variables, ATTENTION when running the test suit with the variable `REDIS_URL` exported, the test suite will remove the keys with this pattern `storyblok:*` from the redis database defined by `REDIS_URL`\n\n```bash\nexport REDIS_URL=\"redis://localhost:6379\"\n```\n\nOptionally you can generate the test report coverage by setting the environment variable\n\n```bash\nexport COVERAGE=true\n```\n\nTo run the whole test suite use the following command:\n\n```bash\nrspec\n```\n\nTo run tests without redis cache tests (for when you don't have redis, or to avoid the test suite to remove the keys with this pattern `storyblok:*` ):\n\n```bash\nrspec --tag ~redis_cache:true\n```\n\n## 🔗 Related Links\n\n* **[Storyblok \u0026 Ruby on GitHub](https://github.com/search?q=org%3Astoryblok+topic%3Aruby)**: Check all of our Ruby open source repos;\n* **[Storyblok \u0026 Ruby 5 minutes tutorial](https://www.storyblok.com/tp/ruby-on-rails-cms?utm_source=github.com\u0026utm_medium=readme\u0026utm_campaign=storyblok-ruby)**: will show you how you can use the API-based CMS Storyblok in combination with the Framework “Ruby on Rails”;\n* **[Technology Hub](https://www.storyblok.com/technologies?utm_source=github.com\u0026utm_medium=readme\u0026utm_campaign=storyblok-ruby)**: We prepared technology hubs so that you can find selected beginner tutorials, videos, boilerplates, and even cheatsheets all in one place;\n* **[Storyblok CLI](https://github.com/storyblok/storyblok)**: A simple CLI for scaffolding Storyblok projects and fieldtypes.\n\n## ℹ️ More Resources\n\n### Support\n\n* Bugs or Feature Requests? [Submit an issue](../../../issues/new);\n\n* Do you have questions about Storyblok or you need help? [Join our Discord Community](https://discord.gg/jKrbAMz).\n\n### Contributing\n\nPlease see our [contributing guidelines](https://github.com/storyblok/.github/blob/master/contributing.md) and our [code of conduct](https://www.storyblok.com/trust-center#code-of-conduct?utm_source=github.com\u0026utm_medium=readme\u0026utm_campaign=storyblok-ruby).\nThis project use [semantic-release](https://semantic-release.gitbook.io/semantic-release/) for generate new versions by using commit messages and we use the Angular Convention to naming the commits. Check [this question](https://semantic-release.gitbook.io/semantic-release/support/faq#how-can-i-change-the-type-of-commits-that-trigger-a-release) about it in semantic-release FAQ.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoryblok%2Fstoryblok-ruby-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstoryblok%2Fstoryblok-ruby-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoryblok%2Fstoryblok-ruby-client/lists"}