rvista 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/testtask'
5
5
  require "rake/gempackagetask"
6
6
  require "rubygems"
7
7
 
8
- PKG_VERSION = "0.5.1"
8
+ PKG_VERSION = "0.5.2"
9
9
  PKG_NAME = "rvista"
10
10
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
11
11
 
@@ -39,32 +39,29 @@ Rake::RDocTask.new("doc") do |rdoc|
39
39
  end
40
40
 
41
41
  spec = Gem::Specification.new do |spec|
42
- spec.name = PKG_NAME
43
- spec.version = PKG_VERSION
44
- spec.platform = Gem::Platform::RUBY
45
- spec.summary = "A small library for reading Vista HDS order files"
46
- spec.files = Dir.glob("{examples,lib,test}/**/**/*") +
47
- ["Rakefile"]
48
-
42
+ spec.name = PKG_NAME
43
+ spec.version = PKG_VERSION
44
+ spec.platform = Gem::Platform::RUBY
45
+ spec.summary = "A small library for reading Vista HDS ecommerce files"
46
+ spec.files = Dir.glob("{examples,lib,test}/**/**/*") + ["Rakefile"]
49
47
  spec.require_path = "lib"
50
-
51
48
  spec.test_files = Dir[ "test/test_*.rb" ]
52
- spec.has_rdoc = true
53
- spec.extra_rdoc_files = %w{README COPYING LICENSE}
54
- spec.rdoc_options << '--title' << 'rvista Documentation' <<
55
- '--main' << 'README' << '-q'
49
+ spec.has_rdoc = true
50
+ spec.extra_rdoc_files = %w{README COPYING LICENSE}
51
+ spec.rdoc_options << '--title' << 'rvista Documentation' <<
52
+ '--main' << 'README' << '-q'
56
53
  spec.add_dependency('fastercsv', '>= 1.2.1')
57
54
  spec.author = "James Healy"
58
- spec.email = "jimmy@deefa.com"
59
- spec.description = <<END_DESC
55
+ spec.email = "jimmy@deefa.com"
56
+ spec.description = <<END_DESC
60
57
  rvista is a small library for reading Vista HDS order files.
61
58
  END_DESC
62
59
  end
63
60
 
64
61
  desc "Generate a gem for rvista"
65
62
  Rake::GemPackageTask.new(spec) do |pkg|
66
- pkg.need_zip = true
67
- pkg.need_tar = true
63
+ pkg.need_zip = true
64
+ pkg.need_tar = true
68
65
  end
69
66
 
70
67
  desc "Report code statistics (KLOCs, etc) from the application"
@@ -9,6 +9,7 @@ module RVista
9
9
  attr_accessor :sender_id, :receiver_id, :doc_type, :description
10
10
  attr_accessor :doc_number, :doc_date, :delivery_location, :currency
11
11
  attr_accessor :items
12
+ attr_accessor :total_value, :total_qty, :total_gst
12
13
 
13
14
  # creates a new RVista::Invoice object
14
15
  def initialize
@@ -95,7 +96,11 @@ module RVista
95
96
  msg.items << item
96
97
  end
97
98
 
99
+ raise InvalidFileError, 'Last line isn\'t a footer' unless data[-1][0].eql?("S")
98
100
  raise InvalidFileError, 'Line item count doesn\'t match footer' unless data[-1][1].to_i.eql?(msg.items.size)
101
+ msg.total_value = BigDecimal.new(data[-1][2])
102
+ msg.total_qty = BigDecimal.new(data[-1][3])
103
+ msg.total_gst = BigDecimal.new(data[-1][4])
99
104
 
100
105
  # return the results
101
106
  return msg
@@ -16,6 +16,9 @@ class InvoiceTest < Test::Unit::TestCase
16
16
  msg = RVista::Invoice.load_from_file(VALID)
17
17
  assert_kind_of RVista::Invoice, msg
18
18
  assert_equal msg.items.size, 2
19
+ assert_equal msg.total_value, BigDecimal.new("25.00")
20
+ assert_equal msg.total_qty, BigDecimal.new("5")
21
+ assert_equal msg.total_gst, BigDecimal.new("2.50")
19
22
 
20
23
  validate_msg(msg)
21
24
  end
metadata CHANGED
@@ -1,98 +1,105 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: rvista
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.5.1
7
- date: 2007-11-12 00:00:00 +11:00
8
- summary: A small library for reading Vista HDS order files
9
- require_paths:
10
- - lib
11
- email: jimmy@deefa.com
12
- homepage:
13
- rubyforge_project:
14
- description: rvista is a small library for reading Vista HDS order files.
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.5.2
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - James Healy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-07-02 00:00:00 +10:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: fastercsv
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.1
24
+ version:
25
+ description: rvista is a small library for reading Vista HDS order files.
26
+ email: jimmy@deefa.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README
33
+ - COPYING
34
+ - LICENSE
31
35
  files:
32
- - examples/test.rb
36
+ - lib/rvista.rb
33
37
  - lib/rvista
34
38
  - lib/rvista/errors.rb
35
- - lib/rvista/poa.rb
39
+ - lib/rvista/invoice.rb
40
+ - lib/rvista/invoice_line_item.rb
36
41
  - lib/rvista/po.rb
37
42
  - lib/rvista/po_line_item.rb
43
+ - lib/rvista/poa.rb
38
44
  - lib/rvista/poa_line_item.rb
39
- - lib/rvista/invoice_line_item.rb
40
- - lib/rvista/invoice.rb
41
- - lib/rvista.rb
42
- - test/unit
43
- - test/unit/message_test.rb
44
- - test/unit/line_item_test.rb
45
- - test/unit/poa_test.rb
46
- - test/unit/poa_line_item_test.rb
47
- - test/unit/invoice_line_item_test.rb
48
- - test/unit/invoice_test.rb
49
45
  - test/data
50
- - test/data/poa
51
- - test/data/poa/invalid_line.txt
52
- - test/data/poa/valid.txt
53
- - test/data/poa/invalid_missing_footer.txt
54
- - test/data/poa/invalid_missing_header.txt
55
46
  - test/data/invoice
56
47
  - test/data/invoice/invalid_line.txt
57
- - test/data/invoice/valid.txt
58
- - test/data/invoice/invalid_missing_header.txt
59
48
  - test/data/invoice/invalid_missing_footer.txt
49
+ - test/data/invoice/invalid_missing_header.txt
50
+ - test/data/invoice/valid.txt
60
51
  - test/data/po
61
52
  - test/data/po/invalid_line.txt
62
53
  - test/data/po/invalid_missing_footer.txt
63
54
  - test/data/po/invalid_missing_header.txt
64
55
  - test/data/po/no_delivery_location.txt
65
- - test/data/po/valid.txt
66
56
  - test/data/po/seperate_delivery_location.txt
57
+ - test/data/po/valid.txt
58
+ - test/data/poa
59
+ - test/data/poa/invalid_line.txt
60
+ - test/data/poa/invalid_missing_footer.txt
61
+ - test/data/poa/invalid_missing_header.txt
62
+ - test/data/poa/valid.txt
63
+ - test/unit
64
+ - test/unit/invoice_line_item_test.rb
65
+ - test/unit/invoice_test.rb
66
+ - test/unit/line_item_test.rb
67
+ - test/unit/message_test.rb
68
+ - test/unit/poa_line_item_test.rb
69
+ - test/unit/poa_test.rb
67
70
  - Rakefile
68
71
  - README
69
72
  - COPYING
70
73
  - LICENSE
71
- test_files: []
72
-
74
+ has_rdoc: true
75
+ homepage:
76
+ post_install_message:
73
77
  rdoc_options:
74
78
  - --title
75
79
  - rvista Documentation
76
80
  - --main
77
81
  - README
78
82
  - -q
79
- extra_rdoc_files:
80
- - README
81
- - COPYING
82
- - LICENSE
83
- executables: []
84
-
85
- extensions: []
86
-
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ version:
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: "0"
96
+ version:
87
97
  requirements: []
88
98
 
89
- dependencies:
90
- - !ruby/object:Gem::Dependency
91
- name: fastercsv
92
- version_requirement:
93
- version_requirements: !ruby/object:Gem::Version::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: 1.2.1
98
- version:
99
+ rubyforge_project:
100
+ rubygems_version: 1.2.0
101
+ signing_key:
102
+ specification_version: 2
103
+ summary: A small library for reading Vista HDS ecommerce files
104
+ test_files: []
105
+
data/examples/test.rb DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.dirname(__FILE__) + "/../lib/rvista"
4
-
5
- #filename = File.dirname(__FILE__) + "/../test/data/seperate_delivery_location.txt"
6
- filename = File.dirname(__FILE__) + "/../test/data/no_delivery_location.txt"
7
- #filename = File.dirname(__FILE__) + "/../test/data/valid.txt"
8
-
9
- msg = RVista::Message.load_from_file(filename)
10
- if msg.delivery_location.nil?
11
- puts "nil delivery location"
12
- else
13
- puts msg.delivery_location
14
- end