Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ItemVendor fields/record_refs for 2021.2 #505

Merged
merged 2 commits into from
Dec 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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. (#505)
* Update InventoryItem record fields/record refs for 2021.2. `member_list` was removed as a field as it doesn't belong to InventoryItem. (#506)

### Fixed
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