Code Monkey home page Code Monkey logo

edi4r's Introduction

= EDI TOOLKIT for RUBY (edi4r)

This is Ruby gem <b>edi4r</b> version 
:include:VERSION

Edi4r was created to greatly simplify the creation and processing of data for
Electronic Data Interchange (EDI). In particular, it supports the UN/EDIFACT
syntax (ISO 9573) and optionally SAP IDocs.
 
== Installation

Install it as any other Ruby gem, e.g.:

  sudo gem install edi4r-<version>.gem

== Usage

  require 'rubygems'
  require_gem 'edi4r'
  require 'edi4r/edifact' # optional

  # Build a UN/EDIFACT interchange from its character representation in a file:
  
  ic = nil
  File.open("received.edi") {|hnd| ic = EDI::E::Interchange.parse( hnd ) }
  ic.each do |msg|
    # Process message, here: Just list document numbers from (only) segment BGM
    puts msg['BGM'].first.d1004
  end

  # Create a minimalistic interchange

  ic  = EDI::E::Interchange.new  # Default: syntax version=3, charset = UNOB
  msg = ic.new_message           # Default: ORDERS D.96A

  bgm = msg.new_segment('BGM')   # Obtain an empty segment
  bgm.cC002.d1001 = '220'	 # Add some content to mandatory elements
  bgm.d1004 = 'PO-54321'
  dtm = msg.new_segment('DTM')
  dtm.cC507.d2005 = '137'
  uns = msg.new_segment('UNS')
  uns.d0081 = 'S'
  [bgm, dtm, uns].each {|seg| msg.add seg} # Add segments to message
  ic.add msg                     # Add message to interchange - ready to go!

  ic.header.cS002.d0004 = 'sender'; ic.header.cS003.d0010 = 'recipient' # UNB
  ic.validate # Conforming to standard?
  print ic    # Could be sent that way!

== See also

* Background[link:files/lib/edi4r_rb.html] info about data structure and classes. 

* A Tutorial[link:files/Tutorial.html] for examples of use.

* A ChangeLog[link:files/ChangeLog.html] will be maintained; it is just starting now.

* Finally, see TO-DO[link:files/TO-DO.html] for the current wish list.

* This code is put under the Ruby license, see COPYING[link:files/COPYING.html] for details.

:include:AuthorCopyright

Enjoy,

Heinz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.