Skip to content

Commit

Permalink
Update ItemVendor fields/record_refs for 2021.2
Browse files Browse the repository at this point in the history
A couple were missing for my use case, so I updated them based on 2021.2

`vendor` got moved from a `field` to a `record_ref`.

I arbitrarily went back 5 years (to version 2016.1) and it was still a
`RecordRef` back then, so this doesn't appear to have been a recent
change on the NetSuite side of things that might affect users of this
gem.
  • Loading branch information
cgunther committed Dec 17, 2021
1 parent 70db1a1 commit b04a73c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Add CI run for an environment with and without `tzinfo` installed
* Update NonInventorySaleItem record fields/record refs for 2021.2. `item_options_list`, `presentation_item_list`, `product_feed_list`, `site_category_list`, `translations_list` were all removed as fields as the are not simple fields, they require special classes. (#503)
* Implement MatrixOptionList#to_record (#504)
* Update ItemVendor record fields/record refs for 2021.1. `vendor` is now a record_ref instead of a field.

### Fixed
* Fix "undefined method `[]` for #<Nori::StringIOFile>" when adding File (#495)
Expand Down
11 changes: 10 additions & 1 deletion lib/netsuite/records/item_vendor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@ module NetSuite
module Records
class ItemVendor
include Support::Fields
include Support::RecordRefs
include Support::Records
include Namespaces::ListAcct

fields :vendor, :purchase_price, :preferred_vendor
fields :purchase_price,
:preferred_vendor,
:vendor_code,
:vendor_currency_name

record_refs :schedule,
:subsidiary,
:vendor,
:vendor_currency

def initialize(attributes = {})
initialize_from_attributes_hash(attributes)
Expand Down
7 changes: 2 additions & 5 deletions spec/netsuite/records/item_vendor_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@
describe '#to_record' do
before do
list.item_vendors << NetSuite::Records::ItemVendor.new(
:vendor => {:name => 'Spring Water'}
:vendor_code => 'Spring Water',
)
end

it 'can represent itself as a SOAP record' do
record = {
"listAcct:itemVendor"=>[
{"listAcct:vendor"=>{
:name=>"Spring Water"
}
}
{"listAcct:vendorCode"=>"Spring Water"}
]
}

Expand Down
16 changes: 14 additions & 2 deletions spec/netsuite/records/item_vendor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@

it 'has all the right fields' do
[
:vendor, :purchase_price, :preferred_vendor
:purchase_price,
:preferred_vendor,
:vendor_code,
:vendor_currency_name,
].each do |field|
expect(vendor).to have_field(field)
end
end

it 'has all the right record refs'
it 'has all the right record refs' do
[
:schedule,
:subsidiary,
:vendor,
:vendor_currency,
].each do |field|
expect(vendor).to have_record_ref(field)
end
end
end

0 comments on commit b04a73c

Please sign in to comment.