diff --git a/lib/netsuite/records/assembly_unbuild.rb b/lib/netsuite/records/assembly_unbuild.rb index 1b0aa045..763cb0d7 100644 --- a/lib/netsuite/records/assembly_unbuild.rb +++ b/lib/netsuite/records/assembly_unbuild.rb @@ -12,7 +12,7 @@ class AssemblyUnbuild :search fields :bin_numbers, :built, :created_date, :expiration_date, - :last_modified_date, :memo, :quantity, :serial_numbers, :total, + :last_modified_date, :memo, :quantity, :serial_numbers, :tran_date, :tran_id read_only_fields :total @@ -36,5 +36,3 @@ def initialize(attributes = {}) end end end - - diff --git a/lib/netsuite/records/currency_rate.rb b/lib/netsuite/records/currency_rate.rb index 39f940ff..6ed7c962 100644 --- a/lib/netsuite/records/currency_rate.rb +++ b/lib/netsuite/records/currency_rate.rb @@ -12,7 +12,7 @@ class CurrencyRate actions :get, :get_list, :search - fields :base_currency, :effective_date, :exchange_rate, :transaction_currency + fields :effective_date, :exchange_rate record_refs :base_currency, :transaction_currency diff --git a/lib/netsuite/records/estimate.rb b/lib/netsuite/records/estimate.rb index cc1602f5..d131964d 100644 --- a/lib/netsuite/records/estimate.rb +++ b/lib/netsuite/records/estimate.rb @@ -10,12 +10,12 @@ class Estimate actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search fields :alt_handling_cost, :alt_sales_total, :alt_shipping_cost, :balance, - :bill_address, :billing_address, :billing_schedule, :bill_is_residential, + :bill_address, :billing_schedule, :bill_is_residential, :created_date, :currency_name, :discount_rate, :email, :end_date, :est_gross_profit, :exchange_rate, :handling_cost, :handling_tax1_rate, :is_taxable, - :last_modified_date, :memo, :message, :other_ref_num, :ship_date, :shipping_cost, - :shipping_tax1_rate, :source, :start_date, :status, :sync_partner_teams, :sync_sales_teams, - :to_be_emailed, :to_be_faxed, :to_be_printed, :total_cost_estimate, :tran_date, :tran_id, + :last_modified_date, :memo, :message, :other_ref_num, :ship_date, :shipping_cost, + :shipping_tax1_rate, :source, :start_date, :status, :sync_partner_teams, :sync_sales_teams, + :to_be_emailed, :to_be_faxed, :to_be_printed, :total_cost_estimate, :tran_date, :tran_id, :linked_tracking_numbers, :is_multi_ship_to field :shipping_address, Address @@ -24,8 +24,8 @@ class Estimate field :item_list, EstimateItemList field :custom_field_list, CustomFieldList - record_refs :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item, :entity, - :handling_tax_code, :job, :klass, :lead_source, :location, :message_sel, :opportunity, :partner, + record_refs :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item, :entity, + :handling_tax_code, :job, :klass, :lead_source, :location, :message_sel, :opportunity, :partner, :promo_code, :sales_group, :sales_rep, :ship_method, :shipping_tax_code, :subsidiary, :terms attr_reader :internal_id diff --git a/lib/netsuite/records/invoice.rb b/lib/netsuite/records/invoice.rb index 12e32b49..997ed302 100644 --- a/lib/netsuite/records/invoice.rb +++ b/lib/netsuite/records/invoice.rb @@ -11,8 +11,8 @@ class Invoice actions :get, :get_deleted, :get_list, :initialize, :add, :update, :delete, :upsert, :upsert_list, :search - fields :balance, :bill_address, - :billing_schedule, :contrib_pct, :created_date, :currency_name, :custom_field_list, + fields :balance, + :billing_schedule, :contrib_pct, :created_date, :currency_name, :deferred_revenue, :discount_amount, :discount_date, :discount_rate, :due_date, :email, :end_date, :est_gross_profit, :est_gross_profit_percent, :exchange_rate, :exclude_commission, :exp_cost_disc_amount, :exp_cost_disc_print, :exp_cost_disc_rate, :exp_cost_disc_tax_1_amt, @@ -24,13 +24,13 @@ class Invoice :linked_tracking_numbers, :memo, :message, :message_sel, :on_credit_hold, :opportunity, :other_ref_num, :partners_list, :rev_rec_end_date, :rev_rec_on_rev_commitment, :rev_rec_schedule, :rev_rec_start_date, :revenue_status, :sales_effective_date, - :sales_group, :sales_team_list, :ship_address, :ship_date, :ship_group_list, + :sales_group, :sales_team_list, :ship_date, :ship_group_list, :shipping_cost, :shipping_tax_1_rate, :shipping_tax_2_rate, :shipping_tax_code, :source, :start_date, :status, :sync_partner_teams, :sync_sales_teams, :tax_2_total, :tax_total, :time_disc_amount, :time_disc_print, :time_disc_rate, :time_disc_tax_1_amt, :time_disc_taxable, :time_discount, :time_list, :time_tax_code, :time_tax_rate_1, :time_tax_rate_2, :to_be_emailed, :to_be_faxed, :to_be_printed, :total_cost_estimate, :tracking_numbers, :tran_date, :tran_id, :tran_is_vsoe_bundle, - :transaction_bill_address, :transaction_ship_address, :vat_reg_num, :vsoe_auto_calc, :tax_rate + :vat_reg_num, :vsoe_auto_calc, :tax_rate field :transaction_bill_address, BillAddress field :transaction_ship_address, ShipAddress @@ -39,7 +39,7 @@ class Invoice field :shipping_address, Address field :billing_address, Address - read_only_fields :sub_total, :discount_total, :total, :recognized_revenue, :amount_remaining, :amount_paid, :amount, + read_only_fields :sub_total, :discount_total, :total, :recognized_revenue, :amount_remaining, :amount_paid, :alt_shipping_cost, :gift_cert_applied, :handling_cost, :alt_handling_cost # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_2/schema/search/transactionsearchrowbasic.html?mode=package diff --git a/lib/netsuite/records/invoice_item.rb b/lib/netsuite/records/invoice_item.rb index c760b2be..bf53483c 100644 --- a/lib/netsuite/records/invoice_item.rb +++ b/lib/netsuite/records/invoice_item.rb @@ -9,7 +9,7 @@ class InvoiceItem fields :amount, :amount_ordered, :bin_numbers, :cost_estimate, :cost_estimate_type, :current_percent, :defer_rev_rec, :description, :gift_cert_from, :gift_cert_message, :gift_cert_number, :gift_cert_recipient_email, :gift_cert_recipient_name, :gross_amt, :inventory_detail, :is_taxable, :item_is_fulfilled, :license_code, :line, - :klass, :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled, + :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled, :quantity_on_hand, :quantity_ordered, :rate, :rev_rec_end_date, :rev_rec_start_date, :serial_numbers, :ship_group, :tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price diff --git a/lib/netsuite/records/item_fulfillment_item.rb b/lib/netsuite/records/item_fulfillment_item.rb index 4dcc3549..27fab331 100644 --- a/lib/netsuite/records/item_fulfillment_item.rb +++ b/lib/netsuite/records/item_fulfillment_item.rb @@ -9,7 +9,7 @@ class ItemFulfillmentItem fields :amount, :amount_ordered, :bin_numbers, :cost_estimate, :cost_estimate_type, :current_percent, :defer_rev_rec, :description, :gift_cert_from, :gift_cert_message, :gift_cert_number, :gift_cert_recipient_email, :gift_cert_recipient_name, :gross_amt, :inventory_detail, :is_taxable, :item_is_fulfilled, :license_code, :line, - :klass, :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled, + :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled, :quantity_on_hand, :quantity_ordered, :rate, :rev_rec_end_date, :rev_rec_start_date, :serial_numbers, :ship_group, :tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :item_receive diff --git a/lib/netsuite/records/item_receipt_item.rb b/lib/netsuite/records/item_receipt_item.rb index c9b927a1..0d921e7e 100644 --- a/lib/netsuite/records/item_receipt_item.rb +++ b/lib/netsuite/records/item_receipt_item.rb @@ -7,7 +7,7 @@ class ItemReceiptItem include Namespaces::TranPurch fields :bin_numbers, :currency, :description, :expiration_date, :is_drop_shipment, - :item_name, :item_receive, :job_name, :line, :on_hand, :options, :order_line, + :item_name, :item_receive, :job_name, :line, :on_hand, :order_line, :quantity, :quantity_remaining, :rate, :restock, :serial_numbers, :unit_cost_override, :units_display diff --git a/lib/netsuite/records/non_inventory_purchase_item.rb b/lib/netsuite/records/non_inventory_purchase_item.rb index f321910a..12d831eb 100644 --- a/lib/netsuite/records/non_inventory_purchase_item.rb +++ b/lib/netsuite/records/non_inventory_purchase_item.rb @@ -17,7 +17,7 @@ class NonInventoryPurchaseItem :manufacturer_zip, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity, :minimum_quantity_units, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title, - :preference_criterion, :presentation_item_list, :prices_include_tax, :pricing_matrix, :producer, :product_feed_list, + :preference_criterion, :presentation_item_list, :prices_include_tax, :producer, :product_feed_list, :rate, :related_items_description, :sales_description, :schedule_b_code, :schedule_b_number, :schedule_b_quantity, :search_keywords, :ship_individually, :shipping_cost, :shipping_cost_units, :shopping_dot_com_category, :shopzilla_category_id, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, diff --git a/lib/netsuite/records/non_inventory_resale_item.rb b/lib/netsuite/records/non_inventory_resale_item.rb index 832dda4f..25c084aa 100644 --- a/lib/netsuite/records/non_inventory_resale_item.rb +++ b/lib/netsuite/records/non_inventory_resale_item.rb @@ -17,7 +17,7 @@ class NonInventoryResaleItem :manufacturer_zip, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity, :minimum_quantity_units, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title, - :preference_criterion, :presentation_item_list, :prices_include_tax, :pricing_matrix, :producer, :product_feed_list, + :preference_criterion, :presentation_item_list, :prices_include_tax, :producer, :product_feed_list, :rate, :related_items_description, :sales_description, :schedule_b_code, :schedule_b_number, :schedule_b_quantity, :search_keywords, :ship_individually, :shipping_cost, :shipping_cost_units, :shopping_dot_com_category, :shopzilla_category_id, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, diff --git a/lib/netsuite/records/non_inventory_sale_item.rb b/lib/netsuite/records/non_inventory_sale_item.rb index 7699b463..832e267b 100644 --- a/lib/netsuite/records/non_inventory_sale_item.rb +++ b/lib/netsuite/records/non_inventory_sale_item.rb @@ -17,7 +17,7 @@ class NonInventorySaleItem :manufacturer_zip, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity, :minimum_quantity_units, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title, - :preference_criterion, :presentation_item_list, :prices_include_tax, :pricing_matrix, :producer, :product_feed_list, + :preference_criterion, :presentation_item_list, :prices_include_tax, :producer, :product_feed_list, :rate, :related_items_description, :sales_description, :schedule_b_code, :schedule_b_number, :schedule_b_quantity, :search_keywords, :ship_individually, :shipping_cost, :shipping_cost_units, :shopping_dot_com_category, :shopzilla_category_id, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, diff --git a/lib/netsuite/records/opportunity.rb b/lib/netsuite/records/opportunity.rb index d1cced56..7da4f0ae 100644 --- a/lib/netsuite/records/opportunity.rb +++ b/lib/netsuite/records/opportunity.rb @@ -17,7 +17,7 @@ class Opportunity :memo, :probability, :proj_alt_sales_amt, :projected_total, :range_high, :range_low, :ship_is_residential, :source, :status, :sync_partner_teams, :sync_sales_teams, - :tax2_total, :tax_total, :title, :total_cost_estimate, :tran_date, :tran_id, + :tax2_total, :title, :total_cost_estimate, :tran_date, :tran_id, :vat_reg_num, :weighted_total field :ship_address, ShipAddress @@ -43,4 +43,4 @@ def initialize(attributes = {}) end end -end \ No newline at end of file +end diff --git a/lib/netsuite/records/phone_call.rb b/lib/netsuite/records/phone_call.rb index e7c42d7e..c6d68531 100644 --- a/lib/netsuite/records/phone_call.rb +++ b/lib/netsuite/records/phone_call.rb @@ -10,7 +10,7 @@ class PhoneCall actions :get, :get_list, :add, :delete, :update, :upsert fields :title, :message, :phone, :status, :priority, :start_date, :end_date, - :start_time, :end_time, :completed_date, :timed_event, :access_level, :timed_event + :start_time, :end_time, :completed_date, :timed_event, :access_level field :contact_list, ContactList diff --git a/lib/netsuite/records/serialized_assembly_item.rb b/lib/netsuite/records/serialized_assembly_item.rb index 2802eb31..60c0c586 100644 --- a/lib/netsuite/records/serialized_assembly_item.rb +++ b/lib/netsuite/records/serialized_assembly_item.rb @@ -180,7 +180,6 @@ class SerializedAssemblyItem :store_display_name, :store_display_thumbnail, :store_item_template, - :subsidiary_list, :supply_lot_sizing_method, :supply_replenishment_method, :supply_time_fence, diff --git a/lib/netsuite/records/service_resale_item.rb b/lib/netsuite/records/service_resale_item.rb index d5ee833b..0eef3bc4 100644 --- a/lib/netsuite/records/service_resale_item.rb +++ b/lib/netsuite/records/service_resale_item.rb @@ -15,7 +15,7 @@ class ServiceResaleItem :item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity, :minimum_quantity_units, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title, :presentation_item_list, :prices_include_tax, - :pricing_matrix, :rate, :related_items_description, :sales_description, :search_keywords, + :rate, :related_items_description, :sales_description, :search_keywords, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description, :store_description, :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component, :use_marginal_rates, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :vsoe_sop_group diff --git a/lib/netsuite/records/service_sale_item.rb b/lib/netsuite/records/service_sale_item.rb index 85bcb30f..5a1b361f 100644 --- a/lib/netsuite/records/service_sale_item.rb +++ b/lib/netsuite/records/service_sale_item.rb @@ -15,7 +15,7 @@ class ServiceSaleItem :item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity, :minimum_quantity_units, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title, :presentation_item_list, :prices_include_tax, - :pricing_matrix, :rate, :related_items_description, :sales_description, :search_keywords, + :rate, :related_items_description, :sales_description, :search_keywords, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description, :store_description, :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component, :use_marginal_rates, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :vsoe_sop_group diff --git a/lib/netsuite/records/transfer_order_item.rb b/lib/netsuite/records/transfer_order_item.rb index 84e16308..72d9337d 100644 --- a/lib/netsuite/records/transfer_order_item.rb +++ b/lib/netsuite/records/transfer_order_item.rb @@ -8,7 +8,7 @@ class TransferOrderItem fields :amount, :average_cost, :klass, :commit_inventory, :description, :expected_receipt_date, :expected_ship_date, :inventory_detail, :is_closed, :last_purchase_price, - :line, :options, :order_priority, :quantity, :quantity_available, + :line, :order_priority, :quantity, :quantity_available, :quantity_back_ordered, :quantity_committed, :quantity_fulfilled, :quantity_on_hand, :quantity_packed, :quantity_picked, :quantity_received, :rate, :serial_numbers diff --git a/lib/netsuite/records/vendor.rb b/lib/netsuite/records/vendor.rb index 9c264ab7..caff2fbf 100644 --- a/lib/netsuite/records/vendor.rb +++ b/lib/netsuite/records/vendor.rb @@ -9,16 +9,16 @@ class Vendor actions :get, :get_list, :add, :update, :upsert, :delete, :search - fields :account_number, :alt_email, :alt_name, :alt_phone, :balance, - :balance_primary, :bcn, :bill_pay, :comments, :company_name, :credit_limit, + fields :account_number, :alt_email, :alt_name, :alt_phone, + :bcn, :bill_pay, :comments, :company_name, :credit_limit, :date_created, :default_address, :eligible_for_commission, :email, :email_preference, :email_transactions, :entity_id, :fax, :fax_transactions, :first_name, :give_access, :global_subscription_status, :home_phone, :is1099_eligible, :is_accountant, :is_inactive, :is_job_resource_vend, :is_person, :labor_cost, - :last_modified_date, :last_name, :legal_name, :middle_name, :mobile_phone, :opening_balance, + :last_name, :legal_name, :middle_name, :mobile_phone, :opening_balance, :opening_balance_date, :password, :password2, :phone, :phonetic_name, :pricing_schedule_list, :print_on_check_as, :print_transactions, :require_pwd_change, :roles_list, :salutation, - :send_email, :subscriptions_list, :tax_id_num, :title, :unbilled_orders, :unbilled_orders_primary, + :send_email, :subscriptions_list, :tax_id_num, :title, :url, :vat_reg_number field :custom_field_list, CustomFieldList diff --git a/lib/netsuite/support/fields.rb b/lib/netsuite/support/fields.rb index 94d529e1..56adb55d 100644 --- a/lib/netsuite/support/fields.rb +++ b/lib/netsuite/support/fields.rb @@ -21,6 +21,7 @@ def fields(*args) def field(name, klass = nil) name_sym = name.to_sym + raise "#{name} already defined on #{self.name}" if fields.include?(name_sym) fields << name_sym if klass define_method(name_sym) do diff --git a/spec/netsuite/support/fields_spec.rb b/spec/netsuite/support/fields_spec.rb index f8d4e34a..bffe8ba5 100644 --- a/spec/netsuite/support/fields_spec.rb +++ b/spec/netsuite/support/fields_spec.rb @@ -1,9 +1,12 @@ require 'spec_helper' describe NetSuite::Support::Fields do - let(:klass) { Class.new.send(:include, NetSuite::Support::Fields) } + DummyRecord = Class.new.send(:include, NetSuite::Support::Fields) + let(:klass) { DummyRecord } let(:instance) { klass.new } + before { klass.fields.clear } + describe '.fields' do context 'with arguments' do it 'calls .field with each argument passed to it' do @@ -29,6 +32,12 @@ instance.one = 1 expect(instance.one).to eql(1) end + + it 'errors when already a field' do + klass.field :one + + expect { klass.field :one }.to raise_error('one already defined on DummyRecord') + end end describe '.read_only_fields' do