efo_nelfo 1.5.5 → 1.6.0

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
  SHA1:
3
- metadata.gz: aacda9ef4cc03af499cd1725ec29d8e2d63f5703
4
- data.tar.gz: 2926ccbb116ee621313abb40e72ad2c8dd8874a7
3
+ metadata.gz: 3f895e084c88a0a5529240622dbc925a7dedbd72
4
+ data.tar.gz: 6e7669cb4d3542100176ced1167214696f4d3a06
5
5
  SHA512:
6
- metadata.gz: 1c25d34c8c71ab0450e3799cd255586fa1f96a58e85eee8acd0fe40d903de40989b946b1db8bb76f09185b89ede9ee150068b6933acec7e11fc7593745b9e5f4
7
- data.tar.gz: 88be022daff8c3fbf715768386c1b58af1112bcf6f7789fc85a56f6538a76a449669e7cff9004dcf9d726f7338bbbb1f63c7242ba16e1679adda7953a7cf5047
6
+ metadata.gz: b98fa98ffbfd002d9b117dd60b0660e8fea1e1bcfbf1dc17afa1864034a91dbe3a70eca6dcbd3804aaae952c3460b5b7ce76ac8818ea3717b6bf195421261c4e
7
+ data.tar.gz: 4bf1ee27b1fbf4166181e56caff450cb06ea7175137910fe9a80d7da3f37ad938b65ff7532d4bc36542be63bb80e3d3f619cf79f4d9f7d4bfc38a229988d2eb8
data/README.md CHANGED
@@ -14,6 +14,7 @@ Supported formats:
14
14
  * Bestilling (BH, BL, BT)
15
15
  * Vareformat (VH, VL, VX, VA)
16
16
  * Rabatt (RH, RL)
17
+ * Ordrebekreftelse (CH, CL, CT)
17
18
 
18
19
  ## Usage
19
20
 
@@ -0,0 +1,64 @@
1
+ module EfoNelfo
2
+ module V40
3
+ class CH < EfoNelfo::PostType
4
+ include PostHeadType
5
+
6
+ # It's important to list the property in the same order as specified in the specs
7
+ property :seller_id, alias: :SelgersId, limit: 14, required: true
8
+ property :buyer_id, alias: :KjøpersId, limit: 14
9
+ property :production_date, alias: :ProdDato, limit: 8, required: true, type: :date
10
+ property :confirmation_number, alias: :BekreftelsesNr, limit: 13, required: true
11
+ property :seller_order_number, alias: :SOrdNr, limit: 10
12
+ property :order_number, alias: :BestNr, limit: 10
13
+ property :customer_id, alias: :KundeNr, limit: 10, required: true
14
+ property :contract_type, alias: :AvtaleIDMrk, limit: 1
15
+ property :contract_id, alias: :AvtaleID, limit: 10
16
+ property :buyer_order_number, alias: :KOrdNr, limit: 10
17
+ property :buyer_customer_id, alias: :KundAvd, limit: 10
18
+ property :project_id, alias: :ProsjektNr, limit: 10
19
+ property :buyer_warehouse_location, alias: :KLagerMrk, limit: 1
20
+ property :buyer_warehouse, alias: :KLager, limit: 14
21
+ property :external_ref, alias: :EksternRef, limit: 10
22
+ property :buyer_ref, alias: :KjøpersRef, limit: 25
23
+ property :seller_ref, alias: :SelgersRef, limit: 25
24
+ property :label, alias: :Merket, limit: 25
25
+ property :transport_type, alias: :TransportMåte, limit: 25
26
+ property :transport_msg, alias: :Melding, limit: 25
27
+ property :delivery_date, alias: :LevDato, type: :date
28
+ property :origin, alias: :BestOpp, limit: 2
29
+
30
+ property :receiver_delivery_location, alias: :LAdrLok, limit: 14
31
+ property :receiver_name, alias: :LFirmaNavn, limit: 35
32
+ property :receiver_address1, alias: :LAdr1, limit: 35
33
+ property :receiver_address2, alias: :LAdr2, limit: 35
34
+ property :receiver_zip, alias: :LPostNr, limit: 9
35
+ property :receiver_office, alias: :LPostSted, limit: 35
36
+ property :receiver_country, alias: :LLandK, limit: 2
37
+
38
+ property :buyer_company_name, alias: :KFirmaNavn, limit: 35
39
+ property :buyer_address1, alias: :KAdr1, limit: 35
40
+ property :buyer_address2, alias: :KAdr2, limit: 35
41
+ property :buyer_zip, alias: :KPostNr, limit: 9
42
+ property :buyer_office, alias: :KPostSted, limit: 35
43
+ property :buyer_country, alias: :KLandK, limit: 2
44
+ property :buyer_name, alias: :KNavn, limit: 35
45
+
46
+ property :billing_company_name, alias: :FFirmaNavn, limit: 35
47
+ property :billing_address1, alias: :FAdr1, limit: 35
48
+ property :billing_address2, alias: :FAdr2, limit: 35
49
+ property :billing_zip, alias: :FPostNr, limit: 9
50
+ property :billing_office, alias: :FPostSted, limit: 35
51
+ property :billing_country, alias: :FLandK, limit: 2
52
+
53
+ property :seller_company_name, alias: :SFirmaNavn, limit: 35
54
+ property :seller_address1, alias: :SAdr1, limit: 35
55
+ property :seller_address2, alias: :SAdr2, limit: 35
56
+ property :seller_zip, alias: :SPostNr, limit: 9
57
+ property :seller_office, alias: :SPostSted, limit: 35
58
+ property :seller_country, alias: :SLandK, limit: 2
59
+ property :currency, alias: :Valuta, limit: 3
60
+
61
+ has_many :lines, post_type: "CL"
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,38 @@
1
+ module EfoNelfo
2
+ module V40
3
+ class CL < EfoNelfo::PostType
4
+
5
+ # It's important to list the property in the same order as specified in the specs
6
+ property :post_type, alias: :PostType, limit: 2, default: post_type, required: true
7
+ property :index_seller, alias: :LinjeNrBekr, limit: 4, type: :integer
8
+ property :index_buyer, alias: :LinjeNrBe, limit: 4, type: :integer
9
+ property :item_type, alias: :VareMrk, limit: 1, required: true, type: :integer
10
+ property :item_number, alias: :VareNr, limit: 14, required: true
11
+ property :item_name, alias: :VaBetg, limit: 30, required: true
12
+ property :item_description, alias: :VaBetg2, limit: 30
13
+ property :item_quantity, alias: :Ant, limit: 9, required: true, type: :integer
14
+ property :item_delivered, alias: :Lev, limit: 9, required: true, type: :integer
15
+ property :item_remainder, alias: :Rest, limit: 9, required: true, type: :integer
16
+ property :price_unit, alias: :PrisEnhet, limit: 3, required: true
17
+ property :buyer_item_number, alias: :KVareNr, limit: 25
18
+ property :buyer_quantity, alias: :KAnt, limit: 9, type: :integer
19
+ property :delivery_date, alias: :LevDato, type: :date
20
+ property :delivery_date_remainder, alias: :RLevDato, type: :date
21
+ property :unit_price, alias: :EnhetsPris, type: :integer, limit: 10
22
+ property :discount_percentage1, alias: :Rab1P, type: :integer, limit: 4
23
+ property :discount_amount1, alias: :Rab1Bel, type: :integer, limit: 11
24
+ property :discount_percentage2, alias: :Rab2P, type: :integer, limit: 4
25
+ property :discount_amount2, alias: :Rab2Bel, type: :integer, limit: 11
26
+ property :addition_percentage, alias: :TilleggP, type: :integer, limit: 4
27
+ property :addition_amount, alias: :TilleggBel, type: :integer, limit: 11
28
+ property :tax_percentage, alias: :AvgiftP, type: :integer, limit: 4
29
+ property :tax_amount, alias: :AvgiftBel, type: :integer, limit: 11
30
+ property :amount, alias: :Beløp, type: :integer, limit: 11
31
+ property :buyers_ref, alias: :KjøpersRef, limit: 25
32
+ property :seller_warehouse_location, alias: :SLagerMrk, limit: 1
33
+ property :seller_warehouse, alias: :SLager, limit: 14
34
+
35
+ has_many :text, post_type: "CT"
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,12 @@
1
+ module EfoNelfo
2
+ module V40
3
+ class CT < EfoNelfo::PostType
4
+ property :post_type, alias: :PostType, limit: 2, default: post_type, required: true
5
+ property :text, alias: :FriTekst, limit: 30
6
+
7
+ def to_s
8
+ text
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module EfoNelfo
2
- VERSION = "1.5.5"
2
+ VERSION = "1.6.0"
3
3
  end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe "parsing a CH.csv file" do
4
+ it "uses the correct version" do
5
+ lambda { EfoNelfo.load(csv('C4.V3.csv')) }.must_raise EfoNelfo::UnsupportedPostType
6
+ end
7
+
8
+ it "parses the file and returns an OrderConfirmation" do
9
+ order = EfoNelfo.load(csv('C450517.032.csv'))
10
+ order.must_be_instance_of EfoNelfo::V40::CH
11
+ order.post_type.must_equal "CH"
12
+ order.format.must_equal "EFONELFO"
13
+ order.version.must_equal "4.0"
14
+
15
+ order.BekreftelsesNr.must_equal "52104503D0001"
16
+ order.SOrdNr.must_equal "52104503D"
17
+ order.BestNr.must_equal "BE0000 23"
18
+ order.KundeNr.must_equal "2110310"
19
+ order.KjøpersRef.must_equal "Knut"
20
+ order.SelgersRef.must_equal "Ole N."
21
+ order.Merket.must_equal "BE2/2"
22
+ order.TransportMåte.must_equal "ROAD"
23
+ order.Melding.must_equal "Ring Jacob 92413009"
24
+ order.LevDato.to_s.must_equal "2005-04-25"
25
+ end
26
+
27
+ it "the order confirmation contains orderlines" do
28
+ order = EfoNelfo.load(csv('C450517.032.csv'))
29
+
30
+ line = order.lines[1]
31
+ line.must_be_instance_of EfoNelfo::V40::CL
32
+ line.post_type.must_equal "CL"
33
+ line.index_seller.must_equal 30
34
+ line.index_buyer.must_equal 3
35
+ line.VareNr.must_equal "1261190"
36
+ line.VaBetg.must_equal "INNSTIKK-KLEMME 2X2,5MM2 WAGO"
37
+ line.Ant.must_equal 3000
38
+ line.Lev.must_equal 2000
39
+ line.Rest.must_equal 1000
40
+ line.PrisEnhet.must_equal "EA"
41
+ line.RLevDato.to_s.must_equal "2005-05-02"
42
+ line.EnhetsPris.must_equal 8000
43
+ end
44
+ end
@@ -0,0 +1,2 @@
1
+ CH;EFONELFO;3.0;;NO986692002MVA;1465;650517;;;5000;;5000;;;;;lager;;1465/5000/lager;;;;20100601;;;;;;;;;;;;;;;;;;;;;;;;;;
2
+ CL;1;1465;1;8000502;200L OSO STD BEREDER SUPER S;;200;EA;;20100601;;;
@@ -0,0 +1,5 @@
1
+ CH;EFONELFO;4.0;NO980672891MVA;NO974378663MVA;20050420;52104503D0001;52104503D;BE0000 23;2110310;P;36248;;2;36248;;1;;Knut;Ole N.;BE2/2;ROAD;Ring Jacob 92413009;20050425;1;;NAVICOM AS;JAKOB 11;Luderupv. 12;4314;SANDNES;NO;;;;;;;Knut;;;;;;Solar Elektroengros AS;Postboks 6549 Etterstad;;0606;Oslo;NO;NOK
2
+ CL;10;1;1;1000226;SKIPSKABEL LKM-HF 3X70;;5000;5000;0;MTR;;;;;25000;2000;;;;;;;;1000000;;E;7080001003395 CL;20;2;1;1050510;RK 0,75MM2 SORT SPOLE;;10000;10000;0;MTR;;;;;5000;2000;;;;;;;;400000;;E;7080001003395
3
+ CT;LEVERES I HEL LENGDE
4
+ CL;30;3;1;1261190;INNSTIKK-KLEMME 2X2,5MM2 WAGO;;3000;2000;1000;EA;;;;20050502;8000;2000;;;;;;;;192000;;E;7080001003395 CT;DELLEVERANSE
5
+ CL;50;5;0;9999999;DEKAFIX 5 GW MRK L- STOR;;10000;10000;0;EA;1265290;10000;20050503;;5000;2000;;;;;;;;400000;;E;7080001003395 CT;LEVERES DIREKTE TIL KUNDE
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: 1.5.5
4
+ version: 1.6.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: 2015-08-21 00:00:00.000000000 Z
11
+ date: 2015-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -191,6 +191,9 @@ files:
191
191
  - lib/efo_nelfo/v40/bh.rb
192
192
  - lib/efo_nelfo/v40/bl.rb
193
193
  - lib/efo_nelfo/v40/bt.rb
194
+ - lib/efo_nelfo/v40/ch.rb
195
+ - lib/efo_nelfo/v40/cl.rb
196
+ - lib/efo_nelfo/v40/ct.rb
194
197
  - lib/efo_nelfo/v40/rh.rb
195
198
  - lib/efo_nelfo/v40/rl.rb
196
199
  - lib/efo_nelfo/v40/va.rb
@@ -202,6 +205,7 @@ files:
202
205
  - spec/csv_writer_spec.rb
203
206
  - spec/efo_nelfo_spec.rb
204
207
  - spec/parsing/bh_spec.rb
208
+ - spec/parsing/ch_spec.rb
205
209
  - spec/parsing/rh_spec.rb
206
210
  - spec/parsing/vh_spec.rb
207
211
  - spec/post_type_spec.rb
@@ -215,6 +219,8 @@ files:
215
219
  - spec/samples/B650517.030.csv
216
220
  - spec/samples/B650517.031.csv
217
221
  - spec/samples/B650517.032.csv
222
+ - spec/samples/C4.V3.csv
223
+ - spec/samples/C450517.032.csv
218
224
  - spec/samples/V4_varefil.csv
219
225
  - spec/samples/rabatt.csv
220
226
  - spec/samples/varefil_eksempel.csv
@@ -251,6 +257,7 @@ test_files:
251
257
  - spec/csv_writer_spec.rb
252
258
  - spec/efo_nelfo_spec.rb
253
259
  - spec/parsing/bh_spec.rb
260
+ - spec/parsing/ch_spec.rb
254
261
  - spec/parsing/rh_spec.rb
255
262
  - spec/parsing/vh_spec.rb
256
263
  - spec/post_type_spec.rb
@@ -264,6 +271,8 @@ test_files:
264
271
  - spec/samples/B650517.030.csv
265
272
  - spec/samples/B650517.031.csv
266
273
  - spec/samples/B650517.032.csv
274
+ - spec/samples/C4.V3.csv
275
+ - spec/samples/C450517.032.csv
267
276
  - spec/samples/V4_varefil.csv
268
277
  - spec/samples/rabatt.csv
269
278
  - spec/samples/varefil_eksempel.csv