quickeebooks 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/quickeebooks.rb +3 -1
- data/lib/quickeebooks/common/online_entity_model.rb +0 -3
- data/lib/quickeebooks/common/service_crud.rb +1 -1
- data/lib/quickeebooks/online/model/account.rb +1 -6
- data/lib/quickeebooks/online/model/address.rb +3 -2
- data/lib/quickeebooks/online/model/clazz.rb +60 -0
- data/lib/quickeebooks/online/model/intuit_type.rb +9 -4
- data/lib/quickeebooks/online/model/item.rb +3 -1
- data/lib/quickeebooks/online/service/account.rb +1 -41
- data/lib/quickeebooks/online/service/clazz.rb +12 -0
- data/lib/quickeebooks/online/service/employee.rb +2 -4
- data/lib/quickeebooks/online/service/invoice.rb +8 -58
- data/lib/quickeebooks/online/service/item.rb +1 -41
- data/lib/quickeebooks/online/service/service_base.rb +2 -2
- data/lib/quickeebooks/shared/service/access_token.rb +1 -0
- data/lib/quickeebooks/version.rb +1 -1
- metadata +8 -178
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -86
- data/Guardfile +0 -8
- data/HISTORY.md +0 -44
- data/MIT-LICENSE +0 -9
- data/README.md +0 -451
- data/Rakefile +0 -17
- data/coverage/assets/0.7.1/application.css +0 -1110
- data/coverage/assets/0.7.1/application.js +0 -626
- data/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
- data/coverage/assets/0.7.1/favicon_green.png +0 -0
- data/coverage/assets/0.7.1/favicon_red.png +0 -0
- data/coverage/assets/0.7.1/favicon_yellow.png +0 -0
- data/coverage/assets/0.7.1/loading.gif +0 -0
- data/coverage/assets/0.7.1/magnify.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +0 -39346
- data/quickeebooks.gemspec +0 -30
- data/spec/mocks/oauth_consumer_mock.rb +0 -2
- data/spec/quickeebooks/common/online_line_item_model_methods_spec.rb +0 -41
- data/spec/quickeebooks/common/service_crud_spec.rb +0 -41
- data/spec/quickeebooks/online/account_spec.rb +0 -37
- data/spec/quickeebooks/online/bill_payment_spec.rb +0 -18
- data/spec/quickeebooks/online/bill_spec.rb +0 -17
- data/spec/quickeebooks/online/company_meta_data_spec.rb +0 -27
- data/spec/quickeebooks/online/customer_spec.rb +0 -48
- data/spec/quickeebooks/online/employee_spec.rb +0 -31
- data/spec/quickeebooks/online/id_spec.rb +0 -18
- data/spec/quickeebooks/online/invoice_spec.rb +0 -12
- data/spec/quickeebooks/online/journal_entry_spec.rb +0 -26
- data/spec/quickeebooks/online/payment_spec.rb +0 -19
- data/spec/quickeebooks/online/sales_receipt_spec.rb +0 -18
- data/spec/quickeebooks/online/services/account_spec.rb +0 -82
- data/spec/quickeebooks/online/services/bill_payment_spec.rb +0 -69
- data/spec/quickeebooks/online/services/bill_spec.rb +0 -61
- data/spec/quickeebooks/online/services/company_meta_data_spec.rb +0 -30
- data/spec/quickeebooks/online/services/customer_spec.rb +0 -93
- data/spec/quickeebooks/online/services/employee_spec.rb +0 -83
- data/spec/quickeebooks/online/services/filter_spec.rb +0 -53
- data/spec/quickeebooks/online/services/invoice_spec.rb +0 -54
- data/spec/quickeebooks/online/services/journal_entry_spec.rb +0 -75
- data/spec/quickeebooks/online/services/payment_spec.rb +0 -63
- data/spec/quickeebooks/online/services/sales_receipt_spec.rb +0 -64
- data/spec/quickeebooks/online/services/service_base_spec.rb +0 -150
- data/spec/quickeebooks/online/services/time_activity_spec.rb +0 -89
- data/spec/quickeebooks/online/services/tracking_class_spec.rb +0 -99
- data/spec/quickeebooks/online/services/vendor_spec.rb +0 -85
- data/spec/quickeebooks/online/time_activity_spec.rb +0 -18
- data/spec/quickeebooks/online/tracking_class_spec.rb +0 -32
- data/spec/quickeebooks/online/vendor_spec.rb +0 -33
- data/spec/quickeebooks/shared/access_token_spec.rb +0 -129
- data/spec/quickeebooks/shared/filter_spec.rb +0 -159
- data/spec/quickeebooks/shared/sort_spec.rb +0 -17
- data/spec/quickeebooks/windows/customer_spec.rb +0 -45
- data/spec/quickeebooks/windows/id_spec.rb +0 -18
- data/spec/quickeebooks/windows/services/class_spec.rb +0 -33
- data/spec/quickeebooks/windows/services/company_meta_data_spec.rb +0 -29
- data/spec/quickeebooks/windows/services/customer_spec.rb +0 -173
- data/spec/quickeebooks/windows/services/employee_spec.rb +0 -42
- data/spec/quickeebooks/windows/services/invoice_spec.rb +0 -127
- data/spec/quickeebooks/windows/services/job_spec.rb +0 -74
- data/spec/quickeebooks/windows/services/payment_method_spec.rb +0 -36
- data/spec/quickeebooks/windows/services/payment_spec.rb +0 -72
- data/spec/quickeebooks/windows/services/sales_rep_spec.rb +0 -42
- data/spec/quickeebooks/windows/services/sales_taxes_spec.rb +0 -36
- data/spec/quickeebooks/windows/services/service_base_spec.rb +0 -95
- data/spec/quickeebooks/windows/services/ship_method_spec.rb +0 -33
- data/spec/quickeebooks/windows/services/sync_activity_spec.rb +0 -42
- data/spec/quickeebooks/windows/services/sync_status_spec.rb +0 -35
- data/spec/quickeebooks/windows/services/time_activity_spec.rb +0 -38
- data/spec/quickeebooks_spec.rb +0 -8
- data/spec/spec_helper.rb +0 -48
- data/spec/support/oauth.rb +0 -20
- data/spec/xml/online/account.xml +0 -13
- data/spec/xml/online/accounts.xml +0 -108
- data/spec/xml/online/api_error.xml +0 -6
- data/spec/xml/online/bill.xml +0 -32
- data/spec/xml/online/bill2.xml +0 -32
- data/spec/xml/online/bill_payment.xml +0 -20
- data/spec/xml/online/bill_payment2.xml +0 -20
- data/spec/xml/online/bill_payments.xml +0 -26
- data/spec/xml/online/bills.xml +0 -33
- data/spec/xml/online/company_meta_data.xml +0 -37
- data/spec/xml/online/customer.xml +0 -77
- data/spec/xml/online/customer2.xml +0 -63
- data/spec/xml/online/customers.xml +0 -125
- data/spec/xml/online/deleted_invoice.xml +0 -2
- data/spec/xml/online/determine_base_url.xml +0 -10
- data/spec/xml/online/employee.xml +0 -31
- data/spec/xml/online/employee2.xml +0 -31
- data/spec/xml/online/employees.xml +0 -36
- data/spec/xml/online/invalid_user.xml +0 -7
- data/spec/xml/online/invoice.xml +0 -28
- data/spec/xml/online/journal_entries.xml +0 -38
- data/spec/xml/online/journal_entry.xml +0 -32
- data/spec/xml/online/journal_entry2.xml +0 -32
- data/spec/xml/online/payment.xml +0 -24
- data/spec/xml/online/payment2.xml +0 -24
- data/spec/xml/online/payments.xml +0 -30
- data/spec/xml/online/sales_receipt.xml +0 -36
- data/spec/xml/online/sales_receipt2.xml +0 -36
- data/spec/xml/online/sales_receipts.xml +0 -39
- data/spec/xml/online/time_activities.xml +0 -27
- data/spec/xml/online/time_activity.xml +0 -21
- data/spec/xml/online/time_activity2.xml +0 -21
- data/spec/xml/online/tracking_class.xml +0 -11
- data/spec/xml/online/tracking_class_updated.xml +0 -11
- data/spec/xml/online/tracking_classes.xml +0 -26
- data/spec/xml/online/user.xml +0 -11
- data/spec/xml/online/vendor.xml +0 -34
- data/spec/xml/online/vendor2.xml +0 -34
- data/spec/xml/online/vendors.xml +0 -67
- data/spec/xml/shared/disconnect_invalid.xml +0 -6
- data/spec/xml/shared/disconnect_success.xml +0 -5
- data/spec/xml/shared/reconnect_error_expired.xml +0 -6
- data/spec/xml/shared/reconnect_error_not_approved.xml +0 -6
- data/spec/xml/shared/reconnect_error_out_of_bounds.xml +0 -6
- data/spec/xml/shared/reconnect_success.xml +0 -8
- data/spec/xml/windows/classes.xml +0 -41
- data/spec/xml/windows/company_meta_data.xml +0 -30
- data/spec/xml/windows/customer.xml +0 -56
- data/spec/xml/windows/customer_create_success.xml +0 -13
- data/spec/xml/windows/customer_update_success.xml +0 -13
- data/spec/xml/windows/customers.xml +0 -137
- data/spec/xml/windows/employees.xml +0 -36
- data/spec/xml/windows/fetch_customer_by_id.xml +0 -53
- data/spec/xml/windows/http_401.xml +0 -8
- data/spec/xml/windows/invoice_success_create.xml +0 -11
- data/spec/xml/windows/invoices.xml +0 -436
- data/spec/xml/windows/job_list_error_invalid_filter_ordering.xml +0 -9
- data/spec/xml/windows/jobs.xml +0 -71
- data/spec/xml/windows/payment_create_success.xml +0 -11
- data/spec/xml/windows/payment_methods.xml +0 -121
- data/spec/xml/windows/payments.xml +0 -39
- data/spec/xml/windows/sales_reps.xml +0 -204
- data/spec/xml/windows/sales_taxes.xml +0 -34
- data/spec/xml/windows/ship_methods.xml +0 -139
- data/spec/xml/windows/sync_activity_responses.xml +0 -20
- data/spec/xml/windows/sync_status_responses.xml +0 -186
- data/spec/xml/windows/time_activities.xml +0 -30
- data/tmp/console.rb +0 -10
@@ -1,75 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::JournalEntry" do
|
2
|
-
before(:all) do
|
3
|
-
construct_oauth_service :journal_entry
|
4
|
-
end
|
5
|
-
|
6
|
-
it "can fetch a list of journal entries" do
|
7
|
-
xml = onlineFixture("journal_entries.xml")
|
8
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::JournalEntry.resource_for_collection)
|
9
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
10
|
-
journal_entries = @service.list
|
11
|
-
journal_entries.current_page.should == 1
|
12
|
-
journal_entries.entries.count.should == 1
|
13
|
-
end
|
14
|
-
|
15
|
-
it "can create a journal entry" do
|
16
|
-
xml = onlineFixture("journal_entry.xml")
|
17
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::JournalEntry.resource_for_singular)
|
18
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
19
|
-
journal_entry = Quickeebooks::Online::Model::JournalEntry.new
|
20
|
-
journal_entry.header = Quickeebooks::Online::Model::JournalEntryHeader.new
|
21
|
-
journal_entry.header.note = "Journal entry for bananas"
|
22
|
-
journal_entry.header.doc_number = "5"
|
23
|
-
|
24
|
-
credit = Quickeebooks::Online::Model::JournalEntryLineItem.new
|
25
|
-
credit.amount = 100.00
|
26
|
-
credit.posting_type = "Credit"
|
27
|
-
credit.account_id = Quickeebooks::Online::Model::Id.new("255")
|
28
|
-
credit.entity_id = Quickeebooks::Online::Model::Id.new("259")
|
29
|
-
journal_entry.line_items << credit
|
30
|
-
|
31
|
-
debit = Quickeebooks::Online::Model::JournalEntryLineItem.new
|
32
|
-
debit.amount = 100.00
|
33
|
-
debit.posting_type = "Debit"
|
34
|
-
debit.account_id = Quickeebooks::Online::Model::Id.new("255")
|
35
|
-
debit.entity_id = Quickeebooks::Online::Model::Id.new("259")
|
36
|
-
journal_entry.line_items << debit
|
37
|
-
|
38
|
-
result = @service.create(journal_entry)
|
39
|
-
result.id.value.to_i.should > 0
|
40
|
-
end
|
41
|
-
|
42
|
-
it "can delete a journal entry" do
|
43
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::JournalEntry.resource_for_singular)}/5?methodx=delete"
|
44
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
|
45
|
-
journal_entry = Quickeebooks::Online::Model::JournalEntry.new
|
46
|
-
journal_entry.id = Quickeebooks::Online::Model::Id.new("5")
|
47
|
-
journal_entry.sync_token = 0
|
48
|
-
result = @service.delete(journal_entry)
|
49
|
-
result.should == true
|
50
|
-
end
|
51
|
-
|
52
|
-
it "can fetch a journal entry by id" do
|
53
|
-
xml = onlineFixture("journal_entry.xml")
|
54
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::JournalEntry.resource_for_singular)}/47"
|
55
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
56
|
-
journal_entry = @service.fetch_by_id(47)
|
57
|
-
journal_entry.header.doc_number.should == "5"
|
58
|
-
end
|
59
|
-
|
60
|
-
it "can update a journal entry" do
|
61
|
-
xml2 = onlineFixture("journal_entry2.xml")
|
62
|
-
journal_entry = Quickeebooks::Online::Model::JournalEntry.new
|
63
|
-
journal_entry.header = Quickeebooks::Online::Model::JournalEntryHeader.new
|
64
|
-
journal_entry.header.note = "Updated note for journal entry"
|
65
|
-
journal_entry.id = Quickeebooks::Online::Model::Id.new("50")
|
66
|
-
journal_entry.sync_token = 2
|
67
|
-
|
68
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::JournalEntry.resource_for_singular)}/#{journal_entry.id.value}"
|
69
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml2)
|
70
|
-
updated = @service.update(journal_entry)
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
end
|
75
|
-
|
@@ -1,63 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::Payment" do
|
2
|
-
before(:all) do
|
3
|
-
construct_oauth_service :payment
|
4
|
-
end
|
5
|
-
|
6
|
-
it "can fetch a list of payments" do
|
7
|
-
xml = onlineFixture("payments.xml")
|
8
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Payment.resource_for_collection)
|
9
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
10
|
-
payments = @service.list
|
11
|
-
payments.current_page.should == 1
|
12
|
-
payments.entries.count.should == 1
|
13
|
-
payments.entries.first.header.total_amount.should == 50.00
|
14
|
-
end
|
15
|
-
|
16
|
-
it "can create a payment" do
|
17
|
-
xml = onlineFixture("payment.xml")
|
18
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Payment.resource_for_singular)
|
19
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
20
|
-
payment = Quickeebooks::Online::Model::Payment.new
|
21
|
-
payment.header = Quickeebooks::Online::Model::PaymentHeader.new
|
22
|
-
payment.header.note = "Payment against Invoice"
|
23
|
-
payment.header.total_amount = 20.00
|
24
|
-
result = @service.create(payment)
|
25
|
-
result.id.value.to_i.should > 0
|
26
|
-
end
|
27
|
-
|
28
|
-
it "can delete a payment" do
|
29
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Payment.resource_for_singular)}/5?methodx=delete"
|
30
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
|
31
|
-
payment = Quickeebooks::Online::Model::Payment.new
|
32
|
-
payment.id = Quickeebooks::Online::Model::Id.new("5")
|
33
|
-
payment.sync_token = 0
|
34
|
-
result = @service.delete(payment)
|
35
|
-
result.should == true
|
36
|
-
end
|
37
|
-
|
38
|
-
it "can fetch a payment by id" do
|
39
|
-
xml = onlineFixture("payment.xml")
|
40
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Payment.resource_for_singular)}/47"
|
41
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
42
|
-
payment = @service.fetch_by_id(47)
|
43
|
-
payment.header.total_amount.should == 20.00
|
44
|
-
end
|
45
|
-
|
46
|
-
it "can update a payment" do
|
47
|
-
xml2 = onlineFixture("payment2.xml")
|
48
|
-
payment = Quickeebooks::Online::Model::Payment.new
|
49
|
-
payment.header = Quickeebooks::Online::Model::PaymentHeader.new
|
50
|
-
payment.header.note = "Payment against Invoice"
|
51
|
-
payment.header.total_amount = 50.00
|
52
|
-
payment.id = Quickeebooks::Online::Model::Id.new("50")
|
53
|
-
payment.sync_token = 2
|
54
|
-
|
55
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Payment.resource_for_singular)}/#{payment.id.value}"
|
56
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml2)
|
57
|
-
updated = @service.update(payment)
|
58
|
-
updated.header.total_amount.should == 50.00
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
end
|
63
|
-
|
@@ -1,64 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::SalesReceipt" do
|
2
|
-
before(:all) do
|
3
|
-
construct_oauth_service :sales_receipt
|
4
|
-
end
|
5
|
-
|
6
|
-
it "can fetch a list of sales receipts" do
|
7
|
-
xml = onlineFixture("sales_receipts.xml")
|
8
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::SalesReceipt.resource_for_collection)
|
9
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
10
|
-
sales_receipts = @service.list
|
11
|
-
sales_receipts.current_page.should == 1
|
12
|
-
sales_receipts.entries.count.should == 1
|
13
|
-
sales_receipts.entries.first.header.doc_number.should == "1006"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "can create a sales receipt" do
|
17
|
-
xml = onlineFixture("sales_receipt.xml")
|
18
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::SalesReceipt.resource_for_singular)
|
19
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
20
|
-
sales_receipt = Quickeebooks::Online::Model::SalesReceipt.new
|
21
|
-
sales_receipt.header = Quickeebooks::Online::Model::SalesReceiptHeader.new
|
22
|
-
sales_receipt.header.note = "Sales receipt for keyboards"
|
23
|
-
sales_receipt.header.total_amount = 25.00
|
24
|
-
sales_receipt.header.doc_number = 1005
|
25
|
-
result = @service.create(sales_receipt)
|
26
|
-
result.id.value.to_i.should > 0
|
27
|
-
end
|
28
|
-
|
29
|
-
it "can delete a sales receipt" do
|
30
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::SalesReceipt.resource_for_singular)}/5?methodx=delete"
|
31
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
|
32
|
-
sales_receipt = Quickeebooks::Online::Model::SalesReceipt.new
|
33
|
-
sales_receipt.id = Quickeebooks::Online::Model::Id.new("5")
|
34
|
-
sales_receipt.sync_token = 0
|
35
|
-
result = @service.delete(sales_receipt)
|
36
|
-
result.should == true
|
37
|
-
end
|
38
|
-
|
39
|
-
it "can fetch a sales receipt by id" do
|
40
|
-
xml = onlineFixture("sales_receipt.xml")
|
41
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::SalesReceipt.resource_for_singular)}/47"
|
42
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
43
|
-
sales_receipt = @service.fetch_by_id(47)
|
44
|
-
sales_receipt.header.doc_number.should == "1006"
|
45
|
-
end
|
46
|
-
|
47
|
-
it "can update a sales receipt" do
|
48
|
-
xml2 = onlineFixture("sales_receipt2.xml")
|
49
|
-
sales_receipt = Quickeebooks::Online::Model::SalesReceipt.new
|
50
|
-
sales_receipt.header = Quickeebooks::Online::Model::SalesReceiptHeader.new
|
51
|
-
sales_receipt.header.note = "Sales receipt for keyboards"
|
52
|
-
sales_receipt.header.total_amount = 45.00
|
53
|
-
sales_receipt.id = Quickeebooks::Online::Model::Id.new("50")
|
54
|
-
sales_receipt.sync_token = 2
|
55
|
-
|
56
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::SalesReceipt.resource_for_singular)}/#{sales_receipt.id.value}"
|
57
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml2)
|
58
|
-
updated = @service.update(sales_receipt)
|
59
|
-
updated.header.total_amount.should == 50.00
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
end
|
64
|
-
|
@@ -1,150 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::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
|
-
xml = onlineFixture("user.xml")
|
17
|
-
user_url = Quickeebooks::Online::Service::ServiceBase::QB_BASE_URI + "/" + @realm_id
|
18
|
-
FakeWeb.register_uri(:get, user_url, :status => ["200", "OK"], :body => xml)
|
19
|
-
@service = Quickeebooks::Online::Service::ServiceBase.new
|
20
|
-
@service.access_token = @oauth
|
21
|
-
@service.instance_eval {
|
22
|
-
@realm_id = "9991111222"
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
it "can determine login_name" do
|
27
|
-
xml = onlineFixture("user.xml")
|
28
|
-
user_url = "https://qbo.intuit.com/qbo1/rest/user/v2/#{@realm_id}"
|
29
|
-
FakeWeb.register_uri(:get, user_url, :status => ["200", "OK"], :body => xml)
|
30
|
-
@service.login_name.should == 'foo@example.com'
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "#do_http" do
|
34
|
-
context 'called from do_http_post' do
|
35
|
-
it "without params" do
|
36
|
-
url = "https://qbo.intuit.com/qbo1/rest/user/v2"
|
37
|
-
@service.should_receive(:do_http).with(:post, url, '', {})
|
38
|
-
@service.send(:do_http_post, url)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "with params" do
|
42
|
-
url = "https://qbo.intuit.com/qbo1/rest/user/v2"
|
43
|
-
@service.should_receive(:do_http).with(:post, url + '?methodx=delete', '', {})
|
44
|
-
@service.send(:do_http_post, url, '', { :methodx => 'delete' })
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should not log by default" do
|
48
|
-
url = "https://qbo.intuit.com/qbo1/rest/user/v2"
|
49
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
|
50
|
-
Quickeebooks.logger.should_receive(:info).never
|
51
|
-
@service.send(:do_http_post, url)
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should log if Quickbooks.log = true" do
|
55
|
-
url = "https://qbo.intuit.com/qbo1/rest/user/v2"
|
56
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
|
57
|
-
Quickeebooks.log = true
|
58
|
-
Quickeebooks.logger.should_receive(:info).at_least(1)
|
59
|
-
@service.send(:do_http_post, url)
|
60
|
-
Quickeebooks.log = false
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
context 'called from do_http_get' do
|
66
|
-
it "without params" do
|
67
|
-
url = "https://qbo.intuit.com/qbo1/rest/user/v2"
|
68
|
-
@service.should_receive(:do_http).with(:get, url, '', {})
|
69
|
-
@service.send(:do_http_get, url)
|
70
|
-
end
|
71
|
-
|
72
|
-
it "with params" do
|
73
|
-
url = "https://qbo.intuit.com/qbo1/rest/user/v2"
|
74
|
-
@service.should_receive(:do_http).with(:get, url + '?methodx=delete', '', {})
|
75
|
-
@service.send(:do_http_get, url, { :methodx => 'delete' })
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe "#fetch_collection" do
|
81
|
-
before do
|
82
|
-
@model = mock(Object)
|
83
|
-
@model.stub(:resource_for_collection){ "foos" }
|
84
|
-
|
85
|
-
@url = @service.url_for_resource(@model.resource_for_collection)
|
86
|
-
end
|
87
|
-
|
88
|
-
it "uses all default values" do
|
89
|
-
@service.should_receive(:do_http_post).with(@url,
|
90
|
-
"PageNum=1&ResultsPerPage=20",
|
91
|
-
{},
|
92
|
-
{"Content-Type"=>"application/x-www-form-urlencoded"})
|
93
|
-
|
94
|
-
@service.send(:fetch_collection, @model)
|
95
|
-
end
|
96
|
-
|
97
|
-
it "filters" do
|
98
|
-
|
99
|
-
filter = Quickeebooks::Online::Service::Filter.new(:text, :field => "Name", :value => "Smith")
|
100
|
-
|
101
|
-
@service.should_receive(:do_http_post).with(@url,
|
102
|
-
"Filter=Name+%3AEQUALS%3A+Smith&PageNum=1&ResultsPerPage=20",
|
103
|
-
{},
|
104
|
-
{"Content-Type"=>"application/x-www-form-urlencoded"})
|
105
|
-
|
106
|
-
@service.send(:fetch_collection, @model, [filter])
|
107
|
-
end
|
108
|
-
|
109
|
-
it "with an ampersand in filter value" do
|
110
|
-
|
111
|
-
filter = Quickeebooks::Online::Service::Filter.new(:text, :field => "Name", :value => "Smith & Gentry")
|
112
|
-
|
113
|
-
@service.should_receive(:do_http_post).with(@url,
|
114
|
-
"Filter=Name+%3AEQUALS%3A+Smith+%2526+Gentry&PageNum=1&ResultsPerPage=20",
|
115
|
-
{},
|
116
|
-
{"Content-Type"=>"application/x-www-form-urlencoded"})
|
117
|
-
|
118
|
-
@service.send(:fetch_collection, @model, [filter])
|
119
|
-
end
|
120
|
-
|
121
|
-
it "paginates" do
|
122
|
-
@service.should_receive(:do_http_post).with(@url,
|
123
|
-
"PageNum=2&ResultsPerPage=20",
|
124
|
-
{},
|
125
|
-
{"Content-Type"=>"application/x-www-form-urlencoded"})
|
126
|
-
|
127
|
-
@service.send(:fetch_collection, @model, nil, 2)
|
128
|
-
end
|
129
|
-
|
130
|
-
it "changes per_page" do
|
131
|
-
@service.should_receive(:do_http_post).with(@url,
|
132
|
-
"PageNum=1&ResultsPerPage=10",
|
133
|
-
{},
|
134
|
-
{"Content-Type"=>"application/x-www-form-urlencoded"})
|
135
|
-
|
136
|
-
@service.send(:fetch_collection, @model, nil, 1, 10)
|
137
|
-
end
|
138
|
-
|
139
|
-
it "sorts" do
|
140
|
-
sorter = Quickeebooks::Online::Service::Sort.new('FamilyName', 'AtoZ')
|
141
|
-
|
142
|
-
@service.should_receive(:do_http_post).with(@url,
|
143
|
-
"PageNum=1&ResultsPerPage=20&Sort=FamilyName+AtoZ",
|
144
|
-
{},
|
145
|
-
{"Content-Type"=>"application/x-www-form-urlencoded"})
|
146
|
-
|
147
|
-
@service.send(:fetch_collection, @model, nil, 1, 20, sorter)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
@@ -1,89 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::TimeActivity" do
|
2
|
-
before(:all) do
|
3
|
-
construct_oauth_service :time_activity
|
4
|
-
end
|
5
|
-
|
6
|
-
it "can fetch a list of time activities" do
|
7
|
-
xml = onlineFixture("time_activities.xml")
|
8
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::TimeActivity.resource_for_collection)
|
9
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
10
|
-
time_activities = @service.list
|
11
|
-
time_activities.current_page.should == 1
|
12
|
-
time_activities.entries.count.should == 1
|
13
|
-
time_activities.entries.first.vendor.vendor_id.value.should == "3793"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "can create a time activity" do
|
17
|
-
xml = onlineFixture("time_activity.xml")
|
18
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::TimeActivity.resource_for_singular)
|
19
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
20
|
-
time_activity = Quickeebooks::Online::Model::TimeActivity.new
|
21
|
-
time_activity.description = "here is my description"
|
22
|
-
time_activity.hourly_rate = "10.5"
|
23
|
-
time_activity.name_of = "Vendor"
|
24
|
-
time_activity.hours = 10
|
25
|
-
time_activity.customer_id = "3794"
|
26
|
-
time_activity.minutes = 5
|
27
|
-
result = @service.create(time_activity)
|
28
|
-
result.id.value.to_i.should > 0
|
29
|
-
result.vendor.is_a?(Quickeebooks::Online::Model::TimeActivityVendor)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "can delete a time_activity" do
|
33
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::TimeActivity.resource_for_singular)}/11?methodx=delete"
|
34
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
|
35
|
-
time_activity = Quickeebooks::Online::Model::TimeActivity.new
|
36
|
-
time_activity.id = Quickeebooks::Online::Model::Id.new("11")
|
37
|
-
time_activity.sync_token = 0
|
38
|
-
result = @service.delete(time_activity)
|
39
|
-
result.should == true
|
40
|
-
end
|
41
|
-
|
42
|
-
it "cannot delete a time_activity with missing required fields for deletion" do
|
43
|
-
time_activity = Quickeebooks::Online::Model::TimeActivity.new
|
44
|
-
expect { @service.delete(time_activity) }.to raise_exception(InvalidModelException, "Missing required parameters for delete")
|
45
|
-
end
|
46
|
-
|
47
|
-
it "exception is raised when we try to create an invalid time_activity" do
|
48
|
-
time_activity = Quickeebooks::Online::Model::TimeActivity.new
|
49
|
-
expect { @service.create(time_activity) }.to raise_exception InvalidModelException
|
50
|
-
end
|
51
|
-
|
52
|
-
it "cannot update an invalid time_activity" do
|
53
|
-
time_activity = Quickeebooks::Online::Model::TimeActivity.new
|
54
|
-
time_activity.name = "John Bilby"
|
55
|
-
expect { @service.update(time_activity) }.to raise_exception InvalidModelException
|
56
|
-
end
|
57
|
-
|
58
|
-
it "can fetch a time_activity by id" do
|
59
|
-
xml = onlineFixture("time_activity.xml")
|
60
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::TimeActivity.resource_for_singular)}/11"
|
61
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
62
|
-
time_activity = @service.fetch_by_id(11)
|
63
|
-
time_activity.vendor.vendor_id.value.should == "3793"
|
64
|
-
end
|
65
|
-
|
66
|
-
it "can update a time_activity" do
|
67
|
-
xml2 = onlineFixture("time_activity2.xml")
|
68
|
-
time_activity = Quickeebooks::Online::Model::TimeActivity.new
|
69
|
-
time_activity.id = Quickeebooks::Online::Model::Id.new("1")
|
70
|
-
time_activity.sync_token = 2
|
71
|
-
|
72
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::TimeActivity.resource_for_singular)}/#{time_activity.id.value}"
|
73
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml2)
|
74
|
-
updated = @service.update(time_activity)
|
75
|
-
updated.hours.should == 12
|
76
|
-
updated.minutes.should == 15
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'Can update a fetched time_activity' do
|
80
|
-
xml = onlineFixture("time_activity.xml")
|
81
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::TimeActivity.resource_for_singular)}/11"
|
82
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
83
|
-
time_activity = @service.fetch_by_id(11)
|
84
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::TimeActivity.resource_for_singular)}/#{time_activity.id.value}"
|
85
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
86
|
-
updated = @service.update(time_activity)
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
describe Quickeebooks::Online::Service::TrackingClass do
|
2
|
-
before(:all) do
|
3
|
-
construct_oauth_service :tracking_class
|
4
|
-
end
|
5
|
-
|
6
|
-
describe ".list" do
|
7
|
-
before(:each) do
|
8
|
-
xml = onlineFixture("tracking_classes.xml")
|
9
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::TrackingClass.resource_for_collection)
|
10
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
11
|
-
end
|
12
|
-
|
13
|
-
subject { @service.list }
|
14
|
-
|
15
|
-
it { subject.count.should == 2 }
|
16
|
-
it { subject.entries.count.should == 2 }
|
17
|
-
it { subject.entries[0].id.value.should == '1' }
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
describe ".create" do
|
22
|
-
before(:each) do
|
23
|
-
xml = onlineFixture("tracking_class.xml")
|
24
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::TrackingClass.resource_for_singular)
|
25
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
26
|
-
|
27
|
-
@tracking_class = Quickeebooks::Online::Model::TrackingClass.new
|
28
|
-
|
29
|
-
@tracking_class.name = "2012-11-02"
|
30
|
-
@tracking_class.class_parent_id = Quickeebooks::Online::Model::Id.new("3000000000000040889")
|
31
|
-
end
|
32
|
-
|
33
|
-
subject { @service.create(@tracking_class) }
|
34
|
-
|
35
|
-
it { subject.id.value.should == "3000000000000029839" }
|
36
|
-
end
|
37
|
-
|
38
|
-
describe ".delete" do
|
39
|
-
before(:each) do
|
40
|
-
@tracking_class_id = "3000000000000029839"
|
41
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::TrackingClass.resource_for_singular)
|
42
|
-
url += "/#{@tracking_class_id}?methodx=delete"
|
43
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
|
44
|
-
|
45
|
-
@tracking_class = Quickeebooks::Online::Model::TrackingClass.new
|
46
|
-
|
47
|
-
@tracking_class.id = Quickeebooks::Online::Model::Id.new(@tracking_class_id)
|
48
|
-
@tracking_class.name = "2012-11-02"
|
49
|
-
@tracking_class.sync_token = 0
|
50
|
-
end
|
51
|
-
|
52
|
-
subject { @service.delete @tracking_class }
|
53
|
-
|
54
|
-
it { should be_true }
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
describe ".fetch_by_id" do
|
59
|
-
before(:each) do
|
60
|
-
@tracking_class_id = "3000000000000029839"
|
61
|
-
xml = onlineFixture("tracking_class.xml")
|
62
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::TrackingClass.resource_for_singular)
|
63
|
-
url += "/#{@tracking_class_id}"
|
64
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
65
|
-
end
|
66
|
-
|
67
|
-
subject { @service.fetch_by_id(3000000000000029839) }
|
68
|
-
|
69
|
-
it { should be_kind_of(Quickeebooks::Online::Model::TrackingClass) }
|
70
|
-
it { subject.name.should == "2012-11-02" }
|
71
|
-
it { subject.id.value.should == @tracking_class_id }
|
72
|
-
it { subject.class_parent_id.value.should == "3000000000000040889" }
|
73
|
-
end
|
74
|
-
|
75
|
-
describe ".update" do
|
76
|
-
before(:each) do
|
77
|
-
@tracking_class_id = "3000000000000029839"
|
78
|
-
xml = onlineFixture("tracking_class_updated.xml")
|
79
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::TrackingClass.resource_for_singular)
|
80
|
-
url += "/#{@tracking_class_id}"
|
81
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
82
|
-
|
83
|
-
@tracking_class = Quickeebooks::Online::Model::TrackingClass.new
|
84
|
-
@tracking_class.id = Quickeebooks::Online::Model::Id.new(@tracking_class_id)
|
85
|
-
@tracking_class.name = "2013-11-02"
|
86
|
-
@tracking_class.class_parent_id = Quickeebooks::Online::Model::Id.new("3000000000000040889")
|
87
|
-
@tracking_class.sync_token = 1
|
88
|
-
end
|
89
|
-
|
90
|
-
subject { @service.update(@tracking_class) }
|
91
|
-
|
92
|
-
it { should be_kind_of(Quickeebooks::Online::Model::TrackingClass) }
|
93
|
-
it { subject.name.should == @tracking_class.name }
|
94
|
-
it { subject.id.value.should == @tracking_class.id.value }
|
95
|
-
it { subject.class_parent_id.value.should == @tracking_class.class_parent_id.value }
|
96
|
-
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|