eddy 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff143c2c6caaef18067adde4cdd0fbea603e487726eab041b53e5c5e26c5f2a4
4
- data.tar.gz: 04c50a0a9c596c72a626c97e048b872698050a81f7c38a1fe2b6e33856a5f24e
3
+ metadata.gz: 90e30433d3481cfb057ca31480ae6ee1e30ba06df8a58439fc20f28e9bf231b3
4
+ data.tar.gz: 8f5e0429739292acc29f9a4135f945cee429e409d08321b6cffc3efdff841f2d
5
5
  SHA512:
6
- metadata.gz: 57f2b71dfd3fb443f174aef086c219821193adffa2e2878472b3cdee0ea075b7d9781b0899921994d9d1d385be2f7f99ad75fd71b31dcd6e0f6daba8407e989a
7
- data.tar.gz: 8ca2545fb05a98e10b30738f7d88982fa1cdc7f45f1200b804333a1acb3a40eaf2bf489de00e4bde4df127b54933e2e4618de9a4b8d3ee6e8b13717cb213a8da
6
+ metadata.gz: 26e9c3a97fba8c9e680ba924462f9cc9546616332808912bb2050901b7c6de07fe88664bd579dd5510b44f9e3a7e0f89482f86eb5386be90cf2530e7f1f34e68
7
+ data.tar.gz: eed5bc960e5c8c7cdbe6deef40a194219dbe9ea98222113342fa4ed237f0a5c1eeeafa30637583e2526d27142ad93f0bc9841923d289a7be4a7560f3aba39a23
data/CHANGELOG.md CHANGED
@@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
 
14
14
  ## master (unreleased)
15
15
 
16
+ ## 0.8.1 (2020-01-08)
17
+
18
+ ### Changed
19
+
20
+ - Add `control_number` attribute to the following classes:
21
+ - `Eddy::Models::Interchange`
22
+ - `Eddy::Models::TransactionSet`
23
+ - `Eddy::Models::FunctionalGroup`
24
+
16
25
  ## 0.8.0 (2020-01-08)
17
26
 
18
27
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eddy (0.8.0)
4
+ eddy (0.8.1)
5
5
  ginny (~> 0.6.3)
6
6
  json_schemer (~> 0.2.8)
7
7
  thor (~> 1.0.1)
data/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  [travis-ci]: https://travis-ci.org/tcd/eddy
11
11
  [coveralls]: https://coveralls.io/github/tcd/eddy?branch=master
12
12
  [license]: https://github.com/tcd/eddy/blob/master/LICENSE.txt
13
- [docs]: https://www.rubydoc.info/gems/eddy/0.8.0
13
+ [docs]: https://www.rubydoc.info/gems/eddy/0.8.1
14
14
 
15
15
  ## Installation
16
16
 
@@ -67,24 +67,6 @@ module Eddy
67
67
  self.application_receivers_code = "receiver_id"
68
68
  self.version_release_industry_id_code = "004010"
69
69
  end
70
-
71
- # @return [Integer]
72
- def interchange_control_number()
73
- return Eddy::Data.new_interchange_control_number()
74
- end
75
-
76
- # @param transaction_set_id [String]
77
- # @return [Integer]
78
- def transaction_set_control_number(transaction_set_id)
79
- return Eddy::Data.new_transaction_set_control_number(transaction_set_id)
80
- end
81
-
82
- # @param functional_group [String]
83
- # @return [Integer]
84
- def functional_group_control_number(functional_group)
85
- return Eddy::Data.new_functional_group_control_number(functional_group)
86
- end
87
-
88
70
  end
89
71
  end
90
72
  end
@@ -5,8 +5,12 @@ module Eddy
5
5
 
6
6
  # @return [String]
7
7
  attr_reader :id
8
- # @return [Eddy::Data::Store] Data store for the Interchange and all encompassed components.
8
+ # Data store for the Interchange and all encompassed components.
9
+ # @return [Eddy::Data::Store]
9
10
  attr_accessor :store
11
+ # A unique control number for the Functional Group.
12
+ # @return [Integer]
13
+ attr_accessor :control_number
10
14
  # An array of Transaction Set instances.
11
15
  # @return [Array<Eddy::Models::TransactionSet>]
12
16
  attr_accessor :transaction_sets
@@ -22,13 +26,13 @@ module Eddy
22
26
  raise ArgumentError, "At least one transaction set is required to create a functional group"
23
27
  end
24
28
  @id = self.transaction_sets.first.functional_group
29
+ self.control_number = Eddy::Data.new_functional_group_control_number(@id)
25
30
  end
26
31
 
27
32
  # @return [Array<#render>]
28
33
  def render()
29
- f_group_ctrl_num = Eddy::Data.new_functional_group_control_number(@id)
30
- gs = Eddy::Segments::GS.new(store, f_group_ctrl_num, @id)
31
- ge = Eddy::Segments::GE.new(store, f_group_ctrl_num, self.transaction_sets.length)
34
+ gs = Eddy::Segments::GS.new(self.store, self.control_number, @id)
35
+ ge = Eddy::Segments::GE.new(self.store, self.control_number, self.transaction_sets.length)
32
36
  return [gs, self.transaction_sets, ge].flatten.map(&:render)
33
37
  end
34
38
 
@@ -4,12 +4,16 @@ module Eddy
4
4
  class Interchange
5
5
  # @return [Eddy::Data::Store] Data store for the Interchange.
6
6
  attr_accessor :store
7
+ # A unique control number for the Interchange.
8
+ # @return [Integer]
9
+ attr_accessor :control_number
7
10
  # @return [Array<Eddy::Models::TransactionSet>]
8
11
  attr_accessor :transaction_sets
9
12
 
10
13
  # @param store [Eddy::Data::Store] (Eddy::Data::Store.new)
11
14
  # @return [void]
12
15
  def initialize(store = Eddy::Data::Store.new())
16
+ self.control_number = Eddy::Data.new_interchange_control_number()
13
17
  self.store = store
14
18
  self.transaction_sets = []
15
19
  end
@@ -25,11 +29,10 @@ module Eddy
25
29
  # @yieldparam [Eddy::Segments::IEA] iea
26
30
  # @return [String]
27
31
  def render()
28
- ctrl_num = Eddy::Data.new_interchange_control_number()
29
32
  f_groups = self.functional_groups()
30
33
  sep = self.store.segment_separator
31
- isa = Eddy::Segments::ISA.new(self.store, ctrl_num)
32
- iea = Eddy::Segments::IEA.new(self.store, ctrl_num, f_groups.length)
34
+ isa = Eddy::Segments::ISA.new(self.store, self.control_number)
35
+ iea = Eddy::Segments::IEA.new(self.store, self.control_number, f_groups.length)
33
36
  yield(isa, iea) if block_given?
34
37
  return [isa, f_groups, iea].flatten.map(&:render).join(sep) + sep
35
38
  end
@@ -12,8 +12,12 @@ module Eddy
12
12
 
13
13
  # @return [Array<Segment, Loop>]
14
14
  attr_accessor :components
15
- # @return [Eddy::Data::Store] Container used to distribute state throughout an Interchange.
15
+ # Container used to distribute state throughout an Interchange.
16
+ # @return [Eddy::Data::Store]
16
17
  attr_accessor :store
18
+ # A unique control number for the Transaction Set.
19
+ # @return [Integer]
20
+ attr_accessor :control_number
17
21
 
18
22
  # @param store [Eddy::Data::Store]
19
23
  # @param components [Array<Segment, Loop>]
@@ -22,6 +26,7 @@ module Eddy
22
26
  self.store = store
23
27
  components.flatten!
24
28
  self.components = components || []
29
+ self.control_number = Eddy::Data.new_transaction_set_control_number(self.id)
25
30
  end
26
31
 
27
32
  # @return [String]
@@ -56,16 +61,15 @@ module Eddy
56
61
 
57
62
  # Add `ST` and `SE` segments to the `components` array.
58
63
  #
59
- # @param control_number [Integer] (Eddy::Data.new_transaction_set_control_number())
60
64
  # @return [void]
61
- def add_envelope(control_number = Eddy::Data.new_transaction_set_control_number(self.id))
65
+ def add_envelope()
62
66
  st = Eddy::Segments::ST.new(self.store)
63
67
  st.TransactionSetIdentifierCode = self.id
64
- st.TransactionSetControlNumber = control_number
68
+ st.TransactionSetControlNumber = self.control_number
65
69
 
66
70
  se = Eddy::Segments::SE.new(self.store)
67
71
  se.NumberOfIncludedSegments = self.all_components.length + 2
68
- se.TransactionSetControlNumber = control_number
72
+ se.TransactionSetControlNumber = self.control_number
69
73
 
70
74
  self.components.unshift(st)
71
75
  self.components.push(se)
data/lib/eddy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eddy
2
- VERSION = "0.8.0".freeze
2
+ VERSION = "0.8.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clay Dunston
@@ -1569,7 +1569,7 @@ metadata:
1569
1569
  homepage_uri: https://github.com/tcd/eddy
1570
1570
  source_code_uri: https://github.com/tcd/eddy
1571
1571
  changelog_uri: https://github.com/tcd/eddy/blob/master/CHANGELOG.md
1572
- documentation_uri: https://www.rubydoc.info/gems/eddy/0.8.0
1572
+ documentation_uri: https://www.rubydoc.info/gems/eddy/0.8.1
1573
1573
  yard.run: yri
1574
1574
  post_install_message:
1575
1575
  rdoc_options: []