quickeebooks 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. data/lib/quickeebooks.rb +3 -1
  2. data/lib/quickeebooks/common/online_entity_model.rb +0 -3
  3. data/lib/quickeebooks/common/service_crud.rb +1 -1
  4. data/lib/quickeebooks/online/model/account.rb +1 -6
  5. data/lib/quickeebooks/online/model/address.rb +3 -2
  6. data/lib/quickeebooks/online/model/clazz.rb +60 -0
  7. data/lib/quickeebooks/online/model/intuit_type.rb +9 -4
  8. data/lib/quickeebooks/online/model/item.rb +3 -1
  9. data/lib/quickeebooks/online/service/account.rb +1 -41
  10. data/lib/quickeebooks/online/service/clazz.rb +12 -0
  11. data/lib/quickeebooks/online/service/employee.rb +2 -4
  12. data/lib/quickeebooks/online/service/invoice.rb +8 -58
  13. data/lib/quickeebooks/online/service/item.rb +1 -41
  14. data/lib/quickeebooks/online/service/service_base.rb +2 -2
  15. data/lib/quickeebooks/shared/service/access_token.rb +1 -0
  16. data/lib/quickeebooks/version.rb +1 -1
  17. metadata +8 -178
  18. data/Gemfile +0 -3
  19. data/Gemfile.lock +0 -86
  20. data/Guardfile +0 -8
  21. data/HISTORY.md +0 -44
  22. data/MIT-LICENSE +0 -9
  23. data/README.md +0 -451
  24. data/Rakefile +0 -17
  25. data/coverage/assets/0.7.1/application.css +0 -1110
  26. data/coverage/assets/0.7.1/application.js +0 -626
  27. data/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
  28. data/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
  29. data/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
  30. data/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
  31. data/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
  32. data/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
  33. data/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
  34. data/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
  35. data/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
  36. data/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
  37. data/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
  38. data/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
  39. data/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
  40. data/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
  41. data/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
  42. data/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
  43. data/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
  44. data/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
  45. data/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
  46. data/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
  47. data/coverage/assets/0.7.1/favicon_green.png +0 -0
  48. data/coverage/assets/0.7.1/favicon_red.png +0 -0
  49. data/coverage/assets/0.7.1/favicon_yellow.png +0 -0
  50. data/coverage/assets/0.7.1/loading.gif +0 -0
  51. data/coverage/assets/0.7.1/magnify.png +0 -0
  52. data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  53. data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  54. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  55. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  56. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  57. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  58. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  59. data/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  60. data/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
  61. data/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  62. data/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
  63. data/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
  64. data/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  65. data/coverage/index.html +0 -39346
  66. data/quickeebooks.gemspec +0 -30
  67. data/spec/mocks/oauth_consumer_mock.rb +0 -2
  68. data/spec/quickeebooks/common/online_line_item_model_methods_spec.rb +0 -41
  69. data/spec/quickeebooks/common/service_crud_spec.rb +0 -41
  70. data/spec/quickeebooks/online/account_spec.rb +0 -37
  71. data/spec/quickeebooks/online/bill_payment_spec.rb +0 -18
  72. data/spec/quickeebooks/online/bill_spec.rb +0 -17
  73. data/spec/quickeebooks/online/company_meta_data_spec.rb +0 -27
  74. data/spec/quickeebooks/online/customer_spec.rb +0 -48
  75. data/spec/quickeebooks/online/employee_spec.rb +0 -31
  76. data/spec/quickeebooks/online/id_spec.rb +0 -18
  77. data/spec/quickeebooks/online/invoice_spec.rb +0 -12
  78. data/spec/quickeebooks/online/journal_entry_spec.rb +0 -26
  79. data/spec/quickeebooks/online/payment_spec.rb +0 -19
  80. data/spec/quickeebooks/online/sales_receipt_spec.rb +0 -18
  81. data/spec/quickeebooks/online/services/account_spec.rb +0 -82
  82. data/spec/quickeebooks/online/services/bill_payment_spec.rb +0 -69
  83. data/spec/quickeebooks/online/services/bill_spec.rb +0 -61
  84. data/spec/quickeebooks/online/services/company_meta_data_spec.rb +0 -30
  85. data/spec/quickeebooks/online/services/customer_spec.rb +0 -93
  86. data/spec/quickeebooks/online/services/employee_spec.rb +0 -83
  87. data/spec/quickeebooks/online/services/filter_spec.rb +0 -53
  88. data/spec/quickeebooks/online/services/invoice_spec.rb +0 -54
  89. data/spec/quickeebooks/online/services/journal_entry_spec.rb +0 -75
  90. data/spec/quickeebooks/online/services/payment_spec.rb +0 -63
  91. data/spec/quickeebooks/online/services/sales_receipt_spec.rb +0 -64
  92. data/spec/quickeebooks/online/services/service_base_spec.rb +0 -150
  93. data/spec/quickeebooks/online/services/time_activity_spec.rb +0 -89
  94. data/spec/quickeebooks/online/services/tracking_class_spec.rb +0 -99
  95. data/spec/quickeebooks/online/services/vendor_spec.rb +0 -85
  96. data/spec/quickeebooks/online/time_activity_spec.rb +0 -18
  97. data/spec/quickeebooks/online/tracking_class_spec.rb +0 -32
  98. data/spec/quickeebooks/online/vendor_spec.rb +0 -33
  99. data/spec/quickeebooks/shared/access_token_spec.rb +0 -129
  100. data/spec/quickeebooks/shared/filter_spec.rb +0 -159
  101. data/spec/quickeebooks/shared/sort_spec.rb +0 -17
  102. data/spec/quickeebooks/windows/customer_spec.rb +0 -45
  103. data/spec/quickeebooks/windows/id_spec.rb +0 -18
  104. data/spec/quickeebooks/windows/services/class_spec.rb +0 -33
  105. data/spec/quickeebooks/windows/services/company_meta_data_spec.rb +0 -29
  106. data/spec/quickeebooks/windows/services/customer_spec.rb +0 -173
  107. data/spec/quickeebooks/windows/services/employee_spec.rb +0 -42
  108. data/spec/quickeebooks/windows/services/invoice_spec.rb +0 -127
  109. data/spec/quickeebooks/windows/services/job_spec.rb +0 -74
  110. data/spec/quickeebooks/windows/services/payment_method_spec.rb +0 -36
  111. data/spec/quickeebooks/windows/services/payment_spec.rb +0 -72
  112. data/spec/quickeebooks/windows/services/sales_rep_spec.rb +0 -42
  113. data/spec/quickeebooks/windows/services/sales_taxes_spec.rb +0 -36
  114. data/spec/quickeebooks/windows/services/service_base_spec.rb +0 -95
  115. data/spec/quickeebooks/windows/services/ship_method_spec.rb +0 -33
  116. data/spec/quickeebooks/windows/services/sync_activity_spec.rb +0 -42
  117. data/spec/quickeebooks/windows/services/sync_status_spec.rb +0 -35
  118. data/spec/quickeebooks/windows/services/time_activity_spec.rb +0 -38
  119. data/spec/quickeebooks_spec.rb +0 -8
  120. data/spec/spec_helper.rb +0 -48
  121. data/spec/support/oauth.rb +0 -20
  122. data/spec/xml/online/account.xml +0 -13
  123. data/spec/xml/online/accounts.xml +0 -108
  124. data/spec/xml/online/api_error.xml +0 -6
  125. data/spec/xml/online/bill.xml +0 -32
  126. data/spec/xml/online/bill2.xml +0 -32
  127. data/spec/xml/online/bill_payment.xml +0 -20
  128. data/spec/xml/online/bill_payment2.xml +0 -20
  129. data/spec/xml/online/bill_payments.xml +0 -26
  130. data/spec/xml/online/bills.xml +0 -33
  131. data/spec/xml/online/company_meta_data.xml +0 -37
  132. data/spec/xml/online/customer.xml +0 -77
  133. data/spec/xml/online/customer2.xml +0 -63
  134. data/spec/xml/online/customers.xml +0 -125
  135. data/spec/xml/online/deleted_invoice.xml +0 -2
  136. data/spec/xml/online/determine_base_url.xml +0 -10
  137. data/spec/xml/online/employee.xml +0 -31
  138. data/spec/xml/online/employee2.xml +0 -31
  139. data/spec/xml/online/employees.xml +0 -36
  140. data/spec/xml/online/invalid_user.xml +0 -7
  141. data/spec/xml/online/invoice.xml +0 -28
  142. data/spec/xml/online/journal_entries.xml +0 -38
  143. data/spec/xml/online/journal_entry.xml +0 -32
  144. data/spec/xml/online/journal_entry2.xml +0 -32
  145. data/spec/xml/online/payment.xml +0 -24
  146. data/spec/xml/online/payment2.xml +0 -24
  147. data/spec/xml/online/payments.xml +0 -30
  148. data/spec/xml/online/sales_receipt.xml +0 -36
  149. data/spec/xml/online/sales_receipt2.xml +0 -36
  150. data/spec/xml/online/sales_receipts.xml +0 -39
  151. data/spec/xml/online/time_activities.xml +0 -27
  152. data/spec/xml/online/time_activity.xml +0 -21
  153. data/spec/xml/online/time_activity2.xml +0 -21
  154. data/spec/xml/online/tracking_class.xml +0 -11
  155. data/spec/xml/online/tracking_class_updated.xml +0 -11
  156. data/spec/xml/online/tracking_classes.xml +0 -26
  157. data/spec/xml/online/user.xml +0 -11
  158. data/spec/xml/online/vendor.xml +0 -34
  159. data/spec/xml/online/vendor2.xml +0 -34
  160. data/spec/xml/online/vendors.xml +0 -67
  161. data/spec/xml/shared/disconnect_invalid.xml +0 -6
  162. data/spec/xml/shared/disconnect_success.xml +0 -5
  163. data/spec/xml/shared/reconnect_error_expired.xml +0 -6
  164. data/spec/xml/shared/reconnect_error_not_approved.xml +0 -6
  165. data/spec/xml/shared/reconnect_error_out_of_bounds.xml +0 -6
  166. data/spec/xml/shared/reconnect_success.xml +0 -8
  167. data/spec/xml/windows/classes.xml +0 -41
  168. data/spec/xml/windows/company_meta_data.xml +0 -30
  169. data/spec/xml/windows/customer.xml +0 -56
  170. data/spec/xml/windows/customer_create_success.xml +0 -13
  171. data/spec/xml/windows/customer_update_success.xml +0 -13
  172. data/spec/xml/windows/customers.xml +0 -137
  173. data/spec/xml/windows/employees.xml +0 -36
  174. data/spec/xml/windows/fetch_customer_by_id.xml +0 -53
  175. data/spec/xml/windows/http_401.xml +0 -8
  176. data/spec/xml/windows/invoice_success_create.xml +0 -11
  177. data/spec/xml/windows/invoices.xml +0 -436
  178. data/spec/xml/windows/job_list_error_invalid_filter_ordering.xml +0 -9
  179. data/spec/xml/windows/jobs.xml +0 -71
  180. data/spec/xml/windows/payment_create_success.xml +0 -11
  181. data/spec/xml/windows/payment_methods.xml +0 -121
  182. data/spec/xml/windows/payments.xml +0 -39
  183. data/spec/xml/windows/sales_reps.xml +0 -204
  184. data/spec/xml/windows/sales_taxes.xml +0 -34
  185. data/spec/xml/windows/ship_methods.xml +0 -139
  186. data/spec/xml/windows/sync_activity_responses.xml +0 -20
  187. data/spec/xml/windows/sync_status_responses.xml +0 -186
  188. data/spec/xml/windows/time_activities.xml +0 -30
  189. data/tmp/console.rb +0 -10
data/quickeebooks.gemspec DELETED
@@ -1,30 +0,0 @@
1
- $:.unshift File.expand_path("../lib", __FILE__)
2
- require "quickeebooks/version"
3
-
4
- Gem::Specification.new do |gem|
5
- gem.name = "quickeebooks"
6
- gem.version = Quickeebooks::VERSION
7
-
8
- gem.author = "Cody Caughlan"
9
- gem.email = "toolbag@gmail.com"
10
- gem.homepage = "http://github.com/ruckus/quickeebooks"
11
- gem.summary = "REST API to Quickbooks Online/Windows via Intuit Data Services"
12
-
13
- gem.description = gem.summary
14
-
15
- gem.files = Dir["**/*"]
16
-
17
- gem.add_dependency 'roxml'
18
- gem.add_dependency 'oauth'
19
- gem.add_dependency 'nokogiri'
20
- gem.add_dependency 'activemodel'
21
- gem.add_dependency 'uuidtools'
22
-
23
- gem.add_development_dependency 'rake'
24
- gem.add_development_dependency 'simplecov'
25
- gem.add_development_dependency 'rr', '~> 1.0.2'
26
- gem.add_development_dependency 'rspec', '2.13.0'
27
- gem.add_development_dependency 'fakeweb'
28
- gem.add_development_dependency 'guard', '1.8.0'
29
- gem.add_development_dependency 'guard-rspec', '3.0.0'
30
- end
@@ -1,2 +0,0 @@
1
- class OauthConsumerMock
2
- end
@@ -1,41 +0,0 @@
1
- describe 'Mixin for online models that have line items' do
2
-
3
- let (:shared_models) { %w(Invoice Payment Bill) }
4
-
5
- it 'initializes' do
6
- shared_models.each do |model|
7
- klass = "Quickeebooks::Online::Model::#{model}".constantize
8
- klass.new.line_items.size == 0
9
- xml = onlineFixture("#{model.downcase}.xml")
10
- klass.from_xml(xml).line_items.size.should == 1
11
- end
12
- end
13
-
14
- it 'references constants' do
15
- shared_models.each do |model|
16
- klass = "Quickeebooks::Online::Model::#{model}".constantize
17
- klass.resource_for_collection.should == "#{model.downcase}s"
18
- klass.new.to_xml_ns.should == "<#{model}/>"
19
- end
20
- end
21
-
22
- it 'valid for updates' do
23
- shared_models.each do |model|
24
- klass = "Quickeebooks::Online::Model::#{model}".constantize.new
25
- klass.valid_for_update?.should be_true
26
- klass.errors.add(:id, 'no user')
27
- klass.valid_for_update?.should be_false
28
- end
29
- end
30
-
31
- it 'valid for deletion' do
32
- shared_models.each do |model|
33
- klass = "Quickeebooks::Online::Model::#{model}".constantize
34
- xml = onlineFixture("#{model.downcase}.xml")
35
- item = klass.from_xml(xml)
36
- item.valid_for_deletion?.should be_true
37
- end
38
- end
39
-
40
- end
41
-
@@ -1,41 +0,0 @@
1
- describe 'Mixin CRUD like methods for various service modules' do
2
-
3
- context 'model method' do
4
- it 'should constantize properly for an online service' do
5
- service = Quickeebooks::Online::Service::Bill.new
6
- service.model.should be_a(Class)
7
- service.model.to_s.should == "Quickeebooks::Online::Model::Bill"
8
- end
9
-
10
- it 'should constantize properly for a windows service' do
11
- expect {
12
- # Test build_dummy first
13
- build_dummy_windows_service
14
- Quickeebooks::Windows::Service::TEST.new.model
15
- }.to raise_exception NoMethodError
16
-
17
- build_dummy_windows_service('include ServiceCRUD')
18
- service = Quickeebooks::Windows::Service::TEST.new
19
- service.model.should be_a(Class)
20
- service.model.to_s.should == "Quickeebooks::Windows::Model::TEST"
21
- end
22
-
23
- def build_dummy_windows_service(inc = '')
24
- eval("
25
- module Quickeebooks
26
- module Windows
27
- module Service
28
- class TEST < Quickeebooks::Windows::Service::ServiceBase
29
- #{inc}
30
- end
31
- end
32
- module Model
33
- class TEST < Quickeebooks::Windows::Model::IntuitType
34
- end
35
- end
36
- end
37
- end
38
- ", TOPLEVEL_BINDING)
39
- end
40
- end
41
- end
@@ -1,37 +0,0 @@
1
- describe "Quickeebooks::Online::Model::Account" do
2
-
3
- it "should convert Ruby to XML" do
4
- account = Quickeebooks::Online::Model::Account.new
5
- account.sync_token = 1
6
- account.name = "John Doe"
7
- expected = "<Account><Name>John Doe</Name></Account>"
8
- # we have to jump through some hoops to get a non-pretty version for easier comparison
9
- s = StringIO.new
10
- xml = account.to_xml(:fields => 'Name').write_to(s, :indent => 0, :indent_text => '')
11
- xml.string.gsub(/\n/, '').should == expected
12
- end
13
-
14
- it "has a validation error on invalid subtype" do
15
- account = Quickeebooks::Online::Model::Account.new
16
- account.sub_type = "invalid"
17
- account.valid?.should == false
18
- end
19
-
20
- it "has a validation error when required attributes are not given" do
21
- account = Quickeebooks::Online::Model::Account.new
22
- account.valid?.should == false
23
- end
24
-
25
- it "should pass validation when all required attributes are given" do
26
- account = Quickeebooks::Online::Model::Account.new
27
- account.name = "John Doe"
28
- account.sub_type = "AccountsPayable"
29
- account.valid?.should == true
30
- end
31
-
32
- it "cannot delete an Account without providing required fields" do
33
- account = Quickeebooks::Online::Model::Account.new
34
- account.valid_for_deletion?.should == false
35
- end
36
-
37
- end
@@ -1,18 +0,0 @@
1
- describe "Quickeebooks::Online::Model::BillPayment" do
2
-
3
- describe "parse bill payment from XML" do
4
- it "should properly parse bill payment from XML" do
5
- xml = onlineFixture("bill_payment.xml")
6
- bill_payment = Quickeebooks::Online::Model::BillPayment.from_xml(xml)
7
- bill_payment.id.value.should == '13'
8
- bill_payment.sync_token.should == 0
9
- bill_payment.header.doc_number.should == '15'
10
- bill_payment.header.entity_id.value.should == '1'
11
- bill_payment.header.total_amount.should == 5000.0
12
- bill_payment.line_items.size.should == 1
13
- bill_payment.line_items[0].amount.should == 5000.0
14
- bill_payment.line_items[0].txn_id.value.should == '12'
15
- end
16
- end
17
-
18
- end
@@ -1,17 +0,0 @@
1
- describe "Quickeebooks::Online::Model::Bill" do
2
-
3
- describe "parse bill from XML" do
4
- xml = onlineFixture("bill.xml")
5
- bill = Quickeebooks::Online::Model::Bill.from_xml(xml)
6
- bill.header.doc_number.should == "2004"
7
- bill.header.vendor_id.value.should == "7"
8
- bill.header.sales_term_id.value.should == "5"
9
- bill.header.total_amount.should == 50
10
-
11
- bill.line_items.count.should == 1
12
- bill.line_items.first.amount.should == 25
13
- bill.line_items.first.billable_status.should == "NotBillable"
14
- bill.line_items.first.reimbursable.customer_id.value.should == "5"
15
- end
16
-
17
- end
@@ -1,27 +0,0 @@
1
- describe "Quickeebooks::Online::Model::CompanyMetaData" do
2
-
3
- it "parse company meta data from XML" do
4
- xml = onlineFixture("company_meta_data.xml")
5
- company_meta_data = Quickeebooks::Online::Model::CompanyMetaData.from_xml(xml)
6
-
7
- company_meta_data.external_realm_id.should be_nil
8
-
9
- company_meta_data.registered_company_name.should == "Bay Area landscape services"
10
-
11
- company_meta_data.industry_type.should == "Landscaping Services"
12
-
13
- company_meta_data.addresses.count.should == 2
14
-
15
- company_meta_data.addresses.first.line1.should == "2600 Service Street"
16
-
17
- company_meta_data.legal_address.line1.should == "2602 Service Street"
18
-
19
- company_meta_data.phone.free_form_number.should == "(669)111-2222"
20
-
21
- company_meta_data.emails.size.should == 2
22
- company_meta_data.emails.first.address.should == "john@bayarealandscapeservices.com"
23
-
24
- # Tag not supported yet in Quickeebooks::Online::Model::Email
25
- # company_meta_data.emails.first.tag.should == "COMPANY_EMAIL"
26
- end
27
- end
@@ -1,48 +0,0 @@
1
- describe "Quickeebooks::Online::Model::Customer" do
2
-
3
- it "parse customer from XML" do
4
- xml = onlineFixture("customer.xml")
5
- customer = Quickeebooks::Online::Model::Customer.from_xml(xml)
6
- customer.sync_token.should == 1
7
- customer.name.should == "John Doe"
8
-
9
- create_time = Date.civil(2011, 9, 29)
10
- customer.meta_data.create_time.year.should == create_time.year
11
- customer.addresses.count.should == 2
12
-
13
- customer.billing_address.line1.should == "123 Main St."
14
- customer.shipping_address.line1.should == "123 Shipping St."
15
-
16
- customer.phones.size.should == 5
17
- customer.primary_phone.free_form_number.should == "(408) 555-1212"
18
- customer.secondary_phone.free_form_number.should == "(408) 555-1213"
19
- customer.mobile_phone.free_form_number.should == "(408) 555-1214"
20
- customer.fax.free_form_number.should == "(408) 555-1215"
21
- customer.pager.free_form_number.should == "(408) 555-1216"
22
-
23
- customer.email.address.should == "johndoe@gmail.com"
24
-
25
- customer.notes.count.should == 1
26
- customer.notes.first.content.should == "Likes chocolate and horses"
27
-
28
- customer.custom_fields.count.should == 3
29
-
30
- customer.open_balance.amount.should == 6200.0
31
- end
32
-
33
- it "can assign an email address" do
34
- customer = Quickeebooks::Online::Model::Customer.new
35
- the_email = "foo@example.org"
36
- customer.email_address = the_email
37
- customer.email.is_a?(Quickeebooks::Online::Model::Email).should == true
38
- customer.email.address.should == the_email
39
- end
40
-
41
- it "cannot update an invalid model" do
42
- customer = Quickeebooks::Online::Model::Customer.new
43
- customer.valid_for_update?.should == false
44
- customer.to_xml_ns.should match('Customer')
45
- customer.errors.keys.include?(:sync_token).should == true
46
- end
47
-
48
- end
@@ -1,31 +0,0 @@
1
- describe "Quickeebooks::Online::Model::Employee" do
2
-
3
- describe "parse employee from XML" do
4
- xml = onlineFixture("employee.xml")
5
- employee = Quickeebooks::Online::Model::Employee.from_xml(xml)
6
- employee.sync_token.should == 0
7
- employee.name.should == "John Simpson"
8
- employee.meta_data.create_time.year.should == Date.civil(2010, 9, 10).year
9
- employee.addresses.count.should == 1
10
- employee.addresses.first.line1.should == "21215 Burbank Boulevard, Ste. 100"
11
- employee.phones.size.should == 2
12
- employee.phones.first.free_form_number.should == "(818) 936-7800"
13
- employee.email.address.should == "john.simpson@mint.com"
14
- end
15
-
16
- it "can assign an email address" do
17
- employee = Quickeebooks::Online::Model::Employee.new
18
- the_email = "foo@example.org"
19
- employee.email_address = the_email
20
- employee.email.is_a?(Quickeebooks::Online::Model::Email).should == true
21
- employee.email.address.should == the_email
22
- end
23
-
24
- it "cannot update an invalid model" do
25
- employee = Quickeebooks::Online::Model::Employee.new
26
- employee.to_xml_ns.should match('Employee')
27
- employee.valid_for_update?.should == false
28
- employee.errors.keys.include?(:sync_token).should == true
29
- end
30
-
31
- end
@@ -1,18 +0,0 @@
1
- describe "Quickeebooks::Online::Model::Id" do
2
-
3
- it "can be converted to String" do
4
- id = Quickeebooks::Online::Model::Id.new(42)
5
- id.to_s.should == "42"
6
- end
7
-
8
- it "can be converted to Integer" do
9
- id = Quickeebooks::Online::Model::Id.new(42)
10
- id.to_i.should == 42
11
- end
12
-
13
- it "can be coerced into a String" do
14
- id = Quickeebooks::Online::Model::Id.new(42)
15
- "/whatever/#{id}".should == "/whatever/42"
16
- end
17
-
18
- end
@@ -1,12 +0,0 @@
1
- describe "Quickeebooks::Online::Model::Invoice" do
2
-
3
- describe "parse invoice from XML" do
4
- xml = onlineFixture("invoice.xml")
5
- invoice = Quickeebooks::Online::Model::Invoice.from_xml(xml)
6
- invoice.header.balance.should == 0
7
- invoice.id.value.should == "13"
8
- invoice.line_items.count.should == 1
9
- invoice.line_items.first.unit_price.should == 225
10
- end
11
-
12
- end
@@ -1,26 +0,0 @@
1
- describe "Quickeebooks::Online::Model::JournalEntry" do
2
- describe "parse invoice from XML" do
3
- xml = onlineFixture("journal_entry.xml")
4
- journal_entry = Quickeebooks::Online::Model::JournalEntry.from_xml(xml)
5
- journal_entry.id.value.should == "381"
6
- journal_entry.sync_token.should == 0
7
- journal_entry.header.doc_number.should == "5"
8
- journal_entry.header.msg.should == "Message about entry"
9
- journal_entry.header.note.should == "Some note"
10
-
11
- credit_li = journal_entry.line_items.select { |l| l.posting_type == "Credit" }.first
12
- credit_li.amount.should == 100.00
13
- credit_li.desc.should == "credit this -- Desc"
14
- credit_li.account_id.value.should == "255"
15
- credit_li.entity_id.value.should == "259"
16
- credit_li.entity_type.should == "Customer"
17
-
18
- debit_li = journal_entry.line_items.select { |l| l.posting_type == "Debit" }.first
19
- debit_li.amount.should == 100.00
20
- debit_li.desc.should == "debit this -- Desc"
21
- debit_li.account_id.value.should == "255"
22
- debit_li.entity_id.value.should == "260"
23
- debit_li.entity_type.should == "Customer"
24
- end
25
-
26
- end
@@ -1,19 +0,0 @@
1
- describe "Quickeebooks::Online::Model::Payment" do
2
-
3
- describe "parse invoice from XML" do
4
- xml = onlineFixture("payment.xml")
5
- invoice = Quickeebooks::Online::Model::Payment.from_xml(xml)
6
- invoice.id.value.should == "47"
7
- invoice.header.doc_number.should == "54"
8
- invoice.header.customer_id.value.should == "5"
9
- invoice.header.note.should == "Payment against Invoice"
10
- invoice.header.total_amount.should == 20.0
11
-
12
- invoice.line_items.count.should == 1
13
- invoice.line_items.first.amount.should == 20.0
14
- invoice.line_items.first.txn_id.value.should == "8"
15
-
16
- invoice.line_items.first.amount.should == invoice.header.total_amount
17
- end
18
-
19
- end
@@ -1,18 +0,0 @@
1
- describe "Quickeebooks::Online::Model::SalesReceipt" do
2
- describe "parse invoice from XML" do
3
- xml = onlineFixture("sales_receipt.xml")
4
- sales_receipt = Quickeebooks::Online::Model::SalesReceipt.from_xml(xml)
5
- sales_receipt.id.value.should == "8"
6
- sales_receipt.sync_token.should == 0
7
- sales_receipt.header.doc_number.should == "1006"
8
- sales_receipt.header.customer_id.value.should == "4"
9
- sales_receipt.header.subtotal_amount.should == 2500.00
10
- sales_receipt.header.total_amount.should == 2500.00
11
-
12
- line_item = sales_receipt.line_items.first
13
- line_item.desc.should == "Keyboards"
14
- line_item.amount.should == 2500.00
15
- line_item.unit_price.should == 10
16
- line_item.quantity.should == 2
17
- end
18
- end
@@ -1,82 +0,0 @@
1
- describe "Quickeebooks::Online::Service::Account" do
2
- before(:all) do
3
- FakeWeb.allow_net_connect = false
4
- qb_key = "key"
5
- qb_secret = "secreet"
6
-
7
- @realm_id = "9991111222"
8
- @oauth_consumer = OAuth::Consumer.new(qb_key, qb_key, {
9
- :site => "https://oauth.intuit.com",
10
- :request_token_path => "/oauth/v1/get_request_token",
11
- :authorize_path => "/oauth/v1/get_access_token",
12
- :access_token_path => "/oauth/v1/get_access_token"
13
- })
14
- @oauth = OAuth::AccessToken.new(@oauth_consumer, "blah", "blah")
15
-
16
- @service = Quickeebooks::Online::Service::Account.new
17
- @service.access_token = @oauth
18
- @service.instance_eval {
19
- @realm_id = "9991111222"
20
- }
21
- end
22
-
23
- it "receives 404 from invalid base URL" do
24
- uri = "https://qbo.intuit.com/invalid"
25
- url = @service.url_for_resource(Quickeebooks::Online::Model::Account.resource_for_collection)
26
- FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => "blah")
27
- lambda { @service.list }.should raise_error(IntuitRequestException)
28
- end
29
-
30
- it "can fetch a list of accounts" do
31
- xml = File.read(File.dirname(__FILE__) + "/../../../xml/online/accounts.xml")
32
- url = @service.url_for_resource(Quickeebooks::Online::Model::Account.resource_for_collection)
33
- FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
34
- accounts = @service.list
35
- accounts.current_page.should == 1
36
- accounts.entries.count.should == 10
37
- accounts.entries.first.current_balance.should == 6200
38
- end
39
-
40
- it "can create an account" do
41
- xml = File.read(File.dirname(__FILE__) + "/../../../xml/online/account.xml")
42
- url = @service.url_for_resource(Quickeebooks::Online::Model::Account.resource_for_singular)
43
- FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
44
- account = Quickeebooks::Online::Model::Account.new
45
- account.name = "Billy Bob"
46
- account.sub_type = "AccountsPayable"
47
- account.valid?.should == true
48
- result = @service.create(account)
49
- result.id.to_i.should > 0
50
- end
51
-
52
- it "can delete an account" do
53
- url = @service.url_for_resource(Quickeebooks::Online::Model::Account.resource_for_singular)
54
- url = "#{url}/99?methodx=delete"
55
- FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
56
- account = Quickeebooks::Online::Model::Account.new
57
- account.id = 99
58
- account.sync_token = 0
59
- result = @service.delete(account)
60
- result.should == true
61
- end
62
-
63
- it "cannot delete an account with missing required fields for deletion" do
64
- account = Quickeebooks::Online::Model::Account.new
65
- lambda { @service.delete(account) }.should raise_error(InvalidModelException, "Missing required parameters for delete")
66
- end
67
-
68
- it "exception is raised when we try to create an invalid account" do
69
- account = Quickeebooks::Online::Model::Account.new
70
- lambda { @service.create(account) }.should raise_error(InvalidModelException)
71
- end
72
-
73
- it "can fetch an account by id" do
74
- xml = onlineFixture("account.xml")
75
- url = @service.url_for_resource(Quickeebooks::Online::Model::Account.resource_for_singular)
76
- url = "#{url}/99"
77
- FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
78
- account = @service.fetch_by_id(99)
79
- account.name.should == "Billy Bob"
80
- end
81
-
82
- end