diff --git a/lib/netsuite.rb b/lib/netsuite.rb index 0e28e5711..bb41c014e 100644 --- a/lib/netsuite.rb +++ b/lib/netsuite.rb @@ -49,6 +49,7 @@ module Support module Actions autoload :Add, 'netsuite/actions/add' + autoload :AddList, 'netsuite/actions/add_list' autoload :Delete, 'netsuite/actions/delete' autoload :DeleteList, 'netsuite/actions/delete_list' autoload :Get, 'netsuite/actions/get' diff --git a/lib/netsuite/actions/add_list.rb b/lib/netsuite/actions/add_list.rb new file mode 100644 index 000000000..48160d320 --- /dev/null +++ b/lib/netsuite/actions/add_list.rb @@ -0,0 +1,118 @@ +# https://system.eu1.netsuite.com/app/help/helpcenter.nl?fid=section_N3481360.html +module NetSuite + module Actions + class AddList + include Support::Requests + + def initialize(*objects) + @objects = objects + end + + private + + def request(credentials={}) + NetSuite::Configuration.connection( + { element_form_default: :unqualified }, credentials + ).call(:add_list, message: request_body) + end + + # + # + # + # Shutter Fly + # Shutter Fly, Inc + # + # + # Target + # Target + # + # + # + def request_body + attrs = @objects.map do |o| + hash = o.to_record.merge({ + '@xsi:type' => o.record_type + }) + + if o.respond_to?(:external_id) && o.external_id + hash['@externalId'] = o.external_id + end + + hash + end + + { 'record' => attrs } + end + + def response_hash + @response_hash ||= Array[@response.body[:add_list_response][:write_response_list][:write_response]].flatten + end + + def response_body + @response_body ||= response_hash.map { |h| h[:base_ref] } + end + + def response_errors + if response_hash.any? { |h| h[:status] && h[:status][:status_detail] } + @response_errors ||= errors + end + end + + def errors + errors = response_hash.select { |h| h[:status] }.each_with_index.map do |obj, index| + error_obj = obj[:status][:status_detail] + next if error_obj.nil? + error_obj = [error_obj] if error_obj.class == Hash + errors = error_obj.map do |error| + NetSuite::Error.new(error) + end + + external_id = + (obj[:base_ref] && obj[:base_ref][:@external_id]) || + (@objects[index].respond_to?(:external_id) && @objects[index].external_id) + [external_id, errors] + end + Hash[errors] + end + + def success? + @success ||= response_hash.all? { |h| h[:status][:@is_success] == 'true' } + end + + module Support + + def self.included(base) + base.extend(ClassMethods) + end + + module ClassMethods + def add_list(records, credentials = {}) + netsuite_records = records.map do |r| + if r.is_a?(self) + r + else + new(r) + end + end + + response = NetSuite::Actions::AddList.call(netsuite_records, credentials) + + if response.success? + response.body.map do |attr| + record = netsuite_records.find do |r| + r.external_id == attr[:@external_id] + end + + record.instance_variable_set('@internal_id', attr[:@internal_id]) + end + + netsuite_records + else + false + end + end + end + end + end + end +end diff --git a/lib/netsuite/records/account.rb b/lib/netsuite/records/account.rb index b749f9596..f58a8507b 100644 --- a/lib/netsuite/records/account.rb +++ b/lib/netsuite/records/account.rb @@ -7,7 +7,7 @@ class Account include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :update, :delete, :search, :upsert + actions :get, :get_list, :add, :add_list, :update, :delete, :search, :upsert fields :acct_name, :acct_number, :acct_type, :cash_flow_rate, :cur_doc_num, :description, :eliminate, :exchange_rate, :general_rate, :include_children, :inventory, :is_inactive, :opening_balance, :revalue, :tran_date, :balance diff --git a/lib/netsuite/records/accounting_period.rb b/lib/netsuite/records/accounting_period.rb index 5dd04b346..1644dec44 100644 --- a/lib/netsuite/records/accounting_period.rb +++ b/lib/netsuite/records/accounting_period.rb @@ -6,7 +6,7 @@ class AccountingPeriod include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :upsert, :search + actions :get, :get_list, :add, :add_list, :delete, :upsert, :search fields :allow_non_gl_changes, :end_date, :is_adjust, :is_quarter, :is_year, :period_name, :start_date diff --git a/lib/netsuite/records/assembly_build.rb b/lib/netsuite/records/assembly_build.rb index 0c83114bd..b579e5ccc 100644 --- a/lib/netsuite/records/assembly_build.rb +++ b/lib/netsuite/records/assembly_build.rb @@ -8,7 +8,7 @@ class AssemblyBuild include Support::Fields include Namespaces::TranInvt - actions :get, :add, :initialize, :delete, :update, :upsert, :upsert_list, + actions :get, :add, :add_list, :initialize, :delete, :update, :upsert, :upsert_list, :search fields :bin_numbers, :buildable, :created_date, :expiration_date, diff --git a/lib/netsuite/records/assembly_item.rb b/lib/netsuite/records/assembly_item.rb index e259617dc..35fdb9632 100644 --- a/lib/netsuite/records/assembly_item.rb +++ b/lib/netsuite/records/assembly_item.rb @@ -7,7 +7,7 @@ class AssemblyItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :get_select_value, :add, :delete, :update, :upsert, :upsert_list, :search + actions :get, :get_list, :get_select_value, :add, :add_list, :delete, :update, :upsert, :upsert_list, :search fields :auto_lead_time, :auto_preferred_stock_level, :auto_reorder_point, :available_to_partners, :average_cost, :build_entire_assembly, :copy_description, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :cost_units, :costing_method, diff --git a/lib/netsuite/records/assembly_unbuild.rb b/lib/netsuite/records/assembly_unbuild.rb index 1b0aa045a..98db5cca7 100644 --- a/lib/netsuite/records/assembly_unbuild.rb +++ b/lib/netsuite/records/assembly_unbuild.rb @@ -8,7 +8,7 @@ class AssemblyUnbuild include Support::Fields include Namespaces::TranInvt - actions :get, :add, :initialize, :delete, :update, :upsert, :upsert_list, + actions :get, :add, :add_list, :initialize, :delete, :update, :upsert, :upsert_list, :search fields :bin_numbers, :built, :created_date, :expiration_date, diff --git a/lib/netsuite/records/billing_schedule.rb b/lib/netsuite/records/billing_schedule.rb index a05977a02..37c2f32f7 100644 --- a/lib/netsuite/records/billing_schedule.rb +++ b/lib/netsuite/records/billing_schedule.rb @@ -7,7 +7,7 @@ class BillingSchedule include Support::Actions include Namespaces::ListAcct - actions :get, :add, :delete, :upsert, :search + actions :get, :add, :add_list, :delete, :upsert, :search fields :bill_for_actuals, :day_period, :frequency, :in_arrears, :initial_amount, :is_inactive, :is_public, :month_dom, :month_dow, :month_dowim, :month_mode, :name, diff --git a/lib/netsuite/records/bin.rb b/lib/netsuite/records/bin.rb index 8a55d3c89..47f19e5e3 100644 --- a/lib/netsuite/records/bin.rb +++ b/lib/netsuite/records/bin.rb @@ -13,7 +13,7 @@ class Bin attr_reader :internal_id attr_accessor :external_id - actions :get, :add, :delete, :search, :update, :upsert + actions :get, :add, :add_list, :delete, :search, :update, :upsert fields :bin_number, :is_inactive, :location, :memo diff --git a/lib/netsuite/records/bin_transfer.rb b/lib/netsuite/records/bin_transfer.rb index d188c7c63..32c9b2d1f 100644 --- a/lib/netsuite/records/bin_transfer.rb +++ b/lib/netsuite/records/bin_transfer.rb @@ -7,7 +7,7 @@ class BinTransfer include Support::Actions include Namespaces::TranInvt - actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search + actions :get, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :search fields :created_date, :last_modified_date, :memo, :subsidiary, :tran_date, :tran_id diff --git a/lib/netsuite/records/cash_refund.rb b/lib/netsuite/records/cash_refund.rb index a4c9b46ab..bdc1c2c0a 100644 --- a/lib/netsuite/records/cash_refund.rb +++ b/lib/netsuite/records/cash_refund.rb @@ -7,7 +7,7 @@ class CashRefund include Support::Actions include Namespaces::TranCust - actions :get, :add, :initialize, :delete, :update, :upsert, :search + actions :get, :add, :add_list, :initialize, :delete, :update, :upsert, :search fields :alt_handling_cost, :alt_shipping_cost, diff --git a/lib/netsuite/records/cash_sale.rb b/lib/netsuite/records/cash_sale.rb index 97fe2d042..837a7c60f 100644 --- a/lib/netsuite/records/cash_sale.rb +++ b/lib/netsuite/records/cash_sale.rb @@ -7,7 +7,7 @@ class CashSale include Support::Actions include Namespaces::TranSales - actions :get, :add, :initialize, :delete, :update, :upsert, :search + actions :get, :add, :add_list, :initialize, :delete, :update, :upsert, :search fields :alt_handling_cost, :alt_shipping_cost, :auth_code, :bill_address, :cc_approved, :cc_expire_date, :cc_is_purchase_card_bin, :cc_name, :cc_number, :cc_process_as_purchas_card, :cc_security_code, :cc_street, :cc_zip_code, :charge_it, :contrib_pct, :created_date, diff --git a/lib/netsuite/records/contact.rb b/lib/netsuite/records/contact.rb index 2934453f0..c926f8a52 100644 --- a/lib/netsuite/records/contact.rb +++ b/lib/netsuite/records/contact.rb @@ -7,7 +7,7 @@ class Contact include Support::Actions include Namespaces::ListRel - actions :get, :get_list, :add, :delete, :delete_list, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :delete_list, :search, :update, :upsert fields :salutation, :first_name, :middle_name, :last_name, :title, :phone, :fax, :email, :default_address, :entity_id, :phonetic_name, :alt_email, :office_phone, :home_phone, :mobile_phone, :supervisor_phone, diff --git a/lib/netsuite/records/credit_memo.rb b/lib/netsuite/records/credit_memo.rb index b9999c869..bb5e7f814 100644 --- a/lib/netsuite/records/credit_memo.rb +++ b/lib/netsuite/records/credit_memo.rb @@ -7,7 +7,7 @@ class CreditMemo include Support::Actions include Namespaces::TranCust - actions :get, :get_deleted, :get_list, :add, :initialize, :delete, :update, :upsert, :upsert_list, :search + actions :get, :get_deleted, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :upsert_list, :search fields :alt_handling_cost, :alt_shipping_cost, :amount_paid, :amount_remaining, :auto_apply, :balance, :bill_address, :contrib_pct, :created_date, :currency_name, :deferred_revenue, :discount_rate, :email, diff --git a/lib/netsuite/records/currency.rb b/lib/netsuite/records/currency.rb index 53b58800b..84b0158d9 100644 --- a/lib/netsuite/records/currency.rb +++ b/lib/netsuite/records/currency.rb @@ -10,7 +10,7 @@ class Currency # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/currency.html - actions :get, :get_list, :get_all, :add, :update, :upsert, :upsert_list, :delete + actions :get, :get_list, :get_all, :add, :add_list, :update, :upsert, :upsert_list, :delete fields :name, :symbol, :is_base_currency, :is_inactive, :override_currency_format, :display_symbol, :symbol_placement, :locale, :formatSample, :exchangeRate, :fx_rate_update_timezone, :incl_in_fx_rate_updates, :currency_precision diff --git a/lib/netsuite/records/custom_list.rb b/lib/netsuite/records/custom_list.rb index 3112b7e2a..c54eecaaa 100644 --- a/lib/netsuite/records/custom_list.rb +++ b/lib/netsuite/records/custom_list.rb @@ -6,7 +6,7 @@ class CustomList include Support::Actions include Namespaces::SetupCustom - actions :get, :update, :get_list, :add, :delete, :search, :upsert + actions :get, :update, :get_list, :add, :add_list, :delete, :search, :upsert # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/customlist.html fields :description, :name, :is_ordered, :script_id, :convert_to_custom_record, diff --git a/lib/netsuite/records/custom_record.rb b/lib/netsuite/records/custom_record.rb index d12fa0915..1f8c53788 100644 --- a/lib/netsuite/records/custom_record.rb +++ b/lib/netsuite/records/custom_record.rb @@ -7,7 +7,7 @@ class CustomRecord include Support::Actions include Namespaces::SetupCustom - actions :get, :update, :get_list, :add, :delete, :search, :upsert + actions :get, :update, :get_list, :add, :add_list, :delete, :search, :upsert fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :alt_name, :auto_name, :created, :custom_record_id, :description, :disclaimer, :enabl_email_merge, :enable_numbering, :include_name, diff --git a/lib/netsuite/records/custom_record_type.rb b/lib/netsuite/records/custom_record_type.rb index 355ca73f3..bd86cd1f8 100644 --- a/lib/netsuite/records/custom_record_type.rb +++ b/lib/netsuite/records/custom_record_type.rb @@ -5,7 +5,7 @@ class CustomRecordType include Support::RecordRefs include Support::Actions - actions :get, :get_list, :add, :delete, :upsert + actions :get, :get_list, :add, :add_list, :delete, :upsert fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :description, :disclaimer, :enable_mail_merge, :enable_numbering, :include_name, :is_available_offline, :is_inactive, diff --git a/lib/netsuite/records/customer.rb b/lib/netsuite/records/customer.rb index 055088713..55915baa8 100644 --- a/lib/netsuite/records/customer.rb +++ b/lib/netsuite/records/customer.rb @@ -7,7 +7,7 @@ class Customer include Support::Actions include Namespaces::ListRel - actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :delete_list, :search + actions :get, :get_list, :add, :add_list, :update, :upsert, :upsert_list, :delete, :delete_list, :search # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/customer.html diff --git a/lib/netsuite/records/customer_category.rb b/lib/netsuite/records/customer_category.rb index a249d2c0d..a40fb9433 100644 --- a/lib/netsuite/records/customer_category.rb +++ b/lib/netsuite/records/customer_category.rb @@ -9,7 +9,7 @@ class CustomerCategory include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :get_all, :add, :update, :delete, :search + actions :get, :get_list, :get_all, :add, :add_list, :update, :delete, :search fields :name, :is_inactive diff --git a/lib/netsuite/records/customer_deposit.rb b/lib/netsuite/records/customer_deposit.rb index 0503300c9..c4214a315 100644 --- a/lib/netsuite/records/customer_deposit.rb +++ b/lib/netsuite/records/customer_deposit.rb @@ -10,7 +10,7 @@ class CustomerDeposit include Support::Records include Namespaces::TranCust - actions :get, :get_list, :initialize, :add, :delete, :update, :upsert, :search + actions :get, :get_list, :initialize, :add, :add_list, :delete, :update, :upsert, :search fields :created_date, :last_modified_date, :status, :payment, :tran_date, :exchange_rate, :undep_funds, :memo, :check_num, :klass, :currency_name, :is_recurring_payment, :tran_id, :auth_code, diff --git a/lib/netsuite/records/customer_payment.rb b/lib/netsuite/records/customer_payment.rb index 9baab81fc..35e445c79 100644 --- a/lib/netsuite/records/customer_payment.rb +++ b/lib/netsuite/records/customer_payment.rb @@ -7,7 +7,7 @@ class CustomerPayment include Support::Actions include Namespaces::TranCust - actions :get, :get_list, :initialize, :add, :delete, :update, :upsert, :search + actions :get, :get_list, :initialize, :add, :add_list, :delete, :update, :upsert, :search fields :auth_code, :auto_apply, :cc_approved, :cc_avs_street_match, :cc_avs_zip_match, :cc_expire_date, :cc_name, :cc_number, :cc_security_code, :cc_security_code_match, :cc_street, :cc_zip_code, diff --git a/lib/netsuite/records/customer_refund.rb b/lib/netsuite/records/customer_refund.rb index 4f6398e40..90d143e24 100644 --- a/lib/netsuite/records/customer_refund.rb +++ b/lib/netsuite/records/customer_refund.rb @@ -7,7 +7,7 @@ class CustomerRefund include Support::Actions include Namespaces::TranCust - actions :get, :get_list, :initialize, :add, :delete, :update, :upsert, :search + actions :get, :get_list, :initialize, :add, :add_list, :delete, :update, :upsert, :search fields :address, :cc_approved, :cc_expire_date, :cc_name, :cc_number, :cc_street, :cc_zip_code, :charge_it, :created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :last_modified_date, :memo, :pn_ref_num, :status, diff --git a/lib/netsuite/records/customer_status.rb b/lib/netsuite/records/customer_status.rb index cb7f54263..65a499981 100644 --- a/lib/netsuite/records/customer_status.rb +++ b/lib/netsuite/records/customer_status.rb @@ -10,7 +10,7 @@ class CustomerStatus include Support::Actions include Namespaces::ListRel - actions :get, :add, :delete, :search, :update, :upsert + actions :get, :add, :add_list, :delete, :search, :update, :upsert fields :description, :include_in_lead_reports, :is_inactive, :name, :probability, :stage diff --git a/lib/netsuite/records/department.rb b/lib/netsuite/records/department.rb index 1c09659a8..dbbc88adf 100644 --- a/lib/netsuite/records/department.rb +++ b/lib/netsuite/records/department.rb @@ -6,7 +6,7 @@ class Department include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :get_select_value, :add, :delete, :upsert, + actions :get, :get_list, :get_select_value, :add, :add_list, :delete, :upsert, :search, :update fields :name, :is_inactive diff --git a/lib/netsuite/records/deposit.rb b/lib/netsuite/records/deposit.rb index 9f1eec3f8..857e2edeb 100644 --- a/lib/netsuite/records/deposit.rb +++ b/lib/netsuite/records/deposit.rb @@ -7,7 +7,7 @@ class Deposit include Support::Actions include Namespaces::TranBank - actions :get, :get_list, :add, :delete, :upsert, :update, :search + actions :get, :get_list, :add, :add_list, :delete, :upsert, :update, :search fields :created_date, :last_modified_date, :currency_name, :exchange_rate, :tran_id, :total, :tran_date, :memo, :to_be_printed diff --git a/lib/netsuite/records/deposit_application.rb b/lib/netsuite/records/deposit_application.rb index 536778848..2078c56b0 100644 --- a/lib/netsuite/records/deposit_application.rb +++ b/lib/netsuite/records/deposit_application.rb @@ -7,7 +7,7 @@ class DepositApplication include Support::Actions include Namespaces::TranCust - actions :get, :get_list, :initialize, :add, :delete, :update, :upsert, :search + actions :get, :get_list, :initialize, :add, :add_list, :delete, :update, :upsert, :search fields :applied, :created_date, diff --git a/lib/netsuite/records/description_item.rb b/lib/netsuite/records/description_item.rb index 7a4d3a442..2c0763da4 100644 --- a/lib/netsuite/records/description_item.rb +++ b/lib/netsuite/records/description_item.rb @@ -7,7 +7,7 @@ class SubtotalItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert fields :available_to_partners, :created_date, :description, :display_name, :include_children, :is_inactive, :item_id, :last_modified_date diff --git a/lib/netsuite/records/discount_item.rb b/lib/netsuite/records/discount_item.rb index db1cc7827..b4b8030ae 100644 --- a/lib/netsuite/records/discount_item.rb +++ b/lib/netsuite/records/discount_item.rb @@ -7,7 +7,7 @@ class DiscountItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :update, :delete, :search, :upsert + actions :get, :get_list, :add, :add_list, :update, :delete, :search, :upsert fields :available_to_partners, :created_date, :description, :display_name, :include_children, :is_inactive, :is_pre_tax, :item_id, :last_modified_date, :non_posting, :rate, :upc_code, :vendor_name diff --git a/lib/netsuite/records/employee.rb b/lib/netsuite/records/employee.rb index 5b59cbc71..96eee7756 100644 --- a/lib/netsuite/records/employee.rb +++ b/lib/netsuite/records/employee.rb @@ -9,7 +9,7 @@ class Employee # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/script/record/employee.html - actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :search + actions :get, :get_list, :add, :add_list, :update, :upsert, :upsert_list, :delete, :search fields :alt_name, :phone, :first_name, :last_name, :is_inactive, :email, :give_access, :send_email, :is_support_rep, :birth_date, :hire_date, :last_review_date, :next_review_date, :title, :home_phone, :office_phone, diff --git a/lib/netsuite/records/file.rb b/lib/netsuite/records/file.rb index 096bd7af3..1978afbfc 100644 --- a/lib/netsuite/records/file.rb +++ b/lib/netsuite/records/file.rb @@ -9,7 +9,7 @@ class File # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/file.html - actions :get, :add, :delete, :search, :get_list + actions :get, :add, :add_list, :delete, :search, :get_list fields :content, :description, :name, :media_type_name, :file_type, :text_file_encoding, :created_date, :last_modified_date diff --git a/lib/netsuite/records/gift_cert_redemption.rb b/lib/netsuite/records/gift_cert_redemption.rb index cb11c8231..c3fade45f 100644 --- a/lib/netsuite/records/gift_cert_redemption.rb +++ b/lib/netsuite/records/gift_cert_redemption.rb @@ -7,7 +7,7 @@ class GiftCertRedemption include Support::Actions include Namespaces::TranSales - actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search + actions :get, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :search fields :auth_code_amt_remaining, :auth_code_applied, :gift_cert_available diff --git a/lib/netsuite/records/gift_certificate.rb b/lib/netsuite/records/gift_certificate.rb index bd3e7ed98..722840cd7 100644 --- a/lib/netsuite/records/gift_certificate.rb +++ b/lib/netsuite/records/gift_certificate.rb @@ -7,7 +7,7 @@ class GiftCertificate include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search + actions :get, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :search fields :amount_remaining, :created_date, :email, :expiration_date, :gift_cert_code, :last_modified_date, :message, :name, :original_amount, :sender diff --git a/lib/netsuite/records/gift_certificate_item.rb b/lib/netsuite/records/gift_certificate_item.rb index beb52f11b..2be89dbc4 100644 --- a/lib/netsuite/records/gift_certificate_item.rb +++ b/lib/netsuite/records/gift_certificate_item.rb @@ -7,7 +7,7 @@ class GiftCertificateItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :search, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :upsert fields :auth_codes_list, :available_to_partners, diff --git a/lib/netsuite/records/inbound_shipment.rb b/lib/netsuite/records/inbound_shipment.rb index 380fbc7db..679250645 100644 --- a/lib/netsuite/records/inbound_shipment.rb +++ b/lib/netsuite/records/inbound_shipment.rb @@ -7,7 +7,7 @@ class InboundShipment include Support::Actions include Namespaces::TranPurch - actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :upsert_list, :search, :update_list + actions :get, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :upsert_list, :search, :update_list fields :shipment_number, :external_document_number, :shipment_status, :expected_shipping_date, :actual_shipping_date, :expected_delivery_date, :actual_delivery_date, :shipment_memo, diff --git a/lib/netsuite/records/inter_company_journal_entry.rb b/lib/netsuite/records/inter_company_journal_entry.rb index 57bb64d57..c9df66293 100644 --- a/lib/netsuite/records/inter_company_journal_entry.rb +++ b/lib/netsuite/records/inter_company_journal_entry.rb @@ -7,7 +7,7 @@ class InterCompanyJournalEntry include Support::Actions include Namespaces::TranGeneral - actions :get, :get_list, :add, :delete, :search, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :upsert fields :approved, :created_date, :exchange_rate, :is_book_specific, :last_modified_date, :memo, :reversal_date, :reversal_defer, :reversal_entry, :tran_date, :tran_id diff --git a/lib/netsuite/records/inventory_adjustment.rb b/lib/netsuite/records/inventory_adjustment.rb index 74cc61a5b..6ba252f1f 100644 --- a/lib/netsuite/records/inventory_adjustment.rb +++ b/lib/netsuite/records/inventory_adjustment.rb @@ -7,7 +7,7 @@ class InventoryAdjustment include Support::Actions include Namespaces::TranInvt - actions :get, :add, :delete, :search, :update, :upsert, :upsert_list + actions :get, :add, :add_list, :delete, :search, :update, :upsert, :upsert_list fields :created_date, :estimated_total_value, :last_modified_date, :tran_date, :tran_id, :memo diff --git a/lib/netsuite/records/inventory_item.rb b/lib/netsuite/records/inventory_item.rb index af8165e5e..4c3dd8f9c 100644 --- a/lib/netsuite/records/inventory_item.rb +++ b/lib/netsuite/records/inventory_item.rb @@ -20,7 +20,7 @@ class InventoryItem # } # ] # - actions :get, :get_list, :add, :delete, :search, :update, :upsert, :update_list + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert, :update_list fields :auto_lead_time, :auto_preferred_stock_level, :auto_reorder_point, :available_to_partners, :average_cost, :copy_description, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :cost_units, :costing_method, diff --git a/lib/netsuite/records/inventory_transfer.rb b/lib/netsuite/records/inventory_transfer.rb index 4e36be04f..c351f04bc 100644 --- a/lib/netsuite/records/inventory_transfer.rb +++ b/lib/netsuite/records/inventory_transfer.rb @@ -7,7 +7,7 @@ class InventoryTransfer include Support::Actions include Namespaces::TranInvt - actions :get, :add, :delete, :search, :update, :upsert, :upsert_list + actions :get, :add, :add_list, :delete, :search, :update, :upsert, :upsert_list fields :klass, :created_date, :last_modified_date, :tran_date, :tran_id, :memo diff --git a/lib/netsuite/records/invoice.rb b/lib/netsuite/records/invoice.rb index 99ea37250..ce82cb8c3 100644 --- a/lib/netsuite/records/invoice.rb +++ b/lib/netsuite/records/invoice.rb @@ -9,7 +9,7 @@ class Invoice # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/invoice.html?mode=package - actions :get, :get_deleted, :get_list, :initialize, :add, :update, :delete, :upsert, :upsert_list, :search + actions :get, :get_deleted, :get_list, :initialize, :add, :add_list, :update, :delete, :upsert, :upsert_list, :search fields :balance, :bill_address, :billing_schedule, :contrib_pct, :created_date, :currency_name, :custom_field_list, diff --git a/lib/netsuite/records/item_fulfillment.rb b/lib/netsuite/records/item_fulfillment.rb index fd5e691d3..a61e934c0 100644 --- a/lib/netsuite/records/item_fulfillment.rb +++ b/lib/netsuite/records/item_fulfillment.rb @@ -7,7 +7,7 @@ class ItemFulfillment include Support::Actions include Namespaces::TranSales - actions :get, :get_list, :add, :initialize, :update, :delete, :search, :upsert, :upsert_list + actions :get, :get_list, :add, :add_list, :initialize, :update, :delete, :search, :upsert, :upsert_list fields :tran_date, :tran_id, :shipping_cost, :memo, :ship_company, :ship_attention, :ship_addr1, :ship_addr2, :ship_city, :ship_state, :ship_zip, :ship_phone, :ship_is_residential, diff --git a/lib/netsuite/records/item_group.rb b/lib/netsuite/records/item_group.rb index 3cda03efb..af9f4695e 100644 --- a/lib/netsuite/records/item_group.rb +++ b/lib/netsuite/records/item_group.rb @@ -7,7 +7,7 @@ class ItemGroup include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert fields :available_to_partners, :created_date, :description, :display_name, :include_children, :include_start_end_lines, :is_inactive, :is_vsoe_bundle, :item_id, :last_modified_date, :print_items, :upc_code, :vendor_name diff --git a/lib/netsuite/records/item_receipt.rb b/lib/netsuite/records/item_receipt.rb index 798b2b70c..eb6acf8af 100644 --- a/lib/netsuite/records/item_receipt.rb +++ b/lib/netsuite/records/item_receipt.rb @@ -7,7 +7,7 @@ class ItemReceipt include Support::Actions include Namespaces::TranPurch - actions :get, :get_deleted, :get_list, :add, :initialize, :delete, :update, :upsert, :search + actions :get, :get_deleted, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :search fields :created_date, :currency_name, :exchange_rate, :landed_cost_per_line, :last_modified_date, :memo, :tran_date, :tran_id diff --git a/lib/netsuite/records/job.rb b/lib/netsuite/records/job.rb index dcfb5e59f..8988b9321 100644 --- a/lib/netsuite/records/job.rb +++ b/lib/netsuite/records/job.rb @@ -7,7 +7,7 @@ class Job include Support::Actions include Namespaces::ListRel - actions :get, :get_list, :add, :delete, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert fields :account_number, :allocate_payroll_expenses, :allow_all_resources_for_tasks, :allow_expenses, :allow_time, :alt_name, :alt_phone, :bill_pay, :calculated_end_date, :calculated_end_date_baseline, :comments, :company_name, diff --git a/lib/netsuite/records/job_status.rb b/lib/netsuite/records/job_status.rb index 05b82d57f..29ba80fb3 100644 --- a/lib/netsuite/records/job_status.rb +++ b/lib/netsuite/records/job_status.rb @@ -7,7 +7,7 @@ class JobStatus include Support::Actions include Namespaces::ListRel - actions :get, :get_list, :add, :delete, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert fields :description, :is_inactive, :name diff --git a/lib/netsuite/records/journal_entry.rb b/lib/netsuite/records/journal_entry.rb index 30504e445..bbec4e524 100644 --- a/lib/netsuite/records/journal_entry.rb +++ b/lib/netsuite/records/journal_entry.rb @@ -7,7 +7,7 @@ class JournalEntry include Support::Actions include Namespaces::TranGeneral - actions :get, :get_list, :add, :delete, :search, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :upsert fields :approved, :created_date, :exchange_rate, :last_modified_date, :memo, :reversal_date, :reversal_defer, :reversal_entry, :tran_date, :tran_id diff --git a/lib/netsuite/records/kit_item.rb b/lib/netsuite/records/kit_item.rb index 34dd2c7c2..40cfd3eba 100644 --- a/lib/netsuite/records/kit_item.rb +++ b/lib/netsuite/records/kit_item.rb @@ -7,7 +7,7 @@ class KitItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert fields :available_to_partners, :cost_estimate, :created_date, :defer_rev_rec, :description, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description, :handling_cost, diff --git a/lib/netsuite/records/lot_numbered_assembly_item.rb b/lib/netsuite/records/lot_numbered_assembly_item.rb index 67c7d07f3..e4587d45c 100644 --- a/lib/netsuite/records/lot_numbered_assembly_item.rb +++ b/lib/netsuite/records/lot_numbered_assembly_item.rb @@ -7,7 +7,7 @@ class LotNumberedAssemblyItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :get_select_value, :add, :delete, :update, :upsert, :upsert_list, :search + actions :get, :get_list, :get_select_value, :add, :add_list, :delete, :update, :upsert, :upsert_list, :search fields :auto_lead_time, :auto_preferred_stock_level, :auto_reorder_point, :available_to_partners, :average_cost, :build_entire_assembly, :copy_description, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :cost_units, :costing_method, diff --git a/lib/netsuite/records/non_inventory_purchase_item.rb b/lib/netsuite/records/non_inventory_purchase_item.rb index f321910aa..5c2b0622b 100644 --- a/lib/netsuite/records/non_inventory_purchase_item.rb +++ b/lib/netsuite/records/non_inventory_purchase_item.rb @@ -7,7 +7,7 @@ class NonInventoryPurchaseItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :search, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :upsert fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture, :created_date, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, diff --git a/lib/netsuite/records/non_inventory_resale_item.rb b/lib/netsuite/records/non_inventory_resale_item.rb index 0628c8c6a..da8921ed1 100644 --- a/lib/netsuite/records/non_inventory_resale_item.rb +++ b/lib/netsuite/records/non_inventory_resale_item.rb @@ -7,7 +7,7 @@ class NonInventoryResaleItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :search, :upsert, :update + actions :get, :get_list, :add, :add_list, :delete, :search, :upsert, :update fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture, :created_date, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, diff --git a/lib/netsuite/records/non_inventory_sale_item.rb b/lib/netsuite/records/non_inventory_sale_item.rb index 7699b4637..f5c7f530c 100644 --- a/lib/netsuite/records/non_inventory_sale_item.rb +++ b/lib/netsuite/records/non_inventory_sale_item.rb @@ -7,7 +7,7 @@ class NonInventorySaleItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture, :created_date, :direct_revenue_posting, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, diff --git a/lib/netsuite/records/note.rb b/lib/netsuite/records/note.rb index 94994b3aa..31f7252d6 100644 --- a/lib/netsuite/records/note.rb +++ b/lib/netsuite/records/note.rb @@ -10,7 +10,7 @@ class Note # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2016_1/schema/record/note.html - actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :delete_list, :search + actions :get, :get_list, :add, :add_list, :update, :upsert, :upsert_list, :delete, :delete_list, :search fields :direction, :lastModifiedDate, :note, :noteDate, :title, :topic diff --git a/lib/netsuite/records/opportunity.rb b/lib/netsuite/records/opportunity.rb index d1cced560..469d6e5ad 100644 --- a/lib/netsuite/records/opportunity.rb +++ b/lib/netsuite/records/opportunity.rb @@ -7,7 +7,7 @@ class Opportunity include Support::Actions include Namespaces::TranSales - actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search + actions :get, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :search fields :action_item, :alt_sales_range_high, :alt_sales_range_low, :close_date, :contrib_pct, :created_date, :currency_name, :days_open, diff --git a/lib/netsuite/records/other_charge_sale_item.rb b/lib/netsuite/records/other_charge_sale_item.rb index 874643327..f23ded9fc 100644 --- a/lib/netsuite/records/other_charge_sale_item.rb +++ b/lib/netsuite/records/other_charge_sale_item.rb @@ -7,7 +7,7 @@ class OtherChargeSaleItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :update, :delete, :upsert, :search + actions :get, :get_list, :add, :add_list, :update, :delete, :upsert, :search attr_reader :internal_id attr_accessor :external_id diff --git a/lib/netsuite/records/partner.rb b/lib/netsuite/records/partner.rb index 04d0b93eb..5efdfba06 100644 --- a/lib/netsuite/records/partner.rb +++ b/lib/netsuite/records/partner.rb @@ -10,7 +10,7 @@ class Partner # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/partner.html - actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :search + actions :get, :get_list, :add, :add_list, :update, :upsert, :upsert_list, :delete, :search fields :phone, :home_phone, :first_name, :last_name, :alt_name, :is_inactive, :email, :give_access, :partner_code, :is_person, :company_name, :eligible_for_commission, :entity_id, :last_modified_date, diff --git a/lib/netsuite/records/payment_item.rb b/lib/netsuite/records/payment_item.rb index d58a0268d..c14b592bb 100644 --- a/lib/netsuite/records/payment_item.rb +++ b/lib/netsuite/records/payment_item.rb @@ -7,7 +7,7 @@ class PaymentItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert fields :available_to_partners, :created_date, :description, :display_name, :include_children, :is_inactive, :item_id, :last_modified_date, :undep_funds diff --git a/lib/netsuite/records/phone_call.rb b/lib/netsuite/records/phone_call.rb index e7c42d7eb..93ad0b165 100644 --- a/lib/netsuite/records/phone_call.rb +++ b/lib/netsuite/records/phone_call.rb @@ -7,7 +7,7 @@ class PhoneCall include Support::Actions include Namespaces::ActSched - actions :get, :get_list, :add, :delete, :update, :upsert + actions :get, :get_list, :add, :add_list, :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 diff --git a/lib/netsuite/records/price_level.rb b/lib/netsuite/records/price_level.rb index ad17f782a..28b7a92d8 100644 --- a/lib/netsuite/records/price_level.rb +++ b/lib/netsuite/records/price_level.rb @@ -7,7 +7,7 @@ class PriceLevel include Support::RecordRefs include Namespaces::ListAcct - actions :get, :update, :get_list, :add, :delete, :search, :upsert + actions :get, :update, :get_list, :add, :add_list, :delete, :search, :upsert # http://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_1/schema/record/pricelevel.html fields :discountpct, :name, :is_online, :update_existing_prices, diff --git a/lib/netsuite/records/promotion_code.rb b/lib/netsuite/records/promotion_code.rb index 5db0b8a1b..03b6524b8 100644 --- a/lib/netsuite/records/promotion_code.rb +++ b/lib/netsuite/records/promotion_code.rb @@ -9,7 +9,7 @@ class PromotionCode include Support::Actions include Namespaces::ListMkt - actions :get, :get_list, :add, :search, :delete, :update, :upsert + actions :get, :get_list, :add, :add_list, :search, :delete, :update, :upsert fields :code, :code_pattern, :description, :discount_type, :display_line_discounts, :end_date, :exclude_items, :is_inactive, :is_public, :minimum_order_amount, :name, :number_to_generate, diff --git a/lib/netsuite/records/purchase_order.rb b/lib/netsuite/records/purchase_order.rb index fe5c0d12d..021961ae6 100644 --- a/lib/netsuite/records/purchase_order.rb +++ b/lib/netsuite/records/purchase_order.rb @@ -7,7 +7,7 @@ class PurchaseOrder include Support::Actions include Namespaces::TranPurch - actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search + actions :get, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :search fields :created_date, :currency_name, :due_date, :email, :exchange_rate, :fax, :fob, :interco_status, :interco_transaction, :last_modified_date, diff --git a/lib/netsuite/records/return_authorization.rb b/lib/netsuite/records/return_authorization.rb index dc92e0cc9..1e21a2614 100644 --- a/lib/netsuite/records/return_authorization.rb +++ b/lib/netsuite/records/return_authorization.rb @@ -9,7 +9,7 @@ class ReturnAuthorization # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2015_2/schema/record/returnauthorization.html - actions :get, :get_list, :initialize, :add, :update, :delete, :upsert, :search + actions :get, :get_list, :initialize, :add, :add_list, :update, :delete, :upsert, :search fields :alt_sales_total, :cc_approved, diff --git a/lib/netsuite/records/rev_rec_schedule.rb b/lib/netsuite/records/rev_rec_schedule.rb index 23f5e66c6..c227a0bdd 100644 --- a/lib/netsuite/records/rev_rec_schedule.rb +++ b/lib/netsuite/records/rev_rec_schedule.rb @@ -9,7 +9,7 @@ class RevRecSchedule include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :update, :upsert, :delete, :search + actions :get, :get_list, :add, :add_list, :update, :upsert, :delete, :search fields :initial_amount, :is_inactive, :name, :period_offset, :rev_rec_offset, :amortization_period diff --git a/lib/netsuite/records/rev_rec_template.rb b/lib/netsuite/records/rev_rec_template.rb index 6ce748677..fe51816a3 100644 --- a/lib/netsuite/records/rev_rec_template.rb +++ b/lib/netsuite/records/rev_rec_template.rb @@ -7,7 +7,7 @@ class RevRecTemplate include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :update, :upsert, :delete, :search + actions :get, :get_list, :add, :add_list, :update, :upsert, :delete, :search fields :name, :is_inactive diff --git a/lib/netsuite/records/sales_order.rb b/lib/netsuite/records/sales_order.rb index 8b6059e47..180d1bb69 100644 --- a/lib/netsuite/records/sales_order.rb +++ b/lib/netsuite/records/sales_order.rb @@ -7,7 +7,7 @@ class SalesOrder include Support::Actions include Namespaces::TranSales - actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :upsert_list, :search + actions :get, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :upsert_list, :search fields :alt_handling_cost, :alt_shipping_cost, :amount_paid, :amount_remaining, :auto_apply, :balance, :bill_address, :cc_approved, :contrib_pct, :created_date, :currency_name, :deferred_revenue, :discount_rate, :email, :end_date, diff --git a/lib/netsuite/records/sales_tax_item.rb b/lib/netsuite/records/sales_tax_item.rb index 2f8aa8d79..c39c35043 100644 --- a/lib/netsuite/records/sales_tax_item.rb +++ b/lib/netsuite/records/sales_tax_item.rb @@ -9,7 +9,7 @@ class SalesTaxItem # NOTE `get_all` is not available in recent API versions ~2017_2 # `search` is only available in recent API versions - actions :get, :get_list, :get_all, :get_select_value, :add, :delete, + actions :get, :get_list, :get_all, :get_select_value, :add, :add_list, :delete, :update, :upsert, :search fields :item_id, :display_name, :description, :rate, :is_inactive, diff --git a/lib/netsuite/records/serialized_inventory_item.rb b/lib/netsuite/records/serialized_inventory_item.rb index 6ce9a46a8..24577cdc3 100644 --- a/lib/netsuite/records/serialized_inventory_item.rb +++ b/lib/netsuite/records/serialized_inventory_item.rb @@ -7,7 +7,7 @@ class SerializedInventoryItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert record_refs :soft_descriptor, :stock_unit, diff --git a/lib/netsuite/records/service_resale_item.rb b/lib/netsuite/records/service_resale_item.rb index d5ee833b5..b255b9c4a 100644 --- a/lib/netsuite/records/service_resale_item.rb +++ b/lib/netsuite/records/service_resale_item.rb @@ -7,7 +7,7 @@ class ServiceResaleItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :update, :delete, :upsert, :search + actions :get, :get_list, :add, :add_list, :update, :delete, :upsert, :search fields :available_to_partners, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description, diff --git a/lib/netsuite/records/service_sale_item.rb b/lib/netsuite/records/service_sale_item.rb index 85bcb30fb..3e275df64 100644 --- a/lib/netsuite/records/service_sale_item.rb +++ b/lib/netsuite/records/service_sale_item.rb @@ -7,7 +7,7 @@ class ServiceSaleItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :update, :delete, :upsert, :search + actions :get, :get_list, :add, :add_list, :update, :delete, :upsert, :search fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description, diff --git a/lib/netsuite/records/site_category.rb b/lib/netsuite/records/site_category.rb index 85c33abd4..7df5947f3 100644 --- a/lib/netsuite/records/site_category.rb +++ b/lib/netsuite/records/site_category.rb @@ -9,7 +9,7 @@ class SiteCategory # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/sitecategory.html - actions :get, :get_list, :add, :delete, :update, :upsert, :search + actions :get, :get_list, :add, :add_list, :delete, :update, :upsert, :search fields :description, :exclude_from_site_map, :is_inactive, :is_online, :item_id, :meta_tag_html, :page_title, :presentation_item_list, diff --git a/lib/netsuite/records/subtotal_item.rb b/lib/netsuite/records/subtotal_item.rb index 85cb546a2..b55163e5b 100644 --- a/lib/netsuite/records/subtotal_item.rb +++ b/lib/netsuite/records/subtotal_item.rb @@ -7,7 +7,7 @@ class DescriptionItem include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert fields :available_to_partners, :created_date, :description, :include_children, :is_inactive, :item_id, :last_modified_date diff --git a/lib/netsuite/records/support_case.rb b/lib/netsuite/records/support_case.rb index d9753f670..a02f804b9 100644 --- a/lib/netsuite/records/support_case.rb +++ b/lib/netsuite/records/support_case.rb @@ -7,7 +7,7 @@ class SupportCase include Support::Actions include Namespaces::ListSupport - actions :get, :get_list, :add, :delete, :update, :upsert, :search + actions :get, :get_list, :add, :add_list, :delete, :update, :upsert, :search fields :end_date, :incoming_message, :outgoing_message, :search_solution, :email_form, :internal_only, :title, :case_number, :start_date, :email, :phone, :inbound_email, diff --git a/lib/netsuite/records/task.rb b/lib/netsuite/records/task.rb index 9b56febec..8ebe6e0b1 100644 --- a/lib/netsuite/records/task.rb +++ b/lib/netsuite/records/task.rb @@ -7,7 +7,7 @@ class Task include Support::Actions include Namespaces::ActSched - actions :get, :get_list, :add, :search, :delete, :update, :upsert + actions :get, :get_list, :add, :add_list, :search, :delete, :update, :upsert fields :title, :send_email, :message, :status, :access_level, :reminder_type, :reminder_minutes, :start_date, :end_date, :due_date, :timed_event, diff --git a/lib/netsuite/records/tax_group.rb b/lib/netsuite/records/tax_group.rb index a88198012..8f1d9b0b8 100644 --- a/lib/netsuite/records/tax_group.rb +++ b/lib/netsuite/records/tax_group.rb @@ -9,7 +9,7 @@ class TaxGroup # NOTE `get_all` is not available API > 2017_1 # `search` is available API > 2016_2 - actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search, :get_all + actions :get, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :search, :get_all fields :city, :county, :description, :include_children, :is_default, :is_inactive, :item_id, :piggyback, :rate, :state, :subsidiary_list, :unitprice1, :unitprice2, diff --git a/lib/netsuite/records/tax_type.rb b/lib/netsuite/records/tax_type.rb index c7567742b..dad8f0ed0 100644 --- a/lib/netsuite/records/tax_type.rb +++ b/lib/netsuite/records/tax_type.rb @@ -5,7 +5,7 @@ class TaxType include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :update, :upsert, :delete, :search + actions :get, :get_list, :add, :add_list, :update, :upsert, :delete, :search fields :description, :name diff --git a/lib/netsuite/records/term.rb b/lib/netsuite/records/term.rb index 87affab68..1577e2afe 100644 --- a/lib/netsuite/records/term.rb +++ b/lib/netsuite/records/term.rb @@ -7,7 +7,7 @@ class Term include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :delete, :upsert, :search + actions :get, :get_list, :add, :add_list, :delete, :upsert, :search fields :due_next_month_if_within_days, :name, :date_driven, :days_until_expiry, :days_until_net_due, :day_discount_expires, :day_of_month_net_due, :discount_percent, :discount_percent_date_driven, :is_inactive, diff --git a/lib/netsuite/records/time_bill.rb b/lib/netsuite/records/time_bill.rb index bad36d2f3..80ccac53e 100644 --- a/lib/netsuite/records/time_bill.rb +++ b/lib/netsuite/records/time_bill.rb @@ -7,7 +7,7 @@ class TimeBill include Support::Actions include Namespaces::TranEmp - actions :get, :get_list, :add, :delete, :search, :update, :upsert + actions :get, :get_list, :add, :add_list, :delete, :search, :update, :upsert fields :created_date, :is_billable, :last_modified_date, :memo, :override_rate, :paid_externally, :rate, :status, :supervisor_approval, :tran_date, :time_type diff --git a/lib/netsuite/records/transfer_order.rb b/lib/netsuite/records/transfer_order.rb index db43ce630..568a9d71a 100644 --- a/lib/netsuite/records/transfer_order.rb +++ b/lib/netsuite/records/transfer_order.rb @@ -7,7 +7,7 @@ class TransferOrder include Support::Actions include Namespaces::TranInvt - actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search + actions :get, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :search fields :alt_shipping_cost, :created_date, :firmed, :fob, :handling_tax1_rate, :handling_tax2_rate, :last_modified_date, :linked_tracking_numbers, diff --git a/lib/netsuite/records/units_type.rb b/lib/netsuite/records/units_type.rb index 13c08e72b..09b9c01d4 100644 --- a/lib/netsuite/records/units_type.rb +++ b/lib/netsuite/records/units_type.rb @@ -6,7 +6,7 @@ class UnitsType include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :add, :update, :upsert, :delete, :search + actions :get, :get_list, :add, :add_list, :update, :upsert, :delete, :search fields :is_inactive, :name diff --git a/lib/netsuite/records/vendor.rb b/lib/netsuite/records/vendor.rb index e1491c6b1..faeca0bd4 100644 --- a/lib/netsuite/records/vendor.rb +++ b/lib/netsuite/records/vendor.rb @@ -7,7 +7,7 @@ class Vendor include Support::Actions include Namespaces::ListRel - actions :get, :get_list, :add, :update, :upsert, :delete, :search + actions :get, :get_list, :add, :add_list, :update, :upsert, :delete, :search fields :account_number, :alt_email, :alt_name, :alt_phone, :balance, :balance_primary, :bcn, :bill_pay, :comments, :company_name, :credit_limit, diff --git a/lib/netsuite/records/vendor_category.rb b/lib/netsuite/records/vendor_category.rb index f4c4f2e3c..90e850d92 100644 --- a/lib/netsuite/records/vendor_category.rb +++ b/lib/netsuite/records/vendor_category.rb @@ -9,7 +9,7 @@ class VendorCategory include Support::Actions include Namespaces::ListAcct - actions :get, :get_list, :get_all, :add, :update, :delete, :search + actions :get, :get_list, :get_all, :add, :add_list, :update, :delete, :search fields :name, :is_tax_agency, :is_inactive diff --git a/lib/netsuite/records/vendor_payment.rb b/lib/netsuite/records/vendor_payment.rb index dbf08cbf7..c0920a5fa 100644 --- a/lib/netsuite/records/vendor_payment.rb +++ b/lib/netsuite/records/vendor_payment.rb @@ -7,7 +7,7 @@ class VendorPayment include Support::Actions include Namespaces::TranPurch - actions :get, :get_list, :initialize, :add, :delete, :update, :upsert, :search + actions :get, :get_list, :initialize, :add, :add_list, :delete, :update, :upsert, :search fields :address, :balance, :bill_pay, :created_date, :credit_list, :currency_name, :exchange_rate, :last_modified_date, :memo, :print_voucher, :status, :to_ach, :to_be_printed, :total, :tran_date, :tran_id, :transaction_number diff --git a/lib/netsuite/records/vendor_return_authorization.rb b/lib/netsuite/records/vendor_return_authorization.rb index a7035de20..6750ddac9 100644 --- a/lib/netsuite/records/vendor_return_authorization.rb +++ b/lib/netsuite/records/vendor_return_authorization.rb @@ -7,7 +7,7 @@ class VendorReturnAuthorization include Support::Actions include Namespaces::TranPurch - actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search + actions :get, :get_list, :add, :add_list, :initialize, :delete, :update, :upsert, :search fields :billing_address, :created_date, :memo, :tran_date, :tran_id diff --git a/lib/netsuite/records/work_order.rb b/lib/netsuite/records/work_order.rb index 7807047e7..369845f9d 100644 --- a/lib/netsuite/records/work_order.rb +++ b/lib/netsuite/records/work_order.rb @@ -7,7 +7,7 @@ class WorkOrder include Support::Actions include Namespaces::TranInvt - actions :get, :add, :initialize, :delete, :update, :upsert, :upsert_list, + actions :get, :add, :add_list, :initialize, :delete, :update, :upsert, :upsert_list, :search fields :buildable, :built, :created_date, :end_date, :expanded_assembly, diff --git a/lib/netsuite/support/actions.rb b/lib/netsuite/support/actions.rb index 19d62c552..66c1d90da 100644 --- a/lib/netsuite/support/actions.rb +++ b/lib/netsuite/support/actions.rb @@ -32,6 +32,8 @@ def action(name) self.send(:include, NetSuite::Actions::Search::Support) when :add self.send(:include, NetSuite::Actions::Add::Support) + when :add_list + self.send(:include, NetSuite::Actions::AddList::Support) when :upsert self.send(:include, NetSuite::Actions::Upsert::Support) when :upsert_list diff --git a/spec/netsuite/actions/add_list_spec.rb b/spec/netsuite/actions/add_list_spec.rb new file mode 100644 index 000000000..a6dc65ce7 --- /dev/null +++ b/spec/netsuite/actions/add_list_spec.rb @@ -0,0 +1,148 @@ +require 'spec_helper' + +describe NetSuite::Actions::AddList do + before { savon.mock! } + after { savon.unmock! } + + context 'Customers' do + context 'one customer' do + let(:customers) do + [ + NetSuite::Records::Customer.new(external_id: 'ext2', entity_id: 'Target', company_name: 'Target') + ] + end + + before do + savon.expects(:add_list).with(:message => + { + 'record' => [{ + 'listRel:entityId' => 'Target', + 'listRel:companyName' => 'Target', + '@xsi:type' => 'listRel:Customer', + '@externalId' => 'ext2' + }] + }).returns(File.read('spec/support/fixtures/add_list/add_list_one_customer.xml')) + end + + it 'makes a valid request to the NetSuite API' do + NetSuite::Actions::AddList.call(customers) + end + + it 'returns a valid Response object' do + response = NetSuite::Actions::AddList.call(customers) + expect(response).to be_kind_of(NetSuite::Response) + expect(response).to be_success + end + end + + context 'two customers' do + let(:customers) do + [ + NetSuite::Records::Customer.new(external_id: 'ext1', entity_id: 'Shutter Fly', company_name: 'Shutter Fly, Inc.'), + NetSuite::Records::Customer.new(external_id: 'ext2', entity_id: 'Target', company_name: 'Target') + ] + end + + before do + savon.expects(:add_list).with(:message => + { + 'record' => [{ + 'listRel:entityId' => 'Shutter Fly', + 'listRel:companyName' => 'Shutter Fly, Inc.', + '@xsi:type' => 'listRel:Customer', + '@externalId' => 'ext1' + }, + { + 'listRel:entityId' => 'Target', + 'listRel:companyName' => 'Target', + '@xsi:type' => 'listRel:Customer', + '@externalId' => 'ext2' + } + ] + }).returns(File.read('spec/support/fixtures/add_list/add_list_customers.xml')) + end + + it 'makes a valid request to the NetSuite API' do + NetSuite::Actions::AddList.call(customers) + end + + it 'returns a valid Response object' do + response = NetSuite::Actions::AddList.call(customers) + expect(response).to be_kind_of(NetSuite::Response) + expect(response).to be_success + end + end + end + + context 'with validation errors' do + let(:customers) do + [ + NetSuite::Records::Customer.new(external_id: 'ext1-bad', entity_id: 'Shutter Fly', company_name: 'Shutter Fly, Inc.'), + NetSuite::Records::Customer.new(external_id: 'ext2-bad', entity_id: 'Target', company_name: 'Target') + ] + end + + before do + savon.expects(:add_list).with(:message => + { + 'record' => [{ + 'listRel:entityId' => 'Shutter Fly', + 'listRel:companyName' => 'Shutter Fly, Inc.', + '@xsi:type' => 'listRel:Customer', + '@externalId' => 'ext1-bad' + }, + { + 'listRel:entityId' => 'Target', + 'listRel:companyName' => 'Target', + '@xsi:type' => 'listRel:Customer', + '@externalId' => 'ext2-bad' + } + ] + }).returns(File.read('spec/support/fixtures/add_list/add_list_with_errors.xml')) + end + + it 'constructs error objects' do + response = NetSuite::Actions::AddList.call(customers) + expect(response.errors.keys).to match_array(['ext1-bad', 'ext2-bad']) + expect(response.errors['ext1-bad'].first.code).to eq('USER_ERROR') + expect(response.errors['ext1-bad'].first.message).to eq('Please enter value(s) for: Item') + expect(response.errors['ext1-bad'].first.type).to eq('ERROR') + end + end + + context 'with existing record errors' do + let(:customers) do + [ + NetSuite::Records::Customer.new(external_id: 'ext1', entity_id: 'Shutter Fly', company_name: 'Shutter Fly, Inc.'), + NetSuite::Records::Customer.new(external_id: 'ext2', entity_id: 'Target', company_name: 'Target') + ] + end + + before do + savon.expects(:add_list).with(:message => + { + 'record' => [{ + 'listRel:entityId' => 'Shutter Fly', + 'listRel:companyName' => 'Shutter Fly, Inc.', + '@xsi:type' => 'listRel:Customer', + '@externalId' => 'ext1' + }, + { + 'listRel:entityId' => 'Target', + 'listRel:companyName' => 'Target', + '@xsi:type' => 'listRel:Customer', + '@externalId' => 'ext2' + } + ] + }).returns(File.read('spec/support/fixtures/add_list/add_list_with_existing_records.xml')) + end + + it 'constructs error objects' do + response = NetSuite::Actions::AddList.call(customers) + expect(response.errors.keys).to match_array(['ext1', 'ext2']) + expect(response.errors['ext1'].first.code).to eq('DUP_ENTITY') + expect(response.errors['ext1'].first.message).to eq('This entity already exists.') + expect(response.errors['ext1'].first.type).to eq('ERROR') + end + end +end diff --git a/spec/support/fixtures/add_list/add_list_customers.xml b/spec/support/fixtures/add_list/add_list_customers.xml new file mode 100644 index 000000000..a70fd4cb1 --- /dev/null +++ b/spec/support/fixtures/add_list/add_list_customers.xml @@ -0,0 +1,22 @@ + + + + + WEBSERVICES_3392464_1220201115821392011296470399_67055c545d0 + + + + + + + + + + + + + + + + + diff --git a/spec/support/fixtures/add_list/add_list_one_customer.xml b/spec/support/fixtures/add_list/add_list_one_customer.xml new file mode 100644 index 000000000..9b2592d66 --- /dev/null +++ b/spec/support/fixtures/add_list/add_list_one_customer.xml @@ -0,0 +1,18 @@ + + + + + WEBSERVICES_3392464_1220201115821392011296470399_67055c545d0 + + + + + + + + + + + + + diff --git a/spec/support/fixtures/add_list/add_list_with_errors.xml b/spec/support/fixtures/add_list/add_list_with_errors.xml new file mode 100644 index 000000000..08e7782bf --- /dev/null +++ b/spec/support/fixtures/add_list/add_list_with_errors.xml @@ -0,0 +1,33 @@ + + + + + WEBSERVICES_3868171_1117201410832887841076557109_965331437a3 + + + + + + + + + + USER_ERROR + Please enter value(s) for: Item + + + + + + + + USER_ERROR + Please enter value(s) for: Item + + + + + + + + diff --git a/spec/support/fixtures/add_list/add_list_with_existing_records.xml b/spec/support/fixtures/add_list/add_list_with_existing_records.xml new file mode 100644 index 000000000..790f32b62 --- /dev/null +++ b/spec/support/fixtures/add_list/add_list_with_existing_records.xml @@ -0,0 +1,33 @@ + + + + + WEBSERVICES_3868171_1117201410832887841076557109_965331437a3 + + + + + + + + + + DUP_ENTITY + This entity already exists. + + + + + + + + DUP_ENTITY + This entity already exists. + + + + + + + +