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,69 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::BillPayment" do
|
2
|
-
before(:all) do
|
3
|
-
construct_oauth_service :bill_payment
|
4
|
-
end
|
5
|
-
|
6
|
-
describe "list" do
|
7
|
-
it "should fetch list of bill payments" do
|
8
|
-
xml = onlineFixture "bill_payments.xml"
|
9
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::BillPayment.resource_for_collection)
|
10
|
-
FakeWeb.register_uri :post, url, :status => ['200', 'OK'], :body => xml
|
11
|
-
bill_payments = @service.list
|
12
|
-
bill_payments.count.should == 1
|
13
|
-
bill_payments.entries.count.should == 1
|
14
|
-
bill_payments.entries[0].id.value.should == '16'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "create" do
|
19
|
-
it "should create a bill payment" do
|
20
|
-
xml = onlineFixture "bill_payment.xml"
|
21
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::BillPayment.resource_for_singular)
|
22
|
-
FakeWeb.register_uri :post, url, :status => ["200", "OK"], :body => xml
|
23
|
-
bill_payment = Quickeebooks::Online::Model::BillPayment.new
|
24
|
-
bill_payment.header = Quickeebooks::Online::Model::BillPaymentHeader.new
|
25
|
-
bill_payment.header.total_amount = 25.00
|
26
|
-
result = @service.create bill_payment
|
27
|
-
result.id.value.to_i.should > 0
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "delete" do
|
32
|
-
it "should delete a bill payment" do
|
33
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::BillPayment.resource_for_singular)}/56?methodx=delete"
|
34
|
-
FakeWeb.register_uri :post, url, :status => ["200", "OK"]
|
35
|
-
bill_payment = Quickeebooks::Online::Model::BillPayment.new
|
36
|
-
bill_payment.id = Quickeebooks::Online::Model::Id.new("56")
|
37
|
-
bill_payment.sync_token = 0
|
38
|
-
result = @service.delete bill_payment
|
39
|
-
result.should == true
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "fetch_by_id" do
|
44
|
-
it "should retrive bill payment by id" do
|
45
|
-
xml = onlineFixture("bill_payment.xml")
|
46
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::BillPayment.resource_for_singular)}/56"
|
47
|
-
FakeWeb.register_uri :get, url, :status => ["200", "OK"], :body => xml
|
48
|
-
bill_payment = @service.fetch_by_id(56)
|
49
|
-
bill_payment.header.total_amount.should == 5000
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe "update" do
|
54
|
-
it "should update existing bill payment" do
|
55
|
-
xml2 = onlineFixture("bill_payment2.xml")
|
56
|
-
bill_payment = Quickeebooks::Online::Model::BillPayment.new
|
57
|
-
bill_payment.header = Quickeebooks::Online::Model::BillPaymentHeader.new
|
58
|
-
bill_payment.header.total_amount = 75.00
|
59
|
-
bill_payment.id = Quickeebooks::Online::Model::Id.new("56")
|
60
|
-
bill_payment.sync_token = 2
|
61
|
-
|
62
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::BillPayment.resource_for_singular)}/#{bill_payment.id.value}"
|
63
|
-
|
64
|
-
FakeWeb.register_uri :post, url, :status => ["200", "OK"], :body => xml2
|
65
|
-
updated = @service.update(bill_payment)
|
66
|
-
updated.header.total_amount.should == 75.00
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::Bill" do
|
2
|
-
before(:all) do
|
3
|
-
construct_oauth_service :bill
|
4
|
-
end
|
5
|
-
|
6
|
-
it "can fetch a list of bills" do
|
7
|
-
xml = onlineFixture("bills.xml")
|
8
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Bill.resource_for_collection)
|
9
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
10
|
-
bills = @service.list
|
11
|
-
bills.current_page.should == 1
|
12
|
-
bills.entries.count.should == 1
|
13
|
-
bills.entries.first.header.balance.should == 25.00
|
14
|
-
end
|
15
|
-
|
16
|
-
it "can create a bill" do
|
17
|
-
xml = onlineFixture("bill.xml")
|
18
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Bill.resource_for_singular)
|
19
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
20
|
-
bill = Quickeebooks::Online::Model::Bill.new
|
21
|
-
bill.header = Quickeebooks::Online::Model::BillHeader.new
|
22
|
-
bill.header.total_amount = 25.00
|
23
|
-
result = @service.create(bill)
|
24
|
-
result.id.value.to_i.should > 0
|
25
|
-
end
|
26
|
-
|
27
|
-
it "can delete a bill" do
|
28
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Bill.resource_for_singular)}/56?methodx=delete"
|
29
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
|
30
|
-
bill = Quickeebooks::Online::Model::Bill.new
|
31
|
-
bill.id = Quickeebooks::Online::Model::Id.new("56")
|
32
|
-
bill.sync_token = 0
|
33
|
-
result = @service.delete(bill)
|
34
|
-
result.should == true
|
35
|
-
end
|
36
|
-
|
37
|
-
it "can fetch a bill by id" do
|
38
|
-
xml = onlineFixture("bill.xml")
|
39
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Bill.resource_for_singular)}/56"
|
40
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
41
|
-
bill = @service.fetch_by_id(56)
|
42
|
-
bill.header.total_amount.should == 50
|
43
|
-
end
|
44
|
-
|
45
|
-
it "can update a bill" do
|
46
|
-
xml2 = onlineFixture("bill2.xml")
|
47
|
-
bill = Quickeebooks::Online::Model::Bill.new
|
48
|
-
bill.header = Quickeebooks::Online::Model::BillHeader.new
|
49
|
-
bill.header.total_amount = 75.00
|
50
|
-
bill.id = Quickeebooks::Online::Model::Id.new("56")
|
51
|
-
bill.sync_token = 2
|
52
|
-
|
53
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Bill.resource_for_singular)}/#{bill.id.value}"
|
54
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml2)
|
55
|
-
updated = @service.update(bill)
|
56
|
-
updated.header.total_amount.should == 75.00
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
|
@@ -1,30 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::CompanyMetaData" 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::CompanyMetaData.new
|
17
|
-
@service.access_token = @oauth
|
18
|
-
@service.instance_eval {
|
19
|
-
@realm_id = "9991111222"
|
20
|
-
}
|
21
|
-
end
|
22
|
-
|
23
|
-
it "can get the realm's company_meta_data record" do
|
24
|
-
xml = onlineFixture("company_meta_data.xml")
|
25
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::CompanyMetaData.resource_for_singular)
|
26
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
27
|
-
company_meta_data_response = @service.load
|
28
|
-
company_meta_data_response.registered_company_name.should == "Bay Area landscape services"
|
29
|
-
end
|
30
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::Customer" do
|
2
|
-
before(:all) do
|
3
|
-
construct_oauth_service :customer
|
4
|
-
end
|
5
|
-
|
6
|
-
it "can fetch a list of customers" do
|
7
|
-
xml = onlineFixture("customers.xml")
|
8
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Customer.resource_for_collection)
|
9
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
10
|
-
accounts = @service.list
|
11
|
-
accounts.current_page.should == 1
|
12
|
-
accounts.entries.count.should == 3
|
13
|
-
accounts.entries.first.name.should == "John Doe"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "can fetch a list of customers with filters" do
|
17
|
-
xml = onlineFixture("customers.xml")
|
18
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Customer.resource_for_collection)
|
19
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
20
|
-
accounts = @service.list
|
21
|
-
accounts.current_page.should == 1
|
22
|
-
accounts.entries.count.should == 3
|
23
|
-
accounts.entries.first.name.should == "John Doe"
|
24
|
-
end
|
25
|
-
|
26
|
-
it "can create a customer" do
|
27
|
-
xml = onlineFixture("customer.xml")
|
28
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Customer.resource_for_singular)
|
29
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
30
|
-
customer = Quickeebooks::Online::Model::Customer.new
|
31
|
-
customer.name = "Billy Bob"
|
32
|
-
result = @service.create(customer)
|
33
|
-
result.id.value.to_i.should > 0
|
34
|
-
end
|
35
|
-
|
36
|
-
it "can delete a customer" do
|
37
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Customer.resource_for_singular)}/99?methodx=delete"
|
38
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
|
39
|
-
customer = Quickeebooks::Online::Model::Customer.new
|
40
|
-
customer.id = Quickeebooks::Online::Model::Id.new("99")
|
41
|
-
customer.sync_token = 0
|
42
|
-
result = @service.delete(customer)
|
43
|
-
result.should == true
|
44
|
-
end
|
45
|
-
|
46
|
-
it "cannot delete a customer with missing required fields for deletion" do
|
47
|
-
customer = Quickeebooks::Online::Model::Customer.new
|
48
|
-
lambda { @service.delete(customer) }.should raise_error(InvalidModelException, "Missing required parameters for delete")
|
49
|
-
end
|
50
|
-
|
51
|
-
it "exception is raised when we try to create an invalid account" do
|
52
|
-
customer = Quickeebooks::Online::Model::Customer.new
|
53
|
-
lambda { @service.create(customer) }.should raise_error(InvalidModelException)
|
54
|
-
end
|
55
|
-
|
56
|
-
it "cannot update an invalid customer" do
|
57
|
-
customer = Quickeebooks::Online::Model::Customer.new
|
58
|
-
customer.name = "John Doe"
|
59
|
-
lambda { @service.update(customer) }.should raise_error(InvalidModelException)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "can fetch a customer by id" do
|
63
|
-
xml = onlineFixture("customer.xml")
|
64
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Customer.resource_for_singular)}/99"
|
65
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
66
|
-
customer = @service.fetch_by_id(99)
|
67
|
-
customer.name.should == "John Doe"
|
68
|
-
end
|
69
|
-
|
70
|
-
it "can update a customer" do
|
71
|
-
xml2 = onlineFixture("customer2.xml")
|
72
|
-
customer = Quickeebooks::Online::Model::Customer.new
|
73
|
-
customer.name = "John Doe"
|
74
|
-
customer.id = Quickeebooks::Online::Model::Id.new("1")
|
75
|
-
customer.sync_token = 2
|
76
|
-
|
77
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Customer.resource_for_singular)}/#{customer.id.value}"
|
78
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml2)
|
79
|
-
updated = @service.update(customer)
|
80
|
-
updated.name.should == "Billy Bob"
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'Can update a fetched customer' do
|
84
|
-
xml = onlineFixture("customer.xml")
|
85
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Customer.resource_for_singular)}/99"
|
86
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
87
|
-
customer = @service.fetch_by_id(99)
|
88
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Customer.resource_for_singular)}/#{customer.id.value}"
|
89
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
90
|
-
updated = @service.update(customer)
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::Employee" do
|
2
|
-
before(:all) do
|
3
|
-
construct_oauth_service :employee
|
4
|
-
end
|
5
|
-
|
6
|
-
it "can fetch a list of employees" do
|
7
|
-
xml = onlineFixture("employees.xml")
|
8
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Employee.resource_for_collection)
|
9
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
10
|
-
employees = @service.list
|
11
|
-
employees.current_page.should == 1
|
12
|
-
employees.entries.count.should == 1
|
13
|
-
employees.entries.first.name.should == "John Simpson"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "can create a employee" do
|
17
|
-
xml = onlineFixture("employee.xml")
|
18
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Employee.resource_for_singular)
|
19
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
20
|
-
employee = Quickeebooks::Online::Model::Employee.new
|
21
|
-
employee.name = "John Doe"
|
22
|
-
result = @service.create(employee)
|
23
|
-
result.id.value.to_i.should > 0
|
24
|
-
end
|
25
|
-
|
26
|
-
it "can delete a employee" do
|
27
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Employee.resource_for_singular)}/11?methodx=delete"
|
28
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"])
|
29
|
-
employee = Quickeebooks::Online::Model::Employee.new
|
30
|
-
employee.id = Quickeebooks::Online::Model::Id.new("11")
|
31
|
-
employee.sync_token = 0
|
32
|
-
result = @service.delete(employee)
|
33
|
-
result.should == true
|
34
|
-
end
|
35
|
-
|
36
|
-
it "cannot delete a employee with missing required fields for deletion" do
|
37
|
-
employee = Quickeebooks::Online::Model::Employee.new
|
38
|
-
expect { @service.delete(employee) }.to raise_exception(InvalidModelException, "Missing required parameters for delete")
|
39
|
-
end
|
40
|
-
|
41
|
-
it "exception is raised when we try to create an invalid account" do
|
42
|
-
employee = Quickeebooks::Online::Model::Employee.new
|
43
|
-
expect { @service.create(employee) }.to raise_exception InvalidModelException
|
44
|
-
end
|
45
|
-
|
46
|
-
it "cannot update an invalid employee" do
|
47
|
-
employee = Quickeebooks::Online::Model::Employee.new
|
48
|
-
employee.name = "John Bilby"
|
49
|
-
expect { @service.update(employee) }.to raise_exception InvalidModelException
|
50
|
-
end
|
51
|
-
|
52
|
-
it "can fetch a employee by id" do
|
53
|
-
xml = onlineFixture("employee.xml")
|
54
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Employee.resource_for_singular)}/11"
|
55
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
56
|
-
employee = @service.fetch_by_id(11)
|
57
|
-
employee.name.should == "John Simpson"
|
58
|
-
end
|
59
|
-
|
60
|
-
it "can update a employee" do
|
61
|
-
xml2 = onlineFixture("employee2.xml")
|
62
|
-
employee = Quickeebooks::Online::Model::Employee.new
|
63
|
-
employee.name = "John Doe"
|
64
|
-
employee.id = Quickeebooks::Online::Model::Id.new("1")
|
65
|
-
employee.sync_token = 2
|
66
|
-
|
67
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Employee.resource_for_singular)}/#{employee.id.value}"
|
68
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml2)
|
69
|
-
updated = @service.update(employee)
|
70
|
-
updated.name.should == "John Doe"
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'Can update a fetched employee' do
|
74
|
-
xml = onlineFixture("employee.xml")
|
75
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Employee.resource_for_singular)}/11"
|
76
|
-
FakeWeb.register_uri(:get, url, :status => ["200", "OK"], :body => xml)
|
77
|
-
employee = @service.fetch_by_id(11)
|
78
|
-
url = "#{@service.url_for_resource(Quickeebooks::Online::Model::Employee.resource_for_singular)}/#{employee.id.value}"
|
79
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
80
|
-
updated = @service.update(employee)
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::Filter" do
|
2
|
-
before(:all) do
|
3
|
-
end
|
4
|
-
|
5
|
-
it "can generate a text filter" do
|
6
|
-
filter = Quickeebooks::Online::Service::Filter.new(:text, :field => "Name", :value => "Smith")
|
7
|
-
filter.to_s.should == "Name :EQUALS: Smith"
|
8
|
-
end
|
9
|
-
|
10
|
-
it "can generate a boolean filter" do
|
11
|
-
filter = Quickeebooks::Online::Service::Filter.new(:boolean, :field => "IncludeJobs", :value => false)
|
12
|
-
filter.to_s.should == "IncludeJobs :EQUALS: false"
|
13
|
-
end
|
14
|
-
|
15
|
-
it "can generate a date filter" do
|
16
|
-
date = Date.civil(2012, 2, 16)
|
17
|
-
filter = Quickeebooks::Online::Service::Filter.new(:date, :field => "CreateTime", :value => date)
|
18
|
-
filter.to_s.should == "CreateTime :EQUALS: 2012-02-16"
|
19
|
-
end
|
20
|
-
|
21
|
-
it "can generate a datetime filter" do
|
22
|
-
time = Time.mktime(2012, 1, 2, 8, 31, 44)
|
23
|
-
filter = Quickeebooks::Online::Service::Filter.new(:datetime, :field => "CreateTime", :after => time)
|
24
|
-
filter.to_s.should == "CreateTime :AFTER: 2012-01-02T08:31:44"
|
25
|
-
end
|
26
|
-
|
27
|
-
it "can generate a number filter with equals" do
|
28
|
-
filter = Quickeebooks::Online::Service::Filter.new(:number, :field => "OpenBalance", :eq => 5)
|
29
|
-
filter.to_s.should == "OpenBalance :EQUALS: 5"
|
30
|
-
end
|
31
|
-
|
32
|
-
it "can generate a number filter with greater than" do
|
33
|
-
filter = Quickeebooks::Online::Service::Filter.new(:number, :field => "OpenBalance", :gt => 5)
|
34
|
-
filter.to_s.should == "OpenBalance :GreaterThan: 5"
|
35
|
-
end
|
36
|
-
|
37
|
-
it "can generate a number filter with less than" do
|
38
|
-
filter = Quickeebooks::Online::Service::Filter.new(:number, :field => "OpenBalance", :lt => 5)
|
39
|
-
filter.to_s.should == "OpenBalance :LessThan: 5"
|
40
|
-
end
|
41
|
-
|
42
|
-
it "can generate a datetime filter with bounded dates" do
|
43
|
-
time1 = Time.mktime(2012, 1, 2, 1)
|
44
|
-
time2 = Time.mktime(2012, 1, 5, 8)
|
45
|
-
filter = Quickeebooks::Online::Service::Filter.new(:datetime, :field => "CreateTime", :after => time1, :before => time2)
|
46
|
-
# 'before' is checked before 'after' :)
|
47
|
-
text = "CreateTime :BEFORE: #{time2.strftime(Quickeebooks::Online::Service::Filter::DATE_TIME_FORMAT)}"
|
48
|
-
text = "#{text} :AND: CreateTime :AFTER: #{time1.strftime(Quickeebooks::Online::Service::Filter::DATE_TIME_FORMAT)}"
|
49
|
-
filter.to_s.should == text
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
describe "Quickeebooks::Online::Service::Invoice" 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
|
-
@service = Quickeebooks::Online::Service::Invoice.new
|
16
|
-
@service.access_token = @oauth
|
17
|
-
@service.instance_eval {
|
18
|
-
@realm_id = "9991111222"
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
22
|
-
it "can create an invoice" do
|
23
|
-
xml = onlineFixture("invoice.xml")
|
24
|
-
|
25
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Invoice.resource_for_singular)
|
26
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml)
|
27
|
-
invoice = Quickeebooks::Online::Model::Invoice.new
|
28
|
-
invoice.header = Quickeebooks::Online::Model::InvoiceHeader.new
|
29
|
-
invoice.header.doc_number = "123"
|
30
|
-
|
31
|
-
line_item = Quickeebooks::Online::Model::InvoiceLineItem.new
|
32
|
-
line_item.item_id = Quickeebooks::Online::Model::Id.new("123")
|
33
|
-
line_item.desc = "Pinor Noir 2005"
|
34
|
-
line_item.unit_price = 188
|
35
|
-
line_item.quantity = 2
|
36
|
-
invoice.line_items << line_item
|
37
|
-
|
38
|
-
result = @service.create(invoice)
|
39
|
-
result.id.value.to_i.should > 0
|
40
|
-
end
|
41
|
-
|
42
|
-
it "can delete an invoice" do
|
43
|
-
fixture_xml = onlineFixture("invoice.xml")
|
44
|
-
response_xml = onlineFixture("deleted_invoice.xml")
|
45
|
-
|
46
|
-
invoice_id = "123"
|
47
|
-
url = @service.url_for_resource(Quickeebooks::Online::Model::Invoice.resource_for_singular) + "/13?methodx=delete"
|
48
|
-
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => response_xml)
|
49
|
-
invoice = Quickeebooks::Online::Model::Invoice.from_xml(fixture_xml)
|
50
|
-
|
51
|
-
result = @service.delete(invoice)
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|