xeroizer 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
@@ -65,14 +65,16 @@ module Xeroizer
|
|
65
65
|
self.send(field_name)
|
66
66
|
|
67
67
|
# Add each record.
|
68
|
-
|
68
|
+
last_record = nil
|
69
69
|
records.each do | record |
|
70
70
|
record = record_class.build(record, model_parent) if record.is_a?(Hash)
|
71
71
|
raise StandardError.new("Record #{record.class.name} is not a #{record_class.name}.") unless record.is_a?(record_class)
|
72
72
|
self.attributes[field_name] ||= []
|
73
73
|
self.attributes[field_name] << record
|
74
|
+
last_record = record
|
74
75
|
end
|
75
|
-
|
76
|
+
|
77
|
+
last_record # last record
|
76
78
|
end
|
77
79
|
|
78
80
|
end
|
@@ -56,7 +56,7 @@ module Xeroizer
|
|
56
56
|
|
57
57
|
# Turn a record into its XML representation.
|
58
58
|
def to_xml(b = Builder::XmlMarkup.new(:indent => 2))
|
59
|
-
|
59
|
+
optional_root_tag(parent.class.optional_xml_root_name, b) do |b|
|
60
60
|
b.tag!(parent.class.xml_node_name || parent.model_name) {
|
61
61
|
attributes.each do | key, value |
|
62
62
|
field = self.class.fields[key]
|
@@ -64,7 +64,7 @@ module Xeroizer
|
|
64
64
|
xml_value_from_field(b, field, value) unless value.nil?
|
65
65
|
end
|
66
66
|
}
|
67
|
-
|
67
|
+
end
|
68
68
|
end
|
69
69
|
|
70
70
|
protected
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper'))
|
2
2
|
|
3
3
|
class JournalLineTest < Test::Unit::TestCase
|
4
4
|
include TestHelper
|
@@ -9,13 +9,13 @@ class JournalLineTest < Test::Unit::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it "journal_line tracking specified correctly" do
|
12
|
-
|
13
|
-
|
12
|
+
journal = @client.Journal.build
|
13
|
+
journal_line = journal.add_journal_line({})
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
journal_line.add_tracking_category(:name => "Name 1", :option => "Option 1")
|
16
|
+
journal_line.add_tracking_category(:name => "Name 2", :option => "Option 2")
|
17
17
|
|
18
|
-
doc = Nokogiri::XML(
|
18
|
+
doc = Nokogiri::XML(journal_line.to_xml)
|
19
19
|
assert_equal 2, doc.xpath("/JournalLine/TrackingCategories/TrackingCategory").size
|
20
20
|
end
|
21
21
|
|
@@ -10,7 +10,7 @@ class LineItemTest < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
it "line_item tracking specified correctly" do
|
12
12
|
invoice = @client.Invoice.build
|
13
|
-
line_item = invoice.add_line_item({})
|
13
|
+
line_item = invoice.add_line_item({:description => "Test Description", :quantity => 1, :unit_amount => 200})
|
14
14
|
|
15
15
|
line_item.add_tracking(:name => "Name 1", :option => "Option 1")
|
16
16
|
line_item.add_tracking(:name => "Name 2", :option => "Option 2")
|
data/xeroizer.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xeroizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 2
|
10
|
+
version: 0.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Wayne Robinson
|