rvista 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Rakefile +1 -1
- data/lib/rvista/invoice.rb +2 -2
- data/lib/rvista/po.rb +2 -2
- data/lib/rvista/poa.rb +2 -2
- data/test/data/po/quotes.txt +13 -0
- data/test/unit/message_test.rb +13 -4
- data/test/unit/poa_line_item_test.rb +1 -1
- metadata +3 -2
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/lib/rvista/invoice.rb
CHANGED
@@ -19,14 +19,14 @@ module RVista
|
|
19
19
|
# that specifies the file path
|
20
20
|
def self.load_from_file(input)
|
21
21
|
raise InvalidFileError, 'Invalid file' unless File.exist?(input)
|
22
|
-
data = FasterCSV.read(input)
|
22
|
+
data = FasterCSV.read(input, :quote_char => "`")
|
23
23
|
return self.build_message(data)
|
24
24
|
end
|
25
25
|
|
26
26
|
# creates a RVista::Invoice object from a string. Input should
|
27
27
|
# be a complete vista file as a string
|
28
28
|
def self.load_from_string(input)
|
29
|
-
data = FasterCSV.parse(input)
|
29
|
+
data = FasterCSV.parse(input, :quote_char => "`")
|
30
30
|
return self.build_message(data)
|
31
31
|
end
|
32
32
|
|
data/lib/rvista/po.rb
CHANGED
@@ -22,14 +22,14 @@ module RVista
|
|
22
22
|
# that specifies the file path
|
23
23
|
def self.load_from_file(input)
|
24
24
|
raise InvalidFileError, 'Invalid file' unless File.exist?(input)
|
25
|
-
data = FasterCSV.read(input)
|
25
|
+
data = FasterCSV.read(input, :quote_char => "`")
|
26
26
|
return self.build_message(data)
|
27
27
|
end
|
28
28
|
|
29
29
|
# creates a RVista::Message object from a string. Input should
|
30
30
|
# be a complete vista file as a string
|
31
31
|
def self.load_from_string(input)
|
32
|
-
data = FasterCSV.parse(input)
|
32
|
+
data = FasterCSV.parse(input, :quote_char => "`")
|
33
33
|
return self.build_message(data)
|
34
34
|
end
|
35
35
|
|
data/lib/rvista/poa.rb
CHANGED
@@ -19,14 +19,14 @@ module RVista
|
|
19
19
|
# that specifies the file path
|
20
20
|
def self.load_from_file(input)
|
21
21
|
raise InvalidFileError, 'Invalid file' unless File.exist?(input)
|
22
|
-
data = FasterCSV.read(input)
|
22
|
+
data = FasterCSV.read(input, :quote_char => "`")
|
23
23
|
return self.build_message(data)
|
24
24
|
end
|
25
25
|
|
26
26
|
# creates a RVista::POA object from a string. Input should
|
27
27
|
# be a complete vista file as a string
|
28
28
|
def self.load_from_string(input)
|
29
|
-
data = FasterCSV.parse(input)
|
29
|
+
data = FasterCSV.parse(input, :quote_char => "`")
|
30
30
|
return self.build_message(data)
|
31
31
|
end
|
32
32
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
H,9027378,9013725,,16742,,00,,090819,,000000,000000,,,,,,9027378,,,
|
2
|
+
D,1,EN,9780486264035,Little Zoo Animals Coloring Bo,1,0.00,EA,,,40000,Y,,
|
3
|
+
D,2,EN,9780517228678,Vampire Stories,1,0.00,EA,,,40000,Y,,
|
4
|
+
D,3,EN,9780566087721,Project Management : 9Th Editi,1,0.00,EA,,,40000,Y,,
|
5
|
+
D,4,EN,9780566087981,Understanding and Managing Ris,1,0.00,EA,,,40000,Y,,
|
6
|
+
D,5,EN,9780754645986,Safety at the Sharp End : Trai,1,0.00,EA,,,40000,Y,,
|
7
|
+
D,6,EN,9780754651772,After Sibelius : Studies in Fi,1,0.00,EA,,,40000,Y,,
|
8
|
+
D,7,EN,9780754658115,The Counts of Laval : Culture ,1,0.00,EA,,,40000,Y,,
|
9
|
+
D,8,EN,9780827230262,Unveiling the Secret Life of B,1,0.00,EA,,,40000,Y,,
|
10
|
+
D,9,EN,9781426700187,Noah's Very Big Boat,1,0.00,EA,,,40000,Y,,
|
11
|
+
D,10,EN,9781426700231,The Cool Cat: A Modern "Tail",1,0.00,EA,,,40000,Y,,
|
12
|
+
D,11,EN,9781921421259,The Climate Caper,4,0.00,EA,,,40000,Y,,
|
13
|
+
S,11,,
|
data/test/unit/message_test.rb
CHANGED
@@ -6,6 +6,7 @@ require 'rvista'
|
|
6
6
|
class POTest < Test::Unit::TestCase
|
7
7
|
|
8
8
|
VALID = File.dirname(__FILE__) + "/../data/po/valid.txt"
|
9
|
+
VALID_QUOTES = File.dirname(__FILE__) + "/../data/po/quotes.txt"
|
9
10
|
INVALID_MISSING_HEADER = File.dirname(__FILE__) + "/../data/po/invalid_missing_header.txt"
|
10
11
|
INVALID_MISSING_FOOTER = File.dirname(__FILE__) + "/../data/po/invalid_missing_footer.txt"
|
11
12
|
INVALID_LINE = File.dirname(__FILE__) + "/../data/po/invalid_line.txt"
|
@@ -18,7 +19,6 @@ class POTest < Test::Unit::TestCase
|
|
18
19
|
assert_equal msg.items.size, 38
|
19
20
|
|
20
21
|
validate_msg(msg)
|
21
|
-
|
22
22
|
end
|
23
23
|
|
24
24
|
# ensure the load_from_file method works as expected
|
@@ -26,14 +26,23 @@ class POTest < Test::Unit::TestCase
|
|
26
26
|
msg = RVista::PO.load_from_string(File.read(VALID))
|
27
27
|
assert_kind_of RVista::PO, msg
|
28
28
|
assert_equal msg.items.size, 38
|
29
|
-
|
29
|
+
|
30
30
|
validate_msg(msg)
|
31
31
|
end
|
32
32
|
|
33
|
+
# ensure files that (probably incorrectly) contain quotes can be
|
34
|
+
# parsed.
|
35
|
+
#
|
36
|
+
def test_files_with_quotes
|
37
|
+
msg = RVista::PO.load_from_string(File.read(VALID_QUOTES))
|
38
|
+
assert_kind_of RVista::PO, msg
|
39
|
+
assert_equal msg.items.size, 11
|
40
|
+
end
|
41
|
+
|
33
42
|
# ensure the load_from_file method throws the correct exceptions
|
34
43
|
# when it encounters a problem
|
35
44
|
def test_product_validation
|
36
|
-
|
45
|
+
|
37
46
|
assert_raise(RVista::InvalidFileError) {
|
38
47
|
msg = RVista::PO.load_from_file(INVALID_MISSING_HEADER)
|
39
48
|
}
|
@@ -41,7 +50,7 @@ class POTest < Test::Unit::TestCase
|
|
41
50
|
assert_raise(RVista::InvalidFileError) {
|
42
51
|
msg = RVista::PO.load_from_file(INVALID_MISSING_FOOTER)
|
43
52
|
}
|
44
|
-
|
53
|
+
|
45
54
|
assert_raise(RVista::InvalidLineItemError) {
|
46
55
|
msg = RVista::PO.load_from_file(INVALID_LINE)
|
47
56
|
}
|
@@ -63,7 +63,7 @@ class POALineItemTest < Test::Unit::TestCase
|
|
63
63
|
|
64
64
|
def test_status_text
|
65
65
|
item = RVista::POALineItem.load_from_array(@row)
|
66
|
-
assert_equal
|
66
|
+
assert_equal "Accepted: Title Shipped As Ordered", item.status_text
|
67
67
|
end
|
68
68
|
|
69
69
|
def test_to_s
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rvista
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Healy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-19 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- test/data/po/no_delivery_location.txt
|
44
44
|
- test/data/po/seperate_delivery_location.txt
|
45
45
|
- test/data/po/valid.txt
|
46
|
+
- test/data/po/quotes.txt
|
46
47
|
- test/data/poa/invalid_line.txt
|
47
48
|
- test/data/poa/invalid_missing_footer.txt
|
48
49
|
- test/data/poa/invalid_missing_header.txt
|