netsuite 0.8.5 → 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/main.yml +20 -0
  3. data/.ruby-version +1 -1
  4. data/.tool-versions +1 -0
  5. data/Gemfile +1 -5
  6. data/HISTORY.md +32 -0
  7. data/README.md +48 -21
  8. data/Rakefile +1 -1
  9. data/lib/netsuite/configuration.rb +21 -4
  10. data/lib/netsuite/records/accounting_period.rb +2 -2
  11. data/lib/netsuite/records/assembly_unbuild.rb +1 -3
  12. data/lib/netsuite/records/classification.rb +4 -1
  13. data/lib/netsuite/records/contact.rb +1 -1
  14. data/lib/netsuite/records/cost_category.rb +28 -0
  15. data/lib/netsuite/records/credit_memo.rb +1 -1
  16. data/lib/netsuite/records/currency_rate.rb +1 -1
  17. data/lib/netsuite/records/custom_field_list.rb +9 -3
  18. data/lib/netsuite/records/custom_record.rb +1 -1
  19. data/lib/netsuite/records/customer.rb +2 -1
  20. data/lib/netsuite/records/customer_credit_cards.rb +36 -0
  21. data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
  22. data/lib/netsuite/records/customer_deposit.rb +5 -5
  23. data/lib/netsuite/records/customer_payment.rb +6 -2
  24. data/lib/netsuite/records/customer_payment_credit.rb +17 -0
  25. data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
  26. data/lib/netsuite/records/employee.rb +1 -1
  27. data/lib/netsuite/records/estimate.rb +42 -0
  28. data/lib/netsuite/records/estimate_item.rb +40 -0
  29. data/lib/netsuite/records/estimate_item_list.rb +11 -0
  30. data/lib/netsuite/records/inventory_item.rb +62 -1
  31. data/lib/netsuite/records/invoice.rb +97 -4
  32. data/lib/netsuite/records/invoice_item.rb +1 -1
  33. data/lib/netsuite/records/item_fulfillment.rb +1 -1
  34. data/lib/netsuite/records/item_fulfillment_item.rb +1 -1
  35. data/lib/netsuite/records/item_receipt_item.rb +1 -1
  36. data/lib/netsuite/records/member_list.rb +0 -2
  37. data/lib/netsuite/records/non_inventory_purchase_item.rb +1 -1
  38. data/lib/netsuite/records/non_inventory_resale_item.rb +2 -1
  39. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  40. data/lib/netsuite/records/opportunity.rb +2 -2
  41. data/lib/netsuite/records/partner.rb +7 -5
  42. data/lib/netsuite/records/phone_call.rb +1 -1
  43. data/lib/netsuite/records/serialized_assembly_item.rb +3 -2
  44. data/lib/netsuite/records/service_resale_item.rb +2 -2
  45. data/lib/netsuite/records/service_sale_item.rb +1 -1
  46. data/lib/netsuite/records/transfer_order_item.rb +1 -1
  47. data/lib/netsuite/records/vendor.rb +6 -5
  48. data/lib/netsuite/records/vendor_currency.rb +26 -0
  49. data/lib/netsuite/records/vendor_currency_list.rb +9 -0
  50. data/lib/netsuite/support/fields.rb +17 -0
  51. data/lib/netsuite/support/records.rb +1 -1
  52. data/lib/netsuite/support/search_result.rb +23 -4
  53. data/lib/netsuite/utilities.rb +2 -1
  54. data/lib/netsuite/version.rb +1 -1
  55. data/lib/netsuite.rb +10 -0
  56. data/netsuite.gemspec +5 -3
  57. data/spec/netsuite/actions/search_spec.rb +22 -0
  58. data/spec/netsuite/configuration_spec.rb +93 -6
  59. data/spec/netsuite/records/basic_record_spec.rb +8 -1
  60. data/spec/netsuite/records/classification_spec.rb +10 -1
  61. data/spec/netsuite/records/cost_category_spec.rb +105 -0
  62. data/spec/netsuite/records/custom_field_list_spec.rb +46 -6
  63. data/spec/netsuite/records/custom_record_spec.rb +1 -1
  64. data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
  65. data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
  66. data/spec/netsuite/records/customer_payment_spec.rb +1 -6
  67. data/spec/netsuite/records/customer_spec.rb +22 -1
  68. data/spec/netsuite/records/employee_spec.rb +2 -2
  69. data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
  70. data/spec/netsuite/records/estimate_item_spec.rb +40 -0
  71. data/spec/netsuite/records/estimate_spec.rb +216 -0
  72. data/spec/netsuite/records/inventory_item_spec.rb +65 -0
  73. data/spec/netsuite/records/invoice_spec.rb +94 -0
  74. data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
  75. data/spec/netsuite/records/partner_spec.rb +143 -0
  76. data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
  77. data/spec/netsuite/records/vendor_spec.rb +1 -1
  78. data/spec/netsuite/support/fields_spec.rb +36 -1
  79. data/spec/support/fixtures/custom_fields/multi_select.xml +47 -0
  80. data/spec/support/fixtures/search/saved_search_item.xml +55 -0
  81. data/spec/support/fixtures/search/saved_search_joined_custom_customer.xml +15 -1
  82. data/spec/support/search_only_field_matcher.rb +7 -0
  83. metadata +68 -12
  84. data/circle.yml +0 -17
@@ -9,7 +9,7 @@ module NetSuite
9
9
  fields :amount, :amount_ordered, :bin_numbers, :cost_estimate, :cost_estimate_type, :current_percent,
10
10
  :defer_rev_rec, :description, :gift_cert_from, :gift_cert_message, :gift_cert_number, :gift_cert_recipient_email,
11
11
  :gift_cert_recipient_name, :gross_amt, :inventory_detail, :is_taxable, :item_is_fulfilled, :license_code, :line,
12
- :klass, :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled,
12
+ :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled,
13
13
  :quantity_on_hand, :quantity_ordered, :rate, :rev_rec_end_date, :rev_rec_start_date,
14
14
  :serial_numbers, :ship_group, :tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral,
15
15
  :vsoe_delivered, :vsoe_permit_discount, :vsoe_price
@@ -11,7 +11,7 @@ module NetSuite
11
11
 
12
12
  fields :tran_date, :tran_id, :shipping_cost, :memo, :ship_company, :ship_attention, :ship_addr1,
13
13
  :ship_addr2, :ship_city, :ship_state, :ship_zip, :ship_phone, :ship_is_residential,
14
- :ship_status, :last_modified_date, :created_date
14
+ :ship_status, :last_modified_date, :created_date, :status
15
15
 
16
16
  read_only_fields :handling_cost
17
17
 
@@ -9,7 +9,7 @@ module NetSuite
9
9
  fields :amount, :amount_ordered, :bin_numbers, :cost_estimate, :cost_estimate_type, :current_percent,
10
10
  :defer_rev_rec, :description, :gift_cert_from, :gift_cert_message, :gift_cert_number, :gift_cert_recipient_email,
11
11
  :gift_cert_recipient_name, :gross_amt, :inventory_detail, :is_taxable, :item_is_fulfilled, :license_code, :line,
12
- :klass, :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled,
12
+ :options, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled,
13
13
  :quantity_on_hand, :quantity_ordered, :rate, :rev_rec_end_date, :rev_rec_start_date,
14
14
  :serial_numbers, :ship_group, :tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral,
15
15
  :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :item_receive
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Namespaces::TranPurch
8
8
 
9
9
  fields :bin_numbers, :currency, :description, :expiration_date, :is_drop_shipment,
10
- :item_name, :item_receive, :job_name, :line, :on_hand, :options, :order_line,
10
+ :item_name, :item_receive, :job_name, :line, :on_hand, :order_line,
11
11
  :quantity, :quantity_remaining, :rate, :restock, :serial_numbers,
12
12
  :unit_cost_override, :units_display
13
13
 
@@ -3,8 +3,6 @@ module NetSuite
3
3
  class MemberList < Support::Sublist
4
4
  include Namespaces::ListAcct
5
5
 
6
- fields :replace_all
7
-
8
6
  sublist :item_member, ItemMember
9
7
 
10
8
  end
@@ -17,7 +17,7 @@ module NetSuite
17
17
  :manufacturer_zip, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity,
18
18
  :minimum_quantity_units, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support,
19
19
  :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title,
20
- :preference_criterion, :presentation_item_list, :prices_include_tax, :pricing_matrix, :producer, :product_feed_list,
20
+ :preference_criterion, :presentation_item_list, :prices_include_tax, :producer, :product_feed_list,
21
21
  :rate, :related_items_description, :sales_description, :schedule_b_code, :schedule_b_number, :schedule_b_quantity,
22
22
  :search_keywords, :ship_individually, :shipping_cost, :shipping_cost_units, :shopping_dot_com_category,
23
23
  :shopzilla_category_id, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor,
@@ -17,7 +17,7 @@ module NetSuite
17
17
  :manufacturer_zip, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity,
18
18
  :minimum_quantity_units, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support,
19
19
  :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title,
20
- :preference_criterion, :presentation_item_list, :prices_include_tax, :pricing_matrix, :producer, :product_feed_list,
20
+ :preference_criterion, :presentation_item_list, :prices_include_tax, :producer, :product_feed_list,
21
21
  :rate, :related_items_description, :sales_description, :schedule_b_code, :schedule_b_number, :schedule_b_quantity,
22
22
  :search_keywords, :ship_individually, :shipping_cost, :shipping_cost_units, :shopping_dot_com_category,
23
23
  :shopzilla_category_id, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor,
@@ -33,6 +33,7 @@ module NetSuite
33
33
  field :custom_field_list, CustomFieldList
34
34
  field :pricing_matrix, PricingMatrix
35
35
  field :subsidiary_list, RecordRefList
36
+ field :item_vendor_list, ItemVendorList
36
37
 
37
38
 
38
39
  attr_reader :internal_id
@@ -17,7 +17,7 @@ module NetSuite
17
17
  :manufacturer_zip, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity,
18
18
  :minimum_quantity_units, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support,
19
19
  :on_special, :out_of_stock_behavior, :out_of_stock_message, :overall_quantity_pricing_type, :page_title,
20
- :preference_criterion, :presentation_item_list, :prices_include_tax, :pricing_matrix, :producer, :product_feed_list,
20
+ :preference_criterion, :presentation_item_list, :prices_include_tax, :producer, :product_feed_list,
21
21
  :rate, :related_items_description, :sales_description, :schedule_b_code, :schedule_b_number, :schedule_b_quantity,
22
22
  :search_keywords, :ship_individually, :shipping_cost, :shipping_cost_units, :shopping_dot_com_category,
23
23
  :shopzilla_category_id, :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor,
@@ -17,7 +17,7 @@ module NetSuite
17
17
  :memo, :probability, :proj_alt_sales_amt, :projected_total,
18
18
  :range_high, :range_low,
19
19
  :ship_is_residential, :source, :status, :sync_partner_teams, :sync_sales_teams,
20
- :tax2_total, :tax_total, :title, :total_cost_estimate, :tran_date, :tran_id,
20
+ :tax2_total, :title, :total_cost_estimate, :tran_date, :tran_id,
21
21
  :vat_reg_num, :weighted_total
22
22
 
23
23
  field :ship_address, ShipAddress
@@ -43,4 +43,4 @@ module NetSuite
43
43
 
44
44
  end
45
45
  end
46
- end
46
+ end
@@ -8,15 +8,17 @@ module NetSuite
8
8
  include Support::RecordRefs
9
9
  include Namespaces::ListRel
10
10
 
11
- # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/partner.html
11
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_2/schema/record/partner.html
12
12
 
13
13
  actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :search
14
14
 
15
- fields :phone, :home_phone, :first_name, :last_name, :alt_name, :is_inactive, :email, :give_access,
16
- :partner_code, :is_person, :company_name, :eligible_for_commission, :entity_id, :last_modified_date,
17
- :date_created, :title, :mobile_phone, :comments, :middle_name, :send_email, :password, :password2
15
+ fields :alt_email, :alt_name, :bcn, :comments, :company_name, :date_created, :default_address,
16
+ :eligible_for_commission, :email, :entity_id, :fax, :first_name, :give_access, :home_phone, :is_inactive,
17
+ :is_person, :last_modified_date, :last_name, :login_as, :middle_name, :mobile_phone, :partner_code,
18
+ :password, :password2, :phone, :phonetic_name, :print_on_check_as, :referring_url, :require_pwd_change,
19
+ :salutation, :send_email, :sub_partner_login, :tax_id_num, :title, :url, :vat_reg_number
18
20
 
19
- record_refs :klass, :access_role, :department
21
+ record_refs :access_role, :klass, :custom_form, :default_tax_reg, :department, :image, :location, :parent, :subsidiary
20
22
 
21
23
  attr_reader :internal_id
22
24
  attr_accessor :external_id
@@ -10,7 +10,7 @@ module NetSuite
10
10
  actions :get, :get_list, :add, :delete, :update, :upsert
11
11
 
12
12
  fields :title, :message, :phone, :status, :priority, :start_date, :end_date,
13
- :start_time, :end_time, :completed_date, :timed_event, :access_level, :timed_event
13
+ :start_time, :end_time, :completed_date, :timed_event, :access_level
14
14
 
15
15
  field :contact_list, ContactList
16
16
 
@@ -61,7 +61,6 @@ module NetSuite
61
61
  :hazmat_packing_group,
62
62
  :hazmat_shipping_name,
63
63
  :include_children,
64
- :income_account,
65
64
  :interco_cogs_account,
66
65
  :interco_income_account,
67
66
  :invt_classification,
@@ -181,7 +180,6 @@ module NetSuite
181
180
  :store_display_name,
182
181
  :store_display_thumbnail,
183
182
  :store_item_template,
184
- :subsidiary_list,
185
183
  :supply_lot_sizing_method,
186
184
  :supply_replenishment_method,
187
185
  :supply_time_fence,
@@ -209,6 +207,8 @@ module NetSuite
209
207
  :wip_acct,
210
208
  :wip_variance_acct
211
209
 
210
+ record_refs :income_account
211
+
212
212
  # accountingBookDetailList ItemAccountingBookDetailList
213
213
  # binNumberList InventoryItemBinNumberList
214
214
  # itemOptionsList ItemOptionsList
@@ -220,6 +220,7 @@ module NetSuite
220
220
  # siteCategoryList SiteCategoryList
221
221
  # translationsList TranslationList
222
222
 
223
+ field :subsidiary_list, RecordRefList
223
224
  field :custom_field_list, CustomFieldList
224
225
 
225
226
  attr_reader :internal_id
@@ -9,13 +9,13 @@ module NetSuite
9
9
 
10
10
  actions :get, :get_list, :add, :update, :delete, :upsert, :search
11
11
 
12
- fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date,
12
+ fields :available_to_partners, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date,
13
13
  :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description,
14
14
  :include_children, :is_donation_item, :is_fulfillable, :is_gco_compliant, :is_inactive, :is_online, :is_taxable,
15
15
  :item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html,
16
16
  :minimum_quantity, :minimum_quantity_units, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
17
17
  :out_of_stock_message, :overall_quantity_pricing_type, :page_title, :presentation_item_list, :prices_include_tax,
18
- :pricing_matrix, :rate, :related_items_description, :sales_description, :search_keywords,
18
+ :rate, :related_items_description, :sales_description, :search_keywords,
19
19
  :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description,
20
20
  :store_description, :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component,
21
21
  :use_marginal_rates, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :vsoe_sop_group
@@ -15,7 +15,7 @@ module NetSuite
15
15
  :item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html,
16
16
  :minimum_quantity, :minimum_quantity_units, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
17
17
  :out_of_stock_message, :overall_quantity_pricing_type, :page_title, :presentation_item_list, :prices_include_tax,
18
- :pricing_matrix, :rate, :related_items_description, :sales_description, :search_keywords,
18
+ :rate, :related_items_description, :sales_description, :search_keywords,
19
19
  :show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description,
20
20
  :store_description, :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component,
21
21
  :use_marginal_rates, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :vsoe_sop_group
@@ -8,7 +8,7 @@ module NetSuite
8
8
 
9
9
  fields :amount, :average_cost, :klass, :commit_inventory, :description,
10
10
  :expected_receipt_date, :expected_ship_date, :inventory_detail, :is_closed, :last_purchase_price,
11
- :line, :options, :order_priority, :quantity, :quantity_available,
11
+ :line, :order_priority, :quantity, :quantity_available,
12
12
  :quantity_back_ordered, :quantity_committed, :quantity_fulfilled,
13
13
  :quantity_on_hand, :quantity_packed, :quantity_picked, :quantity_received,
14
14
  :rate, :serial_numbers
@@ -9,19 +9,20 @@ module NetSuite
9
9
 
10
10
  actions :get, :get_list, :add, :update, :upsert, :delete, :search
11
11
 
12
- fields :account_number, :alt_email, :alt_name, :alt_phone, :balance,
13
- :balance_primary, :bcn, :bill_pay, :comments, :company_name, :credit_limit,
14
- :currency_list, :date_created, :default_address, :eligible_for_commission,
12
+ fields :account_number, :alt_email, :alt_name, :alt_phone,
13
+ :bcn, :bill_pay, :comments, :company_name, :credit_limit,
14
+ :date_created, :default_address, :eligible_for_commission,
15
15
  :email, :email_preference, :email_transactions, :entity_id, :fax, :fax_transactions,
16
16
  :first_name, :give_access, :global_subscription_status, :home_phone, :is1099_eligible,
17
17
  :is_accountant, :is_inactive, :is_job_resource_vend, :is_person, :labor_cost,
18
- :last_modified_date, :last_name, :legal_name, :middle_name, :mobile_phone, :opening_balance,
18
+ :last_name, :legal_name, :middle_name, :mobile_phone, :opening_balance,
19
19
  :opening_balance_date, :password, :password2, :phone, :phonetic_name, :pricing_schedule_list,
20
20
  :print_on_check_as, :print_transactions, :require_pwd_change, :roles_list, :salutation,
21
- :send_email, :subscriptions_list, :tax_id_num, :title, :unbilled_orders, :unbilled_orders_primary,
21
+ :send_email, :subscriptions_list, :tax_id_num, :title,
22
22
  :url, :vat_reg_number
23
23
 
24
24
  field :custom_field_list, CustomFieldList
25
+ field :currency_list, VendorCurrencyList
25
26
  # TODO should change name to VendorAddressBookList
26
27
  field :addressbook_list, CustomerAddressbookList
27
28
 
@@ -0,0 +1,26 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorCurrency
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::ListRel
8
+
9
+ fields :balance, :consol_balance, :consol_deposit_balance, :consol_overdue_balance,
10
+ :consol_unbilled_orders, :deposit_balance, :display_symbol, :overdue_balance,
11
+ :override_currency_format, :symbol_placement, :unbilled_orders
12
+
13
+ record_refs :currency
14
+
15
+ def initialize(attributes_or_record = {})
16
+ case attributes_or_record
17
+ when Hash
18
+ initialize_from_attributes_hash(attributes_or_record)
19
+ when self.class
20
+ initialize_from_record(attributes_or_record)
21
+ end
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorCurrencyList < Support::Sublist
4
+ include Namespaces::ListRel
5
+
6
+ sublist :vendor_currency, NetSuite::Records::VendorCurrency
7
+ end
8
+ end
9
+ end
@@ -21,6 +21,7 @@ module NetSuite
21
21
 
22
22
  def field(name, klass = nil)
23
23
  name_sym = name.to_sym
24
+ raise "#{name} already defined on #{self.name}" if fields.include?(name_sym)
24
25
  fields << name_sym
25
26
  if klass
26
27
  define_method(name_sym) do
@@ -60,6 +61,22 @@ module NetSuite
60
61
  read_only_fields << name_sym
61
62
  field name
62
63
  end
64
+
65
+ def search_only_fields(*args)
66
+ if args.empty?
67
+ @search_only_fields ||= Set.new
68
+ else
69
+ args.each do |arg|
70
+ search_only_field arg
71
+ end
72
+ end
73
+ end
74
+
75
+ def search_only_field(name)
76
+ name_sym = name.to_sym
77
+ search_only_fields << name_sym
78
+ field name
79
+ end
63
80
  end
64
81
 
65
82
  end
@@ -5,7 +5,7 @@ module NetSuite
5
5
  include Namespaces::PlatformCore
6
6
 
7
7
  def to_record
8
- attributes.reject { |k,v| self.class.read_only_fields.include?(k) }.inject({}) do |hash, (k,v)|
8
+ attributes.reject { |k,v| self.class.read_only_fields.include?(k) || self.class.search_only_fields.include?(k) }.inject({}) do |hash, (k,v)|
9
9
  kname = "#{record_namespace}:"
10
10
  kname += k == :klass ? 'class' : k.to_s.lower_camelcase
11
11
 
@@ -52,9 +52,6 @@ module NetSuite
52
52
  record_list = [record_list] unless record_list.is_a?(Array)
53
53
 
54
54
  record_list.each do |record|
55
- # TODO because of customFieldList we need to either make this recursive
56
- # or handle the customFieldList as a special case
57
-
58
55
  record.each_pair do |search_group, search_data|
59
56
  # skip all attributes: look for :basic and all :xxx_join
60
57
  next if search_group.to_s.start_with?('@')
@@ -63,7 +60,25 @@ module NetSuite
63
60
  # all return values are wrapped in a <SearchValue/>
64
61
  # extract the value from <SearchValue/> to make results easier to work with
65
62
 
66
- if v.is_a?(Hash) && v.has_key?(:search_value)
63
+ if k == :custom_field_list
64
+ # Here's an example of a response
65
+
66
+ # <platformCommon:customFieldList>
67
+ # <platformCore:customField internalId="1756" scriptId="custitem_stringfield" xsi:type="platformCore:SearchColumnStringCustomField">
68
+ # <platformCore:searchValue>sample string value</platformCore:searchValue>
69
+ # </platformCore:customField>
70
+ # <platformCore:customField internalId="1713" scriptId="custitem_apcategoryforsales" xsi:type="platformCore:SearchColumnSelectCustomField">
71
+ # <platformCore:searchValue internalId="4" typeId="464"/>
72
+ # </platformCore:customField>
73
+ # </platformCommon:customFieldList>
74
+
75
+ custom_field_list = v.fetch(:custom_field)
76
+ custom_field_list = [custom_field_list] unless custom_field_list.is_a?(Array)
77
+ record[search_group][k][:custom_field] = custom_field_list.map do |custom_field|
78
+ custom_field[:value] = custom_field.fetch(:search_value)
79
+ custom_field
80
+ end
81
+ elsif v.is_a?(Hash) && v.has_key?(:search_value)
67
82
  # Here's an example of a record ref and string response
68
83
 
69
84
  # <platformCommon:entity>
@@ -89,6 +104,10 @@ module NetSuite
89
104
  record[:basic][:internal_id] = record[:basic][:internal_id][:@internal_id]
90
105
  end
91
106
 
107
+ if record[:basic][:external_id]
108
+ record[:basic][:external_id] = record[:basic][:external_id][:@external_id]
109
+ end
110
+
92
111
  result_wrapper = result_class.new(record.delete(:basic))
93
112
  result_wrapper.search_joins = record
94
113
  results << result_wrapper
@@ -78,7 +78,7 @@ module NetSuite
78
78
  begin
79
79
  count += 1
80
80
  yield
81
- rescue Exception => e
81
+ rescue StandardError => e
82
82
  exceptions_to_retry = [
83
83
  Errno::ECONNRESET,
84
84
  Errno::ETIMEDOUT,
@@ -173,6 +173,7 @@ module NetSuite
173
173
  ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::GiftCertificateItem, ns_item_internal_id, opts)
174
174
  ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::KitItem, ns_item_internal_id, opts)
175
175
  ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::SerializedInventoryItem, ns_item_internal_id, opts)
176
+ ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::SerializedAssemblyItem, ns_item_internal_id, opts)
176
177
  ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::LotNumberedAssemblyItem, ns_item_internal_id, opts)
177
178
  ns_item ||= NetSuite::Utilities.get_record(NetSuite::Records::LotNumberedInventoryItem, ns_item_internal_id, opts)
178
179
 
@@ -1,3 +1,3 @@
1
1
  module NetSuite
2
- VERSION = '0.8.5'
2
+ VERSION = '0.8.9'
3
3
  end
data/lib/netsuite.rb CHANGED
@@ -95,6 +95,7 @@ module NetSuite
95
95
  autoload :CashRefundItemList, 'netsuite/records/cash_refund_item_list'
96
96
  autoload :Campaign, 'netsuite/records/campaign'
97
97
  autoload :Classification, 'netsuite/records/classification'
98
+ autoload :CostCategory, 'netsuite/records/cost_category'
98
99
  autoload :CreditMemo, 'netsuite/records/credit_memo'
99
100
  autoload :CreditMemoApply, 'netsuite/records/credit_memo_apply'
100
101
  autoload :CreditMemoApplyList, 'netsuite/records/credit_memo_apply_list'
@@ -112,6 +113,8 @@ module NetSuite
112
113
  autoload :CustomerAddressbook, 'netsuite/records/customer_addressbook'
113
114
  autoload :CustomerAddressbookList, 'netsuite/records/customer_addressbook_list'
114
115
  autoload :CustomerCategory, 'netsuite/records/customer_category'
116
+ autoload :CustomerCreditCards, 'netsuite/records/customer_credit_cards'
117
+ autoload :CustomerCreditCardsList, 'netsuite/records/customer_credit_cards_list'
115
118
  autoload :CustomerCurrency, 'netsuite/records/customer_currency'
116
119
  autoload :CustomerCurrencyList, 'netsuite/records/customer_currency_list'
117
120
  autoload :CustomerDeposit, 'netsuite/records/customer_deposit'
@@ -121,6 +124,8 @@ module NetSuite
121
124
  autoload :CustomerPayment, 'netsuite/records/customer_payment'
122
125
  autoload :CustomerPaymentApply, 'netsuite/records/customer_payment_apply'
123
126
  autoload :CustomerPaymentApplyList, 'netsuite/records/customer_payment_apply_list'
127
+ autoload :CustomerPaymentCredit, 'netsuite/records/customer_payment_credit'
128
+ autoload :CustomerPaymentCreditList, 'netsuite/records/customer_payment_credit_list'
124
129
  autoload :CustomerPartner, 'netsuite/records/customer_partner'
125
130
  autoload :CustomerRefund, 'netsuite/records/customer_refund'
126
131
  autoload :CustomerRefundApply, 'netsuite/records/customer_refund_apply'
@@ -156,6 +161,9 @@ module NetSuite
156
161
  autoload :Duration, 'netsuite/records/duration'
157
162
  autoload :Employee, 'netsuite/records/employee'
158
163
  autoload :EntityCustomField, 'netsuite/records/entity_custom_field'
164
+ autoload :Estimate, 'netsuite/records/estimate'
165
+ autoload :EstimateItem, 'netsuite/records/estimate_item'
166
+ autoload :EstimateItemList, 'netsuite/records/estimate_item_list'
159
167
  autoload :File, 'netsuite/records/file'
160
168
  autoload :GiftCertificate, 'netsuite/records/gift_certificate'
161
169
  autoload :GiftCertificateItem, 'netsuite/records/gift_certificate_item'
@@ -292,6 +300,8 @@ module NetSuite
292
300
  autoload :VendorCreditItemList, 'netsuite/records/vendor_credit_item_list'
293
301
  autoload :VendorCreditExpense, 'netsuite/records/vendor_credit_expense'
294
302
  autoload :VendorCreditExpenseList, 'netsuite/records/vendor_credit_expense_list'
303
+ autoload :VendorCurrencyList, 'netsuite/records/vendor_currency_list'
304
+ autoload :VendorCurrency, 'netsuite/records/vendor_currency'
295
305
  autoload :VendorReturnAuthorization, 'netsuite/records/vendor_return_authorization'
296
306
  autoload :VendorReturnAuthorizationItem, 'netsuite/records/vendor_return_authorization_item'
297
307
  autoload :VendorReturnAuthorizationItemList, 'netsuite/records/vendor_return_authorization_item_list'
data/netsuite.gemspec CHANGED
@@ -2,8 +2,9 @@
2
2
  require File.expand_path('../lib/netsuite/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
+ gem.licenses = ['MIT']
5
6
  gem.authors = ['Ryan Moran', 'Michael Bianco']
6
- gem.email = ['ryan.moran@gmail.com', 'mike@cliffsidemedia.com']
7
+ gem.email = ['ryan.moran@gmail.com', 'mike@mikebian.co']
7
8
  gem.description = %q{NetSuite SuiteTalk API Wrapper}
8
9
  gem.summary = %q{NetSuite SuiteTalk API (SOAP) Wrapper}
9
10
  gem.homepage = 'https://github.com/NetSweet/netsuite'
@@ -15,7 +16,8 @@ Gem::Specification.new do |gem|
15
16
  gem.require_paths = ['lib']
16
17
  gem.version = NetSuite::VERSION
17
18
 
18
- gem.add_dependency 'savon', '>= 2.3.0'
19
+ gem.add_dependency 'savon', '>= 2.3.0', '<= 2.11.1'
19
20
 
20
- gem.add_development_dependency 'rspec', '~> 3.8.0'
21
+ gem.add_development_dependency 'rspec', '~> 3.10.0'
22
+ gem.add_development_dependency 'rake'
21
23
  end