netsuite 0.8.12 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql-analysis.yml +3 -3
  3. data/HISTORY.md +21 -1
  4. data/lib/netsuite/actions/add.rb +2 -1
  5. data/lib/netsuite/actions/delete.rb +17 -0
  6. data/lib/netsuite/configuration.rb +16 -3
  7. data/lib/netsuite/records/assembly_item.rb +2 -1
  8. data/lib/netsuite/records/customer.rb +225 -23
  9. data/lib/netsuite/records/customer_refund.rb +1 -1
  10. data/lib/netsuite/records/description_item.rb +1 -1
  11. data/lib/netsuite/records/discount_item.rb +1 -1
  12. data/lib/netsuite/records/file.rb +1 -1
  13. data/lib/netsuite/records/gift_certificate_item.rb +1 -1
  14. data/lib/netsuite/records/item_availability.rb +46 -0
  15. data/lib/netsuite/records/item_fulfillment.rb +4 -1
  16. data/lib/netsuite/records/item_fulfillment_package_fed_ex.rb +28 -0
  17. data/lib/netsuite/records/item_fulfillment_package_fed_ex_list.rb +32 -0
  18. data/lib/netsuite/records/item_fulfillment_package_ups.rb +27 -0
  19. data/lib/netsuite/records/item_fulfillment_package_ups_list.rb +32 -0
  20. data/lib/netsuite/records/item_fulfillment_package_usps.rb +26 -0
  21. data/lib/netsuite/records/item_fulfillment_package_usps_list.rb +32 -0
  22. data/lib/netsuite/records/item_group.rb +1 -1
  23. data/lib/netsuite/records/kit_item.rb +1 -1
  24. data/lib/netsuite/records/lot_numbered_assembly_item.rb +1 -1
  25. data/lib/netsuite/records/non_inventory_purchase_item.rb +1 -1
  26. data/lib/netsuite/records/non_inventory_resale_item.rb +1 -1
  27. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  28. data/lib/netsuite/records/other_charge_sale_item.rb +1 -1
  29. data/lib/netsuite/records/payment_item.rb +1 -1
  30. data/lib/netsuite/records/sales_order.rb +1 -0
  31. data/lib/netsuite/records/sales_order_item.rb +2 -1
  32. data/lib/netsuite/records/serialized_assembly_item.rb +1 -1
  33. data/lib/netsuite/records/serialized_inventory_item.rb +1 -1
  34. data/lib/netsuite/records/service_resale_item.rb +1 -1
  35. data/lib/netsuite/records/service_sale_item.rb +1 -1
  36. data/lib/netsuite/records/{customer_subscription.rb → subscription.rb} +1 -1
  37. data/lib/netsuite/records/subscriptions_list.rb +10 -0
  38. data/lib/netsuite/records/subtotal_item.rb +1 -1
  39. data/lib/netsuite/support/sublist.rb +1 -1
  40. data/lib/netsuite/utilities.rb +20 -13
  41. data/lib/netsuite/version.rb +1 -1
  42. data/lib/netsuite.rb +9 -2
  43. data/netsuite.gemspec +3 -0
  44. data/spec/netsuite/actions/add_spec.rb +4 -2
  45. data/spec/netsuite/actions/delete_spec.rb +74 -14
  46. data/spec/netsuite/actions/get_select_value_spec.rb +43 -0
  47. data/spec/netsuite/configuration_spec.rb +35 -0
  48. data/spec/netsuite/records/customer_spec.rb +287 -20
  49. data/spec/netsuite/records/item_availability_spec.rb +59 -0
  50. data/spec/netsuite/records/item_fulfillment_package_fed_ex_list_spec.rb +27 -0
  51. data/spec/netsuite/records/item_fulfillment_package_ups_list_spec.rb +27 -0
  52. data/spec/netsuite/records/item_fulfillment_package_usps_list_spec.rb +27 -0
  53. data/spec/netsuite/records/sales_order_item_spec.rb +4 -3
  54. data/spec/netsuite/records/sales_order_spec.rb +17 -0
  55. data/spec/netsuite/records/{customer_subscription_spec.rb → subscription_spec.rb} +2 -2
  56. data/spec/netsuite/records/{customer_subscriptions_list_spec.rb → subscriptions_list_spec.rb} +2 -2
  57. data/spec/support/fixtures/add/add_invoice.xml +9 -5
  58. data/spec/support/fixtures/delete/delete_customer_error.xml +21 -0
  59. data/spec/support/fixtures/delete/delete_customer_multiple_errors.xml +25 -0
  60. data/spec/support/fixtures/get_item_availability/get_item_availability.xml +46 -0
  61. data/spec/support/fixtures/get_select_value/empty_result.xml +22 -0
  62. data/spec/support/fixtures/get_select_value/item_fulfillment_ship_method.xml +43 -0
  63. metadata +39 -10
  64. 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: 53e37d7468526bab26109064a50e3d393735e7fbb0758b56867de985e3230170
4
+ data.tar.gz: 318ed153297d54f2d19c821677e5d8bfffe89d7f688ea31aa324f93e1293f411
5
5
  SHA512:
6
- metadata.gz: 914d9e8b9effdfc2815de7907404d89b9ddf71b03ab08a78f95c762de470a63f5c51c4af138bc326cad2757ce0e5e076cbd0695330794c324d1e224d1ab04b17
7
- data.tar.gz: ba72989cd165db27b6420b4b09e93c2aec018bf27e10b516872068cebf20c2405dd17d4015f45beeb274f8d27bc1db7e8d0074795c03c8ae070a9e2ec08dd5b0
6
+ metadata.gz: 0df38ba22afe3361daace766b033e947f20962ab0ac6d0f336e706b2bbd06bfae091478c856ce9b33ff18f28f07a3e796a774d1a78a1fc6766348538b89afb0a
7
+ data.tar.gz: c3021d78e3718dd30332accc69de70e3f88df394e33648a49eb995d4d9a5177ad669c5fdb269485a75cd29c13a186c5b863e84a83dfee8eb88ea7c7ba4c9765e
@@ -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/HISTORY.md CHANGED
@@ -1,8 +1,28 @@
1
1
  ## Unreleased
2
2
 
3
- ### Added
4
3
 
4
+ ### Added
5
5
  ### Fixed
6
+ ### Breaking Changes
7
+
8
+ ## 0.9.0
9
+
10
+ ### Added
11
+
12
+ * Update `Customer` record fields/record refs for 2021.2. (#535)
13
+ 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`
14
+ The following were removed as `fields` since their sublist class is not yet implemented: `download_list`, `group_pricing_list`, `item_pricing_list`
15
+ * Add search-only fields to `Customer` (#535)
16
+ * Add `attach_file` action to `Customer` records (#544)
17
+ * Add `update` action to `File` records (#544)
18
+ * Expose `errors` after calls to `delete` action (#545)
19
+ * Add `update_list` action where missing on supported item records (#546)
20
+ * Ignore `after_submit_failed` status details (>= 2018.2) when collating errors in add action (#550)
21
+ * Add `NullFieldList` to `SalesOrder` (#552)
22
+ * Add thread safety to NetSuite configuration and utilities (#549)
23
+
24
+ ### Breaking Changes
25
+ * Rename `CustomerSubscriptionsList` to `SubscriptionsList` and `CustomerSubscription` to `Subscription` to match NetSuite naming (#535)
6
26
 
7
27
  ## 0.8.12
8
28
 
@@ -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,7 @@ module NetSuite
11
11
  end
12
12
 
13
13
  def attributes
14
- @attributes ||= {}
14
+ Thread.current[:netsuite_gem_attributes] ||= {}
15
15
  end
16
16
 
17
17
  def connection(params={}, credentials={})
@@ -27,6 +27,7 @@ module NetSuite
27
27
  logger: logger,
28
28
  log_level: log_level,
29
29
  log: !silent, # turn off logging entirely if configured
30
+ proxy: proxy,
30
31
  }.update(params))
31
32
  cache_wsdl(client)
32
33
  return client
@@ -50,11 +51,11 @@ module NetSuite
50
51
  end
51
52
 
52
53
  def wsdl_cache
53
- @wsdl_cache ||= {}
54
+ Thread.current[:netsuite_gem_wsdl_cache] ||= {}
54
55
  end
55
56
 
56
57
  def clear_wsdl_cache
57
- @wsdl_cache = {}
58
+ Thread.current[:netsuite_gem_wsdl_cache] = {}
58
59
  end
59
60
 
60
61
  def cached_wsdl
@@ -394,5 +395,17 @@ module NetSuite
394
395
  def log_level=(value)
395
396
  attributes[:log_level] = value
396
397
  end
398
+
399
+ def proxy=(proxy)
400
+ attributes[:proxy] = proxy
401
+ end
402
+
403
+ def proxy(proxy = nil)
404
+ if proxy
405
+ self.proxy = proxy
406
+ else
407
+ attributes[:proxy]
408
+ end
409
+ end
397
410
  end
398
411
  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
@@ -0,0 +1,32 @@
1
+ module NetSuite
2
+ module Records
3
+ class ItemFulfillmentPackageFedExList
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Namespaces::TranSales
7
+
8
+ fields :package_fed_ex
9
+
10
+ def initialize(attributes = {})
11
+ initialize_from_attributes_hash(attributes)
12
+ end
13
+
14
+ def package_fed_ex=(packages)
15
+ case packages
16
+ when Hash
17
+ self.packages << ItemFulfillmentPackageFedEx.new(packages)
18
+ when Array
19
+ packages.each { |package| self.packages << ItemFulfillmentPackageFedEx.new(package) }
20
+ end
21
+ end
22
+
23
+ def packages
24
+ @packages ||= []
25
+ end
26
+
27
+ def to_record
28
+ { "#{record_namespace}:packageFedEx" => packages.map(&:to_record) }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ module NetSuite
2
+ module Records
3
+ class ItemFulfillmentPackageUps
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Namespaces::TranSales
7
+
8
+ fields :additional_handling_ups, :cod_amount_ups, :cod_method_ups, :delivery_conf_ups, :insured_value_ups, :package_descr_ups,
9
+ :package_height_ups, :package_length_ups, :package_tracking_number_ups, :package_weight_ups, :package_width_ups,
10
+ :packaging_ups, :reference1_ups, :reference2_ups, :use_cod_ups
11
+
12
+
13
+ def initialize(attributes_or_record = {})
14
+ case attributes_or_record
15
+ when Hash
16
+ initialize_from_attributes_hash(attributes_or_record)
17
+ when self.class
18
+ initialize_from_record(attributes_or_record)
19
+ end
20
+ end
21
+
22
+ def initialize_from_record(record)
23
+ self.attributes = record.send(:attributes)
24
+ end
25
+ end
26
+ end
27
+ end