Sha256: bfd88ef095837e0848e27a62649c8c5dd657b9afb330354dd6977462b2a1e521

Contents?: true

Size: 1.69 KB

Versions: 42

Compression:

Stored size: 1.69 KB

Contents

# sbJson 1.0 writer

# History:
#  Stan Smith 2017-05-22 original script

require_relative 'sbJson_codelists'

module ADIWG
   module Mdtranslator
      module Writers
         module SbJson

            module Rights

               def self.build(aConstraints, aDistributionInfo)

                  rights = ''

                  aConstraints.each do |hConstraint|
                     if hConstraint[:type] = 'legal'
                        unless hConstraint[:legalConstraint].empty?

                           # map legal constraint usage restriction codes
                           hConstraint[:legalConstraint][:useCodes].each do |code|
                              codeDef = Codelists.get_code_definition('iso_restriction', code)
                              unless codeDef.nil?
                                 rights += code + ' - ' + codeDef + '; '
                              end
                           end

                           # map other legal constraints
                           hConstraint[:legalConstraint][:otherCons].each do |con|
                              rights += con + '; '
                           end

                        end
                     end
                  end

                  aDistributionInfo.each do |hDistribution|
                     unless hDistribution[:liabilityStatement].nil?
                        rights += hDistribution[:liabilityStatement] + '; '
                     end
                  end

                  # clean off last semicolon
                  if rights.length > 2
                     rights = rights[0...-2]
                  end

                  rights

               end

            end

         end
      end
   end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.19.0.pre.beta.31 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.30 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.29 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.28 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.27 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.26 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.13 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.12 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.11 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.10 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.9 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.8 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.19.0.pre.beta.7 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.18.4 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.18.2 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.18.1 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.18.0 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.18.0rc9 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.18.0rc8 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.18.0rc7 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb