Sha256: 2181e5ec9380d89eb035a5c4cf83061c1f4f8db75f4cc67bcbaafc8196ecd0a6

Contents?: true

Size: 522 Bytes

Versions: 3

Compression:

Stored size: 522 Bytes

Contents

module Spontaneous::Rack::Back
  class Map < Base
    get '/?:id?' do
      last_modified(Spontaneous::Site.modified_at)
      map = Spontaneous::Site.map(params[:id])
      if map
        json(map)
      else
        404
      end
    end

    get '/path*' do
      last_modified(Spontaneous::Site.modified_at)
      if content_model::Page.count == 0
        406
      else
        path = params[:splat].first
        page = Spontaneous::Site[path]
        json Spontaneous::Site.map(page.id)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta4 lib/spontaneous/rack/back/map.rb
spontaneous-0.2.0.beta3 lib/spontaneous/rack/back/map.rb
spontaneous-0.2.0.beta2 lib/spontaneous/rack/back/map.rb