Module: ADIWG::Mdtranslator::Readers::MdJson::Schema

Defined in:
lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb

Class Method Summary collapse

Class Method Details

.unpack(hSchema, responseObj) ⇒ Object



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
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb', line 15

def self.unpack(hSchema, responseObj)

   @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson

   # return nil object if input is empty
   if hSchema.empty?
      @MessagePath.issueError(720, responseObj)
      return nil
   end

   # instance classes needed in script
   intMetadataClass = .new
   intSchema = intMetadataClass.newSchema

   # schema - name (required)
   if hSchema.has_key?('name')
      intSchema[:name] = hSchema['name']
   end
   if intSchema[:name].nil? || intSchema[:name] == ''
      @MessagePath.issueError(721, responseObj)
   end

   # schema - version (required)
   if hSchema.has_key?('version')
      intSchema[:version] = hSchema['version']
   end
   if intSchema[:version].nil? || intSchema[:version] == ''
      @MessagePath.issueWarning(722, responseObj)
   end

   return intSchema

end