Sha256: a7672a0734085b29d494bcb490e89baa490a1f87a532ee5bed021667eeaecd24

Contents?: true

Size: 531 Bytes

Versions: 15

Compression:

Stored size: 531 Bytes

Contents

# bundle exec ruby examples/tree.rb

require 'storyblok'

logger = Logger.new(STDOUT)

client = Storyblok::Client.new(
  token: 't618GfLe1YHICBioAHnMrwtt',
  api_url: 'localhost:3001',
  secure: false,
  logger: logger
)

tree = client.tree

puts '<ul>'
tree.each do |key, item|
  puts '<li>' + item['item']['name']

  if !item['children'].empty?
    puts '<ul>'
    item['children'].each do |key, inner_item|
      puts '<li>' + inner_item['item']['name'] + '</li>'
    end
    puts '</ul>'
  end

  puts '</li>'
end
puts '</ul>'

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
storyblok-3.0.1 examples/tree.rb
storyblok-3.0.0 examples/tree.rb
storyblok-2.1.1 examples/tree.rb
storyblok-2.1.0 examples/tree.rb
storyblok-2.0.8 examples/tree.rb
storyblok-2.0.7 examples/tree.rb
storyblok-2.0.6 examples/tree.rb
storyblok-2.0.5 examples/tree.rb
storyblok-2.0.4 examples/tree.rb
storyblok-2.0.3 examples/tree.rb
storyblok-2.0.2 examples/tree.rb
storyblok-2.0.1 examples/tree.rb
storyblok-2.0.0 examples/tree.rb
storyblok-1.0.4 examples/tree.rb
storyblok-1.0.3 examples/tree.rb