Module: Riddl::Utils::Properties

Defined in:
lib/ruby/riddl/utils/properties.rb

Defined Under Namespace

Classes: AddContent, AddProperties, AddProperty, All, Backend, DelContent, GetContent, HandlerBase, Properties, PtcContent, Query, RngSchema, Schema, UpdContent

Constant Summary collapse

VERSION_MAJOR =
1
VERSION_MINOR =
0
PROPERTIES_SCHEMA_XSL_RNG =
"#{File.dirname(__FILE__)}/../ns/common-patterns/properties/#{VERSION_MAJOR}.#{VERSION_MINOR}/properties.schema.xsl"

Class Method Summary collapse

Class Method Details

.implementation(backend, handler = nil, details = :production) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ruby/riddl/utils/properties.rb', line 9

def self::implementation(backend,handler=nil,details=:production)
  unless handler.nil? || (handler.is_a? Riddl::Utils::Properties::HandlerBase)
    raise "handler not a subclass of HandlerBase"
  end
  Proc.new do
    run          Riddl::Utils::Properties::All,           backend, handler if get    '*'
    run          Riddl::Utils::Properties::Query,         backend, handler if get    'query'
    on resource 'schema' do
      run        Riddl::Utils::Properties::Schema,        backend          if get
      on resource 'rng' do
        run      Riddl::Utils::Properties::RngSchema,     backend          if get
      end
    end
    on resource 'values' do
      run        Riddl::Utils::Properties::Properties,    backend, handler if get
      run        Riddl::Utils::Properties::AddProperty,   backend, handler if post   'property'
      run        Riddl::Utils::Properties::AddProperties, backend, handler if put    'properties'
      on resource do
        run      Riddl::Utils::Properties::GetContent,    backend, handler if get
        run      Riddl::Utils::Properties::DelContent,    backend, handler if delete
        run      Riddl::Utils::Properties::AddContent,    backend, handler if post   'addcontent'
        run      Riddl::Utils::Properties::UpdContent,    backend, handler if put    'updcontent'
        run      Riddl::Utils::Properties::PtcContent,    backend, handler if patch  'updcontent'
        on resource do
          run    Riddl::Utils::Properties::GetContent,    backend, handler if get
          run    Riddl::Utils::Properties::DelContent,    backend, handler if delete
          run    Riddl::Utils::Properties::UpdContent,    backend, handler if put    'updcontent'
          on resource do
            run  Riddl::Utils::Properties::GetContent,    backend, handler if get
          end
        end
      end
    end
  end
end