Module: CPEE::Properties

Defined in:
lib/cpee/implementation_properties.rb

Defined Under Namespace

Classes: DelDetail, DelItem, Get, GetComplex, GetDetail, GetHandlerWrapper, GetItem, GetItems, GetPositions, GetPt, GetState, GetStateChanged, GetStateMachine, GetStatus, GetStatusID, GetStatusMessage, GetTransformation, Patch, PatchItems, PatchPositions, PostItem, PostPositions, Put, PutDescription, PutHandlerWrapper, PutItems, PutPositions, PutState, PutStatus, PutTransformation, SetDetail, SetItem

Class Method Summary collapse

Class Method Details

.implementation(id, opts) ⇒ Object



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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/cpee/implementation_properties.rb', line 11

def self::implementation(id,opts)
  Proc.new do
    run CPEE::Properties::Get, id, opts if get
    run CPEE::Properties::Patch, id, opts if patch 'set-some-properties'
    run CPEE::Properties::Put, id, opts if put 'set-some-properties'
    on resource 'state' do
      run CPEE::Properties::GetStateMachine, id, opts if get 'machine'
      run CPEE::Properties::GetState, id, opts if get
      run CPEE::Properties::PutState, id, opts if put 'state'
      on resource '@changed' do
        run CPEE::Properties::GetStateChanged, id, opts if get
      end
    end
    on resource 'status' do
      run CPEE::Properties::GetStatus, id, opts if get
      run CPEE::Properties::PutStatus, id, opts if put 'status'
      on resource 'id' do
        run CPEE::Properties::GetStatusID, id, opts if get
      end
      on resource 'message' do
        run CPEE::Properties::GetStatusMessage, id, opts if get
      end
    end
    on resource 'handlerwrapper' do
      run CPEE::Properties::GetHandlerWrapper, id, opts if get
      run CPEE::Properties::PutHandlerWrapper, id, opts if put 'handlerwrapper'
    end
    on resource 'positions' do
      run CPEE::Properties::GetPositions, id, opts if get
      run CPEE::Properties::PatchPositions, id, opts if patch 'positions'
      run CPEE::Properties::PutPositions, id, opts if put 'positions'
      run CPEE::Properties::PostPositions, id, opts if post 'position'
      on resource do
        run CPEE::Properties::GetDetail, 'positions', id, opts if get
        run CPEE::Properties::SetDetail, id, opts if put 'detail'
        run CPEE::Properties::DelDetail, id, opts if delete
        on resource '@passthrough' do
          run CPEE::Properties::GetPt, id, opts if get
        end
      end
    end
    %w{dataelements endpoints attributes}.each do |ele|
      on resource ele do
        run CPEE::Properties::GetItems, ele, id, opts if get
        run CPEE::Properties::PatchItems, ele, id, opts if patch ele
        run CPEE::Properties::PutItems, ele, id, opts if put ele
        run CPEE::Properties::PostItem, ele, id, opts if post ele[0..-2]
        on resource do
          run CPEE::Properties::GetItem, ele, id, opts if get
          run CPEE::Properties::SetItem, ele, id, opts if put 'string'
          run CPEE::Properties::DelItem, ele, id, opts if delete
        end
      end
    end
    on resource 'dsl' do
      run CPEE::Properties::GetComplex, 'dsl', 'text/plain', id, opts if get
    end
    on resource 'dslx' do
      run CPEE::Properties::GetComplex, 'dslx', 'text/xml', id, opts if get
    end
    on resource 'description' do
      run CPEE::Properties::GetComplex, 'description', 'text/xml', id, opts if get
      run CPEE::Properties::PutDescription, id, opts if put 'description'
    end
    on resource 'transformation' do
      run CPEE::Properties::GetTransformation, id, opts if get
      run CPEE::Properties::PutTransformation, id, opts if put 'transformation'
    end
  end
end