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
@@ -1,74 +0,0 @@
1
- describe "Quickeebooks::Windows::Service::Job" 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
- @base_uri = "https://qbo.intuit.com/qbo36"
9
- @oauth_consumer = OAuth::Consumer.new(qb_key, qb_key, {
10
- :site => "https://oauth.intuit.com",
11
- :request_token_path => "/oauth/v1/get_request_token",
12
- :authorize_path => "/oauth/v1/get_access_token",
13
- :access_token_path => "/oauth/v1/get_access_token"
14
- })
15
- @oauth = OAuth::AccessToken.new(@oauth_consumer, "blah", "blah")
16
- end
17
-
18
- it "can fetch a list of jobs" do
19
- xml = windowsFixture("jobs.xml")
20
- model = Quickeebooks::Windows::Model::Job
21
- service = Quickeebooks::Windows::Service::Job.new
22
- service.access_token = @oauth
23
- service.realm_id = @realm_id
24
- FakeWeb.register_uri(:post, service.url_for_resource(model::REST_RESOURCE), :status => ["200", "OK"], :body => xml)
25
- jobs = service.list
26
- jobs.entries.count.should == 1
27
- my_job = jobs.entries.first
28
- my_job.name.should == "My Job Name"
29
-
30
- my_job_address = my_job.billing_address
31
- my_job_address.should_not == nil
32
- my_job_address.line1.should == "EngeniusMicro"
33
- my_job_address.line2.should == "107 Jefferson Street N"
34
- my_job_address.city.should == "Huntsville"
35
- my_job_address.state.should == "AL"
36
- my_job_address.postal_code.should == "35801"
37
-
38
- my_job.email.address.should == "michael.whitley@engeniusmicro.com"
39
- my_job.dba_name.should == "EngeniusMicro"
40
- my_job.acct_num.should == ".0000"
41
- my_job.job_parent_name.should == ".0000.001"
42
- end
43
-
44
- it "gets a REST error when filters are not in expected order" do
45
- xml = windowsFixture("job_list_error_invalid_filter_ordering.xml")
46
- model = Quickeebooks::Windows::Model::Job
47
- service = Quickeebooks::Windows::Service::Job.new
48
- service.access_token = @oauth
49
- service.realm_id = @realm_id
50
- FakeWeb.register_uri(:post, service.url_for_resource(model::REST_RESOURCE), :status => ["200", "OK"], :body => xml)
51
-
52
-
53
- filters = []
54
- filters << Quickeebooks::Windows::Service::Filter.new(:datetime, :field => 'StartCreatedTMS', :value => Time.mktime(2013, 6, 1))
55
- filters << Quickeebooks::Windows::Service::Filter.new(:datetime, :field => 'EndCreatedTMS', :value => Time.mktime(2013, 6, 10))
56
-
57
- expect { response = service.list(filters) }.to raise_error(IntuitRequestException)
58
- end
59
-
60
- it "reorders filters according to the Service specification" do
61
- service = Quickeebooks::Windows::Service::Job.new
62
-
63
- f1 = Quickeebooks::Windows::Service::Filter.new(:datetime, :field => 'StartCreatedTMS', :value => Time.mktime(2013, 6, 1))
64
- f2 = Quickeebooks::Windows::Service::Filter.new(:boolean, :field => 'CustomFieldEnable', :value => true)
65
- f3 = Quickeebooks::Windows::Service::Filter.new(:datetime, :field => 'EndCreatedTMS', :value => Time.mktime(2013, 6, 10))
66
-
67
- out_of_order = [f1, f2, f3]
68
- in_order = [f2, f1, f3]
69
- reordered = service.enforce_filter_order(out_of_order)
70
-
71
- reordered.should == in_order
72
- end
73
-
74
- end
@@ -1,36 +0,0 @@
1
- describe "Quickeebooks::Windows::Service::PaymentMethod" 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
- @base_uri = "https://qbo.intuit.com/qbo36"
9
- @oauth_consumer = OAuth::Consumer.new(qb_key, qb_key, {
10
- :site => "https://oauth.intuit.com",
11
- :request_token_path => "/oauth/v1/get_request_token",
12
- :authorize_path => "/oauth/v1/get_access_token",
13
- :access_token_path => "/oauth/v1/get_access_token"
14
- })
15
- @oauth = OAuth::AccessToken.new(@oauth_consumer, "blah", "blah")
16
- end
17
-
18
- it "can fetch a list of payment methods" do
19
- xml = windowsFixture("payment_methods.xml")
20
- service = Quickeebooks::Windows::Service::PaymentMethod.new
21
- service.access_token = @oauth
22
- service.realm_id = @realm_id
23
-
24
- model = Quickeebooks::Windows::Model::PaymentMethod
25
- FakeWeb.register_uri(:post,
26
- service.url_for_resource(model::REST_RESOURCE),
27
- :status => ["200", "OK"],
28
- :body => xml)
29
- methods = service.list
30
- methods.entries.count.should == 9
31
-
32
- method1 = methods.entries.first
33
- method1.id.value.should == "9"
34
- method1.name.should == "E-Check"
35
- end
36
- end
@@ -1,72 +0,0 @@
1
- describe "Quickeebooks::Windows::Service::Payment" 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
- @base_uri = "https://qbo.intuit.com/qbo36"
9
- @oauth_consumer = OAuth::Consumer.new(qb_key, qb_key, {
10
- :site => "https://oauth.intuit.com",
11
- :request_token_path => "/oauth/v1/get_request_token",
12
- :authorize_path => "/oauth/v1/get_access_token",
13
- :access_token_path => "/oauth/v1/get_access_token"
14
- })
15
- @oauth = OAuth::AccessToken.new(@oauth_consumer, "blah", "blah")
16
- end
17
-
18
- it "can fetch a list of payments" do
19
- xml = windowsFixture("payments.xml")
20
- service = Quickeebooks::Windows::Service::Payment.new
21
- service.access_token = @oauth
22
- service.realm_id = @realm_id
23
-
24
- model = Quickeebooks::Windows::Model::Payment
25
- FakeWeb.register_uri(:post,
26
- service.url_for_resource(model::REST_RESOURCE),
27
- :status => ["200", "OK"],
28
- :body => xml)
29
- payments = service.list
30
- payments.entries.count.should == 1
31
-
32
- payment = payments.entries.first
33
- payment.id.value.should == "4"
34
- payment.header.should_not be_nil
35
- header = payment.header
36
- header.customer_name.should == "Davis"
37
-
38
- line1 = payment.line_items.first
39
- line1.should_not be_nil
40
- line1.amount.should == header.total_amount
41
- end
42
-
43
- it "can create a payment" do
44
- xml = windowsFixture("payment_create_success.xml")
45
- service = Quickeebooks::Windows::Service::Payment.new
46
- model = Quickeebooks::Windows::Model::Payment
47
- customer = Quickeebooks::Windows::Model::Payment.new
48
-
49
- service.access_token = @oauth
50
- service.realm_id = @realm_id
51
- FakeWeb.register_uri(:post, service.url_for_resource(model::REST_RESOURCE), :status => ["200", "OK"], :body => xml)
52
-
53
- payment = Quickeebooks::Windows::Model::Payment.new
54
- payment.header = Quickeebooks::Windows::Model::PaymentHeader.new
55
- payment.header.customer_id = Quickeebooks::Windows::Model::Id.new("4")
56
- payment.header.payment_method_id = Quickeebooks::Windows::Model::Id.new("8") # Gift Card
57
-
58
- payment.header.doc_number = "99999"
59
- payment.header.txn_date = Date.civil(2013, 5, 3)
60
- payment.header.total_amount = 88
61
-
62
- line_item = Quickeebooks::Windows::Model::PaymentLineItem.new
63
- line_item.desc = "Dog Grooming"
64
- line_item.amount = 88
65
- payment.line_items << line_item
66
-
67
- create_response = service.create(payment)
68
- create_response.success?.should == true
69
- create_response.success.object_ref.id.value.should == "984434"
70
- create_response.success.request_name.should == "PaymentAdd"
71
- end
72
- end
@@ -1,42 +0,0 @@
1
- describe "Quickeebooks::Windows::Service::SalesRep" 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
- @base_uri = "https://qbo.intuit.com/qbo36"
9
- @oauth_consumer = OAuth::Consumer.new(qb_key, qb_key, {
10
- :site => "https://oauth.intuit.com",
11
- :request_token_path => "/oauth/v1/get_request_token",
12
- :authorize_path => "/oauth/v1/get_access_token",
13
- :access_token_path => "/oauth/v1/get_access_token"
14
- })
15
- @oauth = OAuth::AccessToken.new(@oauth_consumer, "blah", "blah")
16
- end
17
-
18
- it "can fetch a list of sales reps" do
19
- xml = windowsFixture("sales_reps.xml")
20
- service = Quickeebooks::Windows::Service::SalesRep.new
21
- service.access_token = @oauth
22
- service.realm_id = @realm_id
23
-
24
- model = Quickeebooks::Windows::Model::SalesRep
25
- FakeWeb.register_uri(:post, service.url_for_resource(model::REST_RESOURCE), :status => ["200", "OK"], :body => xml)
26
- reps = service.list
27
- reps.entries.count.should == 10
28
-
29
- lukas = reps.entries.detect { |sr| sr.id.value == "13" }
30
- lukas.should_not == nil
31
- lukas.external_key.value.should == "13"
32
- lukas.initials.should == "LB"
33
- lukas.vendor.vendor_id.value.should == "275"
34
- lukas.vendor.vendor_name.should == "Lukas Billybob"
35
-
36
- other_name = reps.entries.detect { |r| r.other_name? }
37
- other_name.should_not == nil
38
- other_name.other_name.other_name_id.value.should == "96"
39
- other_name.other_name.other_name_name.should == "Samples."
40
- end
41
-
42
- end
@@ -1,36 +0,0 @@
1
- describe "Quickeebooks::Windows::Service::SalesTax" 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
- @base_uri = "https://qbo.intuit.com/qbo36"
9
- @oauth_consumer = OAuth::Consumer.new(qb_key, qb_key, {
10
- :site => "https://oauth.intuit.com",
11
- :request_token_path => "/oauth/v1/get_request_token",
12
- :authorize_path => "/oauth/v1/get_access_token",
13
- :access_token_path => "/oauth/v1/get_access_token"
14
- })
15
- @oauth = OAuth::AccessToken.new(@oauth_consumer, "blah", "blah")
16
- end
17
-
18
- it "can fetch a list of sales taxes" do
19
- xml = windowsFixture("sales_taxes.xml")
20
- model = Quickeebooks::Windows::Model::SalesTax
21
- service = Quickeebooks::Windows::Service::SalesTax.new
22
- service.access_token = @oauth
23
- service.realm_id = @realm_id
24
- FakeWeb.register_uri(:post, service.url_for_resource(model::REST_RESOURCE), :status => ["200", "OK"], :body => xml)
25
- shipping_methods = service.list
26
- shipping_methods.entries.count.should == 2
27
-
28
- sf = shipping_methods.entries.detect { |sm| sm.name == "San Francisco County" }
29
- sf.should_not == nil
30
- sf.id.value.should == "80"
31
- sf.desc.should == 'Sales Tax - San Francisco'
32
- sf.tax_rate.should == 8.5
33
-
34
- end
35
-
36
- end
@@ -1,95 +0,0 @@
1
- describe "Quickeebooks::Windows::Service::ServiceBase" 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::Windows::Service::ServiceBase.new
17
- @service.access_token = @oauth
18
- @service.instance_eval {
19
- @realm_id = "9991111222"
20
- }
21
- end
22
-
23
- describe "#fetch_collection" do
24
- let(:default_params){ "<StartPage>1</StartPage><ChunkSize>20</ChunkSize>" }
25
-
26
- before do
27
- stub_const("Object::REST_RESOURCE", "foos")
28
- stub_const("Object::XML_NODE", "Foo")
29
-
30
- @url = @service.url_for_resource(Object::REST_RESOURCE)
31
- end
32
-
33
- def wrap_result(res)
34
- %Q{<?xml version="1.0" encoding="utf-8"?>\n<FooQuery xmlns="http://www.intuit.com/sb/cdm/v2">#{res}</FooQuery>}
35
- end
36
-
37
- it "uses all default values" do
38
- @service.should_receive(:do_http_post).with(@url,
39
- wrap_result(default_params),
40
- {},
41
- {"Content-Type"=>"text/xml"})
42
-
43
- @service.send(:fetch_collection, Object)
44
- end
45
-
46
- it "queries arbitrary things" do
47
- @service.should_receive(:do_http_post).with(@url,
48
- wrap_result("#{default_params}<Something>42</Something>"),
49
- {},
50
- {"Content-Type"=>"text/xml"})
51
-
52
- @service.send(:fetch_collection, Object, "<Something>42</Something>")
53
- end
54
-
55
- it "filters" do
56
- filter = Quickeebooks::Windows::Service::Filter.new(:boolean, :field => "IsPaid", :value => true)
57
-
58
- @service.should_receive(:do_http_post).with(@url,
59
- wrap_result("#{default_params}<IsPaid>true</IsPaid>"),
60
- {},
61
- {"Content-Type"=>"text/xml"})
62
-
63
- @service.send(:fetch_collection, Object, nil, [filter])
64
- end
65
-
66
- it "paginates" do
67
- @service.should_receive(:do_http_post).with(@url,
68
- wrap_result("<StartPage>2</StartPage><ChunkSize>20</ChunkSize>"),
69
- {},
70
- {"Content-Type"=>"text/xml"})
71
-
72
- @service.send(:fetch_collection, Object, nil, nil, 2)
73
- end
74
-
75
- it "changes per_page" do
76
- @service.should_receive(:do_http_post).with(@url,
77
- wrap_result("<StartPage>1</StartPage><ChunkSize>10</ChunkSize>"),
78
- {},
79
- {"Content-Type"=>"text/xml"})
80
-
81
- @service.send(:fetch_collection, Object, nil, nil, 1, 10)
82
- end
83
-
84
- it "sorts" do
85
- sorter = Quickeebooks::Windows::Service::Sort.new('FamilyName', 'Ascending')
86
-
87
- @service.should_receive(:do_http_post).with(@url,
88
- wrap_result("#{default_params}<SortByColumn sortOrder=\"Ascending\">FamilyName</SortByColumn>"),
89
- {},
90
- {"Content-Type"=>"text/xml"})
91
-
92
- @service.send(:fetch_collection, Object, nil, nil, 1, 20, sorter)
93
- end
94
- end
95
- end
@@ -1,33 +0,0 @@
1
- describe "Quickeebooks::Windows::Service::ShipMethod" 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
- @base_uri = "https://qbo.intuit.com/qbo36"
9
- @oauth_consumer = OAuth::Consumer.new(qb_key, qb_key, {
10
- :site => "https://oauth.intuit.com",
11
- :request_token_path => "/oauth/v1/get_request_token",
12
- :authorize_path => "/oauth/v1/get_access_token",
13
- :access_token_path => "/oauth/v1/get_access_token"
14
- })
15
- @oauth = OAuth::AccessToken.new(@oauth_consumer, "blah", "blah")
16
- end
17
-
18
- it "can fetch a list of shipping methods" do
19
- xml = windowsFixture("ship_methods.xml")
20
- model = Quickeebooks::Windows::Model::ShipMethod
21
- service = Quickeebooks::Windows::Service::ShipMethod.new
22
- service.access_token = @oauth
23
- service.realm_id = @realm_id
24
- FakeWeb.register_uri(:post, service.url_for_resource(model::REST_RESOURCE), :status => ["200", "OK"], :body => xml)
25
- shipping_methods = service.list
26
- shipping_methods.entries.count.should == 15
27
-
28
- vinlux = shipping_methods.entries.detect { |sm| sm.name == "Vinlux" }
29
- vinlux.should_not == nil
30
- vinlux.id.value.should == "13"
31
- end
32
-
33
- end
@@ -1,42 +0,0 @@
1
- describe "Quickeebooks::Windows::Service::SyncActivity" 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
- @base_uri = "https://qbo.intuit.com/qbo36"
9
- @oauth_consumer = OAuth::Consumer.new(qb_key, qb_key, {
10
- :site => "https://oauth.intuit.com",
11
- :request_token_path => "/oauth/v1/get_request_token",
12
- :authorize_path => "/oauth/v1/get_access_token",
13
- :access_token_path => "/oauth/v1/get_access_token"
14
- })
15
- @oauth = OAuth::AccessToken.new(@oauth_consumer, "blah", "blah")
16
- end
17
-
18
- it "can fetch a list of time_activities" do
19
- xml = windowsFixture("sync_activity_responses.xml")
20
- model = Quickeebooks::Windows::Model::SyncActivityResponse
21
- service = Quickeebooks::Windows::Service::SyncActivity.new
22
- service.access_token = @oauth
23
- service.realm_id = @realm_id
24
- FakeWeb.register_uri(:post, service.url_for_resource(model::REST_RESOURCE), :status => ["200", "OK"], :body => xml)
25
- sync_activity_responses = service.retrieve
26
- sync_activity_responses.entries.count.should == 1
27
- single_response = sync_activity_responses.entries.first
28
- single_response.sync_type.should == "Writeback"
29
- single_response.start_sync_tms.utc.should == Time.parse("2011-07-29T07:09:02.0").utc
30
- single_response.end_sync_tms.utc.should == Time.parse("2011-07-29T07:09:02.0").utc
31
- single_response.entity_name.should == "Customer"
32
- drill_down = single_response.sync_status_drill_down
33
- drill_down.sync_tms.should == Time.parse("2011-07-29T14:09:02.0Z").utc
34
- drill_down.entity_id.should == "2480872"
35
- drill_down.request_id.should == "0729e1124a274fc79d65a1d97233877f"
36
- drill_down.ng_object_type.should == "Customer"
37
- drill_down.operation_type.should == "CustomerAdd"
38
- drill_down.sync_message_code.should == "10"
39
- drill_down.sync_message.should == "success"
40
- end
41
-
42
- end
@@ -1,35 +0,0 @@
1
- describe "Quickeebooks::Windows::Service::SyncStatus" 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
- @base_uri = "https://qbo.intuit.com/qbo36"
9
- @oauth_consumer = OAuth::Consumer.new(qb_key, qb_key, {
10
- :site => "https://oauth.intuit.com",
11
- :request_token_path => "/oauth/v1/get_request_token",
12
- :authorize_path => "/oauth/v1/get_access_token",
13
- :access_token_path => "/oauth/v1/get_access_token"
14
- })
15
- @oauth = OAuth::AccessToken.new(@oauth_consumer, "blah", "blah")
16
- end
17
-
18
- it "can fetch a list of sync statuses" do
19
- xml = windowsFixture("sync_status_responses.xml")
20
- model = Quickeebooks::Windows::Model::SyncStatusRequest
21
- service = Quickeebooks::Windows::Service::SyncStatus.new
22
- service.access_token = @oauth
23
- service.realm_id = @realm_id
24
- FakeWeb.register_uri(:post, service.url_for_resource(model::REST_RESOURCE), :status => ["200", "OK"], :body => xml)
25
-
26
- request = Quickeebooks::Windows::Model::SyncStatusRequest.new
27
- sync_status_responses = service.retrieve(request)
28
-
29
- sync_status_responses.entries.count.should == 15
30
- single_response = sync_status_responses.entries.first
31
- single_response.ng_id_set.to_i.should == 145058
32
- single_response.state_desc.should == "Next Gen record created"
33
- end
34
-
35
- end