Module: CPEE::Properties

Defined in:
lib/cpee/implementation_properties.rb

Defined Under Namespace

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

Class Method Summary collapse

Class Method Details

.implementation(id, opts) ⇒ Object



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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/cpee/implementation_properties.rb', line 27

def self::implementation(id,opts)
  Proc.new do
    if CPEE::Persistence::exists?(id,opts)
      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 'executionhandler' do
        run CPEE::Properties::GetExecutionHandler, id, opts if get
        run CPEE::Properties::PutExecutionHandler, id, opts if put 'executionhandler'
      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
    else
      run CPEE::FAIL
    end
  end
end