Revision 4363e23a

View differences:

src/oca/ruby/OpenNebula/Document.rb
18 18

  
19 19
module OpenNebula
20 20

  
21
    # All subclasses must define the Document::TYPE constant.
21
    # All subclasses must define the DOCUMENT_TYPE constant.
22 22
    #
23 23
    # @example
24 24
    #   require 'OpenNebula/Document'
25 25
    #
26 26
    #   module OpenNebula
27 27
    #       class CustomObject < Document
28
    #   
29
    #           Document::TYPE = 400
28
    #
29
    #           DOCUMENT_TYPE = 400
30 30
    #
31 31
    #       end
32 32
    #   end
......
65 65
        #
66 66
        # @param [Nokogiri::XML::Node, REXML::Element] xml string
67 67
        #   created by the build_xml() method
68
        # @param [OpenNebula::Client] client the xml-rpc client 
68
        # @param [OpenNebula::Client] client the xml-rpc client
69 69
        #
70 70
        # @return [Document] the new object
71 71
        #
......
94 94
        # @return [nil, OpenNebula::Error] nil in case of success, Error
95 95
        #   otherwise
96 96
        def allocate(description)
97
            super(DOCUMENT_METHODS[:allocate], description, TYPE)
97
            super(DOCUMENT_METHODS[:allocate], description, document_type)
98 98
        end
99 99

  
100 100
        # Deletes the Document
......
187 187
            end
188 188
        end
189 189

  
190
        def document_type
191
            self.class::DOCUMENT_TYPE
192
        end
193

  
190 194
    private
191 195

  
192 196
        def set_publish(published)
src/oca/ruby/OpenNebula/DocumentPool.rb
18 18

  
19 19
module OpenNebula
20 20

  
21
    # All subclasses must define the DocumentPool::TYPE constant
21
    # All subclasses must define the DOCUMENT_TYPE constant
22 22
    # and the factory method.
23 23
    #
24 24
    # @example
......
27 27
    #   module OpenNebula
28 28
    #       class CustomObjectPool < DocumentPool
29 29
    #
30
    #           DocumentPool::TYPE = 400
30
    #           DOCUMENT_TYPE = 400
31 31
    #
32 32
    #           def factory(element_xml)
33 33
    #               OpenNebula::CustomObject.new(element_xml, @client)
......
72 72
        def info(*args)
73 73
            case args.size
74 74
                when 0
75
                    info_filter(DOCUMENT_POOL_METHODS[:info],@user_id,-1,-1, TYPE)
75
                    info_filter(DOCUMENT_POOL_METHODS[:info],@user_id,-1,-1, document_type)
76 76
                when 3
77
                    info_filter(DOCUMENT_POOL_METHODS[:info],args[0],args[1],args[2], TYPE)
77
                    info_filter(DOCUMENT_POOL_METHODS[:info],args[0],args[1],args[2], document_type)
78 78
            end
79 79
        end
80 80

  
81 81
        def info_all()
82
            return super(DOCUMENT_POOL_METHODS[:info], TYPE)
82
            return super(DOCUMENT_POOL_METHODS[:info], document_type)
83 83
        end
84 84

  
85 85
        def info_mine()
86
            return super(DOCUMENT_POOL_METHODS[:info], TYPE)
86
            return super(DOCUMENT_POOL_METHODS[:info], document_type)
87 87
        end
88 88

  
89 89
        def info_group()
90
            return super(DOCUMENT_POOL_METHODS[:info], TYPE)
90
            return super(DOCUMENT_POOL_METHODS[:info], document_type)
91
        end
92

  
93
        def document_type
94
            self.class::DOCUMENT_TYPE
91 95
        end
92 96
    end
93 97
end

Also available in: Unified diff