efo_nelfo 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/efo_nelfo/v40/rh.rb +25 -0
- data/lib/efo_nelfo/v40/rl.rb +12 -0
- data/lib/efo_nelfo/version.rb +1 -1
- data/lib/efo_nelfo.rb +3 -7
- data/spec/efo_nelfo_spec.rb +18 -0
- data/spec/samples/rabatt.csv +4 -1233
- metadata +3 -3
- data/spec/samples/varer.csv +0 -75429
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b537774388538c770ec1282b7d1c5902ea651989
|
4
|
+
data.tar.gz: 179c2a02944098fcecd0d28d5e3e36fdebd40cb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69ea8d385d4dca754374bb43c92eb91a2d29ab06b3547369f65b56a08334ce3c15d04881a859af4fbc70c229ce4bfa3b19c75061f55ace5fa4ba1dee1c99080f
|
7
|
+
data.tar.gz: a83c65e5668b027e7d5eefa60bfd9603c8c6981833919aeeb7d271ce565ea980b7ebbea3d3fcbac8939e2ee825e41d234a48c84c4e2bea6296880152aee1d926
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module EfoNelfo
|
2
|
+
module V40
|
3
|
+
class RH < EfoNelfo::PostType
|
4
|
+
include PostHeadType
|
5
|
+
|
6
|
+
property :seller_id, alias: :SelgersId, limit: 14, required: true
|
7
|
+
property :buyer_id, alias: :KjøpersId, limit: 14
|
8
|
+
property :customer_id, alias: :KundeNr, limit: 10, required: true
|
9
|
+
property :contract_id, alias: :AvtaleId, limit: 10, required: true
|
10
|
+
property :from_date, alias: :FraDato, limit: 8, type: :date, required: true
|
11
|
+
property :to_date, alias: :TilDato, limit: 8, type: :date
|
12
|
+
property :currency, alias: :Valuta, limit: 3, required: true
|
13
|
+
property :contract_type, alias: :Avtaletype, limit: 1, required: true
|
14
|
+
property :seller_name, alias: :SFirmaNavn, limit: 35, required: true
|
15
|
+
property :seller_address1, alias: :SAdr1, limit: 35
|
16
|
+
property :seller_address2, alias: :SAdr2, limit: 35
|
17
|
+
property :seller_zip, alias: :SPostNr, limit: 9, required: true
|
18
|
+
property :seller_office, alias: :SPostSted, limit: 35, required: true
|
19
|
+
property :seller_country, alias: :SLandK, limit: 2
|
20
|
+
|
21
|
+
has_many :lines, post_type: 'RL'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module EfoNelfo
|
2
|
+
module V40
|
3
|
+
class RL < EfoNelfo::PostType
|
4
|
+
property :post_type, alias: :PostType, limit: 2, default: post_type, required: true
|
5
|
+
property :product_type, alias: :VareMrk, limit: 1, type: :integer, required: true
|
6
|
+
property :product_number, alias: :VareNr, limit: 14, required: true
|
7
|
+
property :price, alias: :AvtaltPris, limit: 10, type: :integer
|
8
|
+
property :discount, alias: :Rabatt, limit: 2, required: true
|
9
|
+
property :text, alias: :Tekst, limit: 30
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/efo_nelfo/version.rb
CHANGED
data/lib/efo_nelfo.rb
CHANGED
@@ -10,13 +10,9 @@ require 'efo_nelfo/post_type'
|
|
10
10
|
require 'efo_nelfo/post_head_type'
|
11
11
|
|
12
12
|
# EfoNelfo v4.0 modules
|
13
|
-
|
14
|
-
require
|
15
|
-
|
16
|
-
require 'efo_nelfo/v40/vh'
|
17
|
-
require 'efo_nelfo/v40/vl'
|
18
|
-
require 'efo_nelfo/v40/vx'
|
19
|
-
require 'efo_nelfo/v40/va'
|
13
|
+
Dir.glob(File.expand_path('../efo_nelfo/v40/*.rb', __FILE__)).each do |file|
|
14
|
+
require file
|
15
|
+
end
|
20
16
|
|
21
17
|
# Reader modules (import)
|
22
18
|
require 'efo_nelfo/reader/csv'
|
data/spec/efo_nelfo_spec.rb
CHANGED
@@ -145,6 +145,24 @@ describe EfoNelfo do
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
+
describe "passing a discount file" do
|
149
|
+
let(:nelfo) { EfoNelfo.load csv('rabatt.csv') }
|
150
|
+
it { nelfo.must_be_instance_of EfoNelfo::V40::RH }
|
151
|
+
# RH;EFONELFO;4.0;NO910478656MVA;NO000000000MVA;0;0;20130404;20140404;NOK;H;Alsell Norge AS;Vestre Svanholmen 4;;4313;SANDNES;NO
|
152
|
+
it "assigns attributes" do
|
153
|
+
nelfo.seller_id.must_equal "NO910478656MVA"
|
154
|
+
nelfo.buyer_id.must_equal "NO000000000MVA"
|
155
|
+
end
|
156
|
+
|
157
|
+
it "assigns lines" do
|
158
|
+
nelfo.lines.size.must_equal 4
|
159
|
+
line = nelfo.lines.last
|
160
|
+
line.product_type.must_equal 5
|
161
|
+
line.product_number.must_equal "P10501"
|
162
|
+
line.AvtaltPris.must_be_nil
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
148
166
|
describe "passing a Order file" do
|
149
167
|
|
150
168
|
it "uses the correct version" do
|