quickeebooks 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/Gemfile.lock +19 -16
  2. data/README.md +29 -23
  3. data/coverage/assets/0.7.1/application.css +1110 -0
  4. data/coverage/assets/0.7.1/application.js +626 -0
  5. data/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
  6. data/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
  7. data/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
  8. data/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
  9. data/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
  10. data/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
  11. data/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
  12. data/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
  13. data/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
  14. data/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
  15. data/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
  16. data/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
  17. data/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
  18. data/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
  19. data/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
  20. data/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
  21. data/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
  22. data/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
  23. data/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
  24. data/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
  25. data/coverage/assets/0.7.1/favicon_green.png +0 -0
  26. data/coverage/assets/0.7.1/favicon_red.png +0 -0
  27. data/coverage/assets/0.7.1/favicon_yellow.png +0 -0
  28. data/coverage/assets/0.7.1/loading.gif +0 -0
  29. data/coverage/assets/0.7.1/magnify.png +0 -0
  30. data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  31. data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  32. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  33. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  34. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  35. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  36. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  37. data/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  38. data/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
  39. data/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  40. data/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
  41. data/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
  42. data/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  43. data/coverage/index.html +29154 -0
  44. data/lib/quickeebooks/common/online_line_item_model_methods.rb +43 -0
  45. data/lib/quickeebooks/common/service_crud.rb +56 -0
  46. data/lib/quickeebooks/online/model/bill.rb +26 -0
  47. data/lib/quickeebooks/online/model/bill_header.rb +21 -0
  48. data/lib/quickeebooks/online/model/bill_line_item.rb +22 -0
  49. data/lib/quickeebooks/online/model/bill_reimbursable.rb +11 -0
  50. data/lib/quickeebooks/online/model/invoice.rb +2 -31
  51. data/lib/quickeebooks/online/model/payment.rb +5 -33
  52. data/lib/quickeebooks/online/service/bill.rb +17 -0
  53. data/lib/quickeebooks/online/service/customer.rb +3 -47
  54. data/lib/quickeebooks/online/service/invoice.rb +1 -1
  55. data/lib/quickeebooks/online/service/payment.rb +3 -46
  56. data/lib/quickeebooks/online/service/service_base.rb +3 -2
  57. data/lib/quickeebooks/online/service/sort.rb +1 -12
  58. data/lib/quickeebooks/shared/service/filter.rb +19 -2
  59. data/lib/quickeebooks/shared/service/sort.rb +22 -0
  60. data/lib/quickeebooks/version.rb +1 -1
  61. data/lib/quickeebooks/windows/service/clazz.rb +1 -5
  62. data/lib/quickeebooks/windows/service/customer.rb +9 -13
  63. data/lib/quickeebooks/windows/service/item.rb +2 -5
  64. data/lib/quickeebooks/windows/service/service_base.rb +30 -15
  65. data/lib/quickeebooks/windows/service/sort.rb +8 -0
  66. data/lib/quickeebooks.rb +11 -5
  67. data/quickeebooks.gemspec +2 -2
  68. data/spec/quickeebooks/common/online_line_item_model_methods_spec.rb +41 -0
  69. data/spec/quickeebooks/common/service_crud_spec.rb +41 -0
  70. data/spec/quickeebooks/online/account_spec.rb +4 -8
  71. data/spec/quickeebooks/online/bill_spec.rb +17 -0
  72. data/spec/quickeebooks/online/company_meta_data_spec.rb +6 -9
  73. data/spec/quickeebooks/online/customer_spec.rb +10 -14
  74. data/spec/quickeebooks/online/invoice_spec.rb +3 -7
  75. data/spec/quickeebooks/online/payment_spec.rb +6 -10
  76. data/spec/quickeebooks/online/services/account_spec.rb +8 -13
  77. data/spec/quickeebooks/online/services/bill_spec.rb +61 -0
  78. data/spec/quickeebooks/online/services/company_meta_data_spec.rb +2 -7
  79. data/spec/quickeebooks/online/services/customer_spec.rb +15 -20
  80. data/spec/quickeebooks/online/services/filter_spec.rb +0 -5
  81. data/spec/quickeebooks/online/services/invoice_spec.rb +5 -10
  82. data/spec/quickeebooks/online/services/payment_spec.rb +63 -0
  83. data/spec/quickeebooks/online/services/service_base_spec.rb +62 -9
  84. data/spec/quickeebooks/shared/access_token_spec.rb +6 -11
  85. data/spec/quickeebooks/shared/filter_spec.rb +159 -0
  86. data/spec/quickeebooks/shared/sort_spec.rb +17 -0
  87. data/spec/quickeebooks/windows/customer_spec.rb +11 -15
  88. data/spec/quickeebooks/windows/services/class_spec.rb +2 -7
  89. data/spec/quickeebooks/windows/services/company_meta_data_spec.rb +2 -7
  90. data/spec/quickeebooks/windows/services/customer_spec.rb +16 -21
  91. data/spec/quickeebooks/windows/services/invoice_spec.rb +13 -19
  92. data/spec/quickeebooks/windows/services/payment_spec.rb +6 -12
  93. data/spec/quickeebooks/windows/services/sales_rep_spec.rb +6 -11
  94. data/spec/quickeebooks/windows/services/sales_taxes_spec.rb +5 -10
  95. data/spec/quickeebooks/windows/services/service_base_spec.rb +95 -0
  96. data/spec/quickeebooks/windows/services/ship_method_spec.rb +4 -9
  97. data/spec/quickeebooks_spec.rb +0 -3
  98. data/spec/spec_helper.rb +30 -1
  99. data/spec/support/oauth.rb +20 -0
  100. data/spec/xml/online/bill.xml +32 -0
  101. data/spec/xml/online/bill2.xml +32 -0
  102. data/spec/xml/online/bills.xml +33 -0
  103. data/spec/xml/online/payment.xml +1 -1
  104. data/spec/xml/online/payment2.xml +24 -0
  105. data/spec/xml/online/payments.xml +30 -0
  106. metadata +103 -40
  107. data/spec/quickeebooks/online/services/sort_spec.rb +0 -17
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- quickeebooks (0.1.1)
4
+ quickeebooks (0.1.2)
5
5
  activemodel
6
6
  nokogiri
7
7
  oauth
@@ -11,21 +11,20 @@ PATH
11
11
  GEM
12
12
  remote: http://rubygems.org/
13
13
  specs:
14
- activemodel (3.2.6)
15
- activesupport (= 3.2.6)
14
+ activemodel (3.2.12)
15
+ activesupport (= 3.2.12)
16
16
  builder (~> 3.0.0)
17
- activesupport (3.2.6)
17
+ activesupport (3.2.12)
18
18
  i18n (~> 0.6)
19
19
  multi_json (~> 1.0)
20
- builder (3.0.0)
20
+ builder (3.0.4)
21
21
  diff-lcs (1.1.3)
22
22
  fakeweb (1.3.0)
23
- i18n (0.6.0)
24
- multi_json (1.3.6)
25
- nokogiri (1.5.5)
26
- oauth (0.4.6)
27
- rake (0.9.2.2)
28
- rcov (0.9.11)
23
+ i18n (0.6.1)
24
+ multi_json (1.6.1)
25
+ nokogiri (1.5.6)
26
+ oauth (0.4.7)
27
+ rake (10.0.3)
29
28
  roxml (3.3.1)
30
29
  activesupport (>= 2.3.0)
31
30
  nokogiri (>= 1.3.3)
@@ -34,11 +33,15 @@ GEM
34
33
  rspec-core (~> 2.11.0)
35
34
  rspec-expectations (~> 2.11.0)
36
35
  rspec-mocks (~> 2.11.0)
37
- rspec-core (2.11.0)
38
- rspec-expectations (2.11.1)
36
+ rspec-core (2.11.1)
37
+ rspec-expectations (2.11.3)
39
38
  diff-lcs (~> 1.1.3)
40
- rspec-mocks (2.11.1)
41
- uuidtools (2.1.2)
39
+ rspec-mocks (2.11.3)
40
+ simplecov (0.7.1)
41
+ multi_json (~> 1.0)
42
+ simplecov-html (~> 0.7.1)
43
+ simplecov-html (0.7.1)
44
+ uuidtools (2.1.3)
42
45
 
43
46
  PLATFORMS
44
47
  ruby
@@ -47,6 +50,6 @@ DEPENDENCIES
47
50
  fakeweb
48
51
  quickeebooks!
49
52
  rake
50
- rcov (~> 0.9.8)
51
53
  rr (~> 1.0.2)
52
54
  rspec (= 2.11.0)
55
+ simplecov
data/README.md CHANGED
@@ -9,6 +9,8 @@ This library communicates with the Quickbooks Data Services `v2` API, documented
9
9
  When Intuit finalizes the `v3` API I would like to move to that version as it appears to be better structured
10
10
  and has `JSON` request/response formats, which should be easier to work with than XML.
11
11
 
12
+ [![Build Status](https://travis-ci.org/ruckus/quickeebooks.png)](https://travis-ci.org/ruckus/quickeebooks)
13
+
12
14
  ## Requirements
13
15
 
14
16
  This is being developed on Ruby 1.9.2. Other versions/VMs are untested but Ruby 1.8 should work in theory.
@@ -89,7 +91,7 @@ oauth_client = OAuth::AccessToken.new($qb_oauth_consumer, access_token, access_s
89
91
 
90
92
  ## Quickbooks Online vs Windows
91
93
 
92
- IDS provides 2 APIs, one for interacting with Quickbooks Online resources and one for Quickbooks Windows resources.
94
+ IDS provides 2 APIs, one for interacting with Quickbooks Online resources and one for Quickbooks Windows resources.
93
95
 
94
96
  See: https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services
95
97
 
@@ -102,13 +104,13 @@ For example:
102
104
  customer_service = Quickeebooks::Online::Service::Customer.new
103
105
  customer_service.access_token = oauth_client
104
106
  customer_service.realm_id = realm_id
105
- customer_service.list
107
+ customer_service.list
106
108
 
107
109
  # Instantiate a Windows API
108
110
  customer_service = Quickeebooks::Windows::Service::Customer.new(oauth_client, realm_id)
109
111
  customer_service.access_token = oauth_client
110
112
  customer_service.realm_id = realm_id
111
- customer_service.list
113
+ customer_service.list
112
114
  ```
113
115
 
114
116
  All of the documentation below is geared towards the Online flavor but unless noted one should be able to replace it with Windows.
@@ -119,8 +121,8 @@ Now we can initialize any of the `Service` clients:
119
121
  customer_service = Quickeebooks::Online::Service::Customer.new
120
122
  customer_service.access_token = oauth_client
121
123
  customer_service.realm_id = realm_id
122
- customer_service.list
123
- customer_service.list
124
+ customer_service.list
125
+ customer_service.list
124
126
 
125
127
  # returns a `Collection` object
126
128
  ```
@@ -156,7 +158,7 @@ Specify none of these to get the defaults:
156
158
  customer_service = Quickeebooks::Online::Service::Customer.new
157
159
  customer_service.access_token = oauth_client
158
160
  customer_service.realm_id = realm_id
159
- customer_service.list
161
+ customer_service.list
160
162
 
161
163
  # fetch all customers with default parameters (pagination, sorting, filtering)
162
164
  customers = customer_service.list
@@ -164,13 +166,17 @@ customers = customer_service.list
164
166
 
165
167
  Return result: a `Collection` instance with properties: `entries`, `current_page`, `count` which should be self-explanatory.
166
168
 
167
- ### Filtering (currently only supported in the Online API)
169
+ ### Filtering (full Online API support, partial Windows API support)
170
+
171
+ For Online, all filters in the Intuit documentation are supported: text, datetime, boolean.
168
172
 
169
- All filters in the Intuit documentation are supported: text, datetime, boolean.
173
+ 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
170
174
 
171
- Construct an instance of `Quickeebooks::Online::Service::Filter` with the type of filter, one of: `:text`, `:datetime`, `:boolean`.
175
+ Note: you'll get an exception from Intuit if you attempt to query on a non-queryable attribute.
172
176
 
173
- Pass an array of `Quickeebooks::Online::Service::Filter` objects as the first argument to the Services `list` method and all filters will be applied.
177
+ Construct an instance of `Quickeebooks::Shared::Service::Filter` with the type of filter, one of: `:text`, `:datetime`, `:boolean`.
178
+
179
+ Pass an array of `Quickeebooks::Shared::Service::Filter` objects as the first argument to the Services `list` method and all filters will be applied.
174
180
 
175
181
  #### Filtering on a text field
176
182
 
@@ -179,7 +185,7 @@ Specify a type of `:text` and your desired `:field` and a `:value` clause which
179
185
  Note: the Intuit API is case-INSENSITIVE.
180
186
 
181
187
  ```ruby
182
- Quickeebooks::Online::Service::Filter.new(:text, :field => 'FamilyName', :value => 'Richards')
188
+ Quickeebooks::Shared::Service::Filter.new(:text, :field => 'FamilyName', :value => 'Richards')
183
189
  ```
184
190
 
185
191
  #### Filtering on a Date/Time
@@ -191,16 +197,16 @@ Examples:
191
197
  ```ruby
192
198
  # find all customers created after 2/15/2011
193
199
  datetime = Time.mktime(2011, 2, 15)
194
- Quickeebooks::Online::Service::Filter.new(:datetime, :field => 'CreateTime', :after => datetime)
200
+ Quickeebooks::Shared::Service::Filter.new(:datetime, :field => 'CreateTime', :after => datetime)
195
201
 
196
202
  # find all customers created before 3/28/2011
197
203
  datetime = Time.mktime(2011, 2, 28)
198
- Quickeebooks::Online::Service::Filter.new(:datetime, :field => 'CreateTime', :before => datetime)
204
+ Quickeebooks::Shared::Service::Filter.new(:datetime, :field => 'CreateTime', :before => datetime)
199
205
 
200
206
  # find all customers created between 1/1/2011 and 2/15/2011
201
207
  after = Time.mktime(2011, 1, 1)
202
208
  before = Time.mktime(2011, 2, 15
203
- Quickeebooks::Online::Service::Filter.new(:datetime, :field => 'CreateTime', :after => after, :before => before)
209
+ Quickeebooks::Shared::Service::Filter.new(:datetime, :field => 'CreateTime', :after => after, :before => before)
204
210
  ```
205
211
 
206
212
  #### Filtering on a Boolean field
@@ -209,7 +215,7 @@ Specify a type of `:boolean` and your desired `:field` and a `:value` with eithe
209
215
 
210
216
  ```ruby
211
217
  # find all customers and exclude jobs
212
- Quickeebooks::Online::Service::Filter.new(:boolean, :field => 'IncludeJobs', :value => false)
218
+ Quickeebooks::Shared::Service::Filter.new(:boolean, :field => 'IncludeJobs', :value => false)
213
219
  ```
214
220
 
215
221
  #### Filtering on a Number
@@ -218,7 +224,7 @@ Specify a type of `:number` and an operator, one of: `:gt`, `:lt`, or `:eq`.
218
224
 
219
225
  ```ruby
220
226
  # find all customers and exclude jobs
221
- Quickeebooks::Online::Service::Filter.new(:number, :field => 'Amount', :gt => 150)
227
+ Quickeebooks::Shared::Service::Filter.new(:number, :field => 'Amount', :gt => 150)
222
228
  ```
223
229
 
224
230
  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.
@@ -233,7 +239,7 @@ filters << Quickeebooks::Online::Service::Filter.new(:datetime, :field => 'Creat
233
239
  customer_service = Quickeebooks::Online::Service::Customer.new
234
240
  customer_service.access_token = oauth_client
235
241
  customer_service.realm_id = realm_id
236
- customer_service.list
242
+ customer_service.list
237
243
 
238
244
  customers = customer_service.list(filters)
239
245
  ```
@@ -266,19 +272,19 @@ sorter = Quickeebooks::Online::Service::Sort.new('FamilyName', 'AtoZ')
266
272
  customer_service = Quickeebooks::Online::Service::Customer.new
267
273
  customer_service.access_token = oauth_client
268
274
  customer_service.realm_id = realm_id
269
- customer_service.list
275
+ customer_service.list
270
276
 
271
277
  customers = customer_service.list(filters, 1, 30, sort)
272
278
 
273
279
  # returns
274
-
280
+
275
281
  customers.count
276
282
  => 67
277
283
 
278
284
  customers.current_page
279
285
  => 1
280
286
 
281
- customers.entries
287
+ customers.entries
282
288
  => [ #<Quickeebooks::Online::Model::Customer:0x007f8e29259770>, #<Quickeebooks::Online::Model::Customer:0x0078768202020>, ... ]
283
289
  ```
284
290
 
@@ -291,7 +297,7 @@ Use the `Service` instance to fetch an object by its id using the `fetch_by_id`
291
297
  customer_service = Quickeebooks::Online::Service::Customer.new
292
298
  customer_service.access_token = oauth_client
293
299
  customer_service.realm_id = realm_id
294
- customer_service.list
300
+ customer_service.list
295
301
 
296
302
  customer = customer_service.fetch_by_id(100)
297
303
  customer.name
@@ -312,7 +318,7 @@ Pass an instance of your object to the `create` method on its related Service:
312
318
  customer_service = Quickeebooks::Online::Service::Customer.new
313
319
  customer_service.access_token = oauth_client
314
320
  customer_service.realm_id = realm_id
315
- customer_service.list
321
+ customer_service.list
316
322
 
317
323
  customer = Quickeebooks::Online::Model::Customer.new
318
324
  customer.name = "Richard Parker"
@@ -330,7 +336,7 @@ Pass an instance of your object to the `update` method on its related Service:
330
336
  customer_service = Quickeebooks::Online::Service::Customer.new
331
337
  customer_service.access_token = oauth_client
332
338
  customer_service.realm_id = realm_id
333
- customer_service.list
339
+ customer_service.list
334
340
 
335
341
  customer = customer_service.fetch_by_id(100)
336
342
  customer.name = "Richard Parker"