netsuite 0.8.4 → 0.8.8
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.
- checksums.yaml +5 -5
- data/.github/workflows/main.yml +20 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.tool-versions +1 -0
- data/Gemfile +2 -5
- data/HISTORY.md +26 -0
- data/README.md +72 -29
- data/Rakefile +1 -1
- data/lib/netsuite.rb +13 -19
- data/lib/netsuite/actions/login.rb +10 -2
- data/lib/netsuite/actions/upsert.rb +2 -0
- data/lib/netsuite/configuration.rb +34 -4
- data/lib/netsuite/records/accounting_period.rb +2 -2
- data/lib/netsuite/records/classification.rb +4 -1
- data/lib/netsuite/records/contact.rb +1 -1
- data/lib/netsuite/records/cost_category.rb +28 -0
- data/lib/netsuite/records/credit_memo.rb +1 -1
- data/lib/netsuite/records/custom_field_list.rb +9 -3
- data/lib/netsuite/records/custom_record.rb +1 -1
- data/lib/netsuite/records/customer.rb +2 -1
- data/lib/netsuite/records/customer_credit_cards.rb +36 -0
- data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
- data/lib/netsuite/records/customer_deposit.rb +5 -5
- data/lib/netsuite/records/customer_payment.rb +6 -2
- data/lib/netsuite/records/customer_payment_credit.rb +17 -0
- data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
- data/lib/netsuite/records/employee.rb +1 -1
- data/lib/netsuite/records/estimate.rb +42 -0
- data/lib/netsuite/records/estimate_item.rb +40 -0
- data/lib/netsuite/records/estimate_item_list.rb +11 -0
- data/lib/netsuite/records/inventory_item.rb +62 -1
- data/lib/netsuite/records/invoice.rb +94 -1
- data/lib/netsuite/records/item_fulfillment.rb +1 -1
- data/lib/netsuite/records/lot_numbered_inventory_item.rb +116 -0
- data/lib/netsuite/records/matrix_option_list.rb +12 -4
- data/lib/netsuite/records/message.rb +30 -0
- data/lib/netsuite/records/non_inventory_resale_item.rb +1 -0
- data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
- data/lib/netsuite/records/other_charge_sale_item.rb +2 -2
- data/lib/netsuite/records/partner.rb +7 -5
- data/lib/netsuite/records/serialized_assembly_item.rb +3 -1
- data/lib/netsuite/records/service_resale_item.rb +1 -1
- data/lib/netsuite/records/support_case_type.rb +26 -0
- data/lib/netsuite/records/tax_group.rb +2 -2
- data/lib/netsuite/records/vendor.rb +2 -1
- data/lib/netsuite/records/vendor_currency.rb +26 -0
- data/lib/netsuite/records/vendor_currency_list.rb +9 -0
- data/lib/netsuite/support/fields.rb +16 -0
- data/lib/netsuite/support/records.rb +1 -1
- data/lib/netsuite/support/search_result.rb +36 -6
- data/lib/netsuite/utilities.rb +18 -6
- data/lib/netsuite/version.rb +1 -1
- data/netsuite.gemspec +5 -3
- data/spec/netsuite/actions/search_spec.rb +22 -0
- data/spec/netsuite/configuration_spec.rb +111 -6
- data/spec/netsuite/records/basic_record_spec.rb +9 -1
- data/spec/netsuite/records/classification_spec.rb +10 -1
- data/spec/netsuite/records/cost_category_spec.rb +105 -0
- data/spec/netsuite/records/custom_field_list_spec.rb +46 -6
- data/spec/netsuite/records/custom_record_spec.rb +1 -1
- data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
- data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
- data/spec/netsuite/records/customer_payment_spec.rb +1 -6
- data/spec/netsuite/records/customer_spec.rb +22 -1
- data/spec/netsuite/records/employee_spec.rb +2 -2
- data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
- data/spec/netsuite/records/estimate_item_spec.rb +40 -0
- data/spec/netsuite/records/estimate_spec.rb +216 -0
- data/spec/netsuite/records/inventory_item_spec.rb +65 -0
- data/spec/netsuite/records/invoice_spec.rb +94 -0
- data/spec/netsuite/records/matrix_option_list_spec.rb +15 -5
- data/spec/netsuite/records/message_spec.rb +49 -0
- data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
- data/spec/netsuite/records/non_inventory_sale_item_spec.rb +1 -1
- data/spec/netsuite/records/partner_spec.rb +143 -0
- data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
- data/spec/netsuite/records/support_case_type_spec.rb +22 -0
- data/spec/netsuite/records/vendor_spec.rb +1 -1
- data/spec/netsuite/support/search_result_spec.rb +24 -0
- data/spec/netsuite/utilities_spec.rb +20 -15
- data/spec/support/fixtures/custom_fields/multi_select.xml +47 -0
- data/spec/support/fixtures/search/saved_search_item.xml +55 -0
- data/spec/support/fixtures/search/saved_search_joined_custom_customer.xml +15 -1
- data/spec/support/search_only_field_matcher.rb +7 -0
- metadata +77 -12
- data/circle.yml +0 -17
@@ -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
|
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class LotNumberedInventoryItem
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Support::Actions
|
8
|
+
include Namespaces::ListAcct
|
9
|
+
|
10
|
+
# http://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2018_2/schema/record/lotnumberedinventoryitem.html
|
11
|
+
|
12
|
+
# TODO
|
13
|
+
# countryOfManufacture Country
|
14
|
+
# hazmatPackingGroup HazmatPackingGroup
|
15
|
+
# accountingBookDetailList ItemAccountingBookDetailList
|
16
|
+
# costEstimateType ItemCostEstimateType
|
17
|
+
# costingMethod ItemCostingMethod
|
18
|
+
# invtClassification ItemInvtClassification
|
19
|
+
# matrixType ItemMatrixType
|
20
|
+
# itemOptionsList ItemOptionsList
|
21
|
+
# outOfStockBehavior ItemOutOfStockBehavior
|
22
|
+
# overallQuantityPricingType ItemOverallQuantityPricingType
|
23
|
+
# preferenceCriterion ItemPreferenceCriterion
|
24
|
+
# itemVendorList ItemVendorList
|
25
|
+
# weightUnit ItemWeightUnit
|
26
|
+
# hierarchyVersionsList LotNumberedInventoryItemHierarchyVersionsList
|
27
|
+
# numbersList LotNumberedInventoryItemNumbersList
|
28
|
+
# periodicLotSizeType PeriodicLotSizeType
|
29
|
+
# presentationItemList PresentationItemList
|
30
|
+
# productFeedList ProductFeedList
|
31
|
+
|
32
|
+
field :pricing_matrix, PricingMatrix
|
33
|
+
field :custom_field_list, CustomFieldList
|
34
|
+
field :bin_number_list, BinNumberList
|
35
|
+
field :locations_list, LocationsList
|
36
|
+
field :item_vendor_list, ItemVendorList
|
37
|
+
field :matrix_option_list, MatrixOptionList
|
38
|
+
field :subsidiary_list, RecordRefList
|
39
|
+
|
40
|
+
actions :get, :get_list, :add, :delete, :search, :update, :upsert, :update_list
|
41
|
+
|
42
|
+
record_refs :alternate_demand_source_item, :asset_account, :bill_exch_rate_variance_acct,
|
43
|
+
:billing_schedule, :bill_price_variance_acct, :bill_qty_variance_acct,
|
44
|
+
:klass, :cogs_account, :cost_category, :create_revenue_plans_on,
|
45
|
+
:custom_form, :default_item_ship_method, :deferred_revenue_account,
|
46
|
+
:demand_source, :department, :dropship_expense_account, :gain_loss_account,
|
47
|
+
:income_account, :interco_cogs_account, :interco_income_account,
|
48
|
+
:issue_product, :item_revenue_category, :location, :parent, :preferred_location,
|
49
|
+
:pricing_group, :purchase_price_variance_acct, :purchase_tax_code, :purchase_unit,
|
50
|
+
:quantity_pricing_schedule, :revenue_allocation_group, :revenue_recognition_rule,
|
51
|
+
:rev_rec_forecast_rule, :rev_rec_schedule, :sales_tax_code, :sale_unit,
|
52
|
+
:ship_package, :soft_descriptor, :stock_unit, :store_display_image,
|
53
|
+
:store_display_thumbnail, :store_item_template, :supply_lot_sizing_method,
|
54
|
+
:supply_replenishment_method, :supply_type, :tax_schedule, :units_type, :vendor
|
55
|
+
|
56
|
+
# TODO
|
57
|
+
# itemNumberOptionsList RecordRefList
|
58
|
+
# itemShipMethodList RecordRefList
|
59
|
+
# subsidiaryList RecordRefList
|
60
|
+
# scheduleBCode ScheduleBCode
|
61
|
+
# itemCarrier ShippingCarrier
|
62
|
+
# siteCategoryList SiteCategoryList
|
63
|
+
# sitemapPriority SitemapPriority
|
64
|
+
# translationsList TranslationList
|
65
|
+
# vsoeDeferral VsoeDeferral
|
66
|
+
# vsoePermitDiscount VsoePermitDiscount
|
67
|
+
# vsoeSopGroup VsoeSopGroup
|
68
|
+
|
69
|
+
fields :auto_lead_time, :auto_preferred_stock_level, :auto_reorder_point, :available_to_partners,
|
70
|
+
:copy_description, :direct_revenue_posting, :dont_show_price, :enforce_min_qty_internally,
|
71
|
+
:exclude_from_sitemap, :include_children, :is_donation_item, :is_drop_ship_item, :is_gco_compliant,
|
72
|
+
:is_hazmat_item, :is_inactive, :is_online, :is_special_order_item, :is_store_pickup_allowed,
|
73
|
+
:is_taxable, :match_bill_to_receipt, :mult_manufacture_addr, :offer_support, :on_special,
|
74
|
+
:prices_include_tax, :producer, :round_up_as_component, :seasonal_demand, :ship_individually,
|
75
|
+
:show_default_donation_amount, :track_landed_cost, :use_bins, :use_marginal_rates, :vsoe_delivered,
|
76
|
+
:created_date, :expiration_date, :last_invt_count_date, :last_modified_date, :next_invt_count_date,
|
77
|
+
:average_cost, :cost, :cost_estimate, :default_return_cost, :demand_modifier, :fixed_lot_size,
|
78
|
+
:handling_cost, :hazmat_item_units_qty, :last_purchase_price, :max_donation_amount,
|
79
|
+
:on_hand_value_mli, :preferred_stock_level, :preferred_stock_level_days, :purchase_order_amount,
|
80
|
+
:purchase_order_quantity, :purchase_order_quantity_diff, :quantity_available,
|
81
|
+
:quantity_back_ordered, :quantity_committed, :quantity_on_hand, :quantity_on_order,
|
82
|
+
:rate, :receipt_amount, :receipt_quantity, :receipt_quantity_diff, :reorder_point,
|
83
|
+
:safety_stock_level, :shipping_cost, :total_value, :transfer_price, :vsoe_price,
|
84
|
+
:weight, :backward_consumption_days, :demand_time_fence, :forward_consumption_days,
|
85
|
+
:invt_count_interval, :lead_time, :maximum_quantity, :minimum_quantity, :periodic_lot_size_days,
|
86
|
+
:reorder_multiple, :reschedule_in_days, :reschedule_out_days, :safety_stock_level_days,
|
87
|
+
:schedule_b_quantity, :shopzilla_category_id, :supply_time_fence, :costing_method_display,
|
88
|
+
:cost_units, :currency, :display_name, :featured_description, :handling_cost_units,
|
89
|
+
:hazmat_hazard_class, :hazmat_id, :hazmat_item_units, :hazmat_shipping_name, :item_id,
|
90
|
+
:manufacturer, :manufacturer_addr1, :manufacturer_city, :manufacturer_state,
|
91
|
+
:manufacturer_tariff, :manufacturer_tax_id, :manufacturer_zip, :matrix_item_name_template,
|
92
|
+
:meta_tag_html, :minimum_quantity_units, :mpn, :nex_tag_category, :no_price_message,
|
93
|
+
:out_of_stock_message, :page_title, :preferred_stock_level_units, :purchase_description,
|
94
|
+
:quantity_on_hand_units, :quantity_reorder_units, :related_items_description,
|
95
|
+
:reorder_point_units, :safety_stock_level_units, :sales_description, :schedule_b_number,
|
96
|
+
:search_keywords, :serial_numbers, :shipping_cost_units, :shopping_dot_com_category,
|
97
|
+
:specials_description, :stock_description, :store_description, :store_detailed_description,
|
98
|
+
:store_display_name, :upc_code, :url_component, :vendor_name, :weight_units
|
99
|
+
|
100
|
+
|
101
|
+
attr_reader :internal_id
|
102
|
+
attr_accessor :external_id, :search_joins
|
103
|
+
|
104
|
+
def initialize(attributes = {})
|
105
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
106
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
107
|
+
initialize_from_attributes_hash(attributes)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.search_class_name
|
111
|
+
"Item"
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -15,10 +15,14 @@ module NetSuite
|
|
15
15
|
#
|
16
16
|
# <listAcct:matrixOptionList>
|
17
17
|
# <listAcct:matrixOption internalId="45" scriptId="custitem13">
|
18
|
-
# <platformCore:value internalId="4" typeId="28"
|
18
|
+
# <platformCore:value internalId="4" typeId="28">
|
19
|
+
# <platformCore:name>foo</platformCore:name>
|
20
|
+
# </platformCore:value>
|
19
21
|
# </listAcct:matrixOption>
|
20
22
|
# <listAcct:matrixOption internalId="46" scriptId="custitem14">
|
21
|
-
# <platformCore:value internalId="1" typeId="29"
|
23
|
+
# <platformCore:value internalId="1" typeId="29">
|
24
|
+
# <platformCore:name>bar</platformCore:name>
|
25
|
+
# </platformCore:value>
|
22
26
|
# </listAcct:matrixOption>
|
23
27
|
# </listAcct:matrixOptionList>
|
24
28
|
#
|
@@ -27,13 +31,17 @@ module NetSuite
|
|
27
31
|
when Hash
|
28
32
|
options << OpenStruct.new(
|
29
33
|
type_id: attributes[:matrix_option][:value][:'@type_id'],
|
30
|
-
value_id: attributes[:matrix_option][:value][:'@internal_id']
|
34
|
+
value_id: attributes[:matrix_option][:value][:'@internal_id'],
|
35
|
+
script_id: attributes[:matrix_option][:@script_id],
|
36
|
+
name: attributes[:matrix_option][:value][:name]
|
31
37
|
)
|
32
38
|
when Array
|
33
39
|
attributes[:matrix_option].each do |option|
|
34
40
|
options << OpenStruct.new(
|
35
41
|
type_id: option[:value][:'@type_id'],
|
36
|
-
value_id: option[:value][:'@internal_id']
|
42
|
+
value_id: option[:value][:'@internal_id'],
|
43
|
+
script_id: option[:@script_id],
|
44
|
+
name: option[:value][:name]
|
37
45
|
)
|
38
46
|
end
|
39
47
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class Message
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Support::Actions
|
8
|
+
include Namespaces::CommGeneral
|
9
|
+
|
10
|
+
actions :get, :add, :delete, :search
|
11
|
+
|
12
|
+
fields :bcc, :cc, :compress_attachments, :date_time, :emailed, :incoming,
|
13
|
+
:message, :record_name, :record_type_name, :subject
|
14
|
+
|
15
|
+
read_only_fields :last_modified_date, :message_date
|
16
|
+
|
17
|
+
record_refs :activity, :author, :recipient, :transaction
|
18
|
+
|
19
|
+
attr_reader :internal_id
|
20
|
+
attr_accessor :external_id
|
21
|
+
|
22
|
+
def initialize(attributes_or_record = {})
|
23
|
+
@internal_id = attributes_or_record.delete(:internal_id) || attributes_or_record.delete(:@internal_id)
|
24
|
+
@external_id = attributes_or_record.delete(:external_id) || attributes_or_record.delete(:@external_id)
|
25
|
+
initialize_from_attributes_hash(attributes_or_record)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -10,7 +10,7 @@ module NetSuite
|
|
10
10
|
actions :get, :get_list, :add, :delete, :search, :update, :upsert
|
11
11
|
|
12
12
|
fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture,
|
13
|
-
:created_date, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap,
|
13
|
+
:created_date, :direct_revenue_posting, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap,
|
14
14
|
:featured_description, :handling_cost, :handling_cost_units, :include_children, :is_donation_item, :is_fulfillable,
|
15
15
|
:is_gco_compliant, :is_inactive, :is_online, :is_taxable, :item_id, :last_modified_date, :manufacturer,
|
16
16
|
:manufacturer_addr1, :manufacturer_city, :manufacturer_state, :manufacturer_tariff, :manufacturer_tax_id,
|
@@ -52,11 +52,11 @@ module NetSuite
|
|
52
52
|
:units_type, :sales_tax_code, :sale_unit, :tax_schedule, :parent
|
53
53
|
|
54
54
|
field :custom_field_list, CustomFieldList
|
55
|
-
|
55
|
+
field :pricing_matrix, PricingMatrix
|
56
56
|
# :translations_list,
|
57
57
|
# :matrix_option_list,
|
58
58
|
# :item_options_list
|
59
|
-
|
59
|
+
field :subsidiary_list, RecordRefList
|
60
60
|
|
61
61
|
def initialize(attributes = {})
|
62
62
|
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
@@ -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/
|
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 :
|
16
|
-
:
|
17
|
-
:
|
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, :
|
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
|
@@ -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,
|
@@ -209,6 +208,8 @@ module NetSuite
|
|
209
208
|
:wip_acct,
|
210
209
|
:wip_variance_acct
|
211
210
|
|
211
|
+
record_refs :income_account
|
212
|
+
|
212
213
|
# accountingBookDetailList ItemAccountingBookDetailList
|
213
214
|
# binNumberList InventoryItemBinNumberList
|
214
215
|
# itemOptionsList ItemOptionsList
|
@@ -220,6 +221,7 @@ module NetSuite
|
|
220
221
|
# siteCategoryList SiteCategoryList
|
221
222
|
# translationsList TranslationList
|
222
223
|
|
224
|
+
field :subsidiary_list, RecordRefList
|
223
225
|
field :custom_field_list, CustomFieldList
|
224
226
|
|
225
227
|
attr_reader :internal_id
|
@@ -9,7 +9,7 @@ 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,
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class SupportCaseType
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Support::Actions
|
8
|
+
include Namespaces::ListSupport
|
9
|
+
|
10
|
+
actions :get
|
11
|
+
|
12
|
+
fields :description, :is_inactive, :name
|
13
|
+
|
14
|
+
record_refs :insert_before
|
15
|
+
|
16
|
+
attr_reader :internal_id
|
17
|
+
attr_accessor :external_id
|
18
|
+
|
19
|
+
def initialize(attributes = {})
|
20
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
21
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
22
|
+
initialize_from_attributes_hash(attributes)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -7,8 +7,8 @@ module NetSuite
|
|
7
7
|
include Support::Actions
|
8
8
|
include Namespaces::ListAcct
|
9
9
|
|
10
|
-
# NOTE `get_all` is not available
|
11
|
-
# `search` is
|
10
|
+
# NOTE `get_all` is not available API > 2017_1
|
11
|
+
# `search` is available API > 2016_2
|
12
12
|
actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search, :get_all
|
13
13
|
|
14
14
|
fields :city, :county, :description, :include_children, :is_default, :is_inactive,
|
@@ -11,7 +11,7 @@ module NetSuite
|
|
11
11
|
|
12
12
|
fields :account_number, :alt_email, :alt_name, :alt_phone, :balance,
|
13
13
|
:balance_primary, :bcn, :bill_pay, :comments, :company_name, :credit_limit,
|
14
|
-
:
|
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,
|
@@ -22,6 +22,7 @@ module NetSuite
|
|
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
|
@@ -60,6 +60,22 @@ module NetSuite
|
|
60
60
|
read_only_fields << name_sym
|
61
61
|
field name
|
62
62
|
end
|
63
|
+
|
64
|
+
def search_only_fields(*args)
|
65
|
+
if args.empty?
|
66
|
+
@search_only_fields ||= Set.new
|
67
|
+
else
|
68
|
+
args.each do |arg|
|
69
|
+
search_only_field arg
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def search_only_field(name)
|
75
|
+
name_sym = name.to_sym
|
76
|
+
search_only_fields << name_sym
|
77
|
+
field name
|
78
|
+
end
|
63
79
|
end
|
64
80
|
|
65
81
|
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
|
|
@@ -29,8 +29,19 @@ module NetSuite
|
|
29
29
|
if @total_records > 0
|
30
30
|
if response.body.has_key?(:record_list)
|
31
31
|
# basic search results
|
32
|
-
|
33
|
-
|
32
|
+
|
33
|
+
# `recordList` node can contain several nested `record` nodes, only one node or be empty
|
34
|
+
# so we have to handle all these cases:
|
35
|
+
# * { record_list: nil }
|
36
|
+
# * { record_list: { record: => {...} } }
|
37
|
+
# * { record_list: { record: => [{...}, {...}, ...] } }
|
38
|
+
record_list = if response.body[:record_list].nil?
|
39
|
+
[]
|
40
|
+
elsif response.body[:record_list][:record].is_a?(Array)
|
41
|
+
response.body[:record_list][:record]
|
42
|
+
else
|
43
|
+
[response.body[:record_list][:record]]
|
44
|
+
end
|
34
45
|
|
35
46
|
record_list.each do |record|
|
36
47
|
results << result_class.new(record)
|
@@ -41,9 +52,6 @@ module NetSuite
|
|
41
52
|
record_list = [record_list] unless record_list.is_a?(Array)
|
42
53
|
|
43
54
|
record_list.each do |record|
|
44
|
-
# TODO because of customFieldList we need to either make this recursive
|
45
|
-
# or handle the customFieldList as a special case
|
46
|
-
|
47
55
|
record.each_pair do |search_group, search_data|
|
48
56
|
# skip all attributes: look for :basic and all :xxx_join
|
49
57
|
next if search_group.to_s.start_with?('@')
|
@@ -52,7 +60,25 @@ module NetSuite
|
|
52
60
|
# all return values are wrapped in a <SearchValue/>
|
53
61
|
# extract the value from <SearchValue/> to make results easier to work with
|
54
62
|
|
55
|
-
if
|
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)
|
56
82
|
# Here's an example of a record ref and string response
|
57
83
|
|
58
84
|
# <platformCommon:entity>
|
@@ -78,6 +104,10 @@ module NetSuite
|
|
78
104
|
record[:basic][:internal_id] = record[:basic][:internal_id][:@internal_id]
|
79
105
|
end
|
80
106
|
|
107
|
+
if record[:basic][:external_id]
|
108
|
+
record[:basic][:external_id] = record[:basic][:external_id][:@external_id]
|
109
|
+
end
|
110
|
+
|
81
111
|
result_wrapper = result_class.new(record.delete(:basic))
|
82
112
|
result_wrapper.search_joins = record
|
83
113
|
results << result_wrapper
|