Eancom

This software translates EDI to JSON messages. The following message types are supported:

  • ORDRSP
  • PRICAT
  • ORDERS
  • DESADV
  • INVOIC
  • SLSRPT
  • RETANN

It will be expanded into a fully fledged gem later on.

Translate EDI to JSON messages

In order to translate EDI to JSON messages, open the terminal and type in the following commands within the project structure.

  • bin/console
    Opens the console.
  • edi_file = File.open('filepath')
    Opens the EDI file that needs to be translated.
  • json = Eancom::Parser::Document.new(file: edi_file).parse.to_json
    Translates the EDI file to a JSON file and stores it under the name json.

Translate JSON to EDI messages

Similarily, in order to translate JSON to EDI messages, open the terminal and type the following commands within the project structure.

  • bin/console
    Opens the console.
  • json_file = File.open('filepath')
    Opens the EDI file that needs to be translated.
  • edi = Eancom::Factory.new(json: json_file.read).build.to_s
    Translates the JSON file to a EDI file and stores it under the name edi.

Supported message formats

The GS1 standard contains many different messaging formats. Two of the most popular ones are the D96A and the D01B formats, both of which are implemented in this translator. The main difference between them is how the messages are structured, not what kind of segments or descriptions they contain. Please respect the structure defined by these formats. Otherwise the translator may reject your file.

Usage

You can add this gem to your project by either installing it using bundle install prime-eancom or by adding gem "prime-eancom", "~> 0.1.0" to your Gemfile. If you choose the latter option, go to your projects file structure within the terminal, type bundle install and hit enter. The prime-eancom now serenely inhabits your project.

Testing

The prime-eancom is being tested with rspec. If you wan't to run the tests, go to the projects file structure within the terminal, type rspec and hit enter. You can also use bundle exec rspec spec/ if the former option doesn't work.