This gem provides convenience ruby classes to work with ISO 20022 messages.
The provided classes are happymapper classes with types defined for all elements. This makes consuming ISO 20022 messages easy.
Additionally, messages can be serialized to XML which allows constructing and sending messages.
Add this line to your application's Gemfile:
gem 'ruby_iso20022', git: 'https://github.com/wunderschild/ruby_iso20022'
And then execute:
$ bundle install
Suppose you have the XML messages string in variable xml
:
xml = '<?xml version="1.0" encoding="UTF-8"?><Document xmlns="urn:iso"...'
Load the gem:
require 'ruby_iso20022'
And you know that xml contains a single pain.001.001 message. Then you can easily consume this message:
document = RubyIso20022::Pain001001::Document.parse(xml, single: true)
When we have the parsed document
, we can easily extract any field of the message.
For example, we can get the message id like this:
document.cstmr_cdt_trf_initn.grp_hdr.msg_id
Code generation is done via jaxb2ruby
. To set up the development environment,
- Uncomment
jaxb2ruby
dependency in Gemfile - Run
bundle install
with jruby. JAXB should be installed (xjc
should be in PATH). We recommend using the provideddocker-compose.yml
to get the development environment running with required dependencies. - Rub
rake ruby_all
to download message definitions and to generate classes.
Bug reports and pull requests are welcome on GitHub at https://github.com/wunderschild/ruby_iso20022.
The gem is available as open source under the terms of the MIT License.