xero_gateway 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -98,7 +98,7 @@ module XeroGateway
98
98
  case(element.name)
99
99
  when "LineItemID" then line_item.line_item_id = element.text
100
100
  when "Description" then line_item.description = element.text
101
- when "Quantity" then line_item.quantity = element.text.to_i
101
+ when "Quantity" then line_item.quantity = BigDecimal(element.text)
102
102
  when "UnitAmount" then line_item.unit_amount = BigDecimal.new(element.text)
103
103
  when "TaxType" then line_item.tax_type = element.text
104
104
  when "TaxAmount" then line_item.tax_amount = BigDecimal.new(element.text)
@@ -71,6 +71,7 @@ module XeroGateway
71
71
  element.children.each do |option_child|
72
72
  tracking_category.options << option_child.children.detect {|c| c.name == "Name"}.text
73
73
  end
74
+ when "Option" then tracking_category.options << element.text
74
75
  end
75
76
  end
76
77
  tracking_category
@@ -17,7 +17,22 @@ class TrackingCategoryTest < Test::Unit::TestCase
17
17
  # Check the tracking category details
18
18
  assert_equal tracking_category, result_tracking_category
19
19
  end
20
-
20
+
21
+ def test_build_and_parse_xml_from_line_item
22
+ tracking_category = create_test_line_item_tracking_category
23
+
24
+ # Generate the XML message
25
+ tracking_category_as_xml = tracking_category.to_xml_for_invoice_messages
26
+
27
+ # Parse the XML message and retrieve the tracking category element
28
+ tracking_category_element = REXML::XPath.first(REXML::Document.new(tracking_category_as_xml), "/TrackingCategory")
29
+
30
+ # Build a new tracking category from the XML
31
+ result_tracking_category = XeroGateway::TrackingCategory.from_xml(tracking_category_element)
32
+
33
+ # Check the tracking category details
34
+ assert_equal tracking_category, result_tracking_category
35
+ end
21
36
 
22
37
  private
23
38
 
@@ -27,4 +42,11 @@ class TrackingCategoryTest < Test::Unit::TestCase
27
42
  tracking_category.options = ["NORTH", "SOUTH", "CENTRAL"]
28
43
  tracking_category
29
44
  end
30
- end
45
+
46
+ def create_test_line_item_tracking_category
47
+ tracking_category = XeroGateway::TrackingCategory.new
48
+ tracking_category.name = "REGION"
49
+ tracking_category.options = ["NORTH"]
50
+ tracking_category
51
+ end
52
+ end
data/xero_gateway.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "xero_gateway"
3
- s.version = "2.0.6"
4
- s.date = "2010-10-21"
3
+ s.version = "2.0.7"
4
+ s.date = "2010-12-09"
5
5
  s.summary = "Enables ruby based applications to communicate with the Xero API"
6
6
  s.email = "tim@connorsoftware.com"
7
7
  s.homepage = "http://github.com/tlconnor/xero_gateway"
@@ -9,4 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.has_rdoc = false
10
10
  s.authors = ["Tim Connor", "Nik Wakelin"]
11
11
  s.files = ["Gemfile", "LICENSE", "Rakefile", "README.textile", "xero_gateway.gemspec"] + Dir['**/*.rb'] + Dir['**/*.crt']
12
+ s.add_dependency('builder', '>= 2.1.2')
13
+ s.add_dependency('oauth', '>= 0.3.6')
14
+ s.add_dependency('activesupport')
12
15
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xero_gateway
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 6
10
- version: 2.0.6
9
+ - 7
10
+ version: 2.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Connor
@@ -16,10 +16,55 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-21 00:00:00 +13:00
19
+ date: 2010-12-09 00:00:00 +13:00
20
20
  default_executable:
21
- dependencies: []
22
-
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: builder
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 15
31
+ segments:
32
+ - 2
33
+ - 1
34
+ - 2
35
+ version: 2.1.2
36
+ type: :runtime
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: oauth
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ hash: 31
47
+ segments:
48
+ - 0
49
+ - 3
50
+ - 6
51
+ version: 0.3.6
52
+ type: :runtime
53
+ version_requirements: *id002
54
+ - !ruby/object:Gem::Dependency
55
+ name: activesupport
56
+ prerelease: false
57
+ requirement: &id003 !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ type: :runtime
67
+ version_requirements: *id003
23
68
  description: Enables ruby based applications to communicate with the Xero API
24
69
  email: tim@connorsoftware.com
25
70
  executables: []