efo_nelfo 0.0.4 → 0.0.5
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/property.rb +13 -9
- data/lib/efo_nelfo/v40/order/line.rb +4 -0
- data/lib/efo_nelfo/version.rb +1 -1
- data/spec/csv_writer_spec.rb +3 -1
- metadata +2 -3
- data/lib/efo_nelfo/foo.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26b8e9f4719970e00eef63fac39f609584966b05
|
4
|
+
data.tar.gz: daa8bd69f71f561c9afd61258a12a11c527cee57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aa301f7e5b3b633ac34ca8cdd9afb3753415bcc340606c7afb3929421ee28ed73a08a804baaa78e1d572b99fac28ae5231a0bfb147be5ad5f85e5bf5e3a57fc
|
7
|
+
data.tar.gz: 3eb540f61970da6e5d28a5ba66eb7264dc21acdc46d49f77c8ba66aa421c0f01d7e3594ebcc3eaab44d972d734a545758e8b68e92cb81aae222591e4c8b20f48
|
data/lib/efo_nelfo/property.rb
CHANGED
@@ -45,16 +45,20 @@ module EfoNelfo
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def formatted_for_csv(attr)
|
48
|
-
|
49
|
-
|
50
|
-
type = properties[attr][:type]
|
51
|
-
case type
|
52
|
-
when :date
|
53
|
-
value ? value.strftime("%Y%m%d") : nil
|
54
|
-
when :boolean
|
55
|
-
value == true ? "J" : nil
|
48
|
+
if respond_to?("format_#{attr}")
|
49
|
+
value = send "format_#{attr}"
|
56
50
|
else
|
57
|
-
value
|
51
|
+
value = send attr
|
52
|
+
|
53
|
+
type = properties[attr][:type]
|
54
|
+
case type
|
55
|
+
when :date
|
56
|
+
value ? value.strftime("%Y%m%d") : nil
|
57
|
+
when :boolean
|
58
|
+
value == true ? "J" : nil
|
59
|
+
else
|
60
|
+
value
|
61
|
+
end
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
data/lib/efo_nelfo/version.rb
CHANGED
data/spec/csv_writer_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe EfoNelfo::V40::Order do
|
|
21
21
|
|
22
22
|
describe "to_csv" do
|
23
23
|
before do
|
24
|
-
order.add EfoNelfo::V40::Order::Line.new(order_number: 'foo', item_name: 'Ware')
|
24
|
+
order.add EfoNelfo::V40::Order::Line.new(order_number: 'foo', item_name: 'Ware', item_count: 6, splitable: true)
|
25
25
|
order.add EfoNelfo::V40::Order::Text.new text: 'haha'
|
26
26
|
end
|
27
27
|
|
@@ -29,6 +29,8 @@ describe EfoNelfo::V40::Order do
|
|
29
29
|
csv.must_match /;EFONELFO;/
|
30
30
|
csv.must_match /;4.0;/
|
31
31
|
csv.must_match /;123;/
|
32
|
+
csv.must_match /;600;/
|
33
|
+
csv.must_match /;J;/
|
32
34
|
end
|
33
35
|
|
34
36
|
it "can be parsed" do
|
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: 0.0.5
|
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-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,7 +112,6 @@ files:
|
|
112
112
|
- lib/efo_nelfo/array.rb
|
113
113
|
- lib/efo_nelfo/attribute_assignment.rb
|
114
114
|
- lib/efo_nelfo/errors.rb
|
115
|
-
- lib/efo_nelfo/foo.rb
|
116
115
|
- lib/efo_nelfo/post_type.rb
|
117
116
|
- lib/efo_nelfo/property.rb
|
118
117
|
- lib/efo_nelfo/reader/csv.rb
|
data/lib/efo_nelfo/foo.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
class Order
|
2
|
-
def initialize
|
3
|
-
@lines = [ ['c', 'd'] ]
|
4
|
-
@attrs = [ 'a', 'b' ]
|
5
|
-
end
|
6
|
-
|
7
|
-
def to_a
|
8
|
-
# [ @attrs ] << lines
|
9
|
-
arr = [ @attrs ]
|
10
|
-
lines.each do |i|
|
11
|
-
arr += i
|
12
|
-
end
|
13
|
-
arr
|
14
|
-
end
|
15
|
-
|
16
|
-
def lines
|
17
|
-
@lines
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_csv
|
21
|
-
to_a
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
puts Order.new.to_csv.inspect
|