xero_gateway-float 2.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/Gemfile +12 -0
  2. data/LICENSE +14 -0
  3. data/README.textile +357 -0
  4. data/Rakefile +14 -0
  5. data/examples/oauth.rb +25 -0
  6. data/examples/partner_app.rb +36 -0
  7. data/init.rb +1 -0
  8. data/lib/oauth/oauth_consumer.rb +14 -0
  9. data/lib/xero_gateway.rb +39 -0
  10. data/lib/xero_gateway/account.rb +95 -0
  11. data/lib/xero_gateway/accounts_list.rb +87 -0
  12. data/lib/xero_gateway/address.rb +96 -0
  13. data/lib/xero_gateway/bank_transaction.rb +178 -0
  14. data/lib/xero_gateway/ca-certificates.crt +2560 -0
  15. data/lib/xero_gateway/contact.rb +206 -0
  16. data/lib/xero_gateway/credit_note.rb +222 -0
  17. data/lib/xero_gateway/currency.rb +56 -0
  18. data/lib/xero_gateway/dates.rb +30 -0
  19. data/lib/xero_gateway/error.rb +18 -0
  20. data/lib/xero_gateway/exceptions.rb +46 -0
  21. data/lib/xero_gateway/gateway.rb +622 -0
  22. data/lib/xero_gateway/http.rb +138 -0
  23. data/lib/xero_gateway/http_encoding_helper.rb +49 -0
  24. data/lib/xero_gateway/invoice.rb +236 -0
  25. data/lib/xero_gateway/line_item.rb +125 -0
  26. data/lib/xero_gateway/line_item_calculations.rb +55 -0
  27. data/lib/xero_gateway/money.rb +16 -0
  28. data/lib/xero_gateway/oauth.rb +87 -0
  29. data/lib/xero_gateway/organisation.rb +75 -0
  30. data/lib/xero_gateway/partner_app.rb +30 -0
  31. data/lib/xero_gateway/payment.rb +40 -0
  32. data/lib/xero_gateway/phone.rb +77 -0
  33. data/lib/xero_gateway/private_app.rb +17 -0
  34. data/lib/xero_gateway/response.rb +41 -0
  35. data/lib/xero_gateway/tax_rate.rb +63 -0
  36. data/lib/xero_gateway/tracking_category.rb +87 -0
  37. data/test/integration/accounts_list_test.rb +109 -0
  38. data/test/integration/create_bank_transaction_test.rb +38 -0
  39. data/test/integration/create_contact_test.rb +66 -0
  40. data/test/integration/create_credit_note_test.rb +49 -0
  41. data/test/integration/create_invoice_test.rb +49 -0
  42. data/test/integration/get_accounts_test.rb +23 -0
  43. data/test/integration/get_bank_transaction_test.rb +51 -0
  44. data/test/integration/get_bank_transactions_test.rb +88 -0
  45. data/test/integration/get_contact_test.rb +28 -0
  46. data/test/integration/get_contacts_test.rb +40 -0
  47. data/test/integration/get_credit_note_test.rb +48 -0
  48. data/test/integration/get_credit_notes_test.rb +90 -0
  49. data/test/integration/get_currencies_test.rb +25 -0
  50. data/test/integration/get_invoice_test.rb +48 -0
  51. data/test/integration/get_invoices_test.rb +92 -0
  52. data/test/integration/get_organisation_test.rb +24 -0
  53. data/test/integration/get_tax_rates_test.rb +25 -0
  54. data/test/integration/get_tracking_categories_test.rb +27 -0
  55. data/test/integration/update_bank_transaction_test.rb +31 -0
  56. data/test/integration/update_contact_test.rb +31 -0
  57. data/test/integration/update_invoice_test.rb +31 -0
  58. data/test/test_helper.rb +179 -0
  59. data/test/unit/account_test.rb +47 -0
  60. data/test/unit/bank_transaction_test.rb +126 -0
  61. data/test/unit/contact_test.rb +97 -0
  62. data/test/unit/credit_note_test.rb +284 -0
  63. data/test/unit/currency_test.rb +31 -0
  64. data/test/unit/gateway_test.rb +119 -0
  65. data/test/unit/invoice_test.rb +326 -0
  66. data/test/unit/oauth_test.rb +116 -0
  67. data/test/unit/organisation_test.rb +38 -0
  68. data/test/unit/tax_rate_test.rb +38 -0
  69. data/test/unit/tracking_category_test.rb +52 -0
  70. data/xero_gateway.gemspec +15 -0
  71. metadata +164 -0
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class GetAccountsTest < Test::Unit::TestCase
4
+ include TestHelper
5
+
6
+ def setup
7
+ @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)
8
+
9
+ if STUB_XERO_CALLS
10
+ @gateway.xero_url = "DUMMY_URL"
11
+
12
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ /Accounts$/ }.returns(get_file_as_string("accounts.xml"))
13
+ end
14
+ end
15
+
16
+ def test_get_accounts
17
+ result = @gateway.get_accounts
18
+ assert result.success?
19
+ assert !result.response_xml.nil?
20
+ assert result.accounts.size > 0
21
+ assert_equal XeroGateway::Account, result.accounts.first.class
22
+ end
23
+ end
@@ -0,0 +1,51 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class GetBankTransactionTest < Test::Unit::TestCase
4
+ include TestHelper
5
+
6
+ def setup
7
+ @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)
8
+
9
+ if STUB_XERO_CALLS
10
+ @gateway.xero_url = "DUMMY_URL"
11
+
12
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ /BankTransactions(\/[0-9a-z\-]+)?$/i }.returns(get_file_as_string("bank_transaction.xml"))
13
+ @gateway.stubs(:http_put).with {|client, url, body, params| url =~ /BankTransactions$/ }.returns(get_file_as_string("create_bank_transaction.xml"))
14
+ end
15
+ end
16
+
17
+ def test_get_bank_transaction
18
+ # Make sure there is a bank transaction in Xero to retrieve
19
+ response = @gateway.create_bank_transaction(create_test_bank_transaction)
20
+ bank_transaction = response.bank_transaction
21
+
22
+ result = @gateway.get_bank_transaction(bank_transaction.bank_transaction_id)
23
+ assert result.success?
24
+ assert !result.request_params.nil?
25
+ assert !result.response_xml.nil?
26
+ assert_equal result.bank_transaction.bank_transaction_id, bank_transaction.bank_transaction_id
27
+ assert_equal result.bank_transaction.reference, bank_transaction.reference
28
+ assert result.bank_transaction.is_reconciled
29
+
30
+ result = @gateway.get_bank_transaction(bank_transaction.bank_transaction_id)
31
+ assert result.success?
32
+ assert !result.request_params.nil?
33
+ assert !result.response_xml.nil?
34
+ assert_equal result.bank_transaction.bank_transaction_id, bank_transaction.bank_transaction_id
35
+ end
36
+
37
+ def test_line_items_downloaded_set_correctly
38
+ # Make sure there is a bank transaction in Xero to retrieve.
39
+ example_bank_transaction = @gateway.create_bank_transaction(create_test_bank_transaction).bank_transaction
40
+
41
+ # No line items.
42
+ response = @gateway.get_bank_transaction(example_bank_transaction.bank_transaction_id)
43
+ assert_equal(true, response.success?)
44
+
45
+ bank_transaction = response.bank_transaction
46
+ assert_kind_of(XeroGateway::LineItem, bank_transaction.line_items.first)
47
+ assert_kind_of(XeroGateway::BankTransaction, bank_transaction)
48
+ assert_equal(true, bank_transaction.line_items_downloaded?)
49
+ end
50
+
51
+ end
@@ -0,0 +1,88 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class GetBankTransactionsTest < Test::Unit::TestCase
4
+ include TestHelper
5
+
6
+ INVALID_BANK_TRANSACTION_ID = "99999999-9999-9999-9999-999999999999" unless defined?(INVALID_BANK_TRANSACTION_ID)
7
+
8
+ def setup
9
+ @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)
10
+
11
+ if STUB_XERO_CALLS
12
+ @gateway.xero_url = "DUMMY_URL"
13
+
14
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ /BankTransactions(\/[0-9a-z\-]+)?$/i }.returns(get_file_as_string("bank_transactions.xml"))
15
+ @gateway.stubs(:http_put).with {|client, url, body, params| url =~ /BankTransactions$/ }.returns(get_file_as_string("create_bank_transaction.xml"))
16
+
17
+ # Get a bank transaction with an invalid ID.
18
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ Regexp.new("BankTransactions/#{INVALID_BANK_TRANSACTION_ID}") }.returns(get_file_as_string("bank_transaction_not_found_error.xml"))
19
+ end
20
+ end
21
+
22
+ def test_get_bank_transactions
23
+ # Make sure there is a bank transaction in Xero to retrieve
24
+ bank_transaction = @gateway.create_bank_transaction(create_test_bank_transaction).bank_transaction
25
+
26
+ result = @gateway.get_bank_transactions
27
+ assert result.success?
28
+ assert !result.request_params.nil?
29
+ assert !result.response_xml.nil?
30
+ assert result.bank_transactions.collect {|i| i.reference}.include?(bank_transaction.reference)
31
+ assert result.bank_transactions.collect {|i| i.bank_transaction_id}.include?(bank_transaction.bank_transaction_id)
32
+ end
33
+
34
+ def test_get_bank_transactions_with_modified_since_date
35
+ # Create a test bank transaction
36
+ @gateway.create_bank_transaction(create_test_bank_transaction)
37
+
38
+ # Check that it is returned
39
+ result = @gateway.get_bank_transactions(:modified_since => Date.today - 1)
40
+ assert result.success?
41
+ assert !result.request_params.nil?
42
+ assert !result.response_xml.nil?
43
+ assert result.request_params.keys.include?(:ModifiedAfter) # make sure the flag was sent
44
+ end
45
+
46
+ def test_line_items_downloaded_set_correctly
47
+ # No line items.
48
+ response = @gateway.get_bank_transactions
49
+ assert_equal(true, response.success?)
50
+
51
+ bank_transaction = response.bank_transactions.first
52
+ assert_kind_of(XeroGateway::BankTransaction, bank_transaction)
53
+ assert_equal(false, bank_transaction.line_items_downloaded?)
54
+ end
55
+
56
+ # Make sure that a reference to gateway is passed when the get_bank_transactions response is parsed.
57
+ def test_get_bank_transactions_gateway_reference
58
+ result = @gateway.get_bank_transactions
59
+ assert(result.success?)
60
+ assert_not_equal(0, result.bank_transactions.size)
61
+
62
+ result.bank_transactions.each do |bank_transaction|
63
+ assert(bank_transaction.gateway === @gateway)
64
+ end
65
+ end
66
+
67
+ # Test to make sure that we correctly error when a bank transaction doesn't have an ID.
68
+ # This should usually never be ecountered.
69
+ def test_to_ensure_that_a_bank_transaction_with_invalid_id_errors
70
+ # Make sure there is a bank transaction to retrieve, even though we will mangle it later.
71
+ bank_transaction = @gateway.create_bank_transaction(create_test_bank_transaction).bank_transaction
72
+
73
+ result = @gateway.get_bank_transactions
74
+ assert_equal(true, result.success?)
75
+
76
+ bank_transaction = result.bank_transactions.first
77
+ assert_equal(false, bank_transaction.line_items_downloaded?)
78
+
79
+ # Mangle invoice_id to invalid one.
80
+ bank_transaction.bank_transaction_id = INVALID_BANK_TRANSACTION_ID
81
+
82
+ # Make sure we fail here.
83
+ line_items = nil
84
+ assert_raise(XeroGateway::BankTransactionNotFoundError) { line_items = bank_transaction.line_items }
85
+ assert_nil(line_items)
86
+ end
87
+
88
+ end
@@ -0,0 +1,28 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class GetContactTest < Test::Unit::TestCase
4
+ include TestHelper
5
+
6
+ def setup
7
+ @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)
8
+
9
+ if STUB_XERO_CALLS
10
+ @gateway.xero_url = "DUMMY_URL"
11
+
12
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ /Contacts\/[^\/]+$/ }.returns(get_file_as_string("contact.xml"))
13
+ @gateway.stubs(:http_put).with {|client, url, body, params| url =~ /Contacts$/ }.returns(get_file_as_string("contact.xml"))
14
+ end
15
+ end
16
+
17
+ def test_get_contact
18
+ # Make sure there is an contact in Xero to retrieve
19
+ contact = @gateway.create_contact(dummy_contact).contact
20
+ flunk "get_contact could not be tested because create_contact failed" if contact.nil?
21
+
22
+ result = @gateway.get_contact_by_id(contact.contact_id)
23
+ assert result.success?
24
+ assert !result.request_params.nil?
25
+ assert !result.response_xml.nil?
26
+ assert_equal result.contact.name, contact.name
27
+ end
28
+ end
@@ -0,0 +1,40 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class GetContactsTest < Test::Unit::TestCase
4
+ include TestHelper
5
+
6
+ def setup
7
+ @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)
8
+
9
+ if STUB_XERO_CALLS
10
+ @gateway.xero_url = "DUMMY_URL"
11
+
12
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ /Contacts$/ }.returns(get_file_as_string("contacts.xml"))
13
+ @gateway.stubs(:http_put).with {|client, url, body, params| url =~ /Contacts$/ }.returns(get_file_as_string("contact.xml"))
14
+ end
15
+ end
16
+
17
+ def test_get_contacts
18
+ # Make sure there is an contact in Xero to retrieve
19
+ contact = @gateway.create_contact(dummy_contact).contact
20
+ flunk "get_contacts could not be tested because create_contact failed" if contact.nil?
21
+
22
+ result = @gateway.get_contacts
23
+ assert result.success?
24
+ assert !result.request_params.nil?
25
+ assert !result.response_xml.nil?
26
+ assert result.contacts.collect {|c| c.contact_id}.include?(contact.contact_id)
27
+ end
28
+
29
+ # Make sure that a reference to gateway is passed when the get_contacts response is parsed.
30
+ def test_get_contacts_gateway_reference
31
+ result = @gateway.get_contacts
32
+ assert(result.success?)
33
+ assert_not_equal(0, result.contacts.size)
34
+
35
+ result.contacts.each do | contact |
36
+ assert(contact.gateway === @gateway)
37
+ end
38
+ end
39
+
40
+ end
@@ -0,0 +1,48 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class GetCreditNoteTest < Test::Unit::TestCase
4
+ include TestHelper
5
+
6
+ def setup
7
+ @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)
8
+
9
+ if STUB_XERO_CALLS
10
+ @gateway.xero_url = "DUMMY_URL"
11
+
12
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ /CreditNotes(\/[0-9a-z\-]+)?$/i }.returns(get_file_as_string("credit_note.xml"))
13
+ @gateway.stubs(:http_put).with {|client, url, body, params| url =~ /CreditNotes$/ }.returns(get_file_as_string("create_credit_note.xml"))
14
+ end
15
+ end
16
+
17
+ def test_get_credit_note
18
+ # Make sure there is an credit_note in Xero to retrieve
19
+ credit_note = @gateway.create_credit_note(dummy_credit_note).credit_note
20
+
21
+ result = @gateway.get_credit_note(credit_note.credit_note_id)
22
+ assert result.success?
23
+ assert !result.request_params.nil?
24
+ assert !result.response_xml.nil?
25
+ assert_equal result.credit_note.credit_note_number, credit_note.credit_note_number
26
+
27
+ result = @gateway.get_credit_note(credit_note.credit_note_number)
28
+ assert result.success?
29
+ assert !result.request_params.nil?
30
+ assert !result.response_xml.nil?
31
+ assert_equal result.credit_note.credit_note_id, credit_note.credit_note_id
32
+ end
33
+
34
+ def test_line_items_downloaded_set_correctly
35
+ # Make sure there is an credit_note in Xero to retrieve.
36
+ example_credit_note = @gateway.create_credit_note(dummy_credit_note).credit_note
37
+
38
+ # No line items.
39
+ response = @gateway.get_credit_note(example_credit_note.credit_note_id)
40
+ assert_equal(true, response.success?)
41
+
42
+ credit_note = response.credit_note
43
+ assert_kind_of(XeroGateway::LineItem, credit_note.line_items.first)
44
+ assert_kind_of(XeroGateway::CreditNote, credit_note)
45
+ assert_equal(true, credit_note.line_items_downloaded?)
46
+ end
47
+
48
+ end
@@ -0,0 +1,90 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class GetCreditNotesTest < Test::Unit::TestCase
4
+ include TestHelper
5
+
6
+ INVALID_CREDIT_NOTE_ID = "99999999-9999-9999-9999-999999999999" unless defined?(INVALID_CREDIT_NOTE_ID)
7
+
8
+ def setup
9
+ @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)
10
+
11
+ if STUB_XERO_CALLS
12
+ @gateway.xero_url = "DUMMY_URL"
13
+
14
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ /CreditNotes/ }.returns(get_file_as_string("credit_notes.xml"))
15
+ @gateway.stubs(:http_put).with {|client, url, body, params| url =~ /CreditNotes$/ }.returns(get_file_as_string("create_credit_note.xml"))
16
+
17
+ # Get an credit_note with an invalid ID number.
18
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ Regexp.new("CreditNotes/#{INVALID_CREDIT_NOTE_ID}") }.returns(get_file_as_string("credit_note_not_found_error.xml"))
19
+ end
20
+ end
21
+
22
+ def test_get_credit_notes
23
+ # Make sure there is an credit_note in Xero to retrieve
24
+ credit_note = @gateway.create_credit_note(dummy_credit_note).credit_note
25
+
26
+ result = @gateway.get_credit_notes
27
+ assert result.success?
28
+ assert !result.request_params.nil?
29
+ assert !result.response_xml.nil?
30
+ assert result.credit_notes.collect {|i| i.credit_note_number}.include?(credit_note.credit_note_number)
31
+ end
32
+
33
+ def test_get_credit_notes_with_modified_since_date
34
+ # Create a test credit_note
35
+ credit_note = dummy_credit_note
36
+ @gateway.create_credit_note(credit_note)
37
+
38
+ # Check that it is returned
39
+ result = @gateway.get_credit_notes(:modified_since => Date.today - 1)
40
+ assert result.success?
41
+ assert !result.request_params.nil?
42
+ assert !result.response_xml.nil?
43
+ assert result.request_params.keys.include?(:ModifiedAfter) # make sure the flag was sent
44
+ assert result.credit_notes.collect {|response_credit_note| response_credit_note.credit_note_number}.include?(credit_note.credit_note_number)
45
+ end
46
+
47
+ def test_line_items_downloaded_set_correctly
48
+ # No line items.
49
+ response = @gateway.get_credit_notes
50
+ assert_equal(true, response.success?)
51
+
52
+ credit_note = response.credit_notes.first
53
+ assert_kind_of(XeroGateway::CreditNote, credit_note)
54
+ assert_equal(false, credit_note.line_items_downloaded?)
55
+ end
56
+
57
+ # Make sure that a reference to gateway is passed when the get_credit_notes response is parsed.
58
+ def test_get_contacts_gateway_reference
59
+ result = @gateway.get_credit_notes
60
+ assert(result.success?)
61
+ assert_not_equal(0, result.credit_notes.size)
62
+
63
+ result.credit_notes.each do | credit_note |
64
+ assert(credit_note.gateway === @gateway)
65
+ end
66
+ end
67
+
68
+ # Test to make sure that we correctly error when an credit_note doesn't have an ID.
69
+ # This should usually never be ecountered, but might if a draft credit_note is deleted from Xero.
70
+ def test_to_ensure_that_an_credit_note_with_invalid_id_errors
71
+ # Make sure there is an credit_note to retrieve, even though we will mangle it later.
72
+ credit_note = @gateway.create_credit_note(dummy_credit_note).credit_note
73
+
74
+ result = @gateway.get_credit_notes
75
+ assert_equal(true, result.success?)
76
+
77
+ credit_note = result.credit_notes.first
78
+ assert_equal(false, credit_note.line_items_downloaded?)
79
+
80
+ # Mangle credit_note_id to invalid one.
81
+ credit_note.credit_note_id = INVALID_CREDIT_NOTE_ID
82
+
83
+ # Make sure we fail here.
84
+ line_items = nil
85
+ assert_raise(XeroGateway::CreditNoteNotFoundError) { line_items = credit_note.line_items }
86
+ assert_nil(line_items)
87
+
88
+ end
89
+
90
+ end
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class GetCurrenciesTest < Test::Unit::TestCase
4
+ include TestHelper
5
+
6
+ def setup
7
+ @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)
8
+
9
+ if STUB_XERO_CALLS
10
+ @gateway.xero_url = "DUMMY_URL"
11
+
12
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ /Currencies$/ }.returns(get_file_as_string("currencies.xml"))
13
+ end
14
+ end
15
+
16
+ def test_get_currencies
17
+ result = @gateway.get_currencies
18
+ assert result.success?
19
+ assert !result.response_xml.nil?
20
+
21
+ assert result.currencies.size > 0
22
+ assert_equal XeroGateway::Currency, result.currencies.first.class
23
+ assert_equal "NZD", result.currencies.first.code
24
+ end
25
+ end
@@ -0,0 +1,48 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class GetInvoiceTest < Test::Unit::TestCase
4
+ include TestHelper
5
+
6
+ def setup
7
+ @gateway = XeroGateway::Gateway.new(CONSUMER_KEY, CONSUMER_SECRET)
8
+
9
+ if STUB_XERO_CALLS
10
+ @gateway.xero_url = "DUMMY_URL"
11
+
12
+ @gateway.stubs(:http_get).with {|client, url, params| url =~ /Invoices(\/[0-9a-z\-]+)?$/i }.returns(get_file_as_string("invoice.xml"))
13
+ @gateway.stubs(:http_put).with {|client, url, body, params| url =~ /Invoices$/ }.returns(get_file_as_string("create_invoice.xml"))
14
+ end
15
+ end
16
+
17
+ def test_get_invoice
18
+ # Make sure there is an invoice in Xero to retrieve
19
+ invoice = @gateway.create_invoice(dummy_invoice).invoice
20
+
21
+ result = @gateway.get_invoice(invoice.invoice_id)
22
+ assert result.success?
23
+ assert !result.request_params.nil?
24
+ assert !result.response_xml.nil?
25
+ assert_equal result.invoice.invoice_number, invoice.invoice_number
26
+
27
+ result = @gateway.get_invoice(invoice.invoice_number)
28
+ assert result.success?
29
+ assert !result.request_params.nil?
30
+ assert !result.response_xml.nil?
31
+ assert_equal result.invoice.invoice_id, invoice.invoice_id
32
+ end
33
+
34
+ def test_line_items_downloaded_set_correctly
35
+ # Make sure there is an invoice in Xero to retrieve.
36
+ example_invoice = @gateway.create_invoice(dummy_invoice).invoice
37
+
38
+ # No line items.
39
+ response = @gateway.get_invoice(example_invoice.invoice_id)
40
+ assert_equal(true, response.success?)
41
+
42
+ invoice = response.invoice
43
+ assert_kind_of(XeroGateway::LineItem, invoice.line_items.first)
44
+ assert_kind_of(XeroGateway::Invoice, invoice)
45
+ assert_equal(true, invoice.line_items_downloaded?)
46
+ end
47
+
48
+ end