qbwc_requests 0.0.1 → 0.0.1.01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/README.md +81 -3
- data/lib/qbwc_requests.rb +4 -0
- data/lib/qbwc_requests/qbwc/request/base.rb +5 -3
- data/lib/qbwc_requests/qbwc/request/v07/account.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/bill.rb +9 -0
- data/lib/qbwc_requests/qbwc/request/v07/customer.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/estimate.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/invoice.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/item.rb +3 -3
- data/lib/qbwc_requests/qbwc/request/v07/item_discount.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/item_group.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/item_non_inventory.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/item_other_charge.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/item_payment.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/item_service.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/item_subtotal.rb +2 -2
- data/lib/qbwc_requests/qbwc/request/v07/purchase_order.rb +23 -2
- data/lib/qbwc_requests/qbwc/request/v07/vendor.rb +2 -2
- data/lib/qbwc_requests/qbwc/xml_actions.rb +4 -5
- data/lib/qbwc_requests/version.rb +1 -1
- data/qbwc_requests.gemspec +3 -1
- data/spec/qbwc/request/base_spec.rb +19 -0
- data/spec/qbwc/request/v07/bill_spec.rb +29 -0
- data/spec/support/shared_examples_for_xml_requests.rb +1 -1
- metadata +46 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdfecbcbe855bfafb745d3e2addba58d4f1ea206
|
4
|
+
data.tar.gz: 701dfe42d1de2495ccf0640d24fecf1dc0aa6336
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba7f54481db9c1026a783ddb1d01a59f8b9dfecc181594684db0f31841db7fadb9aaeddf4f5df2f0d063bd35c12bcf8a0d52c0f7793191075ac2b423340c918
|
7
|
+
data.tar.gz: 0ee7e5d7cb28482f87adc07266dff3bb3f18591209a5854ff27d90a48a69e84a8cab45e8fee3a6bf71aff14559d06d4f728747d9f13057609dd8057d2e91aae4
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# QbwcRequests
|
2
2
|
|
3
|
-
|
3
|
+
With qbwc_requests you have an easy way to create Qbxml requests.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,85 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
* Query Requisitions
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
Qbwc::Request::V07::Account.query
|
25
|
+
```
|
26
|
+
|
27
|
+
result
|
28
|
+
|
29
|
+
```xml
|
30
|
+
<?xml version='1.0' encoding='utf-8'?>
|
31
|
+
<?qbxml version="7.0"?>
|
32
|
+
<QBXML>
|
33
|
+
<QBXMLMsgsRq onError="stopOnError">
|
34
|
+
<AccountQueryRq>
|
35
|
+
<MaxReturned>2000</MaxReturned>
|
36
|
+
</AccountQueryRq>
|
37
|
+
</QBXMLMsgsRq>
|
38
|
+
</QBXML>
|
39
|
+
```
|
40
|
+
|
41
|
+
That will create an Account query for the qbxml version 7.0
|
42
|
+
|
43
|
+
* Add Requisitions
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
Qbwc::Request::V07::Account.new(name: 'Some Account name').add
|
47
|
+
```
|
48
|
+
|
49
|
+
result
|
50
|
+
|
51
|
+
```xml
|
52
|
+
<?xml version='1.0' encoding='utf-8'?>
|
53
|
+
<?qbxml version="7.0"?>
|
54
|
+
<QBXML>
|
55
|
+
<QBXMLMsgsRq onError="stopOnError">
|
56
|
+
<AccountAddRq requestID="2">
|
57
|
+
<AccountAdd>
|
58
|
+
<Name>Some Account name</Name>
|
59
|
+
</AccountAdd>
|
60
|
+
</AccountAddRq>
|
61
|
+
</QBXMLMsgsRq>
|
62
|
+
</QBXML>
|
63
|
+
```
|
64
|
+
|
65
|
+
That will create an account xml add requisition.
|
66
|
+
Note that <tt>name</tt> is mandatory in order to create an Account.
|
67
|
+
If no name is provided, the result will be a hash of errors.
|
68
|
+
|
69
|
+
You can also call <tt>valid?</tt> on the object to see the required fields.
|
70
|
+
|
71
|
+
* Delete Requisitions
|
72
|
+
|
73
|
+
Not Implemented
|
74
|
+
|
75
|
+
* Update Requisitions
|
76
|
+
|
77
|
+
Not Implemented
|
78
|
+
|
79
|
+
|
80
|
+
Right now we just have the following models on this gem.
|
81
|
+
|
82
|
+
- Customers
|
83
|
+
- Jobs
|
84
|
+
- Account
|
85
|
+
- Items
|
86
|
+
- Discount Item
|
87
|
+
- Non Inventory Item
|
88
|
+
- Other Charge Item
|
89
|
+
- Payment Item
|
90
|
+
- Service Item
|
91
|
+
- Subtotal Item
|
92
|
+
- Group Item
|
93
|
+
- Vendors
|
94
|
+
- Purchase Orders
|
95
|
+
- Invoices
|
96
|
+
- Estimates
|
97
|
+
|
98
|
+
The Qbxml version for this models is the 7.0.
|
99
|
+
|
22
100
|
|
23
101
|
## Contributing
|
24
102
|
|
@@ -26,4 +104,4 @@ TODO: Write usage instructions here
|
|
26
104
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
105
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
106
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
107
|
+
5. Create new Pull Request
|
data/lib/qbwc_requests.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
require "qbwc_requests/version"
|
2
2
|
require "active_model"
|
3
|
+
require "qbxml"
|
4
|
+
|
5
|
+
Dir["#{File.dirname(__FILE__)}/qbwc_requests/qbwc/*.rb"].each {|f| require f}
|
6
|
+
Dir["#{File.dirname(__FILE__)}/qbwc_requests/qbwc/request/*.rb"].each {|f| require f}
|
3
7
|
Dir["#{File.dirname(__FILE__)}/qbwc_requests/qbwc/**/*.rb"].each {|f| require f}
|
4
8
|
|
5
9
|
module QbwcRequests
|
@@ -7,8 +7,9 @@ module Qbwc
|
|
7
7
|
include ActiveModel::Validations
|
8
8
|
include ActiveModel::Conversion
|
9
9
|
|
10
|
-
def self.
|
11
|
-
|
10
|
+
def self.query options = nil
|
11
|
+
options = { max_returned: 2000 } if options == nil or options.empty?
|
12
|
+
XmlActions.query "#{underscore self.name.demodulize}_query_rq", options
|
12
13
|
end
|
13
14
|
|
14
15
|
def add
|
@@ -42,6 +43,7 @@ module Qbwc
|
|
42
43
|
|
43
44
|
def compact opts={}
|
44
45
|
# I pass two times to avoid {v: '1',k: {}}, gotta find a better algorithm (recursive)
|
46
|
+
return {} if opts.nil?
|
45
47
|
proc = Proc.new { |k, v| v.kind_of?(Hash) ? (v.delete_if(&proc); nil) : v.empty? };
|
46
48
|
hash = opts.delete_if(&proc)
|
47
49
|
hash.delete_if { |k, v| v.empty? }
|
@@ -58,4 +60,4 @@ module Qbwc
|
|
58
60
|
|
59
61
|
end
|
60
62
|
end
|
61
|
-
end
|
63
|
+
end
|
@@ -1,12 +1,33 @@
|
|
1
1
|
module Qbwc
|
2
2
|
module Request
|
3
3
|
module V07
|
4
|
-
class PurchaseOrder < Base
|
4
|
+
class PurchaseOrder < Qbwc::Request::Base
|
5
5
|
|
6
6
|
field :vendor_ref
|
7
|
+
field :class_ref
|
8
|
+
field :ship_to_entity_ref
|
9
|
+
field :template_ref
|
10
|
+
field :txn_date
|
11
|
+
field :ref_number
|
12
|
+
field :vendor_address
|
13
|
+
field :ship_address
|
14
|
+
field :terms_ref
|
15
|
+
field :due_date
|
16
|
+
field :expected_date
|
17
|
+
field :ship_method_ref
|
18
|
+
field :FOB
|
19
|
+
field :memo
|
20
|
+
field :vendor_msg
|
21
|
+
field :is_to_be_printed
|
22
|
+
field :is_to_be_emailed
|
23
|
+
field :is_tax_included
|
24
|
+
field :sales_tax_code_ref
|
25
|
+
field :other1
|
26
|
+
field :other2
|
7
27
|
field :purchase_order_line_add
|
28
|
+
field :purchase_order_line_group_add
|
8
29
|
|
9
30
|
end
|
10
31
|
end
|
11
32
|
end
|
12
|
-
end
|
33
|
+
end
|
@@ -1,18 +1,17 @@
|
|
1
1
|
module Qbwc
|
2
2
|
module XmlActions
|
3
3
|
|
4
|
-
def self.query req,
|
4
|
+
def self.query req, options
|
5
5
|
hash = {"qbxml"=>
|
6
6
|
{"xml_attributes"=>{},
|
7
7
|
"qbxml_msgs_rq"=>
|
8
8
|
{"xml_attributes"=>{"onError"=>"stopOnError"},
|
9
9
|
"#{req}"=>
|
10
|
-
{"xml_attributes"=>{}
|
11
|
-
"max_returned"=> max_returned}
|
10
|
+
{"xml_attributes"=>{}}.merge(options)
|
12
11
|
}
|
13
12
|
}
|
14
13
|
}
|
15
|
-
to_xml(hash)
|
14
|
+
self.to_xml(hash)
|
16
15
|
end
|
17
16
|
|
18
17
|
def self.header
|
@@ -28,4 +27,4 @@ module Qbwc
|
|
28
27
|
end
|
29
28
|
|
30
29
|
end
|
31
|
-
end
|
30
|
+
end
|
data/qbwc_requests.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_runtime_dependency "qbxml", "~> 0.1.6"
|
22
|
+
spec.add_runtime_dependency "activemodel"
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
-
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.3"
|
23
25
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class GenericBase < Qbwc::Request::Base
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
describe GenericBase do
|
8
|
+
|
9
|
+
describe '#initialize' do
|
10
|
+
|
11
|
+
it 'should deal with nil values' do
|
12
|
+
expect {
|
13
|
+
GenericBase.new(nil)
|
14
|
+
}.to_not raise_error
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Qbwc::Request::V07::Bill do
|
4
|
+
|
5
|
+
it_behaves_like 'queryable'
|
6
|
+
|
7
|
+
describe "add" do
|
8
|
+
|
9
|
+
let(:bill){ Qbwc::Request::V07::Bill.new() }
|
10
|
+
|
11
|
+
it "should create an add bill xml" do
|
12
|
+
xml = <<-XML
|
13
|
+
<?xml version='1.0' encoding='utf-8'?>
|
14
|
+
<?qbxml version="7.0"?>
|
15
|
+
<QBXML>
|
16
|
+
<QBXMLMsgsRq onError="stopOnError">
|
17
|
+
<BillAddRq requestID="2">
|
18
|
+
<BillAdd>
|
19
|
+
</BillAdd>
|
20
|
+
</BillAddRq>
|
21
|
+
</QBXMLMsgsRq>
|
22
|
+
</QBXML>
|
23
|
+
XML
|
24
|
+
expect( bill.add ).to be_xml_equal_to xml
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
metadata
CHANGED
@@ -1,43 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qbwc_requests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1.01
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Mondaini Calvão
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: qbxml
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.6
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activemodel
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
16
44
|
requirements:
|
17
|
-
- - ~>
|
45
|
+
- - "~>"
|
18
46
|
- !ruby/object:Gem::Version
|
19
47
|
version: '1.3'
|
20
48
|
type: :development
|
21
49
|
prerelease: false
|
22
50
|
version_requirements: !ruby/object:Gem::Requirement
|
23
51
|
requirements:
|
24
|
-
- - ~>
|
52
|
+
- - "~>"
|
25
53
|
- !ruby/object:Gem::Version
|
26
54
|
version: '1.3'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rake
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
|
-
- -
|
59
|
+
- - "~>"
|
32
60
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
61
|
+
version: '10.3'
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
|
-
- -
|
66
|
+
- - "~>"
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
68
|
+
version: '10.3'
|
41
69
|
description: A qbxml request generator
|
42
70
|
email:
|
43
71
|
- apotema@gmail.com
|
@@ -45,8 +73,8 @@ executables: []
|
|
45
73
|
extensions: []
|
46
74
|
extra_rdoc_files: []
|
47
75
|
files:
|
48
|
-
- .gitignore
|
49
|
-
- .rspec
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
50
78
|
- Gemfile
|
51
79
|
- LICENSE
|
52
80
|
- LICENSE.txt
|
@@ -57,6 +85,7 @@ files:
|
|
57
85
|
- lib/qbwc_requests/qbwc/qbwc.rb
|
58
86
|
- lib/qbwc_requests/qbwc/request/base.rb
|
59
87
|
- lib/qbwc_requests/qbwc/request/v07/account.rb
|
88
|
+
- lib/qbwc_requests/qbwc/request/v07/bill.rb
|
60
89
|
- lib/qbwc_requests/qbwc/request/v07/customer.rb
|
61
90
|
- lib/qbwc_requests/qbwc/request/v07/estimate.rb
|
62
91
|
- lib/qbwc_requests/qbwc/request/v07/invoice.rb
|
@@ -123,7 +152,9 @@ files:
|
|
123
152
|
- quickbook/xml/qbxml/examples/xmlfiles/legacy/VendorAddRq.xml
|
124
153
|
- quickbook/xml/qbxmlops130.xml
|
125
154
|
- quickbook/xml/qbxmlops70.xml
|
155
|
+
- spec/qbwc/request/base_spec.rb
|
126
156
|
- spec/qbwc/request/v07/account_spec.rb
|
157
|
+
- spec/qbwc/request/v07/bill_spec.rb
|
127
158
|
- spec/qbwc/request/v07/customer_spec.rb
|
128
159
|
- spec/qbwc/request/v07/estimate_spec.rb
|
129
160
|
- spec/qbwc/request/v07/invoice_spec.rb
|
@@ -151,22 +182,24 @@ require_paths:
|
|
151
182
|
- lib
|
152
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
153
184
|
requirements:
|
154
|
-
- -
|
185
|
+
- - ">="
|
155
186
|
- !ruby/object:Gem::Version
|
156
187
|
version: '0'
|
157
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
189
|
requirements:
|
159
|
-
- -
|
190
|
+
- - ">="
|
160
191
|
- !ruby/object:Gem::Version
|
161
192
|
version: '0'
|
162
193
|
requirements: []
|
163
194
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
195
|
+
rubygems_version: 2.4.2
|
165
196
|
signing_key:
|
166
197
|
specification_version: 4
|
167
198
|
summary: This gem helps you generate Qbxml requests
|
168
199
|
test_files:
|
200
|
+
- spec/qbwc/request/base_spec.rb
|
169
201
|
- spec/qbwc/request/v07/account_spec.rb
|
202
|
+
- spec/qbwc/request/v07/bill_spec.rb
|
170
203
|
- spec/qbwc/request/v07/customer_spec.rb
|
171
204
|
- spec/qbwc/request/v07/estimate_spec.rb
|
172
205
|
- spec/qbwc/request/v07/invoice_spec.rb
|