class Sinatra::Schema::DSL::Resources

Attributes

app[RW]
resource[RW]

Public Class Methods

new(app, path_or_id) click to toggle source
# File lib/sinatra/schema/dsl/resources.rb, line 7
def initialize(app, path_or_id)
  @app = app
  if path_or_id.is_a?(Symbol)
    @resource = Resource.new(id: path_or_id)
  else
    @resource = Resource.new(path: path_or_id)
  end
end

Public Instance Methods

delete(href="/", &blk) click to toggle source
# File lib/sinatra/schema/dsl/resources.rb, line 32
def delete(href="/", &blk)
  build_link(:delete, href, &blk)
end
description(description) click to toggle source
# File lib/sinatra/schema/dsl/resources.rb, line 16
def description(description)
  @resource.description = description
end
get(href="/", &blk) click to toggle source
# File lib/sinatra/schema/dsl/resources.rb, line 36
def get(href="/", &blk)
  build_link(:get, href, &blk)
end
id(id) click to toggle source
# File lib/sinatra/schema/dsl/resources.rb, line 20
def id(id)
  @resource.id = id.to_sym
end
patch(href="/", &blk) click to toggle source
# File lib/sinatra/schema/dsl/resources.rb, line 40
def patch(href="/", &blk)
  build_link(:patch, href, &blk)
end
post(href="/", &blk) click to toggle source
# File lib/sinatra/schema/dsl/resources.rb, line 44
def post(href="/", &blk)
  build_link(:post, href, &blk)
end
property() click to toggle source
# File lib/sinatra/schema/dsl/resources.rb, line 28
def property
  DSL::Definitions.new(resource, [resource.defs, resource.properties])
end
put(href="/", &blk) click to toggle source
# File lib/sinatra/schema/dsl/resources.rb, line 48
def put(href="/", &blk)
  build_link(:put, href, &blk)
end
title(title) click to toggle source
# File lib/sinatra/schema/dsl/resources.rb, line 24
def title(title)
  @resource.title = title
end

Protected Instance Methods