Skip to content

Commit

Permalink
add-record-ItemOptionCustomField (#512)
Browse files Browse the repository at this point in the history
Adding class for ItemOptionCustomField
  • Loading branch information
Timothyjb authored Jan 27, 2022
1 parent 60a8d6b commit f8566d6
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/netsuite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ module Records
autoload :ItemGroup, 'netsuite/records/item_group'
autoload :ItemMember, 'netsuite/records/item_member'
autoload :ItemMemberList, 'netsuite/records/item_member_list'
autoload :ItemOptionCustomField, 'netsuite/records/item_option_custom_field'
autoload :ItemReceipt, 'netsuite/records/item_receipt'
autoload :ItemReceiptItemList, 'netsuite/records/item_receipt_item_list'
autoload :ItemReceiptItem, 'netsuite/records/item_receipt_item'
Expand Down
52 changes: 52 additions & 0 deletions lib/netsuite/records/item_option_custom_field.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module NetSuite
module Records
class ItemOptionCustomField
include Support::Fields
include Support::RecordRefs
include Support::Records
include Support::Actions
include Namespaces::SetupCustom

actions :get, :get_list, :add, :delete, :update, :upsert, :upsert_list

# http://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_1/schema/record/ItemOptionCustomField.html
fields(
:access_level,
:col_all_items,
:col_kit_item,
:col_opportunity,
:col_option_label,
:col_purchase,
:col_sale,
:col_store,
:col_store_hidden,
:col_transfer_order,
:default_checked,
:default_value,
:description,
:display_height,
:display_width,
:help,
:is_formula,
:is_mandatory,
:label,
:link_text,
:max_length,
:max_value,
:min_value,
:store_value
)

record_refs :owner, :source_list, :select_record_type, :source_filter_by, :source_from, :search_default, :search_compare_field, :insert_before, :default_selection

attr_reader :internal_id
attr_accessor :external_id

def initialize(attributes = {})
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
initialize_from_attributes_hash(attributes)
end
end
end
end
27 changes: 27 additions & 0 deletions spec/netsuite/records/item_option_custom_field_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'spec_helper'

describe NetSuite::Records::ItemOptionCustomField do

describe ".get" do
let(:response) do
NetSuite::Response.new(
success: true,
body: {
label: "Value of Label",
}
)
end

it "returns a ItemOptionCustomField instance with populated fields" do
expect(NetSuite::Actions::Get)
.to receive(:call)
.with([NetSuite::Records::ItemOptionCustomField, internal_id: 1], {})
.and_return(response)

record = NetSuite::Records::ItemOptionCustomField.get(internal_id: 1)

expect(record.label).to eql("Value of Label")
end
end

end

0 comments on commit f8566d6

Please sign in to comment.