efo_nelfo 0.0.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Guardfile +2 -1
- data/efo_nelfo.gemspec +1 -0
- data/lib/efo_nelfo/collection.rb +44 -0
- data/lib/efo_nelfo/errors.rb +4 -2
- data/lib/efo_nelfo/has_many.rb +70 -0
- data/lib/efo_nelfo/post_head_type.rb +30 -0
- data/lib/efo_nelfo/post_type.rb +26 -23
- data/lib/efo_nelfo/property.rb +18 -1
- data/lib/efo_nelfo/reader/csv.rb +1 -1
- data/lib/efo_nelfo/v40/{order/order.rb → bh.rb} +13 -45
- data/lib/efo_nelfo/v40/bl.rb +30 -0
- data/lib/efo_nelfo/v40/bt.rb +15 -0
- data/lib/efo_nelfo/v40/va.rb +11 -0
- data/lib/efo_nelfo/v40/vh.rb +24 -0
- data/lib/efo_nelfo/v40/vl.rb +34 -0
- data/lib/efo_nelfo/v40/vx.rb +9 -0
- data/lib/efo_nelfo/version.rb +1 -1
- data/lib/efo_nelfo.rb +10 -7
- data/spec/collection_spec.rb +68 -0
- data/spec/csv_writer_spec.rb +11 -11
- data/spec/efo_nelfo_spec.rb +76 -18
- data/spec/post_type_spec.rb +63 -0
- data/spec/property_spec.rb +14 -0
- data/spec/samples/rabatt.csv +1234 -0
- data/spec/samples/varefil_eksempel.csv +10 -0
- data/spec/samples/varer.csv +75429 -0
- data/spec/samples/varer_small.csv +10 -0
- data/spec/spec_helper.rb +7 -1
- metadata +39 -8
- data/lib/efo_nelfo/array.rb +0 -25
- data/lib/efo_nelfo/attribute_assignment.rb +0 -13
- data/lib/efo_nelfo/v40/order/line.rb +0 -50
- data/lib/efo_nelfo/v40/order/text.rb +0 -22
@@ -0,0 +1,10 @@
|
|
1
|
+
VH;EFONELFO;4.0;NO939765360MVA;;;20110901;20111231;NOK;;ETMAN DISTRIBUSJON AS;GAMLE EIGER�YVEI 87;;4370;EGERSUND;NO
|
2
|
+
VL;1;1006100;MATTE 3MM 100W/M2 100W;1,0 m2 0,5 x 2,0 m;1;EA;STYKK;55300;10000;20110901;1;;1004;;;J;10000;0;
|
3
|
+
VL;1;1006101;MATTE 3MM 100W/M2 150W;1,5 m2 0,5 x 3,0 m ;1;EA;STYKK;68900;10000;20110901;1;;1004;;;J;10000;0;
|
4
|
+
VL;1;1006102;MATTE 3MM 100W/M2 201W;2,0 m2 0,5 x 4,0 m ;1;EA;STYKK;72100;10000;20110901;1;;1004;;;J;10000;0;
|
5
|
+
VL;1;1006103;MATTE 3MM 100W/M2 230W;3,1 m2 0,5 x 6,2 m ;1;EA;STYKK;84500;10000;20110901;1;;1004;;;J;10000;0;
|
6
|
+
VL;1;1006104;MATTE 3MM 100W/M2 400W;4,1 m2 0,5 x 8,2 m ;1;EA;STYKK;105600;10000;20110901;1;;1004;;;J;10000;0;
|
7
|
+
VL;1;1006105;MATTE 3MM 100W/M2 486W;4,9 m2 0,5 x 9,8 m;1;EA;STYKK;124900;10000;20110901;1;;1004;;;J;10000;0;
|
8
|
+
VL;1;1006106;MATTE 3MM 100W/M2 580W;5,8 m2 0,5 x 11,6 m;1;EA;STYKK;145100;10000;20110901;1;;1004;;;J;10000;0;
|
9
|
+
VL;1;1006107;MATTE 3MM 100W/M2 700W;7,0 m2 0,5 x 14,0 m ;1;EA;STYKK;173900;10000;20110901;1;;1004;;;J;10000;0;
|
10
|
+
VL;1;1006108;MATTE 3MM 100W/M2 827W;8,3 m2 0,5 x 16,65 m;1;EA;STYKK;202800;10000;20110901;1;;1004;;;J;10000;0;
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: efo_nelfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gudleik Rasch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: turn
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Parser for EFONELFO format
|
98
112
|
email:
|
99
113
|
- gr@skalar.no
|
@@ -109,18 +123,25 @@ files:
|
|
109
123
|
- Rakefile
|
110
124
|
- efo_nelfo.gemspec
|
111
125
|
- lib/efo_nelfo.rb
|
112
|
-
- lib/efo_nelfo/
|
113
|
-
- lib/efo_nelfo/attribute_assignment.rb
|
126
|
+
- lib/efo_nelfo/collection.rb
|
114
127
|
- lib/efo_nelfo/errors.rb
|
128
|
+
- lib/efo_nelfo/has_many.rb
|
129
|
+
- lib/efo_nelfo/post_head_type.rb
|
115
130
|
- lib/efo_nelfo/post_type.rb
|
116
131
|
- lib/efo_nelfo/property.rb
|
117
132
|
- lib/efo_nelfo/reader/csv.rb
|
118
|
-
- lib/efo_nelfo/v40/
|
119
|
-
- lib/efo_nelfo/v40/
|
120
|
-
- lib/efo_nelfo/v40/
|
133
|
+
- lib/efo_nelfo/v40/bh.rb
|
134
|
+
- lib/efo_nelfo/v40/bl.rb
|
135
|
+
- lib/efo_nelfo/v40/bt.rb
|
136
|
+
- lib/efo_nelfo/v40/va.rb
|
137
|
+
- lib/efo_nelfo/v40/vh.rb
|
138
|
+
- lib/efo_nelfo/v40/vl.rb
|
139
|
+
- lib/efo_nelfo/v40/vx.rb
|
121
140
|
- lib/efo_nelfo/version.rb
|
141
|
+
- spec/collection_spec.rb
|
122
142
|
- spec/csv_writer_spec.rb
|
123
143
|
- spec/efo_nelfo_spec.rb
|
144
|
+
- spec/post_type_spec.rb
|
124
145
|
- spec/property_spec.rb
|
125
146
|
- spec/samples/B028579.594.csv
|
126
147
|
- spec/samples/B028579.595.csv
|
@@ -131,6 +152,10 @@ files:
|
|
131
152
|
- spec/samples/B650517.031.csv
|
132
153
|
- spec/samples/B650517.032.csv
|
133
154
|
- spec/samples/V4_varefil.csv
|
155
|
+
- spec/samples/rabatt.csv
|
156
|
+
- spec/samples/varefil_eksempel.csv
|
157
|
+
- spec/samples/varer.csv
|
158
|
+
- spec/samples/varer_small.csv
|
134
159
|
- spec/spec_helper.rb
|
135
160
|
homepage: http://efo.no
|
136
161
|
licenses:
|
@@ -152,13 +177,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
177
|
version: '0'
|
153
178
|
requirements: []
|
154
179
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.0.
|
180
|
+
rubygems_version: 2.0.2
|
156
181
|
signing_key:
|
157
182
|
specification_version: 4
|
158
183
|
summary: Parser for EFONELFO format
|
159
184
|
test_files:
|
185
|
+
- spec/collection_spec.rb
|
160
186
|
- spec/csv_writer_spec.rb
|
161
187
|
- spec/efo_nelfo_spec.rb
|
188
|
+
- spec/post_type_spec.rb
|
162
189
|
- spec/property_spec.rb
|
163
190
|
- spec/samples/B028579.594.csv
|
164
191
|
- spec/samples/B028579.595.csv
|
@@ -169,4 +196,8 @@ test_files:
|
|
169
196
|
- spec/samples/B650517.031.csv
|
170
197
|
- spec/samples/B650517.032.csv
|
171
198
|
- spec/samples/V4_varefil.csv
|
199
|
+
- spec/samples/rabatt.csv
|
200
|
+
- spec/samples/varefil_eksempel.csv
|
201
|
+
- spec/samples/varer.csv
|
202
|
+
- spec/samples/varer_small.csv
|
172
203
|
- spec/spec_helper.rb
|
data/lib/efo_nelfo/array.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
|
3
|
-
module EfoNelfo
|
4
|
-
|
5
|
-
class Array
|
6
|
-
include Enumerable
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def_delegators :@list, :[], :each, :<<, :last, :size, :empty?
|
10
|
-
|
11
|
-
def initialize(*args)
|
12
|
-
@list = []
|
13
|
-
end
|
14
|
-
|
15
|
-
def to_a
|
16
|
-
map(&:to_a).flatten(1)
|
17
|
-
end
|
18
|
-
|
19
|
-
protected
|
20
|
-
attr_reader :list
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module EfoNelfo
|
3
|
-
module V40
|
4
|
-
class Order
|
5
|
-
class Line < EfoNelfo::PostType
|
6
|
-
POST_TYPES = {
|
7
|
-
'BL' => 'Bestilling vareLinjepost',
|
8
|
-
'IL' => 'Forespørsel vareLinjepost'
|
9
|
-
}
|
10
|
-
|
11
|
-
# It's important to list the property in the same order as specified in the specs
|
12
|
-
property :post_type, alias: :PostType, limit: 2, default: 'BL'
|
13
|
-
property :index, alias: :LinjeNr, limit: 4, type: :integer
|
14
|
-
property :order_number, alias: :BestNr, limit: 10, required: true
|
15
|
-
property :item_type, alias: :VareMrk, limit: 1, required: true, type: :integer
|
16
|
-
property :item_number, alias: :VareNr, limit: 14, required: true
|
17
|
-
property :item_name, alias: :VaBetg, limit: 30, required: true
|
18
|
-
property :item_description, alias: :VaBetg2, limit: 30
|
19
|
-
property :item_count, alias: :Ant, limit: 9, required: true, type: :integer
|
20
|
-
property :price_unit, alias: :PrisEnhet, limit: 3, required: true
|
21
|
-
property :buyer_item_number, alias: :KVareNr, limit: 25
|
22
|
-
property :delivery_date, alias: :LevDato, type: :date
|
23
|
-
property :buyer_ref, alias: :KjøpersRef, limit: 25
|
24
|
-
property :splitable, alias: :DelLev, type: :boolean, default: true
|
25
|
-
property :replacable, alias: :AltKode, type: :boolean, default: true
|
26
|
-
|
27
|
-
attr_reader :text
|
28
|
-
|
29
|
-
# Returns an array with one or more elements
|
30
|
-
def to_a
|
31
|
-
[ super, text.to_a ].reject(&:empty?)
|
32
|
-
end
|
33
|
-
|
34
|
-
def text=(txt)
|
35
|
-
if txt.is_a? String
|
36
|
-
@text = EfoNelfo::V40::Order::Text.new text: txt
|
37
|
-
else
|
38
|
-
@text = txt
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def format_item_count
|
43
|
-
item_count ? item_count * 100 : nil
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module EfoNelfo
|
3
|
-
module V40
|
4
|
-
class Order
|
5
|
-
class Text < EfoNelfo::PostType
|
6
|
-
POST_TYPES = {
|
7
|
-
'BT' => 'Bestilling Fritekstlinje',
|
8
|
-
'IT' => 'Forespørsel Fritekstlinje'
|
9
|
-
}
|
10
|
-
|
11
|
-
# It's important to list the property in the same order as specified in the specs
|
12
|
-
property :post_type, alias: :PostType, limit: 2, default: 'BT'
|
13
|
-
property :text, alias: :FriTekst, limit: 30
|
14
|
-
|
15
|
-
def to_s
|
16
|
-
text
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|