netsuite 0.8.2 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/.tool-versions +1 -0
  5. data/Gemfile +4 -3
  6. data/README.md +129 -38
  7. data/circle.yml +36 -13
  8. data/lib/netsuite.rb +40 -19
  9. data/lib/netsuite/actions/login.rb +20 -1
  10. data/lib/netsuite/actions/search.rb +1 -6
  11. data/lib/netsuite/actions/update.rb +6 -2
  12. data/lib/netsuite/actions/update_list.rb +109 -0
  13. data/lib/netsuite/actions/upsert.rb +2 -0
  14. data/lib/netsuite/configuration.rb +34 -4
  15. data/lib/netsuite/errors.rb +1 -0
  16. data/lib/netsuite/records/accounting_period.rb +2 -2
  17. data/lib/netsuite/records/assembly_build.rb +4 -1
  18. data/lib/netsuite/records/assembly_item.rb +1 -0
  19. data/lib/netsuite/records/assembly_unbuild.rb +3 -0
  20. data/lib/netsuite/records/bin_number.rb +18 -0
  21. data/lib/netsuite/records/bin_number_list.rb +1 -20
  22. data/lib/netsuite/records/bin_transfer.rb +38 -0
  23. data/lib/netsuite/records/bin_transfer_inventory.rb +20 -0
  24. data/lib/netsuite/records/bin_transfer_inventory_list.rb +10 -0
  25. data/lib/netsuite/records/cash_refund_item.rb +1 -1
  26. data/lib/netsuite/records/classification.rb +5 -2
  27. data/lib/netsuite/records/contact.rb +1 -1
  28. data/lib/netsuite/records/credit_memo.rb +1 -1
  29. data/lib/netsuite/records/custom_field_list.rb +10 -2
  30. data/lib/netsuite/records/custom_record.rb +3 -3
  31. data/lib/netsuite/records/custom_record_ref.rb +1 -0
  32. data/lib/netsuite/records/customer.rb +5 -4
  33. data/lib/netsuite/records/customer_credit_cards.rb +36 -0
  34. data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
  35. data/lib/netsuite/records/customer_deposit.rb +9 -6
  36. data/lib/netsuite/records/customer_payment.rb +6 -2
  37. data/lib/netsuite/records/customer_payment_credit.rb +17 -0
  38. data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
  39. data/lib/netsuite/records/customer_sales_team.rb +24 -0
  40. data/lib/netsuite/records/customer_sales_team_list.rb +9 -0
  41. data/lib/netsuite/records/customer_status.rb +29 -0
  42. data/lib/netsuite/records/customer_subscription.rb +18 -0
  43. data/lib/netsuite/records/customer_subscriptions_list.rb +10 -0
  44. data/lib/netsuite/records/employee.rb +1 -1
  45. data/lib/netsuite/records/entity_custom_field.rb +53 -0
  46. data/lib/netsuite/records/estimate.rb +42 -0
  47. data/lib/netsuite/records/estimate_item.rb +40 -0
  48. data/lib/netsuite/records/estimate_item_list.rb +11 -0
  49. data/lib/netsuite/records/inbound_shipment.rb +33 -0
  50. data/lib/netsuite/records/inbound_shipment_item.rb +39 -0
  51. data/lib/netsuite/records/inbound_shipment_item_list.rb +11 -0
  52. data/lib/netsuite/records/inter_company_journal_entry.rb +48 -0
  53. data/lib/netsuite/records/inter_company_journal_entry_line.rb +28 -0
  54. data/lib/netsuite/records/inter_company_journal_entry_line_list.rb +14 -0
  55. data/lib/netsuite/records/inventory_item.rb +3 -2
  56. data/lib/netsuite/records/invoice.rb +1 -1
  57. data/lib/netsuite/records/item_fulfillment.rb +1 -1
  58. data/lib/netsuite/records/lot_numbered_inventory_item.rb +116 -0
  59. data/lib/netsuite/records/matrix_option_list.rb +12 -4
  60. data/lib/netsuite/records/message.rb +30 -0
  61. data/lib/netsuite/records/non_inventory_resale_item.rb +3 -2
  62. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  63. data/lib/netsuite/records/other_charge_sale_item.rb +2 -2
  64. data/lib/netsuite/records/partner.rb +7 -5
  65. data/lib/netsuite/records/price.rb +17 -0
  66. data/lib/netsuite/records/price_level.rb +26 -0
  67. data/lib/netsuite/records/price_list.rb +9 -0
  68. data/lib/netsuite/records/pricing.rb +20 -0
  69. data/lib/netsuite/records/pricing_matrix.rb +2 -2
  70. data/lib/netsuite/records/promotions.rb +26 -0
  71. data/lib/netsuite/records/promotions_list.rb +9 -0
  72. data/lib/netsuite/records/return_authorization_item.rb +1 -1
  73. data/lib/netsuite/records/sales_order.rb +1 -0
  74. data/lib/netsuite/records/sales_order_item.rb +12 -5
  75. data/lib/netsuite/records/sales_role.rb +26 -0
  76. data/lib/netsuite/records/sales_tax_item.rb +3 -1
  77. data/lib/netsuite/records/serialized_assembly_item.rb +239 -0
  78. data/lib/netsuite/records/service_resale_item.rb +1 -1
  79. data/lib/netsuite/records/service_sale_item.rb +1 -1
  80. data/lib/netsuite/records/support_case.rb +1 -1
  81. data/lib/netsuite/records/support_case_type.rb +26 -0
  82. data/lib/netsuite/records/tax_group.rb +2 -2
  83. data/lib/netsuite/records/transaction_body_custom_field.rb +61 -0
  84. data/lib/netsuite/records/transaction_column_custom_field.rb +59 -0
  85. data/lib/netsuite/records/vendor.rb +2 -1
  86. data/lib/netsuite/records/vendor_credit.rb +2 -0
  87. data/lib/netsuite/records/vendor_currency.rb +26 -0
  88. data/lib/netsuite/records/vendor_currency_list.rb +9 -0
  89. data/lib/netsuite/records/work_order.rb +8 -0
  90. data/lib/netsuite/support/actions.rb +2 -0
  91. data/lib/netsuite/support/country.rb +27 -15
  92. data/lib/netsuite/support/search_result.rb +20 -5
  93. data/lib/netsuite/utilities.rb +83 -21
  94. data/lib/netsuite/version.rb +1 -1
  95. data/netsuite.gemspec +4 -3
  96. data/spec/netsuite/actions/login_spec.rb +23 -0
  97. data/spec/netsuite/actions/update_list_spec.rb +107 -0
  98. data/spec/netsuite/actions/update_spec.rb +42 -0
  99. data/spec/netsuite/configuration_spec.rb +111 -6
  100. data/spec/netsuite/records/address_spec.rb +10 -0
  101. data/spec/netsuite/records/basic_record_spec.rb +19 -2
  102. data/spec/netsuite/records/bin_number_spec.rb +23 -0
  103. data/spec/netsuite/records/classification_spec.rb +10 -1
  104. data/spec/netsuite/records/custom_field_list_spec.rb +39 -4
  105. data/spec/netsuite/records/custom_record_spec.rb +1 -1
  106. data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
  107. data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
  108. data/spec/netsuite/records/customer_payment_spec.rb +1 -6
  109. data/spec/netsuite/records/customer_sales_team_list_spec.rb +41 -0
  110. data/spec/netsuite/records/customer_spec.rb +44 -2
  111. data/spec/netsuite/records/customer_subscription_spec.rb +41 -0
  112. data/spec/netsuite/records/customer_subscriptions_list_spec.rb +19 -0
  113. data/spec/netsuite/records/employee_spec.rb +2 -2
  114. data/spec/netsuite/records/entity_custom_field_spec.rb +34 -0
  115. data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
  116. data/spec/netsuite/records/estimate_item_spec.rb +40 -0
  117. data/spec/netsuite/records/estimate_spec.rb +216 -0
  118. data/spec/netsuite/records/inter_company_journal_entry_line_list_spec.rb +26 -0
  119. data/spec/netsuite/records/inter_company_journal_entry_line_spec.rb +60 -0
  120. data/spec/netsuite/records/inter_company_journal_entry_spec.rb +156 -0
  121. data/spec/netsuite/records/inventory_item_spec.rb +57 -0
  122. data/spec/netsuite/records/matrix_option_list_spec.rb +15 -5
  123. data/spec/netsuite/records/message_spec.rb +49 -0
  124. data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
  125. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +1 -1
  126. data/spec/netsuite/records/partner_spec.rb +143 -0
  127. data/spec/netsuite/records/price_level_spec.rb +16 -0
  128. data/spec/netsuite/records/pricing_matrix_spec.rb +15 -13
  129. data/spec/netsuite/records/return_authorization_item_spec.rb +1 -1
  130. data/spec/netsuite/records/sales_order_item_spec.rb +11 -5
  131. data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
  132. data/spec/netsuite/records/support_case_type_spec.rb +22 -0
  133. data/spec/netsuite/records/transaction_body_custom_field_spec.rb +32 -0
  134. data/spec/netsuite/records/transaction_column_custom_field_spec.rb +32 -0
  135. data/spec/netsuite/records/vendor_credit_spec.rb +29 -0
  136. data/spec/netsuite/records/vendor_spec.rb +1 -1
  137. data/spec/netsuite/support/search_result_spec.rb +24 -0
  138. data/spec/netsuite/utilities_spec.rb +44 -6
  139. data/spec/spec_helper.rb +5 -4
  140. data/spec/support/fixtures/update_list/update_list_items.xml +22 -0
  141. data/spec/support/fixtures/update_list/update_list_one_item.xml +18 -0
  142. data/spec/support/fixtures/update_list/update_list_with_errors.xml +32 -0
  143. metadata +111 -11
@@ -1,5 +1,6 @@
1
1
  # https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/login.html
2
2
 
3
+
3
4
  module NetSuite
4
5
  module Actions
5
6
  class Login
@@ -27,14 +28,32 @@ module NetSuite
27
28
  # </platformCore:wsRoleList>
28
29
 
29
30
  def self.call(credentials)
31
+
32
+ soap_header = {}
33
+ if !credentials[:application_id].nil? && !credentials[:application_id].empty?
34
+ soap_header = NetSuite::Configuration.soap_header.dup
35
+ soap_header['platformMsgs:ApplicationInfo'] ||= {}
36
+ soap_header['platformMsgs:ApplicationInfo']['platformMsgs:applicationId'] = credentials[:application_id]
37
+ end
38
+
30
39
  passport = NetSuite::Configuration.auth_header.dup
40
+
41
+
42
+ passport['platformMsgs:passport'] ||= {}
31
43
  passport['platformMsgs:passport']['platformCore:email'] = credentials[:email] || ''
32
44
  passport['platformMsgs:passport']['platformCore:password'] = credentials[:password] || ''
33
45
  passport['platformMsgs:passport']['platformCore:role'] = credentials[:role] || ''
46
+
47
+ if passport['platformMsgs:tokenPassport']
48
+ passport['platformMsgs:passport']['platformCore:account'] ||= passport['platformMsgs:tokenPassport']['platformCore:account']
49
+ end
50
+
34
51
  passport['platformMsgs:passport']['platformCore:account'] = credentials[:account] if !credentials[:account].nil?
35
52
 
53
+ passport.delete('platformMsgs:tokenPassport')
54
+
36
55
  begin
37
- response = NetSuite::Configuration.connection(soap_header: {}).call :login, message: passport
56
+ response = NetSuite::Configuration.connection(soap_header: soap_header).call :login, message: passport
38
57
  rescue Savon::SOAPFault => e
39
58
  error_details = e.to_hash[:fault]
40
59
 
@@ -232,11 +232,6 @@ module NetSuite
232
232
  @success ||= search_result[:status][:@is_success] == 'true'
233
233
  end
234
234
 
235
- protected
236
- def method_name
237
-
238
- end
239
-
240
235
  module Support
241
236
  def self.included(base)
242
237
  base.extend(ClassMethods)
@@ -247,7 +242,7 @@ module NetSuite
247
242
  response = NetSuite::Actions::Search.call([self, options], credentials)
248
243
 
249
244
  if response.success?
250
- NetSuite::Support::SearchResult.new(response, self)
245
+ NetSuite::Support::SearchResult.new(response, self, credentials)
251
246
  else
252
247
  false
253
248
  end
@@ -71,8 +71,12 @@ module NetSuite
71
71
 
72
72
  module Support
73
73
  def update(options = {}, credentials={})
74
- options.merge!(:internal_id => internal_id) if respond_to?(:internal_id) && internal_id
75
- options.merge!(:external_id => external_id) if respond_to?(:external_id) && external_id
74
+ options[:internal_id] = internal_id if respond_to?(:internal_id) && internal_id
75
+
76
+ if !options.include?(:external_id) && (respond_to?(:external_id) && external_id)
77
+ options[:external_id] = external_id
78
+ end
79
+
76
80
  response = NetSuite::Actions::Update.call([self.class, options], credentials)
77
81
  @errors = response.errors
78
82
  response.success?
@@ -0,0 +1,109 @@
1
+ # https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/updateList.html
2
+ module NetSuite
3
+ module Actions
4
+ class UpdateList
5
+ include Support::Requests
6
+
7
+ def initialize(*objects)
8
+ @objects = objects
9
+ end
10
+
11
+ private
12
+
13
+ def request(credentials={})
14
+ NetSuite::Configuration.connection(
15
+ { element_form_default: :unqualified }, credentials
16
+ ).call(:update_list, message: request_body)
17
+ end
18
+
19
+ # <soap:Body>
20
+ # <updateList>
21
+ # <record xsi:type="listRel:Customer" externalId="ext1">
22
+ # <listRel:entityId>Shutter Fly</listRel:entityId>
23
+ # <listRel:companyName>Shutter Fly, Inc</listRel:companyName>
24
+ # </record>
25
+ # <record xsi:type="listRel:Customer" externalId="ext2">
26
+ # <listRel:entityId>Target</listRel:entityId>
27
+ # <listRel:companyName>Target</listRel:companyName>
28
+ # </record>
29
+ # </updateList>
30
+ # </soap:Body>
31
+ def request_body
32
+ attrs = @objects.map do |o|
33
+ hash = o.to_record.merge({
34
+ '@xsi:type' => o.record_type
35
+ })
36
+
37
+ if o.respond_to?(:internal_id) && o.internal_id
38
+ hash['@internalId'] = o.internal_id
39
+ end
40
+
41
+ if o.respond_to?(:external_id) && o.external_id
42
+ hash['@externalId'] = o.external_id
43
+ end
44
+
45
+ hash
46
+ end
47
+
48
+ { 'record' => attrs }
49
+ end
50
+
51
+ def response_hash
52
+ @response_hash ||= Array[@response.body[:update_list_response][:write_response_list][:write_response]].flatten
53
+ end
54
+
55
+ def response_body
56
+ @response_body ||= response_hash.map { |h| h[:base_ref] }
57
+ end
58
+
59
+ def response_errors
60
+ if response_hash.any? { |h| h[:status] && h[:status][:status_detail] }
61
+ @response_errors ||= errors
62
+ end
63
+ end
64
+
65
+ def errors
66
+ errors = response_hash.select { |h| h[:status] && h[:status][:status_detail] }.map do |obj|
67
+ error_obj = obj[:status][:status_detail]
68
+ error_obj = [error_obj] if error_obj.class == Hash
69
+ errors = error_obj.map do |error|
70
+ NetSuite::Error.new(error)
71
+ end
72
+
73
+ [obj[:base_ref][:@internal_id], errors]
74
+ end
75
+ Hash[errors]
76
+ end
77
+
78
+ def success?
79
+ @success ||= response_hash.all? { |h| h[:status][:@is_success] == 'true' }
80
+ end
81
+
82
+ module Support
83
+
84
+ def self.included(base)
85
+ base.extend(ClassMethods)
86
+ end
87
+
88
+ module ClassMethods
89
+ def update_list(records, credentials = {})
90
+ netsuite_records = records.map do |r|
91
+ if r.kind_of?(self)
92
+ r
93
+ else
94
+ self.new(r)
95
+ end
96
+ end
97
+ response = NetSuite::Actions::UpdateList.call(netsuite_records, credentials)
98
+
99
+ if response.success?
100
+ netsuite_records
101
+ else
102
+ false
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -37,6 +37,8 @@ module NetSuite
37
37
  hash['platformMsgs:record']['@platformMsgs:externalId'] = @object.external_id
38
38
  end
39
39
 
40
+ # setting the internal ID on upsert will result in `CANT_SET_INTERNALID`
41
+
40
42
  hash
41
43
  end
42
44
 
@@ -17,7 +17,9 @@ module NetSuite
17
17
  def connection(params={}, credentials={})
18
18
  client = Savon.client({
19
19
  wsdl: cached_wsdl || wsdl,
20
+ endpoint: endpoint,
20
21
  read_timeout: read_timeout,
22
+ open_timeout: open_timeout,
21
23
  namespaces: namespaces,
22
24
  soap_header: auth_header(credentials).update(soap_header),
23
25
  pretty_print_xml: true,
@@ -93,6 +95,18 @@ module NetSuite
93
95
  attributes[:api_version] = version
94
96
  end
95
97
 
98
+ def endpoint=(endpoint)
99
+ attributes[:endpoint] = endpoint
100
+ end
101
+
102
+ def endpoint(endpoint=nil)
103
+ if endpoint
104
+ self.endpoint = endpoint
105
+ else
106
+ attributes[:endpoint]
107
+ end
108
+ end
109
+
96
110
  def sandbox=(flag)
97
111
  if attributes[:sandbox] != flag
98
112
  attributes[:wsdl] = nil
@@ -326,6 +340,18 @@ module NetSuite
326
340
  end
327
341
  end
328
342
 
343
+ def open_timeout=(timeout)
344
+ attributes[:open_timeout] = timeout
345
+ end
346
+
347
+ def open_timeout(timeout = nil)
348
+ if timeout
349
+ self.open_timeout = timeout
350
+ else
351
+ attributes[:open_timeout]
352
+ end
353
+ end
354
+
329
355
  def log=(path)
330
356
  attributes[:log] = path
331
357
  end
@@ -337,7 +363,10 @@ module NetSuite
337
363
 
338
364
  def logger(value = nil)
339
365
  if value.nil?
340
- attributes[:logger] ||= ::Logger.new((log && !log.empty?) ? log : $stdout)
366
+ # if passed a IO object (like StringIO) `empty?` won't exist
367
+ valid_log = log && !(log.respond_to?(:empty?) && log.empty?)
368
+
369
+ attributes[:logger] ||= ::Logger.new(valid_log ? log : $stdout)
341
370
  else
342
371
  attributes[:logger] = value
343
372
  end
@@ -357,12 +386,13 @@ module NetSuite
357
386
  end
358
387
 
359
388
  def log_level(value = nil)
360
- self.log_level = value || :debug
361
- attributes[:log_level]
389
+ self.log_level = value if value
390
+
391
+ attributes[:log_level] || :debug
362
392
  end
363
393
 
364
394
  def log_level=(value)
365
- attributes[:log_level] ||= value
395
+ attributes[:log_level] = value
366
396
  end
367
397
  end
368
398
  end
@@ -3,6 +3,7 @@ module NetSuite
3
3
  class InitializationError < StandardError; end
4
4
  class ConfigurationError < StandardError; end
5
5
 
6
+ # NOTE not an exception, used as a wrapped around NetSuite SOAP error
6
7
  class Error
7
8
  attr_accessor :type, :code, :message
8
9
 
@@ -8,12 +8,12 @@ module NetSuite
8
8
 
9
9
  actions :get, :get_list, :add, :delete, :upsert, :search
10
10
 
11
- fields :allow_non_gl_changes, :end_date, :is_adjust, :is_quarter, :is_year, :period_name, :start_date
11
+ fields :allow_non_gl_changes, :end_date, :is_adjust, :is_quarter, :is_year, :period_name, :start_date, :closed
12
12
 
13
13
  record_refs :parent
14
14
 
15
15
  attr_reader :internal_id
16
- attr_accessor :external_id
16
+ attr_accessor :external_id, :search_joins
17
17
 
18
18
  def initialize(attributes = {})
19
19
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -5,15 +5,18 @@ module NetSuite
5
5
  include Support::RecordRefs
6
6
  include Support::Actions
7
7
  include Support::Records
8
+ include Support::Fields
8
9
  include Namespaces::TranInvt
9
10
 
10
11
  actions :get, :add, :initialize, :delete, :update, :upsert, :upsert_list,
11
12
  :search
12
13
 
13
14
  fields :bin_numbers, :buildable, :created_date, :expiration_date,
14
- :last_modified_date, :memo, :quantity, :serial_numbers, :total,
15
+ :last_modified_date, :memo, :quantity, :serial_numbers,
15
16
  :tran_date, :tran_id
16
17
 
18
+ read_only_fields :total
19
+
17
20
  record_refs :klass, :created_from, :item, :custom_form,
18
21
  :department, :job, :location, :posting_period, :revision,
19
22
  :subsidiary, :units
@@ -50,6 +50,7 @@ module NetSuite
50
50
 
51
51
  attr_reader :internal_id
52
52
  attr_accessor :external_id
53
+ attr_accessor :search_joins
53
54
 
54
55
  def initialize(attributes = {})
55
56
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -5,6 +5,7 @@ module NetSuite
5
5
  include Support::RecordRefs
6
6
  include Support::Records
7
7
  include Support::Actions
8
+ include Support::Fields
8
9
  include Namespaces::TranInvt
9
10
 
10
11
  actions :get, :add, :initialize, :delete, :update, :upsert, :upsert_list,
@@ -14,6 +15,8 @@ module NetSuite
14
15
  :last_modified_date, :memo, :quantity, :serial_numbers, :total,
15
16
  :tran_date, :tran_id
16
17
 
18
+ read_only_fields :total
19
+
17
20
  field :component_list, AssemblyComponentList
18
21
  field :inventory_detail, InventoryDetail
19
22
 
@@ -0,0 +1,18 @@
1
+ module NetSuite
2
+ module Records
3
+ class BinNumber
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Support::RecordRefs
7
+ include Namespaces::ListAcct
8
+
9
+ record_ref :bin_number
10
+
11
+ fields :preferred_bin, :location
12
+
13
+ def initialize(attributes = {})
14
+ initialize_from_attributes_hash(attributes)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,30 +1,11 @@
1
1
  module NetSuite
2
2
  module Records
3
- # TODO this is fairly messy: shouldn't mix multiple classes in one file
4
- # might be possible to trash the GenericField as well
5
-
6
- class GenericField
7
- include Support::Attributes
8
- include Support::Fields
9
-
10
- def initialize(attributes = {})
11
- self.attributes = attributes
12
- end
13
- end
14
-
15
- class BinNumber < GenericField
16
- include Support::Records
17
-
18
- end
19
-
20
3
  class BinNumberList < Support::Sublist
21
- include Namespaces::PlatformCore
22
- # include Namespaces::ListAcct
4
+ include Namespaces::ListAcct
23
5
 
24
6
  sublist :bin_number, BinNumber
25
7
 
26
8
  alias :bin_numbers :bin_number
27
-
28
9
  end
29
10
  end
30
11
  end
@@ -0,0 +1,38 @@
1
+ module NetSuite
2
+ module Records
3
+ class BinTransfer
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::TranInvt
9
+
10
+ actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search
11
+
12
+ fields :created_date, :last_modified_date, :memo, :subsidiary, :tran_date, :tran_id
13
+
14
+ record_refs :location
15
+
16
+ field :custom_field_list, CustomFieldList
17
+ field :inventory_list, BinTransferInventoryList
18
+
19
+ attr_reader :internal_id
20
+ attr_accessor :external_id
21
+
22
+ def initialize(attributes = {})
23
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
24
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
25
+ initialize_from_attributes_hash(attributes)
26
+ end
27
+
28
+ def self.search_class_name
29
+ "Transaction"
30
+ end
31
+
32
+ def self.search_class_namespace
33
+ 'tranSales'
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,20 @@
1
+ module NetSuite
2
+ module Records
3
+ class BinTransferInventory
4
+ include Support::Records
5
+ include Support::Fields
6
+ include Support::RecordRefs
7
+ include Namespaces::TranInvt
8
+
9
+ fields :description, :from_bins, :item_units_label, :line, :preferred_bin, :quantity, :to_bins
10
+
11
+ field :inventory_detail, InventoryDetail
12
+
13
+ record_refs :item
14
+
15
+ def initialize(attributes = {})
16
+ initialize_from_attributes_hash(attributes)
17
+ end
18
+ end
19
+ end
20
+ end