netsuite 0.2.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. data/.travis.yml +3 -0
  2. data/Gemfile +2 -0
  3. data/README.md +132 -54
  4. data/lib/netsuite.rb +123 -76
  5. data/lib/netsuite/actions/add.rb +1 -0
  6. data/lib/netsuite/actions/delete.rb +1 -0
  7. data/lib/netsuite/actions/get.rb +1 -0
  8. data/lib/netsuite/actions/get_all.rb +67 -0
  9. data/lib/netsuite/actions/get_list.rb +2 -1
  10. data/lib/netsuite/actions/get_select_value.rb +1 -0
  11. data/lib/netsuite/actions/initialize.rb +1 -0
  12. data/lib/netsuite/actions/login.rb +2 -0
  13. data/lib/netsuite/actions/search.rb +3 -2
  14. data/lib/netsuite/actions/update.rb +18 -0
  15. data/lib/netsuite/actions/upsert.rb +1 -0
  16. data/lib/netsuite/actions/upsert_list.rb +114 -0
  17. data/lib/netsuite/configuration.rb +5 -0
  18. data/lib/netsuite/namespaces/file_cabinet.rb +11 -0
  19. data/lib/netsuite/namespaces/list_emp.rb +12 -0
  20. data/lib/netsuite/namespaces/list_mkt.rb +12 -0
  21. data/lib/netsuite/namespaces/list_website.rb +11 -0
  22. data/lib/netsuite/namespaces/tran_invt.rb +11 -0
  23. data/lib/netsuite/records/accounting_period.rb +1 -1
  24. data/lib/netsuite/records/assembly_item.rb +10 -4
  25. data/lib/netsuite/records/billing_schedule.rb +33 -0
  26. data/lib/netsuite/records/billing_schedule_milestone.rb +28 -0
  27. data/lib/netsuite/records/billing_schedule_milestone_list.rb +33 -0
  28. data/lib/netsuite/records/billing_schedule_recurrence.rb +28 -0
  29. data/lib/netsuite/records/billing_schedule_recurrence_list.rb +33 -0
  30. data/lib/netsuite/records/bin.rb +22 -0
  31. data/lib/netsuite/records/campaign.rb +28 -0
  32. data/lib/netsuite/records/cash_refund.rb +1 -1
  33. data/lib/netsuite/records/classification.rb +1 -1
  34. data/lib/netsuite/records/contact.rb +1 -1
  35. data/lib/netsuite/records/contact_access_roles.rb +14 -0
  36. data/lib/netsuite/records/contact_access_roles_list.rb +9 -0
  37. data/lib/netsuite/records/custom_field.rb +2 -1
  38. data/lib/netsuite/records/custom_field_list.rb +23 -4
  39. data/lib/netsuite/records/custom_list.rb +27 -0
  40. data/lib/netsuite/records/custom_list_custom_value.rb +14 -0
  41. data/lib/netsuite/records/custom_list_custom_value_list.rb +13 -0
  42. data/lib/netsuite/records/custom_record.rb +1 -1
  43. data/lib/netsuite/records/custom_record_type.rb +1 -1
  44. data/lib/netsuite/records/customer.rb +4 -4
  45. data/lib/netsuite/records/customer_addressbook.rb +8 -5
  46. data/lib/netsuite/records/customer_addressbook_list.rb +13 -1
  47. data/lib/netsuite/records/customer_deposit.rb +3 -2
  48. data/lib/netsuite/records/customer_payment.rb +1 -1
  49. data/lib/netsuite/records/customer_refund.rb +1 -1
  50. data/lib/netsuite/records/department.rb +4 -2
  51. data/lib/netsuite/records/deposit.rb +1 -1
  52. data/lib/netsuite/records/deposit_cash_back.rb +2 -2
  53. data/lib/netsuite/records/deposit_other.rb +2 -2
  54. data/lib/netsuite/records/discount_item.rb +32 -0
  55. data/lib/netsuite/records/employee.rb +20 -0
  56. data/lib/netsuite/records/file.rb +28 -0
  57. data/lib/netsuite/records/inventory_assignment.rb +24 -0
  58. data/lib/netsuite/records/inventory_assignment_list.rb +32 -0
  59. data/lib/netsuite/records/inventory_detail.rb +18 -0
  60. data/lib/netsuite/records/inventory_transfer.rb +29 -0
  61. data/lib/netsuite/records/inventory_transfer_inventory.rb +21 -0
  62. data/lib/netsuite/records/inventory_transfer_inventory_list.rb +33 -0
  63. data/lib/netsuite/records/item_fulfillment.rb +1 -1
  64. data/lib/netsuite/records/item_fulfillment_item_list.rb +3 -21
  65. data/lib/netsuite/records/item_member.rb +21 -0
  66. data/lib/netsuite/records/journal_entry.rb +1 -1
  67. data/lib/netsuite/records/kit_item.rb +1 -1
  68. data/lib/netsuite/records/location.rb +3 -1
  69. data/lib/netsuite/records/member_list.rb +32 -0
  70. data/lib/netsuite/records/non_inventory_sale_item.rb +4 -1
  71. data/lib/netsuite/records/partner.rb +21 -0
  72. data/lib/netsuite/records/promotion_code.rb +38 -0
  73. data/lib/netsuite/records/record_ref_list.rb +40 -0
  74. data/lib/netsuite/records/role_list.rb +25 -0
  75. data/lib/netsuite/records/sales_order.rb +6 -2
  76. data/lib/netsuite/records/sales_tax_item.rb +32 -0
  77. data/lib/netsuite/records/site_category.rb +33 -0
  78. data/lib/netsuite/records/subsidiary.rb +38 -0
  79. data/lib/netsuite/records/tax_type.rb +22 -0
  80. data/lib/netsuite/records/term.rb +1 -1
  81. data/lib/netsuite/records/units_type.rb +25 -0
  82. data/lib/netsuite/records/units_type_uom.rb +20 -0
  83. data/lib/netsuite/records/units_type_uom_list.rb +33 -0
  84. data/lib/netsuite/records/work_order.rb +38 -0
  85. data/lib/netsuite/records/work_order_item.rb +31 -0
  86. data/lib/netsuite/records/work_order_item_list.rb +31 -0
  87. data/lib/netsuite/support/actions.rb +4 -0
  88. data/lib/netsuite/support/base.rb +21 -0
  89. data/lib/netsuite/support/country.rb +273 -0
  90. data/lib/netsuite/support/search_result.rb +4 -0
  91. data/lib/netsuite/support/sublist.rb +54 -0
  92. data/lib/netsuite/version.rb +1 -1
  93. data/spec/netsuite/actions/search_spec.rb +1 -1
  94. data/spec/netsuite/actions/update_spec.rb +62 -31
  95. data/spec/netsuite/actions/upsert_list_spec.rb +112 -0
  96. data/spec/netsuite/records/account_spec.rb +4 -4
  97. data/spec/netsuite/records/accounting_period_spec.rb +4 -4
  98. data/spec/netsuite/records/assembly_item_spec.rb +38 -0
  99. data/spec/netsuite/records/billing_schedule_milestone_list_spec.rb +24 -0
  100. data/spec/netsuite/records/billing_schedule_milestone_spec.rb +51 -0
  101. data/spec/netsuite/records/billing_schedule_recurrence_list_spec.rb +24 -0
  102. data/spec/netsuite/records/billing_schedule_recurrence_spec.rb +49 -0
  103. data/spec/netsuite/records/billing_schedule_spec.rb +164 -0
  104. data/spec/netsuite/records/campaign_spec.rb +43 -0
  105. data/spec/netsuite/records/cash_refund_spec.rb +1 -1
  106. data/spec/netsuite/records/classification_spec.rb +2 -2
  107. data/spec/netsuite/records/credit_memo_spec.rb +4 -4
  108. data/spec/netsuite/records/custom_field_list_spec.rb +10 -0
  109. data/spec/netsuite/records/custom_list_spec.rb +21 -0
  110. data/spec/netsuite/records/custom_record_spec.rb +5 -5
  111. data/spec/netsuite/records/custom_record_type_spec.rb +5 -5
  112. data/spec/netsuite/records/customer_addressbook_list_spec.rb +19 -1
  113. data/spec/netsuite/records/customer_addressbook_spec.rb +42 -13
  114. data/spec/netsuite/records/customer_payment_spec.rb +4 -4
  115. data/spec/netsuite/records/customer_refund_spec.rb +4 -4
  116. data/spec/netsuite/records/customer_spec.rb +80 -6
  117. data/spec/netsuite/records/department_spec.rb +4 -4
  118. data/spec/netsuite/records/deposit_spec.rb +22 -4
  119. data/spec/netsuite/records/discount_item_spec.rb +124 -0
  120. data/spec/netsuite/records/inventory_item_spec.rb +4 -4
  121. data/spec/netsuite/records/inventory_transfer_spec.rb +58 -0
  122. data/spec/netsuite/records/invoice_spec.rb +4 -4
  123. data/spec/netsuite/records/job_spec.rb +7 -7
  124. data/spec/netsuite/records/journal_entry_spec.rb +5 -5
  125. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +4 -4
  126. data/spec/netsuite/records/payment_method_spec.rb +1 -1
  127. data/spec/netsuite/records/pomo_code_spec.rb +40 -0
  128. data/spec/netsuite/records/sales_order_spec.rb +18 -18
  129. data/spec/netsuite/records/sales_tax_item_spec.rb +30 -0
  130. data/spec/netsuite/records/service_sale_item_spec.rb +4 -4
  131. data/spec/netsuite/records/site_category_spec.rb +51 -0
  132. data/spec/netsuite/records/subsidiary_spec.rb +25 -0
  133. data/spec/netsuite/records/support_case_spec.rb +8 -8
  134. data/spec/netsuite/records/tax_type_spec.rb +11 -0
  135. data/spec/netsuite/records/term_spec.rb +4 -4
  136. data/spec/netsuite/records/units_type_spec.rb +33 -0
  137. data/spec/netsuite/records/units_type_uom_list_spec.rb +23 -0
  138. data/spec/netsuite/records/units_type_uom_spec.rb +14 -0
  139. data/spec/netsuite/records/work_order_item_list_spec.rb +26 -0
  140. data/spec/netsuite/records/work_order_item_spec.rb +45 -0
  141. data/spec/netsuite/records/work_order_spec.rb +92 -0
  142. data/spec/netsuite/support/record_refs_spec.rb +1 -1
  143. data/spec/netsuite/support/sublist_spec.rb +36 -0
  144. data/spec/spec_helper.rb +1 -0
  145. data/spec/support/fixtures/update/update_customer_error.xml +21 -0
  146. data/spec/support/fixtures/update/update_customer_multiple_errors.xml +25 -0
  147. data/spec/support/fixtures/upsert_list/upsert_list_customers.xml +21 -0
  148. data/spec/support/fixtures/upsert_list/upsert_list_one_customer.xml +17 -0
  149. data/spec/support/fixtures/upsert_list/upsert_list_with_errors.xml +32 -0
  150. data/spec/support/read_only_field_matcher.rb +1 -1
  151. metadata +115 -5
  152. checksums.yaml +0 -15
@@ -0,0 +1,28 @@
1
+ module NetSuite
2
+ module Records
3
+ class BillingScheduleMilestone
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::ListAcct
8
+
9
+ fields :comments, :milestone_actual_completion_date, :milestone_amount,
10
+ :milestone_completed, :milestone_date, :milestone_id
11
+
12
+ record_refs :milestone_term, :project_task
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,33 @@
1
+ module NetSuite
2
+ module Records
3
+ class BillingScheduleMilestoneList
4
+ include Support::Fields
5
+ include Namespaces::ListAcct
6
+
7
+ fields :billing_schedule_milestone
8
+
9
+ def initialize(attributes = {})
10
+ initialize_from_attributes_hash(attributes)
11
+ end
12
+
13
+ def milestone=(milestones)
14
+ case milestones
15
+ when Hash
16
+ self.milestones << BillingScheduleMilestone.new(milestones)
17
+ when Array
18
+ milestones.each { |milestone| self.milestones << BillingScheduleMilestone.new(milestone) }
19
+ end
20
+ end
21
+
22
+ def milestones
23
+ @milestones ||= []
24
+ end
25
+
26
+ def to_record
27
+ { "#{record_namespace}:billingScheduleMilestone" => milestones.map(&:to_record) }
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1,28 @@
1
+ module NetSuite
2
+ module Records
3
+ class BillingScheduleRecurrence
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::ListAcct
8
+
9
+ fields :amount, :count, :recurrence_date, :recurrence_id,
10
+ :relative_to_previous, :units
11
+
12
+ record_refs :payment_terms
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,33 @@
1
+ module NetSuite
2
+ module Records
3
+ class BillingScheduleRecurrenceList
4
+ include Support::Fields
5
+ include Namespaces::ListAcct
6
+
7
+ fields :billing_schedule_recurrence
8
+
9
+ def initialize(attributes = {})
10
+ initialize_from_attributes_hash(attributes)
11
+ end
12
+
13
+ def recurrence=(recurrences)
14
+ case recurrences
15
+ when Hash
16
+ self.recurrences << BillingScheduleRecurrence.new(recurrences)
17
+ when Array
18
+ recurrences.each { |recurrence| self.recurrences << BillingScheduleRecurrence.new(recurrence) }
19
+ end
20
+ end
21
+
22
+ def recurrences
23
+ @recurrences ||= []
24
+ end
25
+
26
+ def to_record
27
+ { "#{record_namespace}:billingScheduleRecurrence" => recurrences.map(&:to_record) }
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1,22 @@
1
+ module NetSuite
2
+ module Records
3
+
4
+ class Bin < NetSuite::Support::Base
5
+ include Support::RecordRefs
6
+ include Support::Actions
7
+ include Namespaces::ListAcct
8
+
9
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/bin.html?mode=package
10
+
11
+ attr_reader :internal_id
12
+ attr_accessor :external_id
13
+
14
+ actions :get, :add, :delete, :search, :update, :upsert
15
+
16
+ fields :bin_number, :is_inactive, :location, :memo
17
+
18
+ field :custom_field_list, NetSuite::Records::CustomFieldList
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ module NetSuite
2
+ module Records
3
+ class Campaign
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Actions
7
+
8
+ actions :get, :search
9
+
10
+ fields :audience, :base_cost, :campaign_direct_mail_list, :campaign_email_list,
11
+ :campaign_event_list, :campaign_id, :category, :conv_cost_per_customer, :conversions,
12
+ :cost, :cost_per_customer, :end_date, :event_response_list, :expected_revenue,
13
+ :family, :is_inactive, :item_list, :keyword, :leads_generated, :message,
14
+ :offer, :owner, :profit, :promotion_code, :roi, :search_engine, :start_date, :title,
15
+ :total_revenue, :unique_visitors, :url, :vertical
16
+
17
+ attr_reader :internal_id
18
+ attr_accessor :external_id
19
+
20
+ def initialize(attributes = {})
21
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
22
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
23
+ initialize_from_attributes_hash(attributes)
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -9,7 +9,7 @@ module NetSuite
9
9
 
10
10
  actions :add, :get, :delete
11
11
 
12
- fields :tran_date
12
+ fields :tran_date, :to_be_emailed
13
13
 
14
14
  field :item_list, CashRefundItemList
15
15
  field :custom_field_list, CustomFieldList
@@ -4,7 +4,7 @@ module NetSuite
4
4
  include Support::Fields
5
5
  include Support::Actions
6
6
 
7
- actions :get, :delete
7
+ actions :get, :delete, :upsert
8
8
 
9
9
  fields :name, :include_children, :is_inactive, :class_translation_list, :subsidiary_list, :custom_field_list
10
10
 
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListRel
9
9
 
10
- actions :get, :add, :delete, :search, :update
10
+ actions :get, :add, :delete, :search, :update, :upsert
11
11
 
12
12
  fields :salutation, :first_name, :middle_name, :last_name, :title, :phone, :fax, :email, :default_address,
13
13
  :entity_id, :phonetic_name, :alt_email, :office_phone, :home_phone, :mobile_phone, :supervisor_phone,
@@ -0,0 +1,14 @@
1
+ module NetSuite
2
+ module Records
3
+ class ContactAccessRoles < NetSuite::Support::Base
4
+ include Support::RecordRefs
5
+ include Namespaces::ListRel
6
+
7
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/other/contactaccessroles.html?mode=package
8
+
9
+ fields :email, :give_access, :password, :password2, :send_email
10
+
11
+ record_refs :contact, :role
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ module NetSuite
2
+ module Records
3
+ class ContactAccessRolesList < Support::Sublist
4
+ include Namespaces::ListRel
5
+
6
+ sublist :contact_roles, ContactAccessRoles
7
+ end
8
+ end
9
+ end
@@ -4,10 +4,11 @@ module NetSuite
4
4
  include Support::Fields
5
5
  include Support::Records
6
6
 
7
- attr_reader :internal_id
7
+ attr_reader :internal_id, :script_id
8
8
  attr_accessor :type
9
9
 
10
10
  def initialize(attributes = {})
11
+ @script_id = attributes.delete(:script_id) || attributes.delete(:@script_id)
11
12
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
12
13
  @type = attributes.delete(:type) || attributes.delete(:"@xsi:type")
13
14
  self.attributes = attributes
@@ -12,13 +12,21 @@ module NetSuite
12
12
  end
13
13
 
14
14
  @custom_fields_assoc = Hash.new
15
- custom_fields.each { |custom_field| @custom_fields_assoc[custom_field.internal_id.to_sym] = custom_field }
15
+ custom_fields.each do |custom_field|
16
+ reference_id = custom_field.script_id || custom_field.internal_id
17
+ @custom_fields_assoc[reference_id.to_sym] = custom_field
18
+ end
16
19
  end
17
20
 
18
21
  def custom_fields
19
22
  @custom_fields ||= []
20
23
  end
21
24
 
25
+ def delete_custom_field(field)
26
+ custom_fields.delete_if { |c| c.internal_id.to_sym == field }
27
+ @custom_fields_assoc.delete(field)
28
+ end
29
+
22
30
  # In case you want to get only MultiSelectCustomFieldRef for example:
23
31
  #
24
32
  # list.custom_fields_by_type "MultiSelectCustomFieldRef"
@@ -35,7 +43,9 @@ module NetSuite
35
43
 
36
44
  # write custom field
37
45
  if sym.to_s.end_with?('=')
38
- return create_custom_field(sym.to_s[0..-2], args.first)
46
+ field_name = sym.to_s[0..-2]
47
+ delete_custom_field(field_name.to_sym)
48
+ return create_custom_field(field_name, args.first)
39
49
  end
40
50
 
41
51
  super(sym, *args, &block)
@@ -57,11 +67,20 @@ module NetSuite
57
67
  custom_field_value = custom_field.value.to_s
58
68
  end
59
69
 
60
- {
70
+ base = {
61
71
  "platformCore:value" => custom_field_value,
62
- '@internalId' => custom_field.internal_id,
63
72
  '@xsi:type' => custom_field.type
64
73
  }
74
+
75
+ if custom_field.internal_id
76
+ base['@internalId'] = custom_field.internal_id
77
+ end
78
+
79
+ if custom_field.script_id
80
+ base['@scriptId'] = custom_field.script_id
81
+ end
82
+
83
+ base
65
84
  end
66
85
  }
67
86
  end
@@ -0,0 +1,27 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomList
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Support::Actions
7
+ include Namespaces::SetupCustom
8
+
9
+ actions :get, :update, :get_list, :add, :delete, :search, :upsert
10
+
11
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/customlist.html
12
+ fields :description, :name, :is_ordered, :script_id, :convert_to_custom_record,
13
+ :is_inactive
14
+
15
+ field :custom_value_list, NetSuite::Records::CustomListCustomValueList
16
+
17
+ attr_reader :internal_id
18
+ attr_accessor :external_id
19
+
20
+ def initialize(attributes = {})
21
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
22
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
23
+ initialize_from_attributes_hash(attributes)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,14 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomListCustomValue < Support::Base
4
+ include Namespaces::SetupCustom
5
+
6
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/other/customlistcustomvalue.html?mode=package
7
+
8
+ fields :abbreviation, :value, :value_id, :is_inactive
9
+
10
+ # field valueLanguageValueList
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module NetSuite
2
+ module Records
3
+
4
+ class CustomListCustomValueList < Support::Sublist
5
+ include Namespaces::SetupCustom
6
+
7
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/other/customlistcustomvaluelist.html?mode=package
8
+
9
+ sublist :custom_value, CustomListCustomValue
10
+ end
11
+
12
+ end
13
+ end
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::SetupCustom
9
9
 
10
- actions :get, :update, :get_list, :add, :delete, :search
10
+ actions :get, :update, :get_list, :add, :delete, :search, :upsert
11
11
 
12
12
  fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :created,
13
13
  :custom_record_id, :description, :disclaimer, :enabl_email_merge, :enable_numbering, :include_name,
@@ -5,7 +5,7 @@ module NetSuite
5
5
  include Support::RecordRefs
6
6
  include Support::Actions
7
7
 
8
- actions :get, :add, :delete
8
+ actions :get, :add, :delete, :upsert
9
9
 
10
10
  fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :description,
11
11
  :disclaimer, :enable_mail_merge, :enable_numbering, :include_name, :is_available_offline, :is_inactive,
@@ -7,14 +7,13 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListRel
9
9
 
10
- actions :get, :get_list, :add, :update, :upsert, :delete, :search
10
+ actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :search
11
11
 
12
- # See https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/customer.html
13
- # for the complete list of attributes their descriptions
12
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/customer.html
14
13
 
15
14
  fields :access_role, :account_number, :aging, :alt_email, :alt_name, :alt_phone, :bill_pay,
16
15
  :buying_reason, :buying_time_frame, :campaign_category, :click_stream, :comments, :company_name,
17
- :consol_aging, :consol_days_overdue, :contact_roles_list, :contrib_pct, :credit_cards_list, :credit_hold_override,
16
+ :consol_aging, :consol_days_overdue, :contrib_pct, :credit_cards_list, :credit_hold_override,
18
17
  :credit_limit, :currency, :currency_list, :date_created, :days_overdue, :default_address,
19
18
  :download_list, :email, :email_preference, :email_transactions, :end_date, :entity_id,
20
19
  :estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
@@ -30,6 +29,7 @@ module NetSuite
30
29
 
31
30
  field :addressbook_list, CustomerAddressbookList
32
31
  field :custom_field_list, CustomFieldList
32
+ field :contact_roles_list, ContactAccessRolesList
33
33
 
34
34
  read_only_fields :balance, :consol_balance, :deposit_balance, :consol_deposit_balance, :overdue_balance,
35
35
  :consol_overdue_balance, :unbilled_orders, :consol_unbilled_orders
@@ -5,11 +5,15 @@ module NetSuite
5
5
  include Support::Records
6
6
  include Namespaces::ListRel
7
7
 
8
+ # internalId is a bit strange on this record
9
+ # https://github.com/NetSweet/netsuite/wiki/Miscellaneous-Web-Services-Quirks#customer
10
+
8
11
  fields :default_shipping, :default_billing, :is_residential, :label, :attention, :addressee,
9
- :phone, :addr1, :addr2, :addr3, :city, :zip, :country, :addr_text, :override, :state
12
+ :phone, :addr1, :addr2, :addr3, :city, :zip, :override, :state, :internal_id
13
+
14
+ field :country, NetSuite::Support::Country
10
15
 
11
- attr_reader :internal_id
12
- attr_accessor :external_id
16
+ read_only_fields :addr_text
13
17
 
14
18
  def initialize(attributes_or_record = {})
15
19
  case attributes_or_record
@@ -17,7 +21,6 @@ module NetSuite
17
21
  initialize_from_record(attributes_or_record)
18
22
  when Hash
19
23
  attributes_or_record = attributes_or_record[:addressbook] if attributes_or_record[:addressbook]
20
- @internal_id = attributes_or_record.delete(:internal_id)
21
24
  initialize_from_attributes_hash(attributes_or_record)
22
25
  end
23
26
  end
@@ -39,7 +42,7 @@ module NetSuite
39
42
  self.addr_text = obj.addr_text
40
43
  self.override = obj.override
41
44
  self.state = obj.state
42
- @internal_id = obj.internal_id
45
+ self.internal_id = obj.internal_id
43
46
  end
44
47
 
45
48
  end