netsuite 0.8.12 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql-analysis.yml +3 -3
  3. data/Gemfile +7 -0
  4. data/HISTORY.md +24 -0
  5. data/README.md +26 -0
  6. data/lib/netsuite/actions/add.rb +2 -1
  7. data/lib/netsuite/actions/delete.rb +17 -0
  8. data/lib/netsuite/configuration.rb +37 -4
  9. data/lib/netsuite/records/assembly_item.rb +2 -1
  10. data/lib/netsuite/records/customer.rb +225 -23
  11. data/lib/netsuite/records/customer_refund.rb +1 -1
  12. data/lib/netsuite/records/description_item.rb +1 -1
  13. data/lib/netsuite/records/discount_item.rb +1 -1
  14. data/lib/netsuite/records/file.rb +1 -1
  15. data/lib/netsuite/records/gift_certificate_item.rb +1 -1
  16. data/lib/netsuite/records/item_availability.rb +46 -0
  17. data/lib/netsuite/records/item_fulfillment.rb +4 -1
  18. data/lib/netsuite/records/item_fulfillment_package_fed_ex.rb +28 -0
  19. data/lib/netsuite/records/item_fulfillment_package_fed_ex_list.rb +32 -0
  20. data/lib/netsuite/records/item_fulfillment_package_ups.rb +27 -0
  21. data/lib/netsuite/records/item_fulfillment_package_ups_list.rb +32 -0
  22. data/lib/netsuite/records/item_fulfillment_package_usps.rb +26 -0
  23. data/lib/netsuite/records/item_fulfillment_package_usps_list.rb +32 -0
  24. data/lib/netsuite/records/item_group.rb +1 -1
  25. data/lib/netsuite/records/kit_item.rb +1 -1
  26. data/lib/netsuite/records/lot_numbered_assembly_item.rb +1 -1
  27. data/lib/netsuite/records/non_inventory_purchase_item.rb +1 -1
  28. data/lib/netsuite/records/non_inventory_resale_item.rb +1 -1
  29. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  30. data/lib/netsuite/records/other_charge_sale_item.rb +1 -1
  31. data/lib/netsuite/records/payment_item.rb +1 -1
  32. data/lib/netsuite/records/sales_order.rb +1 -0
  33. data/lib/netsuite/records/sales_order_item.rb +2 -1
  34. data/lib/netsuite/records/serialized_assembly_item.rb +1 -1
  35. data/lib/netsuite/records/serialized_inventory_item.rb +1 -1
  36. data/lib/netsuite/records/service_resale_item.rb +1 -1
  37. data/lib/netsuite/records/service_sale_item.rb +1 -1
  38. data/lib/netsuite/records/{customer_subscription.rb → subscription.rb} +1 -1
  39. data/lib/netsuite/records/subscriptions_list.rb +10 -0
  40. data/lib/netsuite/records/subtotal_item.rb +1 -1
  41. data/lib/netsuite/support/sublist.rb +1 -1
  42. data/lib/netsuite/utilities.rb +35 -13
  43. data/lib/netsuite/version.rb +1 -1
  44. data/lib/netsuite.rb +9 -2
  45. data/netsuite.gemspec +6 -3
  46. data/spec/netsuite/actions/add_spec.rb +4 -2
  47. data/spec/netsuite/actions/delete_spec.rb +74 -14
  48. data/spec/netsuite/actions/get_select_value_spec.rb +43 -0
  49. data/spec/netsuite/configuration_spec.rb +62 -3
  50. data/spec/netsuite/records/customer_spec.rb +287 -20
  51. data/spec/netsuite/records/item_availability_spec.rb +59 -0
  52. data/spec/netsuite/records/item_fulfillment_package_fed_ex_list_spec.rb +27 -0
  53. data/spec/netsuite/records/item_fulfillment_package_ups_list_spec.rb +27 -0
  54. data/spec/netsuite/records/item_fulfillment_package_usps_list_spec.rb +27 -0
  55. data/spec/netsuite/records/sales_order_item_spec.rb +4 -3
  56. data/spec/netsuite/records/sales_order_spec.rb +17 -0
  57. data/spec/netsuite/records/{customer_subscription_spec.rb → subscription_spec.rb} +2 -2
  58. data/spec/netsuite/records/{customer_subscriptions_list_spec.rb → subscriptions_list_spec.rb} +2 -2
  59. data/spec/support/fixtures/add/add_invoice.xml +9 -5
  60. data/spec/support/fixtures/delete/delete_customer_error.xml +21 -0
  61. data/spec/support/fixtures/delete/delete_customer_multiple_errors.xml +25 -0
  62. data/spec/support/fixtures/get_item_availability/get_item_availability.xml +46 -0
  63. data/spec/support/fixtures/get_select_value/empty_result.xml +22 -0
  64. data/spec/support/fixtures/get_select_value/item_fulfillment_ship_method.xml +43 -0
  65. metadata +46 -9
  66. data/lib/netsuite/records/customer_subscriptions_list.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f61f6e044bec13cb11de64e320044febb52108b63214d28cb6446ae98e172f9
4
- data.tar.gz: 93a84083918815d7407a1464a4462a448f35751a37d1972cc6ff35b518a17ff7
3
+ metadata.gz: 3429c5cb6575fd1e62738eaf1270a0c585d82bc302975e435491af2a8a5dd7b5
4
+ data.tar.gz: 41a481e39865f46c5a0b8d61c3ab44e4c547ccfb8cc2de4c9621634ec331eb2e
5
5
  SHA512:
6
- metadata.gz: 914d9e8b9effdfc2815de7907404d89b9ddf71b03ab08a78f95c762de470a63f5c51c4af138bc326cad2757ce0e5e076cbd0695330794c324d1e224d1ab04b17
7
- data.tar.gz: ba72989cd165db27b6420b4b09e93c2aec018bf27e10b516872068cebf20c2405dd17d4015f45beeb274f8d27bc1db7e8d0074795c03c8ae070a9e2ec08dd5b0
6
+ metadata.gz: df1a9202d4ccdfaff26031b7f1ae957403d374e90115f063ac107e0f59fc890a4b254bc559e06eb87a2768575827bde20917bf00ae4986e52ad48acf0043c45f
7
+ data.tar.gz: 07de35d4a530d8decc1344a0ed6cdf1d198260bd3ae84dae45b00e2324837172062fc071c0f3a05bf685423e8a0b4da910e865e7cc00f878098ec125c7dcc5c7
@@ -42,7 +42,7 @@ jobs:
42
42
 
43
43
  # Initializes the CodeQL tools for scanning.
44
44
  - name: Initialize CodeQL
45
- uses: github/codeql-action/init@v1
45
+ uses: github/codeql-action/init@v2
46
46
  with:
47
47
  languages: ${{ matrix.language }}
48
48
  # If you wish to specify custom queries, you can do so here or in a config file.
@@ -53,7 +53,7 @@ jobs:
53
53
  # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54
54
  # If this step fails, then you should remove it and run the build manually (see below)
55
55
  - name: Autobuild
56
- uses: github/codeql-action/autobuild@v1
56
+ uses: github/codeql-action/autobuild@v2
57
57
 
58
58
  # ℹ️ Command-line programs to run using the OS shell.
59
59
  # 📚 https://git.io/JvXDl
@@ -67,4 +67,4 @@ jobs:
67
67
  # make release
68
68
 
69
69
  - name: Perform CodeQL Analysis
70
- uses: github/codeql-action/analyze@v1
70
+ uses: github/codeql-action/analyze@v2
data/Gemfile CHANGED
@@ -11,3 +11,10 @@ if ENV.fetch('BUNDLE_TZINFO', 'false') == 'true'
11
11
  # optional dependency for more accurate timezone conversion
12
12
  gem 'tzinfo', '>= 1.2.5'
13
13
  end
14
+
15
+ if RUBY_VERSION >= '3.1.0'
16
+ # Savon v2.13 adds a dependency on mail, which has an implicit dependency on
17
+ # net-smtp. Ruby 3.1 removed net-smtp as a default gem. mail v2.8.0.rc1 is the
18
+ # first to make that dependency explicit to support Ruby 3.1.
19
+ gem 'mail', '>= 2.8.0.rc1'
20
+ end
data/HISTORY.md CHANGED
@@ -1,8 +1,32 @@
1
1
  ## Unreleased
2
2
 
3
+
3
4
  ### Added
5
+ * Add `Configuration#multi_tenant!` for opting into multi-tentant support where configuration/caching is per-thread (#556)
4
6
 
5
7
  ### Fixed
8
+ * Avoid Savon version `2.13.0` to prevent generating invalid envelopes. (#558, #563)
9
+
10
+ ### Breaking Changes
11
+
12
+ ## 0.9.0
13
+
14
+ ### Added
15
+
16
+ * Update `Customer` record fields/record refs for 2021.2. (#535)
17
+ The following were moved from `fields` to `record_refs`: `buying_reason`, `buying_time_frame`, `campaign_category`, `image`, `opening_balance_account`, `pref_cc_processor`, `representing_subsidiary`, `sales_group`, `sales_readiness`
18
+ The following were removed as `fields` since their sublist class is not yet implemented: `download_list`, `group_pricing_list`, `item_pricing_list`
19
+ * Add search-only fields to `Customer` (#535)
20
+ * Add `attach_file` action to `Customer` records (#544)
21
+ * Add `update` action to `File` records (#544)
22
+ * Expose `errors` after calls to `delete` action (#545)
23
+ * Add `update_list` action where missing on supported item records (#546)
24
+ * Ignore `after_submit_failed` status details (>= 2018.2) when collating errors in add action (#550)
25
+ * Add `NullFieldList` to `SalesOrder` (#552)
26
+ * Add thread safety to NetSuite configuration and utilities (#549)
27
+
28
+ ### Breaking Changes
29
+ * Rename `CustomerSubscriptionsList` to `SubscriptionsList` and `CustomerSubscription` to `Subscription` to match NetSuite naming (#535)
6
30
 
7
31
  ## 0.8.12
8
32
 
data/README.md CHANGED
@@ -159,6 +159,32 @@ NetSuite.configure do
159
159
  end
160
160
  ```
161
161
 
162
+ ### Multi-Tenancy
163
+
164
+ If you're interacting with multiple NetSuite accounts, each in separate threads, you can enable multi-tenancy to prevent your configuration and caches from being shared between threads.
165
+
166
+ From your main thread, you'd want to enable multi-tenancy:
167
+
168
+ ```ruby
169
+ NetSuite.configure do
170
+ multi_tentant!
171
+ end
172
+ ```
173
+
174
+ Note that `multi_tenant!` is a special configuration option which is _not_ effected by `reset!`.
175
+
176
+ Then in each child thread, you'd perform any configuration specific to the NetSuite account you're interacting with for that thread, all of which will be specific to that thread only:
177
+
178
+ ```ruby
179
+ NetSuite.configure do
180
+ reset!
181
+
182
+ account ENV['NETSUITE_ACCOUNT']
183
+
184
+ # The rest of your usual configuration...
185
+ end
186
+ ```
187
+
162
188
  # Usage
163
189
 
164
190
  ## CRUD Operations
@@ -70,8 +70,9 @@ module NetSuite
70
70
  error_obj = response_hash[:status][:status_detail]
71
71
  error_obj = [error_obj] if error_obj.class == Hash
72
72
  error_obj.map do |error|
73
+ next if error.keys == [:after_submit_failed]
73
74
  NetSuite::Error.new(error)
74
- end
75
+ end.compact
75
76
  end
76
77
 
77
78
  module Support
@@ -65,6 +65,20 @@ module NetSuite
65
65
  @response_body ||= response_hash[:base_ref]
66
66
  end
67
67
 
68
+ def response_errors
69
+ if response_hash[:status] && response_hash[:status][:status_detail]
70
+ @response_errors ||= errors
71
+ end
72
+ end
73
+
74
+ def errors
75
+ error_obj = response_hash[:status][:status_detail]
76
+ error_obj = [error_obj] if error_obj.class == Hash
77
+ error_obj.map do |error|
78
+ NetSuite::Error.new(error)
79
+ end
80
+ end
81
+
68
82
  module Support
69
83
  def delete(options = {}, credentials={})
70
84
  response = if options.empty?
@@ -72,6 +86,9 @@ module NetSuite
72
86
  else
73
87
  NetSuite::Actions::Delete.call([self, options], credentials)
74
88
  end
89
+
90
+ @errors = response.errors
91
+
75
92
  response.success?
76
93
  end
77
94
  end
@@ -11,7 +11,11 @@ module NetSuite
11
11
  end
12
12
 
13
13
  def attributes
14
- @attributes ||= {}
14
+ if multi_tenant?
15
+ Thread.current[:netsuite_gem_attributes] ||= {}
16
+ else
17
+ @attributes ||= {}
18
+ end
15
19
  end
16
20
 
17
21
  def connection(params={}, credentials={})
@@ -27,6 +31,7 @@ module NetSuite
27
31
  logger: logger,
28
32
  log_level: log_level,
29
33
  log: !silent, # turn off logging entirely if configured
34
+ proxy: proxy,
30
35
  }.update(params))
31
36
  cache_wsdl(client)
32
37
  return client
@@ -50,11 +55,19 @@ module NetSuite
50
55
  end
51
56
 
52
57
  def wsdl_cache
53
- @wsdl_cache ||= {}
58
+ if multi_tenant?
59
+ Thread.current[:netsuite_gem_wsdl_cache] ||= {}
60
+ else
61
+ @wsdl_cache ||= {}
62
+ end
54
63
  end
55
64
 
56
65
  def clear_wsdl_cache
57
- @wsdl_cache = {}
66
+ if multi_tenant?
67
+ Thread.current[:netsuite_gem_wsdl_cache] = {}
68
+ else
69
+ @wsdl_cache = {}
70
+ end
58
71
  end
59
72
 
60
73
  def cached_wsdl
@@ -82,7 +95,7 @@ module NetSuite
82
95
  if version
83
96
  self.api_version = version
84
97
  else
85
- attributes[:api_version] ||= '2015_1'
98
+ attributes[:api_version] ||= '2016_2'
86
99
  end
87
100
  end
88
101
 
@@ -394,5 +407,25 @@ module NetSuite
394
407
  def log_level=(value)
395
408
  attributes[:log_level] = value
396
409
  end
410
+
411
+ def proxy=(proxy)
412
+ attributes[:proxy] = proxy
413
+ end
414
+
415
+ def proxy(proxy = nil)
416
+ if proxy
417
+ self.proxy = proxy
418
+ else
419
+ attributes[:proxy]
420
+ end
421
+ end
422
+
423
+ def multi_tenant!
424
+ @multi_tenant = true
425
+ end
426
+
427
+ def multi_tenant?
428
+ @multi_tenant
429
+ end
397
430
  end
398
431
  end
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
- actions :get, :get_deleted, :get_list, :get_select_value, :add, :delete, :update, :upsert, :upsert_list, :search
10
+ actions :get, :get_deleted, :get_list, :get_select_value, :add, :delete, :update, :update_list, :upsert, :upsert_list, :search
11
11
 
12
12
  fields :auto_lead_time, :auto_preferred_stock_level, :auto_reorder_point, :available_to_partners, :average_cost, :build_entire_assembly,
13
13
  :copy_description, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :cost_units, :costing_method,
@@ -47,6 +47,7 @@ module NetSuite
47
47
  field :pricing_matrix, PricingMatrix
48
48
  field :member_list, MemberList
49
49
  field :subsidiary_list, RecordRefList
50
+ field :translations_list, TranslationList
50
51
 
51
52
  attr_reader :internal_id
52
53
  attr_accessor :external_id
@@ -7,40 +7,242 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListRel
9
9
 
10
- actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :delete_list, :search
10
+ actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :delete_list, :search, :attach_file
11
11
 
12
12
  # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/customer.html
13
13
 
14
- fields :account_number, :aging, :alt_email, :alt_name, :alt_phone, :bill_pay,
15
- :buying_reason, :buying_time_frame, :campaign_category, :click_stream, :comments, :company_name,
16
- :consol_aging, :consol_days_overdue, :contrib_pct, :credit_hold_override,
17
- :credit_limit, :date_created, :days_overdue, :default_address,
18
- :download_list, :email, :email_preference, :email_transactions, :end_date, :entity_id,
19
- :estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
20
- :group_pricing_list, :home_phone, :image, :is_budget_approved, :is_inactive, :is_person, :item_pricing_list, :keywords,
21
- :language, :last_modified_date, :last_name, :last_page_visited, :last_visit, :middle_name, :mobile_phone,
22
- :opening_balance, :opening_balance_account, :opening_balance_date,
23
- :password, :password2, :phone, :phonetic_name, :pref_cc_processor, :print_on_check_as,
24
- :print_transactions, :referrer, :reminder_days, :representing_subsidiary, :require_pwd_change, :resale_number,
25
- :sales_group, :sales_readiness, :salutation, :send_email, :ship_complete,
26
- :stage, :start_date, :sync_partner_teams, :tax_exempt, :taxable,
27
- :third_party_acct, :third_party_country, :third_party_zipcode, :title, :url,
28
- :vat_reg_number, :visits, :web_lead
29
-
30
- field :addressbook_list, CustomerAddressbookList
31
- field :credit_cards_list, CustomerCreditCardsList
32
- field :custom_field_list, CustomFieldList
14
+ fields :account_number,
15
+ :aging,
16
+ :aging1,
17
+ :aging2,
18
+ :aging3,
19
+ :aging4,
20
+ :alcohol_recipient_type,
21
+ :alt_email,
22
+ :alt_name,
23
+ :alt_phone,
24
+ :bill_pay,
25
+ :click_stream,
26
+ :comments,
27
+ :company_name,
28
+ :consol_aging,
29
+ :consol_aging1,
30
+ :consol_aging2,
31
+ :consol_aging3,
32
+ :consol_aging4,
33
+ :consol_days_overdue,
34
+ :contrib_pct,
35
+ :credit_hold_override,
36
+ :credit_limit,
37
+ :date_created,
38
+ :days_overdue,
39
+ :default_address,
40
+ :default_order_priority,
41
+ :display_symbol,
42
+ :email,
43
+ :email_preference,
44
+ :email_transactions,
45
+ :end_date,
46
+ :entity_id,
47
+ :estimated_budget,
48
+ :fax,
49
+ :fax_transactions,
50
+ :first_name,
51
+ :first_visit,
52
+ :give_access,
53
+ :global_subscription_status,
54
+ :home_phone,
55
+ :is_budget_approved,
56
+ :is_inactive,
57
+ :is_person,
58
+ :keywords,
59
+ :language,
60
+ :last_modified_date,
61
+ :last_name,
62
+ :last_page_visited,
63
+ :last_visit,
64
+ :middle_name,
65
+ :mobile_phone,
66
+ :monthly_closing,
67
+ :negative_number_format,
68
+ :number_format,
69
+ :opening_balance,
70
+ :opening_balance_date,
71
+ :override_currency_format,
72
+ :password,
73
+ :password2,
74
+ :phone,
75
+ :phonetic_name,
76
+ :print_on_check_as,
77
+ :print_transactions,
78
+ :referrer,
79
+ :reminder_days,
80
+ :require_pwd_change,
81
+ :resale_number,
82
+ :salutation,
83
+ :send_email,
84
+ :ship_complete,
85
+ :stage,
86
+ :start_date,
87
+ :symbol_placement,
88
+ :sync_partner_teams,
89
+ :taxable,
90
+ :tax_exempt,
91
+ :third_party_acct,
92
+ :third_party_country,
93
+ :third_party_zipcode,
94
+ :title,
95
+ :url,
96
+ :vat_reg_number,
97
+ :visits,
98
+ :web_lead
99
+
100
+ field :addressbook_list, CustomerAddressbookList
33
101
  field :contact_roles_list, ContactAccessRolesList
102
+ field :credit_cards_list, CustomerCreditCardsList
34
103
  field :currency_list, CustomerCurrencyList
104
+ field :custom_field_list, CustomFieldList
105
+ # field :download_list, CustomerDownloadList # TODO Implement me
106
+ # field :group_pricing_list, CustomerGroupPricingList # TODO: Implement me
107
+ # field :item_pricing_list, CustomerItemPricingList # TODO: Implement me
35
108
  field :partners_list, CustomerPartnersList
36
- field :subscriptions_list, CustomerSubscriptionsList
37
109
  field :sales_team_list, CustomerSalesTeamList
110
+ field :subscriptions_list, SubscriptionsList
111
+ # field :tax_registration_list, CustomerTaxRegistrationList # TODO: Implement me
38
112
 
39
113
  read_only_fields :balance, :consol_balance, :deposit_balance, :consol_deposit_balance, :overdue_balance,
40
114
  :consol_overdue_balance, :unbilled_orders, :consol_unbilled_orders
41
115
 
42
- record_refs :access_role, :custom_form, :currency, :entity_status, :partner, :category, :lead_source,
43
- :price_level, :sales_rep, :subsidiary, :terms, :parent, :territory, :tax_item, :shipping_item, :receivables_account
116
+ search_only_fields :address,
117
+ :address1,
118
+ :address2,
119
+ :address3,
120
+ :addressee,
121
+ :address_internal_id,
122
+ :address_label,
123
+ :address_phone,
124
+ :alt_contact,
125
+ :assigned_site,
126
+ :assigned_site_id,
127
+ :attention,
128
+ :available_offline,
129
+ :bill_address,
130
+ :bill_address1,
131
+ :bill_address2,
132
+ :bill_address3,
133
+ :bill_addressee,
134
+ :bill_attention,
135
+ :bill_city,
136
+ :bill_country,
137
+ :bill_country_code,
138
+ :bill_phone,
139
+ :bill_state,
140
+ :bill_zip_code,
141
+ :cc_customer_code,
142
+ :cc_default,
143
+ :cc_exp_date,
144
+ :cc_holder_name,
145
+ :cc_internal_id,
146
+ :cc_number,
147
+ :cc_state,
148
+ :cc_state_from,
149
+ :cc_type,
150
+ :city,
151
+ :contact,
152
+ :contribution,
153
+ :contribution_primary,
154
+ :conversion_date,
155
+ :country,
156
+ :country_code,
157
+ :credit_hold,
158
+ :date_closed,
159
+ :entity_number,
160
+ :explicit_conversion,
161
+ :first_order_date,
162
+ :first_sale_date,
163
+ :fx_balance,
164
+ :fx_consol_balance,
165
+ :fx_consol_unbilled_orders,
166
+ :fx_unbilled_orders,
167
+ :group_pricing_level,
168
+ :has_duplicates,
169
+ :is_default_billing,
170
+ :is_default_shipping,
171
+ :is_ship_address,
172
+ :item_pricing_level,
173
+ :item_pricing_unit_price,
174
+ :job_end_date,
175
+ :job_projected_end,
176
+ :job_start_date,
177
+ :job_type,
178
+ :last_order_date,
179
+ :last_sale_date,
180
+ :lead_date,
181
+ :level,
182
+ :manual_credit_hold,
183
+ :on_credit_hold,
184
+ :partner_contribution,
185
+ :partner_role,
186
+ :partner_team_member,
187
+ :pec,
188
+ :permission,
189
+ :pricing_group,
190
+ :pricing_item,
191
+ :prospect_date,
192
+ :role,
193
+ :sales_team_member,
194
+ :sales_team_role,
195
+ :ship_address,
196
+ :ship_address1,
197
+ :ship_address2,
198
+ :ship_address3,
199
+ :ship_addressee,
200
+ :ship_attention,
201
+ :ship_city,
202
+ :ship_country,
203
+ :ship_country_code,
204
+ :ship_phone,
205
+ :ship_state,
206
+ :ship_zip,
207
+ :source_site,
208
+ :source_site_id,
209
+ :state,
210
+ :subscription,
211
+ :subscription_date,
212
+ :subscription_status,
213
+ :zip_code
214
+
215
+ record_refs :access_role,
216
+ :assigned_web_site,
217
+ :buying_reason,
218
+ :buying_time_frame,
219
+ :campaign_category,
220
+ :category,
221
+ :currency,
222
+ :custom_form,
223
+ :default_allocation_strategy,
224
+ :default_tax_reg,
225
+ :dr_account,
226
+ :entity_status,
227
+ :fx_account,
228
+ :image,
229
+ :lead_source,
230
+ :opening_balance_account,
231
+ :parent,
232
+ :partner,
233
+ :pref_cc_processor,
234
+ :price_level,
235
+ :receivables_account,
236
+ :representing_subsidiary,
237
+ :sales_group,
238
+ :sales_readiness,
239
+ :sales_rep,
240
+ :shipping_item,
241
+ :source_web_site,
242
+ :subsidiary,
243
+ :tax_item,
244
+ :terms,
245
+ :territory
44
246
 
45
247
  attr_reader :internal_id
46
248
  attr_accessor :external_id
@@ -20,7 +20,7 @@ module NetSuite
20
20
  read_only_fields :balance, :total
21
21
 
22
22
  record_refs :account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass,
23
- :location, :payment_method, :posting_period, :subsidiary, :void_journal, :currency
23
+ :location, :payment_method, :posting_period, :subsidiary, :void_journal, :currency, :payment_option
24
24
 
25
25
  attr_reader :internal_id
26
26
  attr_accessor :external_id
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
- actions :get, :get_deleted, :get_list, :add, :delete, :search, :update, :upsert
10
+ actions :get, :get_deleted, :get_list, :add, :delete, :search, :update, :update_list, :upsert
11
11
 
12
12
  fields :available_to_partners, :created_date, :description, :display_name, :include_children, :is_inactive, :item_id, :last_modified_date
13
13
 
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
- actions :get, :get_deleted, :get_list, :add, :update, :delete, :search, :upsert
10
+ actions :get, :get_deleted, :get_list, :add, :update, :update_list, :delete, :search, :upsert
11
11
 
12
12
  fields :available_to_partners, :created_date, :description, :display_name, :include_children, :is_inactive, :is_pre_tax,
13
13
  :item_id, :last_modified_date, :non_posting, :rate, :upc_code, :vendor_name
@@ -9,7 +9,7 @@ module NetSuite
9
9
 
10
10
  # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/file.html
11
11
 
12
- actions :get, :add, :delete, :search, :get_list
12
+ actions :get, :add, :delete, :search, :get_list, :update
13
13
 
14
14
  fields :content, :description, :name, :media_type_name, :file_type, :text_file_encoding, :created_date, :last_modified_date
15
15
 
@@ -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, :update_list, :upsert
11
11
 
12
12
  fields :auth_codes_list,
13
13
  :available_to_partners,
@@ -0,0 +1,46 @@
1
+ module NetSuite
2
+ module Records
3
+ class ItemAvailability
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+
8
+ field :item, InventoryItem
9
+ field :location_id, Location
10
+ alias_method :location, :location_id
11
+
12
+ field :quantity_on_hand
13
+ field :on_hand_value_mli
14
+ field :reorder_point
15
+ field :quantity_on_order
16
+ field :quantity_committed
17
+ field :quantity_available
18
+
19
+ def self.get_item_availability(ref_list, credentials={})
20
+ connection = NetSuite::Configuration.connection({}, credentials)
21
+ response = connection.call :get_item_availability, message: {
22
+ "platformMsgs:itemAvailabilityFilter" => {
23
+ "platformCore:item" => ref_list.to_record
24
+ }
25
+ }
26
+ return false unless response.success?
27
+
28
+ result = response.body[:get_item_availability_response][:get_item_availability_result]
29
+ unless result[:status][:@is_success] == "true"
30
+ return false
31
+ end
32
+ if result[:item_availability_list]
33
+ result[:item_availability_list][:item_availability].map do |row|
34
+ NetSuite::Records::ItemAvailability.new(row)
35
+ end
36
+ else
37
+ []
38
+ end
39
+ end
40
+
41
+ def initialize(attributes = {})
42
+ initialize_from_attributes_hash(attributes)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -9,7 +9,7 @@ module NetSuite
9
9
 
10
10
  actions :get, :get_list, :add, :initialize, :update, :delete, :search, :upsert, :upsert_list
11
11
 
12
- fields :tran_date, :tran_id, :shipping_cost, :memo, :ship_company, :ship_attention, :ship_addr1,
12
+ fields :created_from_ship_group, :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
14
  :ship_status, :last_modified_date, :created_date, :status
15
15
 
@@ -26,6 +26,9 @@ module NetSuite
26
26
 
27
27
  field :item_list, ItemFulfillmentItemList
28
28
  field :package_list, ItemFulfillmentPackageList
29
+ field :package_fed_ex_list, ItemFulfillmentPackageFedExList
30
+ field :package_ups_list, ItemFulfillmentPackageUpsList
31
+ field :package_usps_list, ItemFulfillmentPackageUspsList
29
32
  field :custom_field_list, CustomFieldList
30
33
 
31
34
  attr_reader :internal_id
@@ -0,0 +1,28 @@
1
+ module NetSuite
2
+ module Records
3
+ class ItemFulfillmentPackageFedEx
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Namespaces::TranSales
7
+
8
+ fields :authorization_number_fed_ex, :cod_amount_fed_ex, :dry_ice_weight_fed_ex, :insured_value_fed_ex, :is_alcohol_fed_ex,
9
+ :is_non_haz_lithium_fed_ex, :is_non_standard_container_fed_ex, :package_height_fed_ex, :package_length_fed_ex,
10
+ :package_tracking_number_fed_ex, :package_weight_fed_ex, :package_width_fed_ex, :priority_alert_content_fed_ex,
11
+ :reference1_fed_ex, :signature_releasefed_ex, :use_cod_fed_ex, :use_insured_value_fed_ex
12
+
13
+
14
+ def initialize(attributes_or_record = {})
15
+ case attributes_or_record
16
+ when Hash
17
+ initialize_from_attributes_hash(attributes_or_record)
18
+ when self.class
19
+ initialize_from_record(attributes_or_record)
20
+ end
21
+ end
22
+
23
+ def initialize_from_record(record)
24
+ self.attributes = record.send(:attributes)
25
+ end
26
+ end
27
+ end
28
+ end