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,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::BillingScheduleRecurrence do
4
+ let(:recurrence) { NetSuite::Records::BillingScheduleRecurrence.new }
5
+
6
+ it 'has the right fields' do
7
+ [
8
+ :amount, :count, :recurrence_date, :recurrence_id,
9
+ :relative_to_previous, :units
10
+ ].each do |field|
11
+ recurrence.should have_field(field)
12
+ end
13
+ end
14
+
15
+ it 'has the right record_refs' do
16
+ [
17
+ :payment_terms
18
+ ].each do |record_ref|
19
+ recurrence.should have_record_ref(record_ref)
20
+ end
21
+ end
22
+
23
+ it 'can initialize from a record' do
24
+ record = NetSuite::Records::BillingScheduleRecurrence.new(:amount => 10)
25
+ recurrence = NetSuite::Records::BillingScheduleRecurrence.new(record)
26
+ recurrence.should be_kind_of(NetSuite::Records::BillingScheduleRecurrence)
27
+ recurrence.amount.should eql(10)
28
+ end
29
+
30
+ describe '#to_record' do
31
+ before do
32
+ recurrence.amount = 10
33
+ end
34
+
35
+ it 'can represent itself as a SOAP record' do
36
+ record = {
37
+ 'listAcct:amount' => 10
38
+ }
39
+ recurrence.to_record.should eql(record)
40
+ end
41
+ end
42
+
43
+ describe '#record_type' do
44
+ it 'returns a string of the SOAP record type' do
45
+ recurrence.record_type.should eql('listAcct:BillingScheduleRecurrence')
46
+ end
47
+ end
48
+
49
+ end
@@ -0,0 +1,164 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::BillingSchedule do
4
+ let(:billing_schedule) { NetSuite::Records::BillingSchedule.new }
5
+
6
+ it 'has all the right fields' do
7
+ [
8
+ :bill_for_actuals, :day_period, :frequency, :in_arrears, :initial_amount, :is_inactive,
9
+ :is_public, :month_dom, :month_dow, :month_dowim, :month_mode, :name,
10
+ :number_remaining, :recurrence_dow_mask_list, :repeat_every,
11
+ :schedule_type, :series_start_date, :year_dom, :year_dow,
12
+ :year_dowim, :year_dowim_month, :year_mode, :year_month
13
+ ].each do |field|
14
+ billing_schedule.should have_field(field)
15
+ end
16
+ end
17
+
18
+ it 'has all the right record refs' do
19
+ [
20
+ :initial_terms, :project, :recurrence_terms, :transaction
21
+ ].each do |record_ref|
22
+ billing_schedule.should have_record_ref(record_ref)
23
+ end
24
+ end
25
+
26
+ describe '#milestone_list' do
27
+ it 'can be set from attributes' do
28
+ attributes = {
29
+ :comments => "comment"
30
+ }
31
+ billing_schedule.milestone_list.milestone = attributes
32
+ billing_schedule.milestone_list.should be_kind_of(NetSuite::Records::BillingScheduleMilestoneList)
33
+ billing_schedule.milestone_list.milestones.length.should eql(1)
34
+ end
35
+ end
36
+
37
+ describe '#recurrence_list' do
38
+ it 'can be set from attributes' do
39
+ attributes = {
40
+ :amount => 10
41
+ }
42
+ billing_schedule.recurrence_list.recurrence = attributes
43
+ billing_schedule.recurrence_list.should be_kind_of(NetSuite::Records::BillingScheduleRecurrenceList)
44
+ billing_schedule.recurrence_list.recurrences.length.should eql(1)
45
+ end
46
+ end
47
+
48
+ describe '.get' do
49
+ context 'when the response is successful' do
50
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :name => 'Billing Scheduleing 1' }) }
51
+
52
+ it 'returns a Billing Schedule instance populated with the data from the response object' do
53
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::BillingSchedule, {:external_id => 1}], {}).and_return(response)
54
+ billing_schedule = NetSuite::Records::BillingSchedule.get(:external_id => 1)
55
+ billing_schedule.should be_kind_of(NetSuite::Records::BillingSchedule)
56
+ billing_schedule.name.should eql('Billing Scheduleing 1')
57
+ end
58
+ end
59
+
60
+ context 'when the response is unsuccessful' do
61
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
62
+
63
+ it 'raises a RecordNotFound exception' do
64
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::BillingSchedule, {:external_id => 1}], {}).and_return(response)
65
+ lambda {
66
+ NetSuite::Records::BillingSchedule.get(:external_id => 1)
67
+ }.should raise_error(NetSuite::RecordNotFound,
68
+ /NetSuite::Records::BillingSchedule with OPTIONS=(.*) could not be found/)
69
+ end
70
+ end
71
+ end
72
+
73
+ describe ".search" do
74
+ context 'when the response is successful' do
75
+
76
+ it 'returns a Billing Schedule instance populated with the data from the response object' do
77
+ body = {
78
+ total_records: 2,
79
+ record_list: {
80
+ record: [
81
+ {:bill_for_actuals => true},
82
+ {:bill_for_actuals => false}
83
+ ]
84
+ }
85
+ }
86
+
87
+ allow(NetSuite::Actions::Search).to receive(:call).with(
88
+ [NetSuite::Records::BillingSchedule, {:external_id => 1}], {}
89
+ ).and_return(
90
+ NetSuite::Response.new(:success => true, :body => body)
91
+ )
92
+
93
+ search_result = NetSuite::Records::BillingSchedule.search(:external_id => 1)
94
+
95
+ expect(search_result).to be_a NetSuite::Support::SearchResult
96
+ expect(search_result.total_records).to eq 2
97
+
98
+ schd1, schd2 = search_result.results
99
+
100
+ expect(schd1).to be_a NetSuite::Records::BillingSchedule
101
+ expect(schd1.bill_for_actuals).to eq true
102
+
103
+ expect(schd2).to be_a NetSuite::Records::BillingSchedule
104
+ expect(schd2.bill_for_actuals).to eq false
105
+ end
106
+ end
107
+ end
108
+
109
+ describe '#add' do
110
+ let(:test_data) { { :bill_for_actuals => true, :day_period => 7 } }
111
+
112
+ context 'when the response is successful' do
113
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
114
+
115
+ it 'returns true' do
116
+ billing_schedule = NetSuite::Records::BillingSchedule.new(test_data)
117
+ NetSuite::Actions::Add.should_receive(:call).
118
+ with([billing_schedule], {}).
119
+ and_return(response)
120
+ billing_schedule.add.should be_truthy
121
+ end
122
+ end
123
+
124
+ context 'when the response is unsuccessful' do
125
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
126
+
127
+ it 'returns false' do
128
+ billing_schedule = NetSuite::Records::BillingSchedule.new(test_data)
129
+ NetSuite::Actions::Add.should_receive(:call).
130
+ with([billing_schedule], {}).
131
+ and_return(response)
132
+ billing_schedule.add.should be_falsey
133
+ end
134
+ end
135
+ end
136
+
137
+ describe '#delete' do
138
+ let(:test_data) { { :internal_id => '1' } }
139
+
140
+ context 'when the response is successful' do
141
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
142
+
143
+ it 'returns true' do
144
+ billing_schedule = NetSuite::Records::BillingSchedule.new(test_data)
145
+ NetSuite::Actions::Delete.should_receive(:call).
146
+ with([billing_schedule], {}).
147
+ and_return(response)
148
+ billing_schedule.delete.should be_truthy
149
+ end
150
+ end
151
+
152
+ context 'when the response is unsuccessful' do
153
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
154
+
155
+ it 'returns false' do
156
+ billing_schedule = NetSuite::Records::BillingSchedule.new(test_data)
157
+ NetSuite::Actions::Delete.should_receive(:call).
158
+ with([billing_schedule], {}).
159
+ and_return(response)
160
+ billing_schedule.delete.should be_falsey
161
+ end
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::Campaign do
4
+ let(:campaign) { NetSuite::Records::Campaign.new }
5
+
6
+ it 'has all the right fields' do
7
+ [ :audience, :base_cost, :campaign_direct_mail_list, :campaign_email_list,
8
+ :campaign_event_list, :campaign_id, :category, :conv_cost_per_customer, :conversions,
9
+ :cost, :cost_per_customer, :end_date, :event_response_list, :expected_revenue,
10
+ :family, :is_inactive, :item_list, :keyword, :leads_generated, :message,
11
+ :offer, :owner, :profit, :promotion_code, :roi, :search_engine, :start_date, :title,
12
+ :total_revenue, :unique_visitors, :url, :vertical
13
+ ].each do |field|
14
+ campaign.should have_field(field)
15
+ end
16
+ end
17
+
18
+ describe '.get' do
19
+ context 'when the response is successful' do
20
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :message => 'Message 1' }) }
21
+
22
+ it 'returns a Campaign instance populated with the data from the response object' do
23
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Campaign, {:external_id => 1}], {}).and_return(response)
24
+ campaign = NetSuite::Records::Campaign.get(:external_id => 1)
25
+ campaign.should be_kind_of(NetSuite::Records::Campaign)
26
+ campaign.message.should eql('Message 1')
27
+ end
28
+ end
29
+
30
+ context 'when the response is unsuccessful' do
31
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
32
+
33
+ it 'raises a RecordNotFound exception' do
34
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Campaign, {:external_id => 1}], {}).and_return(response)
35
+ lambda {
36
+ NetSuite::Records::Campaign.get(:external_id => 1)
37
+ }.should raise_error(NetSuite::RecordNotFound,
38
+ /NetSuite::Records::Campaign with OPTIONS=(.*) could not be found/)
39
+ end
40
+ end
41
+ end
42
+
43
+ end
@@ -6,7 +6,7 @@ describe NetSuite::Records::CashRefund do
6
6
 
7
7
  it 'has all the right fields' do
8
8
  [
9
- :tran_date
9
+ :tran_date, :to_be_emailed
10
10
  ].each do |field|
11
11
  expect(cashrefund).to have_field(field)
12
12
  end
@@ -46,7 +46,7 @@ describe NetSuite::Records::Classification do
46
46
  NetSuite::Actions::Delete.should_receive(:call).
47
47
  with([classification], {}).
48
48
  and_return(response)
49
- classification.delete.should be_true
49
+ classification.delete.should be_truthy
50
50
  end
51
51
  end
52
52
 
@@ -58,7 +58,7 @@ describe NetSuite::Records::Classification do
58
58
  NetSuite::Actions::Delete.should_receive(:call).
59
59
  with([classification], {}).
60
60
  and_return(response)
61
- classification.delete.should be_false
61
+ classification.delete.should be_falsey
62
62
  end
63
63
  end
64
64
  end
@@ -143,7 +143,7 @@ describe NetSuite::Records::CreditMemo do
143
143
  NetSuite::Actions::Add.should_receive(:call).
144
144
  with([memo], {}).
145
145
  and_return(response)
146
- memo.add.should be_true
146
+ memo.add.should be_truthy
147
147
  end
148
148
  end
149
149
 
@@ -155,7 +155,7 @@ describe NetSuite::Records::CreditMemo do
155
155
  NetSuite::Actions::Add.should_receive(:call).
156
156
  with([memo], {}).
157
157
  and_return(response)
158
- memo.add.should be_false
158
+ memo.add.should be_falsey
159
159
  end
160
160
  end
161
161
  end
@@ -171,7 +171,7 @@ describe NetSuite::Records::CreditMemo do
171
171
  NetSuite::Actions::Delete.should_receive(:call).
172
172
  with([memo], {}).
173
173
  and_return(response)
174
- memo.delete.should be_true
174
+ memo.delete.should be_truthy
175
175
  end
176
176
  end
177
177
 
@@ -183,7 +183,7 @@ describe NetSuite::Records::CreditMemo do
183
183
  NetSuite::Actions::Delete.should_receive(:call).
184
184
  with([memo], {}).
185
185
  and_return(response)
186
- memo.delete.should be_false
186
+ memo.delete.should be_falsey
187
187
  end
188
188
  end
189
189
  end
@@ -47,6 +47,11 @@ describe NetSuite::Records::CustomFieldList do
47
47
  :type => 'SelectCustomFieldRef',
48
48
  :value => NetSuite::Records::CustomRecordRef.new(:internal_id => 13, :name => "The Name")
49
49
  )
50
+ list.custom_fields << NetSuite::Records::CustomField.new(
51
+ :script_id => 'custbody_accountclassification',
52
+ :type => 'SelectCustomFieldRef',
53
+ :value => NetSuite::Records::CustomRecordRef.new(:internal_id => 11, :name => "The Game")
54
+ )
50
55
  end
51
56
 
52
57
  it 'can represent itself as a SOAP record' do
@@ -61,6 +66,11 @@ describe NetSuite::Records::CustomFieldList do
61
66
  '@internalId' => 'custbody_salesclassification',
62
67
  '@xsi:type' => 'SelectCustomFieldRef',
63
68
  "platformCore:value"=>{"platformCore:name"=>"The Name", :@internalId=>13}
69
+ },
70
+ {
71
+ '@scriptId' => 'custbody_accountclassification',
72
+ '@xsi:type' => 'SelectCustomFieldRef',
73
+ "platformCore:value"=>{"platformCore:name"=>"The Game", :@internalId=>11}
64
74
  }
65
75
  ]
66
76
  }
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CustomList do
4
+ let(:custom_list) { NetSuite::Records::CustomList.new }
5
+
6
+ it 'has all the right fields' do
7
+ custom_list.should have_field(:script_id)
8
+ end
9
+
10
+ it "should handle the #custom_value_list" do
11
+ custom_list.custom_value_list = { custom_value: [
12
+ {
13
+ value: "Value",
14
+ value_id: 1
15
+ }
16
+ ]}
17
+
18
+ custom_list.custom_value_list.should be_kind_of(NetSuite::Support::Sublist)
19
+ custom_list.custom_value_list.custom_value.first.should be_kind_of(NetSuite::Records::CustomListCustomValue)
20
+ end
21
+ end
@@ -55,7 +55,7 @@ describe NetSuite::Records::CustomRecord do
55
55
  and_return(response)
56
56
  customer = NetSuite::Records::CustomRecord.get(:external_id => 1)
57
57
  customer.should be_kind_of(NetSuite::Records::CustomRecord)
58
- customer.allow_quick_search.should be_true
58
+ customer.allow_quick_search.should be_truthy
59
59
  end
60
60
  end
61
61
 
@@ -82,7 +82,7 @@ describe NetSuite::Records::CustomRecord do
82
82
  NetSuite::Actions::Add.should_receive(:call).
83
83
  with([record], {}).
84
84
  and_return(response)
85
- record.add.should be_true
85
+ record.add.should be_truthy
86
86
  end
87
87
  end
88
88
 
@@ -93,7 +93,7 @@ describe NetSuite::Records::CustomRecord do
93
93
  NetSuite::Actions::Add.should_receive(:call).
94
94
  with([record], {}).
95
95
  and_return(response)
96
- record.add.should be_false
96
+ record.add.should be_falsey
97
97
  end
98
98
  end
99
99
  end
@@ -106,7 +106,7 @@ describe NetSuite::Records::CustomRecord do
106
106
  NetSuite::Actions::Delete.should_receive(:call).
107
107
  with([record, { :custom => true }], {}).
108
108
  and_return(response)
109
- record.delete.should be_true
109
+ record.delete.should be_truthy
110
110
  end
111
111
  end
112
112
 
@@ -117,7 +117,7 @@ describe NetSuite::Records::CustomRecord do
117
117
  NetSuite::Actions::Delete.should_receive(:call).
118
118
  with([record, { :custom => true }], {}).
119
119
  and_return(response)
120
- record.delete.should be_false
120
+ record.delete.should be_falsey
121
121
  end
122
122
  end
123
123
  end
@@ -88,7 +88,7 @@ describe NetSuite::Records::CustomRecordType do
88
88
  and_return(response)
89
89
  record_type = NetSuite::Records::CustomRecordType.get(:external_id => 1)
90
90
  record_type.should be_kind_of(NetSuite::Records::CustomRecordType)
91
- record_type.allow_attachments.should be_true
91
+ record_type.allow_attachments.should be_truthy
92
92
  end
93
93
  end
94
94
 
@@ -115,7 +115,7 @@ describe NetSuite::Records::CustomRecordType do
115
115
  NetSuite::Actions::Add.should_receive(:call).
116
116
  with([record_type], {}).
117
117
  and_return(response)
118
- record_type.add.should be_true
118
+ record_type.add.should be_truthy
119
119
  end
120
120
  end
121
121
 
@@ -126,7 +126,7 @@ describe NetSuite::Records::CustomRecordType do
126
126
  NetSuite::Actions::Add.should_receive(:call).
127
127
  with([record_type], {}).
128
128
  and_return(response)
129
- record_type.add.should be_false
129
+ record_type.add.should be_falsey
130
130
  end
131
131
  end
132
132
  end
@@ -139,7 +139,7 @@ describe NetSuite::Records::CustomRecordType do
139
139
  NetSuite::Actions::Delete.should_receive(:call).
140
140
  with([record_type], {}).
141
141
  and_return(response)
142
- record_type.delete.should be_true
142
+ record_type.delete.should be_truthy
143
143
  end
144
144
  end
145
145
 
@@ -150,7 +150,7 @@ describe NetSuite::Records::CustomRecordType do
150
150
  NetSuite::Actions::Delete.should_receive(:call).
151
151
  with([record_type], {}).
152
152
  and_return(response)
153
- record_type.delete.should be_false
153
+ record_type.delete.should be_falsey
154
154
  end
155
155
  end
156
156
  end