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
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
quickeebooks (0.1.10)
|
5
|
-
activemodel
|
6
|
-
nokogiri
|
7
|
-
oauth
|
8
|
-
roxml
|
9
|
-
uuidtools
|
10
|
-
|
11
|
-
GEM
|
12
|
-
remote: http://rubygems.org/
|
13
|
-
specs:
|
14
|
-
activemodel (3.2.12)
|
15
|
-
activesupport (= 3.2.12)
|
16
|
-
builder (~> 3.0.0)
|
17
|
-
activesupport (3.2.12)
|
18
|
-
i18n (~> 0.6)
|
19
|
-
multi_json (~> 1.0)
|
20
|
-
builder (3.0.4)
|
21
|
-
coderay (1.0.9)
|
22
|
-
diff-lcs (1.2.4)
|
23
|
-
fakeweb (1.3.0)
|
24
|
-
ffi (1.8.1)
|
25
|
-
formatador (0.2.4)
|
26
|
-
guard (1.8.0)
|
27
|
-
formatador (>= 0.2.4)
|
28
|
-
listen (>= 1.0.0)
|
29
|
-
lumberjack (>= 1.0.2)
|
30
|
-
pry (>= 0.9.10)
|
31
|
-
thor (>= 0.14.6)
|
32
|
-
guard-rspec (3.0.0)
|
33
|
-
guard (>= 1.8)
|
34
|
-
rspec (~> 2.13)
|
35
|
-
i18n (0.6.1)
|
36
|
-
listen (1.1.3)
|
37
|
-
rb-fsevent (>= 0.9.3)
|
38
|
-
rb-inotify (>= 0.9)
|
39
|
-
rb-kqueue (>= 0.2)
|
40
|
-
lumberjack (1.0.3)
|
41
|
-
method_source (0.8.1)
|
42
|
-
multi_json (1.6.1)
|
43
|
-
nokogiri (1.5.6)
|
44
|
-
oauth (0.4.7)
|
45
|
-
pry (0.9.12.2)
|
46
|
-
coderay (~> 1.0.5)
|
47
|
-
method_source (~> 0.8)
|
48
|
-
slop (~> 3.4)
|
49
|
-
rake (10.0.3)
|
50
|
-
rb-fsevent (0.9.3)
|
51
|
-
rb-inotify (0.9.0)
|
52
|
-
ffi (>= 0.5.0)
|
53
|
-
rb-kqueue (0.2.0)
|
54
|
-
ffi (>= 0.5.0)
|
55
|
-
roxml (3.3.1)
|
56
|
-
activesupport (>= 2.3.0)
|
57
|
-
nokogiri (>= 1.3.3)
|
58
|
-
rr (1.0.4)
|
59
|
-
rspec (2.13.0)
|
60
|
-
rspec-core (~> 2.13.0)
|
61
|
-
rspec-expectations (~> 2.13.0)
|
62
|
-
rspec-mocks (~> 2.13.0)
|
63
|
-
rspec-core (2.13.1)
|
64
|
-
rspec-expectations (2.13.0)
|
65
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
66
|
-
rspec-mocks (2.13.1)
|
67
|
-
simplecov (0.7.1)
|
68
|
-
multi_json (~> 1.0)
|
69
|
-
simplecov-html (~> 0.7.1)
|
70
|
-
simplecov-html (0.7.1)
|
71
|
-
slop (3.4.5)
|
72
|
-
thor (0.18.1)
|
73
|
-
uuidtools (2.1.3)
|
74
|
-
|
75
|
-
PLATFORMS
|
76
|
-
ruby
|
77
|
-
|
78
|
-
DEPENDENCIES
|
79
|
-
fakeweb
|
80
|
-
guard (= 1.8.0)
|
81
|
-
guard-rspec (= 3.0.0)
|
82
|
-
quickeebooks!
|
83
|
-
rake
|
84
|
-
rr (~> 1.0.2)
|
85
|
-
rspec (= 2.13.0)
|
86
|
-
simplecov
|
data/Guardfile
DELETED
data/HISTORY.md
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
## 0.1.10 (2013-06-06)
|
2
|
-
|
3
|
-
* Desktop: Begin implementation of enforcing filter ordering. The Intuit API requires that filter elements obey a given order. We don't expect callers to know this order. Thus, callers can give us an array of filters and the Service class will re-order them appropriately. As of this release only `Job` service has `FILTER_ORDER` defined. However going forward its easy to add it to other Service objects as needed.
|
4
|
-
|
5
|
-
## 0.1.9 (2013-06-04)
|
6
|
-
|
7
|
-
* Desktop: Added PaymentMethod list support. Added Payment create support.
|
8
|
-
* Desktop: SyncStatus support for querying about status of recent sync requests / errors
|
9
|
-
|
10
|
-
## 0.1.8 (2013-05-15)
|
11
|
-
|
12
|
-
* Desktop: SyncActivity provided by kdaigle
|
13
|
-
|
14
|
-
## 0.1.7 (2013-04-29)
|
15
|
-
|
16
|
-
* Online: TimeActivity provided by epugh
|
17
|
-
|
18
|
-
## 0.1.6 (2013-04-08)
|
19
|
-
|
20
|
-
* Online: Moved Shipping and Billing properties from the Invoice model to the InvoiceHeader model where they belong.
|
21
|
-
|
22
|
-
## 0.1.5 (2013-03-30)
|
23
|
-
|
24
|
-
* Added Address convenience assignment methods to Online Customer model.
|
25
|
-
|
26
|
-
## 0.1.4 (2013-03-24)
|
27
|
-
|
28
|
-
* Refactored `Filter` and separated the handling of `Date` and `DateTime`. Also refactored how operational XML is generated and removed hard-coded XML scattered in classes in favor of a centralized mechanism for generating generic XML.
|
29
|
-
|
30
|
-
## 0.1.2 (2013-01-18)
|
31
|
-
|
32
|
-
* Fixed issue where an instance of `ActiveSupport::TimeWithZone` was given to a `:datetime` Filter and the resultant format was not being correctly parsed by Intuit.
|
33
|
-
|
34
|
-
## 0.1.1 (2013-01-16)
|
35
|
-
|
36
|
-
* Quickeebooks can now re-authorize a token via `Quickeebooks::Shared::Service::AccessToken.reconnect`. In addition destroying an access token can now be done via `Quickeebooks::Shared::Service::AccessToken.disconnect`. Thank you to `FundingGates` for the contribution.
|
37
|
-
|
38
|
-
## 0.1.0 (2013-01-16)
|
39
|
-
|
40
|
-
* Quickbooks Online now supports a single HTTP endpoint for API calls, no need to first determine the Base URL. `Quickeebooks::Online::ServiceBase` has been adjusted to use a single API endpoint.
|
41
|
-
|
42
|
-
## < 0.0.9
|
43
|
-
|
44
|
-
History was not being tracked so there is no changelog of activity before `0.0.9`
|
data/MIT-LICENSE
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
The MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2012
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
-
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
-
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,451 +0,0 @@
|
|
1
|
-
# Quickeebooks
|
2
|
-
|
3
|
-
Integration with Quickbooks Online via the Intuit Data Services REST API.
|
4
|
-
|
5
|
-
This library communicates with the Quickbooks Data Services `v2` API, documented at:
|
6
|
-
|
7
|
-
[Data Services v2](https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services)
|
8
|
-
|
9
|
-
When Intuit finalizes the `v3` API I would like to move to that version as it appears to be better structured
|
10
|
-
and has `JSON` request/response formats, which should be easier to work with than XML.
|
11
|
-
|
12
|
-
[![Build Status](https://travis-ci.org/ruckus/quickeebooks.png)](https://travis-ci.org/ruckus/quickeebooks)
|
13
|
-
|
14
|
-
## Requirements
|
15
|
-
|
16
|
-
This is being developed on Ruby REE, 1.9.2 & 1.9.3. Other versions/VMs are untested but stable Rubies should work in theory.
|
17
|
-
|
18
|
-
## Dependencies
|
19
|
-
|
20
|
-
Gems:
|
21
|
-
|
22
|
-
* `oauth`
|
23
|
-
* `roxml` : Workhorse for (de)serializing objects between Ruby & XML
|
24
|
-
* `nokogiri` : XML parsing
|
25
|
-
* `active_model` : For validations
|
26
|
-
|
27
|
-
## Getting Started & Initiating Authentication Flow with Intuit
|
28
|
-
|
29
|
-
What follows is an example using Rails but the principles can be adapted to any other framework / pure Ruby.
|
30
|
-
|
31
|
-
Create a Rails initializer with:
|
32
|
-
|
33
|
-
```ruby
|
34
|
-
QB_KEY = "your apps Intuit App Key"
|
35
|
-
QB_SECRET = "your apps Intuit Secret Key"
|
36
|
-
|
37
|
-
$qb_oauth_consumer = OAuth::Consumer.new(QB_KEY, QB_SECRET, {
|
38
|
-
:site => "https://oauth.intuit.com",
|
39
|
-
:request_token_path => "/oauth/v1/get_request_token",
|
40
|
-
:authorize_url => "https://appcenter.intuit.com/Connect/Begin",
|
41
|
-
:access_token_path => "/oauth/v1/get_access_token"
|
42
|
-
})
|
43
|
-
```
|
44
|
-
|
45
|
-
To start the authentication flow with Intuit you include the Intuit Javascript and on a page of your choosing you present the "Connect to Quickbooks" button by including this XHTML:
|
46
|
-
|
47
|
-
|
48
|
-
```HTML
|
49
|
-
<!-- somewhere in your document include the Javascript -->
|
50
|
-
<script type="text/javascript" src="https://appcenter.intuit.com/Content/IA/intuit.ipp.anywhere.js"></script>
|
51
|
-
|
52
|
-
<!-- configure the Intuit object: 'grantUrl' is a URL in your application which kicks off the flow, see below -->
|
53
|
-
<script>
|
54
|
-
intuit.ipp.anywhere.setup({menuProxy: '/path/to/blue-dot', grantUrl: '/path/to/your-flow-start'});
|
55
|
-
</script>
|
56
|
-
|
57
|
-
<!-- this will display a button that the user clicks to start the flow -->
|
58
|
-
<ipp:connectToIntuit></ipp:connectToIntuit>
|
59
|
-
```
|
60
|
-
|
61
|
-
Your Controller action (the `grantUrl` above) should look like this:
|
62
|
-
|
63
|
-
```ruby
|
64
|
-
def authenticate
|
65
|
-
callback = quickbooks_oauth_callback_url
|
66
|
-
token = $qb_oauth_consumer.get_request_token(:oauth_callback => callback)
|
67
|
-
session[:qb_request_token] = token
|
68
|
-
redirect_to("https://appcenter.intuit.com/Connect/Begin?oauth_token=#{token.token}") and return
|
69
|
-
end
|
70
|
-
```
|
71
|
-
|
72
|
-
Where `quickbooks_oauth_callback_url` is the absolute URL of your application that Intuit should send the user when authentication succeeeds. That action should look like:
|
73
|
-
|
74
|
-
```ruby
|
75
|
-
def oauth_callback
|
76
|
-
at = session[:qb_request_token].get_access_token(:oauth_verifier => params[:oauth_verifier])
|
77
|
-
token = at.token
|
78
|
-
secret = at.secret
|
79
|
-
realm_id = params['realmId']
|
80
|
-
# store the token, secret & RealmID somewhere for this user, you will need all 3 to work with Quickeebooks
|
81
|
-
end
|
82
|
-
```
|
83
|
-
|
84
|
-
## Creating an OAuth Access Token
|
85
|
-
|
86
|
-
Once you have your users OAuth Token & Secret you can initialize your `OAuth Consumer` and create a `OAuth Client` using the `$qb_oauth_consumer` you created earlier in your Rails initializer:
|
87
|
-
|
88
|
-
```ruby
|
89
|
-
oauth_client = OAuth::AccessToken.new($qb_oauth_consumer, access_token, access_secret)
|
90
|
-
```
|
91
|
-
|
92
|
-
## Quickbooks Online vs Windows
|
93
|
-
|
94
|
-
IDS provides 2 APIs, one for interacting with Quickbooks Online resources and one for Quickbooks Windows resources.
|
95
|
-
|
96
|
-
See: https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services
|
97
|
-
|
98
|
-
You will need to be aware of which flavor of the API you want to invoke.
|
99
|
-
|
100
|
-
For example:
|
101
|
-
|
102
|
-
```ruby
|
103
|
-
# Instantiate a Online API
|
104
|
-
customer_service = Quickeebooks::Online::Service::Customer.new
|
105
|
-
customer_service.access_token = oauth_client
|
106
|
-
customer_service.realm_id = realm_id
|
107
|
-
customer_service.list
|
108
|
-
|
109
|
-
# Instantiate a Windows API
|
110
|
-
customer_service = Quickeebooks::Windows::Service::Customer.new(oauth_client, realm_id)
|
111
|
-
customer_service.access_token = oauth_client
|
112
|
-
customer_service.realm_id = realm_id
|
113
|
-
customer_service.list
|
114
|
-
```
|
115
|
-
|
116
|
-
All of the documentation below is geared towards the Online flavor but unless noted one should be able to replace it with Windows.
|
117
|
-
|
118
|
-
Now we can initialize any of the `Service` clients:
|
119
|
-
|
120
|
-
```ruby
|
121
|
-
customer_service = Quickeebooks::Online::Service::Customer.new
|
122
|
-
customer_service.access_token = oauth_client
|
123
|
-
customer_service.realm_id = realm_id
|
124
|
-
customer_service.list
|
125
|
-
customer_service.list
|
126
|
-
|
127
|
-
# returns a `Collection` object
|
128
|
-
```
|
129
|
-
|
130
|
-
See *Retrieving Objects* for the complete docs on fetching collections.
|
131
|
-
|
132
|
-
Quickbooks API requires that all HTTP operations are performed against a client-specific "Base URL", as discussed here:
|
133
|
-
|
134
|
-
Note: The Windows and Online(versions 7.0 and above) now use a static base URL which is the default URL that is used with Quickeebooks so no additional HTTP requests are made.
|
135
|
-
|
136
|
-
[Getting the Base URL](https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0400_QuickBooks_Online/0100_Calling_Data_Services/0010_Getting_the_Base_URL)
|
137
|
-
|
138
|
-
Quickeebooks will attempt to determine the base URL for the given OAuth client and Realm. This comes at the cost of the overhead of making that initial request. A customers Base URL should not change so if you know it ahead of time then you can specify it as the third argument to the service constructor. For example:
|
139
|
-
|
140
|
-
```ruby
|
141
|
-
customer_service = Quickeebooks::Online::Service::Customer.new(oauth_client, realm_id, "https://qbo.intuit.com/qbo36")
|
142
|
-
```
|
143
|
-
|
144
|
-
## Retrieving Objects
|
145
|
-
|
146
|
-
Use a `Service` sub-class to fetch objects of that resource and specifically use the `list` method.
|
147
|
-
|
148
|
-
The signature of the `list` method is:
|
149
|
-
|
150
|
-
```ruby
|
151
|
-
list(filters = [], page = 1, per_page = 20, sort = nil, options = {})
|
152
|
-
```
|
153
|
-
|
154
|
-
Where `filters` is an array of `Filter` objects (see below). Pagination is set to page 1 and 20 results per page by default.
|
155
|
-
Pass a `Sort` object for any desired sorting or just let Intuit use the default sorting for that resource (see below for more sorting options).
|
156
|
-
|
157
|
-
Specify none of these to get the defaults:
|
158
|
-
|
159
|
-
```ruby
|
160
|
-
customer_service = Quickeebooks::Online::Service::Customer.new
|
161
|
-
customer_service.access_token = oauth_client
|
162
|
-
customer_service.realm_id = realm_id
|
163
|
-
customer_service.list
|
164
|
-
|
165
|
-
# fetch all customers with default parameters (pagination, sorting, filtering)
|
166
|
-
customers = customer_service.list
|
167
|
-
```
|
168
|
-
|
169
|
-
Return result: a `Collection` instance with properties: `entries`, `current_page`, `count` which should be self-explanatory.
|
170
|
-
|
171
|
-
### Filtering (full Online API support, partial Windows API support)
|
172
|
-
|
173
|
-
For Online, all filters in the Intuit documentation are supported: text, datetime, boolean.
|
174
|
-
|
175
|
-
For Windows, Intuit has a custom API for certain query fields: you cannot search on an arbitrary attributes. See https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0500_QuickBooks_Windows/0100_Calling_Data_Services/0015_Retrieving_Objects#Filtering for more information, and to see which attributes are queryable, see: https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0500_QuickBooks_Windows/0600_Object_Reference/Invoice#section_9
|
176
|
-
|
177
|
-
Note: you'll get an exception from Intuit if you attempt to query on a non-queryable attribute.
|
178
|
-
|
179
|
-
Construct an instance of `Quickeebooks::Shared::Service::Filter` with the type of filter, one of: `:text`, `:datetime`, `:boolean`.
|
180
|
-
|
181
|
-
Pass an array of `Quickeebooks::Shared::Service::Filter` objects as the first argument to the Services `list` method and all filters will be applied.
|
182
|
-
|
183
|
-
#### Filtering on a text field
|
184
|
-
|
185
|
-
Specify a type of `:text` and your desired `:field` and a `:value` clause which will enforce an exact match.
|
186
|
-
|
187
|
-
Note: the Intuit API is case-INSENSITIVE.
|
188
|
-
|
189
|
-
```ruby
|
190
|
-
Quickeebooks::Shared::Service::Filter.new(:text, :field => 'FamilyName', :value => 'Richards')
|
191
|
-
```
|
192
|
-
|
193
|
-
#### Filtering on a Date/Time
|
194
|
-
|
195
|
-
Specify a type of `:datetime`, your desired `:field` and finally use `:value` to specify the anchoring date.
|
196
|
-
|
197
|
-
Examples:
|
198
|
-
|
199
|
-
```ruby
|
200
|
-
# find all customers created between Feb 1 - 28
|
201
|
-
# this requires specifying TWO filters, one for the start and another for the end
|
202
|
-
filters = []
|
203
|
-
filters << Quickeebooks::Shared::Service::Filter.new(:datetime, :field => 'StartCreatedTMS', :value => Time.mktime(2013, 2, 1))
|
204
|
-
filters << Quickeebooks::Shared::Service::Filter.new(:datetime, :field => 'EndCreatedTMS', :value => Time.mktime(2013, 2, 28))
|
205
|
-
```
|
206
|
-
|
207
|
-
You will need to consult the Intuit API docs for each entity type to determine what the filterable fields are, as they change from entity to entity. In the above case `Customer` supports both `StartCreatedTMS` and `EndCreatedTMS`
|
208
|
-
|
209
|
-
#### Filtering on a Boolean field
|
210
|
-
|
211
|
-
Specify a type of `:boolean` and your desired `:field` and a `:value` with either `true` or `false`
|
212
|
-
|
213
|
-
```ruby
|
214
|
-
# find all customers and exclude jobs
|
215
|
-
Quickeebooks::Shared::Service::Filter.new(:boolean, :field => 'IncludeJobs', :value => false)
|
216
|
-
```
|
217
|
-
|
218
|
-
#### Filtering on a Number
|
219
|
-
|
220
|
-
Specify a type of `:number` and an operator, one of: `:gt`, `:lt`, or `:eq`.
|
221
|
-
|
222
|
-
```ruby
|
223
|
-
# find all customers and exclude jobs
|
224
|
-
Quickeebooks::Shared::Service::Filter.new(:number, :field => 'Amount', :gt => 150)
|
225
|
-
```
|
226
|
-
|
227
|
-
Once you have created all of your `Filters` than just pass an array of them to any services `list` method and they will all be applied.
|
228
|
-
|
229
|
-
Example: find all Customers with a last name of 'Richards' who have been created before Feb 25, 2012:
|
230
|
-
|
231
|
-
```ruby
|
232
|
-
filters = []
|
233
|
-
filters << Quickeebooks::Online::Service::Filter.new(:text, :field => 'FamilyName', :value => 'Richards')
|
234
|
-
datetime = Time.mktime(2011, 2, 25)
|
235
|
-
filters << Quickeebooks::Online::Service::Filter.new(:datetime, :field => 'CreateTime', :before => datetime)
|
236
|
-
customer_service = Quickeebooks::Online::Service::Customer.new
|
237
|
-
customer_service.access_token = oauth_client
|
238
|
-
customer_service.realm_id = realm_id
|
239
|
-
customer_service.list
|
240
|
-
|
241
|
-
customers = customer_service.list(filters)
|
242
|
-
```
|
243
|
-
## Sorting (currently only supported in the Online API)
|
244
|
-
|
245
|
-
Create an instance of `Quickeebooks::Service::Sort` where the first argument is the field and the second is the sorting direction/logic.
|
246
|
-
|
247
|
-
See [Sorting and Pagination](https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0400_QuickBooks_Online/0100_Calling_Data_Services/0030_Retrieving_Objects#Sorting) for the complete set of sorting options.
|
248
|
-
|
249
|
-
Example
|
250
|
-
|
251
|
-
```ruby
|
252
|
-
sorter = Quickeebooks::Online::Service::Sort.new('FamilyName', 'AtoZ')
|
253
|
-
```
|
254
|
-
|
255
|
-
## Bringing it all together
|
256
|
-
|
257
|
-
Goal: fetch all customers with a last name of Smith starting at the first page with a per page size of 30, created between May and August of 2011 and sort by last name from A-to-Z.
|
258
|
-
|
259
|
-
```ruby
|
260
|
-
filters = []
|
261
|
-
filters << Quickeebooks::Online::Service::Filter.new(:text, :field => 'FamilyName', :value => 'Smith')
|
262
|
-
|
263
|
-
d1 = Time.mktime(2011, 5, 1)
|
264
|
-
d2 = Time.mktime(2011, 8, 1)
|
265
|
-
filters << Quickeebooks::Online::Service::Filter.new(:datetime, :field => 'CreateTime', :after => d1, :before => d2)
|
266
|
-
|
267
|
-
sorter = Quickeebooks::Online::Service::Sort.new('FamilyName', 'AtoZ')
|
268
|
-
|
269
|
-
customer_service = Quickeebooks::Online::Service::Customer.new
|
270
|
-
customer_service.access_token = oauth_client
|
271
|
-
customer_service.realm_id = realm_id
|
272
|
-
customer_service.list
|
273
|
-
|
274
|
-
customers = customer_service.list(filters, 1, 30, sort)
|
275
|
-
|
276
|
-
# returns
|
277
|
-
|
278
|
-
customers.count
|
279
|
-
=> 67
|
280
|
-
|
281
|
-
customers.current_page
|
282
|
-
=> 1
|
283
|
-
|
284
|
-
customers.entries
|
285
|
-
=> [ #<Quickeebooks::Online::Model::Customer:0x007f8e29259770>, #<Quickeebooks::Online::Model::Customer:0x0078768202020>, ... ]
|
286
|
-
```
|
287
|
-
|
288
|
-
## Reading a single object
|
289
|
-
|
290
|
-
Use the `Service` instance to fetch an object by its id using the `fetch_by_id` method:
|
291
|
-
|
292
|
-
```ruby
|
293
|
-
# fetch the Customer object with an id of 100
|
294
|
-
customer_service = Quickeebooks::Online::Service::Customer.new
|
295
|
-
customer_service.access_token = oauth_client
|
296
|
-
customer_service.realm_id = realm_id
|
297
|
-
customer_service.list
|
298
|
-
|
299
|
-
customer = customer_service.fetch_by_id(100)
|
300
|
-
customer.name
|
301
|
-
=> John Doe
|
302
|
-
```
|
303
|
-
|
304
|
-
## Writing Objects
|
305
|
-
|
306
|
-
Create or fetch an instance of a `Model` object and pass it to the corresponding service `create` or `update` method.
|
307
|
-
|
308
|
-
You will need make sure you supply all required fields for that Intuit object, so consult the documentation. For instance the documentation for a `Customer` object is at: [Intuit Customer Object](https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0400_QuickBooks_Online/Customer)
|
309
|
-
|
310
|
-
## Creating a single object
|
311
|
-
|
312
|
-
Pass an instance of your object to the `create` method on its related Service:
|
313
|
-
|
314
|
-
```ruby
|
315
|
-
customer_service = Quickeebooks::Online::Service::Customer.new
|
316
|
-
customer_service.access_token = oauth_client
|
317
|
-
customer_service.realm_id = realm_id
|
318
|
-
customer_service.list
|
319
|
-
|
320
|
-
customer = Quickeebooks::Online::Model::Customer.new
|
321
|
-
customer.name = "Richard Parker"
|
322
|
-
customer.email = "richard@example.org"
|
323
|
-
customer_service.create(customer)
|
324
|
-
```
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
## Updating a single object
|
329
|
-
|
330
|
-
Pass an instance of your object to the `update` method on its related Service:
|
331
|
-
|
332
|
-
```ruby
|
333
|
-
customer_service = Quickeebooks::Online::Service::Customer.new
|
334
|
-
customer_service.access_token = oauth_client
|
335
|
-
customer_service.realm_id = realm_id
|
336
|
-
customer_service.list
|
337
|
-
|
338
|
-
customer = customer_service.fetch_by_id(100)
|
339
|
-
customer.name = "Richard Parker"
|
340
|
-
customer.email = "richard@example.org"
|
341
|
-
customer_service.update(customer)
|
342
|
-
```
|
343
|
-
|
344
|
-
# Services
|
345
|
-
|
346
|
-
All `Service` objects (`Quickeebooks::Online::Service::Customer`, `Quickeebooks::Online::Service::Account`, `Quickeebooks::Online::Service::Invoice`, etc) have a simple API for CRUD operations. Some service objects have additional functionality (for example the Invoice object can fetch a PDF representation of an invoice). See notes below for each service.
|
347
|
-
|
348
|
-
```ruby
|
349
|
-
create(object)
|
350
|
-
update(object)
|
351
|
-
list()
|
352
|
-
fetch_by_id(object_id)
|
353
|
-
delete(object)
|
354
|
-
```
|
355
|
-
|
356
|
-
As of `0.1.9` the supported Service operations are:
|
357
|
-
|
358
|
-
Entity | Create | Update | List | Delete | Fetch by ID | Other
|
359
|
-
--- | --- | --- | --- | --- | --- | ---
|
360
|
-
**Online:** Account | yes | yes | yes | yes | yes
|
361
|
-
**Windows:** Account | no | no | yes | no | no
|
362
|
-
**Online:** Bill | yes | yes | yes | yes | yes
|
363
|
-
**Windows:** Bill | no | no | no | no | no
|
364
|
-
**Online:** Bill Payment | yes | yes | yes | yes | yes
|
365
|
-
**Windows:** Bill Payment | no | no | no | no | no
|
366
|
-
**Online:** Company Meta Data | no | no | no | no | no | `load`
|
367
|
-
**Windows:** Company Meta Data | no | no | no | no | no | `load`
|
368
|
-
**Online:** Customer | yes | yes | yes | yes | yes |
|
369
|
-
**Windows:** Customer | yes | yes | yes | no | yes |
|
370
|
-
**Online:** Employee | yes | yes | yes | yes | yes |
|
371
|
-
**Windows:** Employee | no | no | yes | no | no |
|
372
|
-
**Online:** Entitlement | n/a | n/a | n/a | n/a | n/a | `status`
|
373
|
-
**Windows:** Entitlement | n/a | n/a | n/a | n/a | n/a |
|
374
|
-
**Online:** Invoice | yes | yes | yes | yes | yes | `invoice_as_pdf`
|
375
|
-
**Windows:** Invoice | yes | no | yes | no | no |
|
376
|
-
**Online:** Item | yes | yes | yes | yes | yes |
|
377
|
-
**Windows:** Item | yes | no | yes | no | no |
|
378
|
-
**Online:** Journal Entry | yes | yes | yes | yes | yes |
|
379
|
-
**Windows:** Journal Entry | no | no | no | no | no |
|
380
|
-
**Online:** Payment | yes | yes | yes | yes | yes |
|
381
|
-
**Windows:** Payment | yes | no | yes | no | yes |
|
382
|
-
**Online:** Payment Method | no | no | no | no | no |
|
383
|
-
**Windows:** Payment Method | no | no | yes | no | no |
|
384
|
-
**Online:** Sales Receipt | yes | yes | yes | yes | yes |
|
385
|
-
**Windows:** Sales Receipt | yes | no | yes | no | no |
|
386
|
-
**Online:** Sales Rep | no | no | no | no | no |
|
387
|
-
**Windows:** Sales Rep | no | no | yes | no | no |
|
388
|
-
**Online:** Sales Tax | no | no | no | no | no |
|
389
|
-
**Windows:** Sales Tax | no | no | yes | no | no |
|
390
|
-
**Online:** Ship Method | no | no | no | no | no |
|
391
|
-
**Windows:** Ship Method | no | no | yes | no | no |
|
392
|
-
**Online:** Sync Activity | n/a | n/a | n/a | n/a | n/a |
|
393
|
-
**Windows:** Sync Activity | no | no | no | no | no | `retrieve`
|
394
|
-
**Online:** Sync Status | n/a | n/a | n/a | n/a | n/a |
|
395
|
-
**Windows:** Sync Status | no | no | no | no | no | `retrieve`
|
396
|
-
**Online:** Time Activity | yes | yes | yes | yes | yes |
|
397
|
-
**Windows:** Time Activity | no | no | yes | no | no |
|
398
|
-
**Online:** Tracking Class | yes | yes | yes | yes | yes |
|
399
|
-
**Windows:** Tracking Class | n/a | n/a | n/a | n/a | n/a |
|
400
|
-
**Online:** Vendor | yes | yes | yes | yes | yes |
|
401
|
-
**Windows:** Vendor | no | no | no | no | no |
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
## Invoice Service
|
406
|
-
|
407
|
-
The `Quickeebooks::Online::Service::Invoice` has the ability to retrieve an invoice as a PDF document:
|
408
|
-
|
409
|
-
```ruby
|
410
|
-
invoice_as_pdf(invoice_id, destination_file_name)
|
411
|
-
```
|
412
|
-
|
413
|
-
Usage: Download invoice #89 and store it at `/tmp/invoice.pdf`:
|
414
|
-
|
415
|
-
```ruby
|
416
|
-
invoice_as_pdf(89, "/tmp/invoice.pdf")
|
417
|
-
```
|
418
|
-
_Note:_ it is up to you the caller to remove or clean up the file when you are done.
|
419
|
-
|
420
|
-
|
421
|
-
## Logging
|
422
|
-
|
423
|
-
```ruby
|
424
|
-
Quickeebooks.log = true
|
425
|
-
```
|
426
|
-
|
427
|
-
## Author
|
428
|
-
|
429
|
-
Cody Caughlan
|
430
|
-
|
431
|
-
## Credits
|
432
|
-
|
433
|
-
Thank you for the contributions:
|
434
|
-
|
435
|
-
* [Walter McGinnis](https://github.com/walter)
|
436
|
-
* [Simon Wistow](https://github.com/simonwistow)
|
437
|
-
* [Matt Rogish](https://github.com/MattRogish)
|
438
|
-
* [Nick Hammond](https://github.com/nickhammond)
|
439
|
-
* [Christian Pelczarski](https://github.com/minimul)
|
440
|
-
|
441
|
-
## License
|
442
|
-
|
443
|
-
The MIT License
|
444
|
-
|
445
|
-
Copyright (c) 2012
|
446
|
-
|
447
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
448
|
-
|
449
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
450
|
-
|
451
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|