Class: Sinatra::Schema::DSL::Resources

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra/schema/dsl/resources.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, path) ⇒ Resources



7
8
9
10
# File 'lib/sinatra/schema/dsl/resources.rb', line 7

def initialize(app, path)
  @app      = app
  @resource = Resource.new(path: path)
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



5
6
7
# File 'lib/sinatra/schema/dsl/resources.rb', line 5

def app
  @app
end

#resourceObject

Returns the value of attribute resource.



5
6
7
# File 'lib/sinatra/schema/dsl/resources.rb', line 5

def resource
  @resource
end

Instance Method Details

#delete(href = "/", &blk) ⇒ Object



20
21
22
# File 'lib/sinatra/schema/dsl/resources.rb', line 20

def delete(href="/", &blk)
  build_link(:delete, href, &blk)
end

#description(description) ⇒ Object



12
13
14
# File 'lib/sinatra/schema/dsl/resources.rb', line 12

def description(description)
  @resource.description = description
end

#get(href = "/", &blk) ⇒ Object



24
25
26
# File 'lib/sinatra/schema/dsl/resources.rb', line 24

def get(href="/", &blk)
  build_link(:get, href, &blk)
end

#patch(href = "/", &blk) ⇒ Object



28
29
30
# File 'lib/sinatra/schema/dsl/resources.rb', line 28

def patch(href="/", &blk)
  build_link(:patch, href, &blk)
end

#post(href = "/", &blk) ⇒ Object



32
33
34
# File 'lib/sinatra/schema/dsl/resources.rb', line 32

def post(href="/", &blk)
  build_link(:post, href, &blk)
end

#propertyObject



16
17
18
# File 'lib/sinatra/schema/dsl/resources.rb', line 16

def property
  DSL::Definitions.new(resource, [resource.defs, resource.properties])
end

#put(href = "/", &blk) ⇒ Object



36
37
38
# File 'lib/sinatra/schema/dsl/resources.rb', line 36

def put(href="/", &blk)
  build_link(:put, href, &blk)
end