qbwc_requests 0.3.3 → 0.3.4
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/lib/qbwc_requests/estimate/v07/add.rb +5 -27
- data/lib/qbwc_requests/ordered_fields.rb +9 -10
- data/lib/qbwc_requests/sub_models/sales_and_puchase.rb +1 -1
- data/lib/qbwc_requests/version.rb +1 -1
- data/spec/estimate_qbxml_spec.rb +7 -51
- metadata +3 -8
- data/lib/qbwc_requests/estimate/v07/mod.rb +0 -40
- data/lib/qbwc_requests/sub_models/estimate_line_add.rb +0 -28
- data/lib/qbwc_requests/sub_models/estimate_line_group_add.rb +0 -12
- data/lib/qbwc_requests/sub_models/estimate_line_group_mod.rb +0 -14
- data/lib/qbwc_requests/sub_models/estimate_line_mod.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e88c97b71f00f4fc7e25e65458002fccd428d550
|
4
|
+
data.tar.gz: 734e8c2ed6526d7f9a32930f96da52781e06cd95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8359254fee1954a0ae76af02ef285627e90ea3271dcce41b6eb09ee4e1b320f461005bd3662268af9a2f7b62c10e7518009db772cc60de6eee55f113a68dd77
|
7
|
+
data.tar.gz: a354d377a62a896b2bab58eba1d6d5e94c3dd31cb5f9815d43cff2cf2e1077035bd759dc8fb1ed924c576f9d8a55854ba34380977f1fdfe66d199094c8c55930
|
@@ -2,35 +2,13 @@ module QbwcRequests
|
|
2
2
|
module Estimate
|
3
3
|
module V07
|
4
4
|
class Add < QbwcRequests::Base
|
5
|
-
|
6
|
-
ref_to
|
7
|
-
|
8
|
-
ref_to :template, 31
|
9
|
-
field :txn_date
|
10
|
-
field :ref_number
|
11
|
-
field :bill_address
|
12
|
-
field :ship_address
|
13
|
-
field :is_active
|
14
|
-
field :po_number
|
15
|
-
ref_to :terms, 31
|
16
|
-
field :due_date
|
17
|
-
ref_to :sales_rep, 5
|
18
|
-
field :fob
|
19
|
-
ref_to :item_sales_tax, 31
|
20
|
-
field :memo
|
21
|
-
ref_to :customer_msg, 101
|
22
|
-
field :is_to_be_emailed
|
23
|
-
ref_to :customer_sales_tax_code, 3
|
24
|
-
field :other
|
25
|
-
field :estimate_line_add
|
26
|
-
field :estimate_line_group_add
|
5
|
+
|
6
|
+
ref_to :customer, 209
|
7
|
+
field :estimate_line_add
|
27
8
|
|
28
9
|
validates :customer_ref, presence: true
|
29
|
-
validates :
|
30
|
-
|
31
|
-
validates :fob, length: { maximum: 13 }
|
32
|
-
validates :memo, length: { maximum: 4095 }
|
33
|
-
validates :other, length: { maximum: 29 }
|
10
|
+
validates :estimate_line_add, presence: true
|
11
|
+
|
34
12
|
end
|
35
13
|
end
|
36
14
|
end
|
@@ -12,21 +12,21 @@ module QbwcRequests
|
|
12
12
|
attr_accessor attribute_name
|
13
13
|
validates_each attribute_name do |record, attribute, value|
|
14
14
|
if !value.blank? and value.class != klass
|
15
|
-
record.errors.add(attribute, "must be of type #{klass}")
|
15
|
+
record.errors.add(attribute, "must be of type #{klass}")
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
|
-
def ref_to attribute_prefix, name_length
|
19
|
+
def ref_to attribute_prefix, name_length
|
20
20
|
attribute_name = "#{attribute_prefix}_ref".to_sym
|
21
21
|
@attr_order ||= Set.new
|
22
22
|
@attr_order << attribute_name
|
23
23
|
attr_accessor attribute_name
|
24
24
|
validates_each attribute_name do |record, attribute, value|
|
25
|
-
if value.present?
|
25
|
+
if value.present?
|
26
26
|
if value.is_a?(Hash)
|
27
27
|
if !(value[:list_id].present? ^ value[:full_name].present?)
|
28
28
|
record.errors.add(attribute, "Must have list_id or full_name")
|
29
|
-
elsif
|
29
|
+
elsif value.fetch(:full_name, "").length > name_length
|
30
30
|
record.errors.add(attribute, "- maximum 'full name' length is: #{name_length}")
|
31
31
|
end
|
32
32
|
else
|
@@ -61,22 +61,21 @@ module QbwcRequests
|
|
61
61
|
base.extend(ClassMethods)
|
62
62
|
base.validates_with(SubModelsValidator)
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
def ordered_fields
|
66
66
|
return {} if self.class.attr_order.blank?
|
67
67
|
new_hash = {}
|
68
68
|
for attribute in self.class.attr_order
|
69
69
|
value = send(attribute)
|
70
70
|
if value.present?
|
71
|
-
if value.
|
72
|
-
|
71
|
+
if value.respond_to?(:ordered_fields)
|
72
|
+
new_hash[attribute] = value.ordered_fields
|
73
73
|
else
|
74
|
-
|
74
|
+
new_hash[attribute] = value
|
75
75
|
end
|
76
|
-
new_hash[attribute] = result
|
77
76
|
end
|
78
77
|
end
|
79
78
|
new_hash
|
80
|
-
end
|
79
|
+
end
|
81
80
|
end
|
82
81
|
end
|
data/spec/estimate_qbxml_spec.rb
CHANGED
@@ -11,15 +11,16 @@ RSpec.describe EstimateQbxml do
|
|
11
11
|
describe EstimateQbxml::Add do
|
12
12
|
|
13
13
|
it{ is_expected.to validate_field_presence_of :customer_ref }
|
14
|
+
it{ is_expected.to validate_field_presence_of :estimate_line_add }
|
14
15
|
|
15
|
-
let(:estimate)
|
16
|
+
let(:estimate){
|
16
17
|
EstimateQbxml::Add.factory(
|
17
18
|
customer_ref: {full_name: 'Some customer name'},
|
18
|
-
estimate_line_add:
|
19
|
-
|
20
|
-
|
19
|
+
estimate_line_add: {
|
20
|
+
item_ref: {full_name: 'Some intem name'}
|
21
|
+
}
|
21
22
|
)
|
22
|
-
|
23
|
+
}
|
23
24
|
|
24
25
|
it "should create an add estimate xml" do
|
25
26
|
xml = <<-XML
|
@@ -34,12 +35,7 @@ RSpec.describe EstimateQbxml do
|
|
34
35
|
</CustomerRef>
|
35
36
|
<EstimateLineAdd>
|
36
37
|
<ItemRef>
|
37
|
-
<FullName>
|
38
|
-
</ItemRef>
|
39
|
-
</EstimateLineAdd>
|
40
|
-
<EstimateLineAdd>
|
41
|
-
<ItemRef>
|
42
|
-
<FullName>item2</FullName>
|
38
|
+
<FullName>Some intem name</FullName>
|
43
39
|
</ItemRef>
|
44
40
|
</EstimateLineAdd>
|
45
41
|
</EstimateAdd>
|
@@ -49,46 +45,6 @@ RSpec.describe EstimateQbxml do
|
|
49
45
|
XML
|
50
46
|
expect( estimate.to_xml("request_id") ).to be_xml_equal_to xml
|
51
47
|
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe EstimateQbxml::Mod do
|
55
|
-
|
56
|
-
it{ is_expected.to validate_field_presence_of :txn_id }
|
57
|
-
it{ is_expected.to validate_field_presence_of :edit_sequence }
|
58
|
-
|
59
|
-
let(:estimate) do
|
60
|
-
EstimateQbxml::Mod.factory(
|
61
|
-
txn_id: 'transaction id',
|
62
|
-
edit_sequence: 'edit sequence',
|
63
|
-
estimate_line_mod: [
|
64
|
-
{txn_line_id: 'line id 1'},
|
65
|
-
{txn_line_id: 'line id 2'}]
|
66
|
-
)
|
67
|
-
end
|
68
48
|
|
69
|
-
it "should create an add estimate xml" do
|
70
|
-
xml = <<-XML
|
71
|
-
<?xml version="1.0" encoding="ISO-8859-1"?>
|
72
|
-
<?qbxml version="7.0"?>
|
73
|
-
<QBXML>
|
74
|
-
<QBXMLMsgsRq onError="stopOnError">
|
75
|
-
<EstimateModRq requestID="request_id">
|
76
|
-
<EstimateMod>
|
77
|
-
<TxnID>transaction id</TxnID>
|
78
|
-
<EditSequence>edit sequence</EditSequence>
|
79
|
-
<EstimateLineMod>
|
80
|
-
<TxnLineID>line id 1</TxnLineID>
|
81
|
-
</EstimateLineMod>
|
82
|
-
<EstimateLineMod>
|
83
|
-
<TxnLineID>line id 2</TxnLineID>
|
84
|
-
</EstimateLineMod>
|
85
|
-
</EstimateMod>
|
86
|
-
</EstimateModRq>
|
87
|
-
</QBXMLMsgsRq>
|
88
|
-
</QBXML>
|
89
|
-
XML
|
90
|
-
expect( estimate.to_xml("request_id") ).to be_xml_equal_to xml
|
91
|
-
end
|
92
49
|
end
|
93
|
-
|
94
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qbwc_requests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
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: 2016-03-
|
11
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: qbxml
|
@@ -118,7 +118,6 @@ files:
|
|
118
118
|
- lib/qbwc_requests/customer/v07/add.rb
|
119
119
|
- lib/qbwc_requests/customer/v07/query.rb
|
120
120
|
- lib/qbwc_requests/estimate/v07/add.rb
|
121
|
-
- lib/qbwc_requests/estimate/v07/mod.rb
|
122
121
|
- lib/qbwc_requests/estimate/v07/query.rb
|
123
122
|
- lib/qbwc_requests/factory.rb
|
124
123
|
- lib/qbwc_requests/general_detail_report/v07/query.rb
|
@@ -145,10 +144,6 @@ files:
|
|
145
144
|
- lib/qbwc_requests/purchase_order/v07/mod.rb
|
146
145
|
- lib/qbwc_requests/purchase_order/v07/query.rb
|
147
146
|
- lib/qbwc_requests/sub_models/address.rb
|
148
|
-
- lib/qbwc_requests/sub_models/estimate_line_add.rb
|
149
|
-
- lib/qbwc_requests/sub_models/estimate_line_group_add.rb
|
150
|
-
- lib/qbwc_requests/sub_models/estimate_line_group_mod.rb
|
151
|
-
- lib/qbwc_requests/sub_models/estimate_line_mod.rb
|
152
147
|
- lib/qbwc_requests/sub_models/sales_and_puchase.rb
|
153
148
|
- lib/qbwc_requests/sub_models/sales_or_puchase.rb
|
154
149
|
- lib/qbwc_requests/vendor/v07/add.rb
|
@@ -254,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
254
249
|
version: '0'
|
255
250
|
requirements: []
|
256
251
|
rubyforge_project:
|
257
|
-
rubygems_version: 2.4.
|
252
|
+
rubygems_version: 2.4.5.1
|
258
253
|
signing_key:
|
259
254
|
specification_version: 4
|
260
255
|
summary: This gem helps you generate Qbxml requests
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module QbwcRequests
|
2
|
-
module Estimate
|
3
|
-
module V07
|
4
|
-
class Mod < QbwcRequests::Base
|
5
|
-
field :txn_id
|
6
|
-
field :edit_sequence
|
7
|
-
ref_to :customer, 209
|
8
|
-
ref_to :class, 159
|
9
|
-
ref_to :template, 31
|
10
|
-
field :txn_date
|
11
|
-
field :ref_number
|
12
|
-
field :bill_address
|
13
|
-
field :ship_address
|
14
|
-
field :is_active
|
15
|
-
field :create_change_order
|
16
|
-
field :po_number
|
17
|
-
ref_to :terms, 31
|
18
|
-
field :due_date
|
19
|
-
ref_to :sales_rep, 5
|
20
|
-
field :fob
|
21
|
-
ref_to :item_sales_tax, 31
|
22
|
-
field :memo
|
23
|
-
ref_to :customer_msg, 101
|
24
|
-
field :is_to_be_emailed
|
25
|
-
ref_to :customer_sales_tax_code, 3
|
26
|
-
field :other
|
27
|
-
field :estimate_line_mod
|
28
|
-
field :estimate_line_group_mod
|
29
|
-
|
30
|
-
validates :txn_id, presence: true
|
31
|
-
validates :edit_sequence, presence: true, length: { maximum: 16 }
|
32
|
-
validates :ref_number, length: { maximum: 11 }
|
33
|
-
validates :po_number, length: { maximum: 25 }
|
34
|
-
validates :fob, length: { maximum: 13 }
|
35
|
-
validates :memo, length: { maximum: 4095 }
|
36
|
-
validates :other, length: { maximum: 29 }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module QbwcRequests
|
2
|
-
module SubModels
|
3
|
-
class EstimateLineAdd < QbwcRequests::Base
|
4
|
-
ref_to :item
|
5
|
-
field :desc
|
6
|
-
field :quantity
|
7
|
-
field :unit_of_measure
|
8
|
-
field :rate
|
9
|
-
field :rate_percent
|
10
|
-
ref_to :class, 159
|
11
|
-
field :amount
|
12
|
-
ref_to :sales_tax_code, 3
|
13
|
-
field :markup_rate
|
14
|
-
field :markup_rate_percent
|
15
|
-
ref_to :price_level, 31
|
16
|
-
ref_to :override_item_account_ref, 159
|
17
|
-
field :other1
|
18
|
-
field :other2
|
19
|
-
field :data_ext_list
|
20
|
-
|
21
|
-
validates :item, presence: true
|
22
|
-
validates :desc, length: { maximum: 4095 }
|
23
|
-
validates :unit_of_measure, length: { maximum: 31 }
|
24
|
-
validates :other1, length: { maximum: 29 }
|
25
|
-
validates :other2, length: { maximum: 29 }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module QbwcRequests
|
2
|
-
module SubModels
|
3
|
-
class EstimateLineGroupMod < QbwcRequests::Base
|
4
|
-
field :txn_line_id
|
5
|
-
ref_to :item_group, 31
|
6
|
-
field :quantity
|
7
|
-
field :unit_of_measure
|
8
|
-
ref_to :override_uom_set_ref, 31
|
9
|
-
field :estimate_line_mod
|
10
|
-
|
11
|
-
validates :unit_of_measure, length: { maximum: 31 }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module QbwcRequests
|
2
|
-
module SubModels
|
3
|
-
class EstimateLineMod < QbwcRequests::Base
|
4
|
-
field :txn_line_id
|
5
|
-
ref_to :item
|
6
|
-
field :desc
|
7
|
-
field :quantity
|
8
|
-
field :unit_of_measure
|
9
|
-
ref_to :override_uom_set, 31
|
10
|
-
field :rate
|
11
|
-
field :rate_percent
|
12
|
-
ref_to :class, 159
|
13
|
-
field :amount
|
14
|
-
ref_to :sales_tax_code, 3
|
15
|
-
field :markup_rate
|
16
|
-
field :markup_rate_percent
|
17
|
-
ref_to :price_level, 31
|
18
|
-
ref_to :override_item_account_ref, 159
|
19
|
-
field :other1
|
20
|
-
field :other2
|
21
|
-
field :data_ext_list
|
22
|
-
|
23
|
-
validates :txn_line_id, presence: true
|
24
|
-
validates :item, presence: true
|
25
|
-
validates :desc, length: { maximum: 4095 }
|
26
|
-
validates :unit_of_measure, length: { maximum: 31 }
|
27
|
-
validates :other1, length: { maximum: 29 }
|
28
|
-
validates :other2, length: { maximum: 29 }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|