netsuite 0.8.3 → 0.8.4

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/README.md +3 -2
  4. data/circle.yml +3 -2
  5. data/lib/netsuite.rb +17 -0
  6. data/lib/netsuite/actions/login.rb +11 -0
  7. data/lib/netsuite/actions/update.rb +6 -2
  8. data/lib/netsuite/errors.rb +1 -0
  9. data/lib/netsuite/records/assembly_build.rb +4 -1
  10. data/lib/netsuite/records/assembly_item.rb +1 -0
  11. data/lib/netsuite/records/assembly_unbuild.rb +3 -0
  12. data/lib/netsuite/records/bin_number.rb +18 -0
  13. data/lib/netsuite/records/bin_number_list.rb +1 -20
  14. data/lib/netsuite/records/classification.rb +1 -1
  15. data/lib/netsuite/records/custom_field_list.rb +10 -2
  16. data/lib/netsuite/records/custom_record.rb +2 -2
  17. data/lib/netsuite/records/custom_record_ref.rb +1 -0
  18. data/lib/netsuite/records/customer.rb +3 -3
  19. data/lib/netsuite/records/customer_deposit.rb +5 -2
  20. data/lib/netsuite/records/customer_sales_team.rb +24 -0
  21. data/lib/netsuite/records/customer_sales_team_list.rb +9 -0
  22. data/lib/netsuite/records/customer_status.rb +29 -0
  23. data/lib/netsuite/records/customer_subscription.rb +18 -0
  24. data/lib/netsuite/records/customer_subscriptions_list.rb +10 -0
  25. data/lib/netsuite/records/entity_custom_field.rb +53 -0
  26. data/lib/netsuite/records/non_inventory_resale_item.rb +2 -2
  27. data/lib/netsuite/records/price.rb +17 -0
  28. data/lib/netsuite/records/price_list.rb +9 -0
  29. data/lib/netsuite/records/pricing.rb +20 -0
  30. data/lib/netsuite/records/pricing_matrix.rb +2 -2
  31. data/lib/netsuite/records/promotions.rb +26 -0
  32. data/lib/netsuite/records/promotions_list.rb +9 -0
  33. data/lib/netsuite/records/sales_order.rb +1 -0
  34. data/lib/netsuite/records/sales_role.rb +26 -0
  35. data/lib/netsuite/records/sales_tax_item.rb +3 -1
  36. data/lib/netsuite/records/serialized_assembly_item.rb +239 -0
  37. data/lib/netsuite/records/service_sale_item.rb +1 -1
  38. data/lib/netsuite/records/tax_group.rb +2 -2
  39. data/lib/netsuite/records/transaction_body_custom_field.rb +61 -0
  40. data/lib/netsuite/records/transaction_column_custom_field.rb +59 -0
  41. data/lib/netsuite/records/vendor_credit.rb +2 -0
  42. data/lib/netsuite/records/work_order.rb +8 -0
  43. data/lib/netsuite/support/country.rb +27 -15
  44. data/lib/netsuite/utilities.rb +45 -20
  45. data/lib/netsuite/version.rb +1 -1
  46. data/spec/netsuite/actions/login_spec.rb +23 -0
  47. data/spec/netsuite/actions/update_spec.rb +42 -0
  48. data/spec/netsuite/records/address_spec.rb +10 -0
  49. data/spec/netsuite/records/basic_record_spec.rb +6 -1
  50. data/spec/netsuite/records/bin_number_spec.rb +23 -0
  51. data/spec/netsuite/records/custom_field_list_spec.rb +33 -0
  52. data/spec/netsuite/records/customer_sales_team_list_spec.rb +41 -0
  53. data/spec/netsuite/records/customer_spec.rb +22 -1
  54. data/spec/netsuite/records/customer_subscription_spec.rb +41 -0
  55. data/spec/netsuite/records/customer_subscriptions_list_spec.rb +19 -0
  56. data/spec/netsuite/records/entity_custom_field_spec.rb +34 -0
  57. data/spec/netsuite/records/pricing_matrix_spec.rb +15 -13
  58. data/spec/netsuite/records/transaction_body_custom_field_spec.rb +32 -0
  59. data/spec/netsuite/records/transaction_column_custom_field_spec.rb +32 -0
  60. data/spec/netsuite/records/vendor_credit_spec.rb +29 -0
  61. data/spec/netsuite/utilities_spec.rb +15 -3
  62. data/spec/spec_helper.rb +5 -4
  63. metadata +34 -2
@@ -0,0 +1,18 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerSubscription
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Support::RecordRefs
7
+ include Namespaces::ListRel
8
+
9
+ fields :subscribed, :last_modified_date
10
+ record_refs :subscription
11
+
12
+ def initialize(attributes_or_record = {})
13
+ initialize_from_attributes_hash(attributes_or_record)
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerSubscriptionsList < Support::Sublist
4
+ include Namespaces::ListRel
5
+
6
+ sublist :subscriptions, CustomerSubscription
7
+
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,53 @@
1
+ module NetSuite
2
+ module Records
3
+ class EntityCustomField
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::SetupCustom
9
+
10
+ actions :get, :get_list, :add, :delete, :update, :upsert, :upsert_list
11
+
12
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_1/schema/record/entitycustomfield.html
13
+ fields(
14
+ :access_level,
15
+ :applies_to_contact,
16
+ :applies_to_customer,
17
+ :applies_to_employee,
18
+ :applies_to_group,
19
+ :applies_to_other_name,
20
+ :applies_to_partner,
21
+ :applies_to_price_list,
22
+ :applies_to_statement,
23
+ :applies_to_vendor,
24
+ :applies_to_web_site,
25
+ :available_externally,
26
+ :check_spelling,
27
+ :default_checked,
28
+ :display_type,
29
+ :field_type,
30
+ :global_search,
31
+ :is_formula,
32
+ :is_mandatory,
33
+ :is_parent,
34
+ :label,
35
+ :script_id,
36
+ :search_level,
37
+ :show_in_list,
38
+ :store_value,
39
+ )
40
+
41
+ record_refs :owner
42
+
43
+ attr_reader :internal_id
44
+ attr_accessor :external_id
45
+
46
+ def initialize(attributes = {})
47
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
48
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
49
+ initialize_from_attributes_hash(attributes)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
- actions :get, :get_list, :add, :delete, :search, :upsert
10
+ actions :get, :get_list, :add, :delete, :search, :upsert, :update
11
11
 
12
12
  fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture,
13
13
  :created_date, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap,
@@ -28,7 +28,7 @@ module NetSuite
28
28
  record_refs :billing_schedule, :cost_category, :custom_form, :deferred_revenue_account, :department, :income_account,
29
29
  :issue_product, :item_options_list, :klass, :location, :parent, :pricing_group, :purchase_tax_code,
30
30
  :quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :ship_package, :store_display_image,
31
- :store_display_thumbnail, :store_item_template, :tax_schedule, :units_type
31
+ :store_display_thumbnail, :store_item_template, :tax_schedule, :units_type, :expense_account
32
32
 
33
33
  field :custom_field_list, CustomFieldList
34
34
  field :pricing_matrix, PricingMatrix
@@ -0,0 +1,17 @@
1
+ module NetSuite
2
+ module Records
3
+ class Price
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Namespaces::ListAcct
7
+
8
+ fields :value, :quantity
9
+
10
+ def initialize(attributes = {})
11
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
12
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
13
+ initialize_from_attributes_hash(attributes)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ module NetSuite
2
+ module Records
3
+ class PriceList < Support::Sublist
4
+ include Namespaces::ListAcct
5
+
6
+ sublist :price, Price
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,20 @@
1
+ module NetSuite
2
+ module Records
3
+ class Pricing
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Support::RecordRefs
7
+ include Namespaces::ListAcct
8
+
9
+ record_refs :currency, :price_level
10
+
11
+ fields :discount
12
+
13
+ field :price_list, PriceList
14
+
15
+ def initialize(attributes = {})
16
+ initialize_from_attributes_hash(attributes)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,9 +1,9 @@
1
1
  module NetSuite
2
2
  module Records
3
3
  class PricingMatrix < Support::Sublist
4
- include Namespaces::PlatformCore
4
+ include NetSuite::Namespaces::ListAcct
5
5
 
6
- sublist :pricing, RecordRef
6
+ sublist :pricing, NetSuite::Records::Pricing
7
7
 
8
8
  alias :prices :pricing
9
9
  end
@@ -0,0 +1,26 @@
1
+ module NetSuite
2
+ module Records
3
+ class Promotions
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::TranSales
8
+
9
+ record_refs :coupon_code, :promo_code
10
+
11
+ def initialize(attributes_or_record = {})
12
+ case attributes_or_record
13
+ when Hash
14
+ initialize_from_attributes_hash(attributes_or_record)
15
+ when self.class
16
+ initialize_from_record(attributes_or_record)
17
+ end
18
+ end
19
+
20
+ def initialize_from_record(record)
21
+ self.attributes = record.send(:attributes)
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ module NetSuite
2
+ module Records
3
+ class PromotionsList < Support::Sublist
4
+ include Namespaces::TranSales
5
+
6
+ sublist :promotions, Promotions
7
+ end
8
+ end
9
+ end
@@ -32,6 +32,7 @@ module NetSuite
32
32
  field :custom_field_list, CustomFieldList
33
33
  field :gift_cert_redemption_list, GiftCertRedemptionList
34
34
  field :ship_group_list, SalesOrderShipGroupList
35
+ field :promotions_list, PromotionsList
35
36
 
36
37
  read_only_fields :applied, :discount_total, :sub_total, :tax_total, :total, :unapplied,
37
38
  :est_gross_profit_percent
@@ -0,0 +1,26 @@
1
+ module NetSuite
2
+ module Records
3
+ class SalesRole
4
+ include Support::Records
5
+ include Support::Fields
6
+ include Support::Actions
7
+ include Support::RecordRefs
8
+ include Namespaces::ListEmp
9
+
10
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_1/script/record/sales_role.html
11
+
12
+ actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :search
13
+
14
+ fields :name
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,10 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
+ # NOTE `get_all` is not available in recent API versions ~2017_2
11
+ # `search` is only available in recent API versions
10
12
  actions :get, :get_list, :get_all, :get_select_value, :add, :delete,
11
- :update, :upsert
13
+ :update, :upsert, :search
12
14
 
13
15
  fields :item_id, :display_name, :description, :rate, :is_inactive,
14
16
  :effective_from, :valid_until, :include_children, :eccode,
@@ -0,0 +1,239 @@
1
+ module NetSuite
2
+ module Records
3
+ class SerializedAssemblyItem
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::ListAcct
9
+
10
+ actions :get, :get_list, :add, :delete, :search, :update, :upsert
11
+
12
+ fields :alternate_demand_source_item,
13
+ :asset_account,
14
+ :auto_lead_time,
15
+ :auto_preferred_stock_level,
16
+ :auto_reorder_point,
17
+ :available_to_partners,
18
+ :average_cost,
19
+ :bill_exch_rate_variance_acct,
20
+ :billing_schedule,
21
+ :bill_price_variance_acct,
22
+ :bill_qty_variance_acct,
23
+ :build_entire_assembly,
24
+ :build_time,
25
+ :klass,
26
+ :cogs_account,
27
+ :cost,
28
+ :cost_category,
29
+ :cost_estimate,
30
+ :cost_estimate_type,
31
+ :costing_method,
32
+ :costing_method_display,
33
+ :country_of_manufacture,
34
+ :created_date,
35
+ :create_revenue_plans_on,
36
+ :custom_form,
37
+ :default_item_ship_method,
38
+ :default_return_cost,
39
+ :default_revision,
40
+ :deferred_revenue_account,
41
+ :demand_modifier,
42
+ :demand_source,
43
+ :demand_time_fence,
44
+ :department,
45
+ :description,
46
+ :display_name,
47
+ :dont_show_price,
48
+ :dropship_expense_account,
49
+ :effective_bom_control,
50
+ :enforce_min_qty_internally,
51
+ :exclude_from_sitemap,
52
+ :featured_description,
53
+ :fixed_lot_size,
54
+ :gain_loss_account,
55
+ :handling_cost,
56
+ :handling_cost_units,
57
+ :hazmat_hazard_class,
58
+ :hazmat_id,
59
+ :hazmat_item_units,
60
+ :hazmat_item_units_qty,
61
+ :hazmat_packing_group,
62
+ :hazmat_shipping_name,
63
+ :include_children,
64
+ :income_account,
65
+ :interco_cogs_account,
66
+ :interco_income_account,
67
+ :invt_classification,
68
+ :invt_count_interval,
69
+ :is_donation_item,
70
+ :is_gco_compliant,
71
+ :is_hazmat_item,
72
+ :is_inactive,
73
+ :is_online,
74
+ :is_phantom,
75
+ :is_special_work_order_item,
76
+ :issue_product,
77
+ :is_taxable,
78
+ :item_carrier,
79
+ :item_id,
80
+ :item_number_options_list,
81
+ :item_revenue_category,
82
+ :last_invt_count_date,
83
+ :last_modified_date,
84
+ :last_purchase_price,
85
+ :lead_time,
86
+ :location,
87
+ :locations_list,
88
+ :manufacturer,
89
+ :manufactureraddr1,
90
+ :manufacturer_city,
91
+ :manufacturer_state,
92
+ :manufacturer_tariff,
93
+ :manufacturer_tax_id,
94
+ :manufacturer_zip,
95
+ :match_bill_to_receipt,
96
+ :matrix_item_name_template,
97
+ :max_donation_amount,
98
+ :meta_tag_html,
99
+ :minimum_quantity,
100
+ :minimum_quantity_units,
101
+ :mpn,
102
+ :mult_manufacture_addr,
103
+ :nex_tag_category,
104
+ :next_invt_count_date,
105
+ :no_price_message,
106
+ :offer_support,
107
+ :on_special,
108
+ :out_of_stock_behavior,
109
+ :out_of_stock_message,
110
+ :overall_quantity_pricing_type,
111
+ :page_title,
112
+ :parent,
113
+ :preference_criterion,
114
+ :preferred_location,
115
+ :preferred_stock_level,
116
+ :preferred_stock_level_days,
117
+ :preferred_stock_level_units,
118
+ :prices_include_tax,
119
+ :pricing_group,
120
+ :pricing_matrix,
121
+ :print_items,
122
+ :prod_price_variance_acct,
123
+ :prod_qty_variance_acct,
124
+ :producer,
125
+ :product_feed_list,
126
+ :purchase_description,
127
+ :purchase_order_amount,
128
+ :purchase_order_quantity,
129
+ :purchase_order_quantity_diff,
130
+ :purchase_price_variance_acct,
131
+ :purchase_tax_code,
132
+ :purchase_unit,
133
+ :quantity_available,
134
+ :quantity_back_ordered,
135
+ :quantity_committed,
136
+ :quantity_on_hand,
137
+ :quantity_on_hand_units,
138
+ :quantity_on_order,
139
+ :quantity_pricing_schedule,
140
+ :rate,
141
+ :receipt_amount,
142
+ :receipt_quantity,
143
+ :receipt_quantity_diff,
144
+ :related_items_description,
145
+ :reorder_multiple,
146
+ :reorder_point,
147
+ :reorder_point_units,
148
+ :reschedule_in_days,
149
+ :reschedule_out_days,
150
+ :revenue_allocation_group,
151
+ :revenue_recognition_rule,
152
+ :rev_rec_schedule,
153
+ :round_up_as_component,
154
+ :safety_stock_level,
155
+ :safety_stock_level_days,
156
+ :safety_stock_level_units,
157
+ :sales_tax_code,
158
+ :sale_unit,
159
+ :schedule_b_code,
160
+ :schedule_b_number,
161
+ :schedule_b_quantity,
162
+ :scrap_acct,
163
+ :search_keywords,
164
+ :seasonal_demand,
165
+ :serial_numbers,
166
+ :ship_individually,
167
+ :ship_package,
168
+ :shipping_cost,
169
+ :shipping_cost_units,
170
+ :shopping_dot_com_category,
171
+ :shopzilla_category_id,
172
+ :show_default_donation_amount,
173
+ :sitemap_priority,
174
+ :soft_descriptor,
175
+ :specials_description,
176
+ :stock_description,
177
+ :stock_unit,
178
+ :store_description,
179
+ :store_detailed_description,
180
+ :store_display_image,
181
+ :store_display_name,
182
+ :store_display_thumbnail,
183
+ :store_item_template,
184
+ :subsidiary_list,
185
+ :supply_lot_sizing_method,
186
+ :supply_replenishment_method,
187
+ :supply_time_fence,
188
+ :supply_type,
189
+ :tax_schedule,
190
+ :total_value,
191
+ :track_landed_cost,
192
+ :transfer_price,
193
+ :unbuild_variance_account,
194
+ :units_type,
195
+ :upc_code,
196
+ :url_component,
197
+ :use_bins,
198
+ :use_component_yield,
199
+ :use_marginal_rates,
200
+ :vendor_name,
201
+ :vsoe_deferral,
202
+ :vsoe_delivered,
203
+ :vsoe_permit_discount,
204
+ :vsoe_price,
205
+ :vsoe_sop_group,
206
+ :weight,
207
+ :weight_unit,
208
+ :weight_units,
209
+ :wip_acct,
210
+ :wip_variance_acct
211
+
212
+ # accountingBookDetailList ItemAccountingBookDetailList
213
+ # binNumberList InventoryItemBinNumberList
214
+ # itemOptionsList ItemOptionsList
215
+ # itemShipMethodList RecordRefList
216
+ # itemVendorList ItemVendorList
217
+ # memberList ItemMemberList
218
+ # numbersList SerializedInventoryItemNumbersList
219
+ # presentationItemList PresentationItemList
220
+ # siteCategoryList SiteCategoryList
221
+ # translationsList TranslationList
222
+
223
+ field :custom_field_list, CustomFieldList
224
+
225
+ attr_reader :internal_id
226
+ attr_accessor :external_id
227
+
228
+ def initialize(attributes = {})
229
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
230
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
231
+ initialize_from_attributes_hash(attributes)
232
+ end
233
+
234
+ def self.search_class_name
235
+ "Item"
236
+ end
237
+ end
238
+ end
239
+ end