Sha256: 566a1b82b101b4e4d35baa018db32d2a8453c3fb488ee9c4d326cee5ee298251

Contents?: true

Size: 517 Bytes

Versions: 3

Compression:

Stored size: 517 Bytes

Contents

require 'storyblok'

logger = Logger.new(STDOUT)

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

links = client.links
tree = links.as_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

3 entries across 3 versions & 1 rubygems

Version Path
storyblok-1.0.2 examples/tree.rb
storyblok-1.0.1 examples/tree.rb
storyblok-1.0.0 examples/tree.rb