Sha256: 1af3bf19b7643c16b530583429bb3a1557ab9f075061468ca8fd4a1a2122d549

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

# bundle exec ruby examples/renderer.rb

require_relative '../lib/storyblok'

logger = Logger.new(STDOUT)

client = Storyblok::Client.new(
  token: '6HMYdAjBoONyuS6GIf5PdAtt',
  logger: logger,
  component_resolver: ->(component, data) {
    "Placeholder for #{component}: #{data['text']}"
  }
)

puts client.render({'type' => 'doc', 'content' => [
  {'type' => 'paragraph', 'content' => [{'text' => 'Good', 'type' => 'text'}]},
  {'type' => 'blok', 'attrs' => {'body' => [{'component' => 'button', 'text' => 'Click me'}]}}
]})

res = client.story('article/article-1')

puts res['data']['story']['content']['intro']
puts client.render(res['data']['story']['content']['intro'])

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
storyblok-2.0.8 examples/renderer.rb
storyblok-2.0.7 examples/renderer.rb
storyblok-2.0.6 examples/renderer.rb