acordion 0.dev0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ Gemfile.lock
30
+ .ruby-version
31
+ .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in acordion.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Dave Willkomm
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ ACORDion
2
+ ========
3
+
4
+ ACORDion is a collection of utilities for building and parsing ACORD XML documents.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+
data/acordion.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'acordion/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'acordion'
8
+ spec.version = Acordion::VERSION
9
+ spec.authors = ['Dave Willkomm']
10
+ spec.email = ['dinosaurjr10@gmail.com']
11
+ spec.summary = 'ACORD XML builder/parser'
12
+ spec.description = 'ACORDion is a collection of utilities for building and parsing ACORD XML documents.'
13
+ spec.homepage = 'https://github.com/dinosaurjr10/acordion'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'nokogiri', '~> 1.6'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.6'
24
+ spec.add_development_dependency 'rake', '~> 10.3'
25
+ spec.add_development_dependency 'rspec', '~> 3.0'
26
+ end
data/lib/acordion.rb ADDED
@@ -0,0 +1,12 @@
1
+ require 'acordion/olife'
2
+ require 'acordion/tx_life'
3
+ require 'acordion/tx_life_request'
4
+ require 'acordion/tx_life_request_10301'
5
+ require 'acordion/tx_life_schema'
6
+ require 'acordion/user_auth_request'
7
+ require 'acordion/version'
8
+ require 'nokogiri'
9
+
10
+ module Acordion
11
+ VERSION_2_31_00 = '2.31.00'
12
+ end
@@ -0,0 +1,7 @@
1
+ module Acordion
2
+ def self.OLifE(builder)
3
+ builder.OLifE {
4
+ yield if block_given?
5
+ }
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Acordion
2
+ def self.TxLife(builder, data)
3
+ builder.TXLife(Version: data[:version]) {
4
+ yield if block_given?
5
+ }
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module Acordion
2
+ def self.TxLifeRequest(builder, data)
3
+ builder.TXLifeRequest(PrimaryObjectID: data[:primary_object_id]) do |builder|
4
+ builder.TransRefGUID data[:trans_ref_guid]
5
+ builder.TransType tc: data[:trans_type]
6
+ builder.TransSubType tc: data[:trans_sub_type] if data[:trans_sub_type]
7
+
8
+ yield if block_given?
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ require 'securerandom'
2
+
3
+ module Acordion
4
+ def self.TxLifeRequest10301(data)
5
+ #TODO note that *must* used arity of 1 otherwise the binding will include the Acordion module and builder.Node (e.g. TXLife) will recurse
6
+ Nokogiri::XML::Builder.new do |builder|
7
+ trans_ref_guid = SecureRandom.uuid # Uniquely identifies this request instance. Returned in the response so that the client can correlate the response with the request.
8
+ holding_id = SecureRandom.uuid #TODO Used internally in the document to relate nodes
9
+
10
+ Acordion.TxLife builder, version: VERSION_2_31_00 do
11
+ Acordion.UserAuthRequest builder, {}
12
+ Acordion.TxLifeRequest(builder,
13
+ primary_object_id: holding_id,
14
+ trans_ref_guid: trans_ref_guid,
15
+ trans_type: 103,
16
+ trans_sub_type: 10301,
17
+ ) do
18
+ Acordion.OLifE builder do
19
+
20
+ end
21
+ #TODO Holding
22
+ #TODO Party
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ require 'nokogiri'
2
+ require 'singleton'
3
+
4
+ module Acordion
5
+ class TxLifeSchema
6
+ include Singleton
7
+
8
+ def version_2_31_00
9
+ get_schema VERSION_2_31_00
10
+ end
11
+
12
+ private
13
+
14
+ def get_schema(version)
15
+ @schema ||= {}
16
+ @schema[version] ||= Nokogiri::XML::Schema.new(
17
+ File.open(File.expand_path("../../../resources/TXLife#{version}.xsd", __FILE__))
18
+ )
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ module Acordion
2
+ def self.UserAuthRequest(builder, data)
3
+ builder.UserAuthRequest {
4
+ yield if block_given?
5
+ }
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module Acordion
2
+ VERSION = '0.dev0.1'
3
+ end
@@ -0,0 +1,22 @@
1
+ require 'acordion'
2
+
3
+ describe Acordion do
4
+ it 'should work' do
5
+ params = {
6
+ 'TXLife' => {
7
+ 'Version' => '2.31.00',
8
+ 'TXLifeRequest' => {
9
+ 'TansRefGUID' => SecureRandom.uuid,
10
+ 'TransType' => '103',
11
+ 'TransSubType' => '10301',
12
+ }
13
+ }
14
+ }
15
+ request = described_class.TxLifeRequest10301 params
16
+ puts request.to_xml
17
+ xsd = Acordion::TxLifeSchema.instance.version_2_31_00
18
+ xsd.validate(request.doc).each do |error|
19
+ expect(error).to be_nil
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acordion
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.dev0.1
5
+ prerelease: 2
6
+ platform: ruby
7
+ authors:
8
+ - Dave Willkomm
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-08-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nokogiri
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.6'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.6'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.6'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.6'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '10.3'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.3'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '3.0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '3.0'
78
+ description: ACORDion is a collection of utilities for building and parsing ACORD
79
+ XML documents.
80
+ email:
81
+ - dinosaurjr10@gmail.com
82
+ executables: []
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - .gitignore
87
+ - Gemfile
88
+ - LICENSE
89
+ - README.md
90
+ - Rakefile
91
+ - acordion.gemspec
92
+ - lib/acordion.rb
93
+ - lib/acordion/olife.rb
94
+ - lib/acordion/tx_life.rb
95
+ - lib/acordion/tx_life_request.rb
96
+ - lib/acordion/tx_life_request_10301.rb
97
+ - lib/acordion/tx_life_schema.rb
98
+ - lib/acordion/user_auth_request.rb
99
+ - lib/acordion/version.rb
100
+ - spec/lib/flacord/tx_life_request_10301_spec.rb
101
+ homepage: https://github.com/dinosaurjr10/acordion
102
+ licenses:
103
+ - MIT
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ! '>'
118
+ - !ruby/object:Gem::Version
119
+ version: 1.3.1
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 1.8.23.2
123
+ signing_key:
124
+ specification_version: 3
125
+ summary: ACORD XML builder/parser
126
+ test_files:
127
+ - spec/lib/flacord/tx_life_request_10301_spec.rb