Sha256: 09c9ab9ccf8c63d2272ab73530b65e28821b597bf539e3504f99af698850f307
Contents?: true
Size: 770 Bytes
Versions: 15
Compression:
Stored size: 770 Bytes
Contents
require 'json' module Eancom class Factory attr_reader :config, :definition, :document def initialize(json:) @config = JSON.parse(json, object_class: OpenStruct) @document = Eancom::Edifact::Document.new end def build @definition = Eancom.find_definition(name: name, type: type) @definition.run(document: document, config: config) @document end private def type type = header.message_type.downcase.to_sym if Eancom::FILE_TYPES.include?(type) type else raise Eancom::Error.new("EANCOM FILE TYPE NOT VALID!") end end def header config.header end def name header.message_version_number + header.message_release_number end end end
Version data entries
15 entries across 15 versions & 1 rubygems