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
@@ -134,7 +134,7 @@ describe NetSuite::Records::InventoryItem do
134
134
  NetSuite::Actions::Add.should_receive(:call).
135
135
  with([item], {}).
136
136
  and_return(response)
137
- item.add.should be_true
137
+ item.add.should be_truthy
138
138
  end
139
139
  end
140
140
 
@@ -145,7 +145,7 @@ describe NetSuite::Records::InventoryItem do
145
145
  NetSuite::Actions::Add.should_receive(:call).
146
146
  with([item], {}).
147
147
  and_return(response)
148
- item.add.should be_false
148
+ item.add.should be_falsey
149
149
  end
150
150
  end
151
151
  end
@@ -158,7 +158,7 @@ describe NetSuite::Records::InventoryItem do
158
158
  NetSuite::Actions::Delete.should_receive(:call).
159
159
  with([item], {}).
160
160
  and_return(response)
161
- item.delete.should be_true
161
+ item.delete.should be_truthy
162
162
  end
163
163
  end
164
164
 
@@ -169,7 +169,7 @@ describe NetSuite::Records::InventoryItem do
169
169
  NetSuite::Actions::Delete.should_receive(:call).
170
170
  with([item], {}).
171
171
  and_return(response)
172
- item.delete.should be_false
172
+ item.delete.should be_falsey
173
173
  end
174
174
  end
175
175
  end
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::InventoryTransfer do
4
+ let(:inventory_transfer) { NetSuite::Records::InventoryTransfer.new }
5
+
6
+ it 'has all the right fields' do
7
+ [
8
+ :created_date, :last_modified_date, :tran_date, :tran_id, :memo
9
+ ].each do |field|
10
+ inventory_transfer.should have_field(field)
11
+ end
12
+ end
13
+
14
+ it 'has all the right record refs' do
15
+ [
16
+ :posting_period, :location, :transfer_location, :department, :subsidiary
17
+ ].each do |record_ref|
18
+ inventory_transfer.should have_record_ref(record_ref)
19
+ end
20
+ end
21
+
22
+
23
+ describe '#inventory_list' do
24
+ it 'can be set from attributes' do
25
+ attributes = {
26
+ :inventory => [{
27
+ :inventory_detail => {
28
+ :custom_form => {
29
+ internal_id: 1
30
+ },
31
+ :inventory_assignment_list => {
32
+ :inventory_assignment => [{
33
+ quantity: 3
34
+ }]
35
+ }
36
+ }
37
+ }]
38
+ }
39
+ inventory_transfer.inventory_list = attributes
40
+ inventory_transfer.inventory_list.should be_kind_of(NetSuite::Records::InventoryTransferInventoryList)
41
+ inventory_transfer.inventory_list.inventory.length.should eql(1)
42
+
43
+ expect(
44
+ inventory_transfer.inventory_list.inventory.first.inventory_detail.inventory_assignment_list.inventory_assignment.first.quantity
45
+ ).to eq(3)
46
+
47
+ expect(
48
+ inventory_transfer.inventory_list.inventory.first.inventory_detail.custom_form.internal_id
49
+ ).to eq(1)
50
+ end
51
+
52
+ it 'can be set from a InventoryTransferInventoryList object' do
53
+ inventory_list = NetSuite::Records::InventoryTransferInventoryList.new
54
+ inventory_transfer.inventory_list = inventory_list
55
+ inventory_transfer.inventory_list.should eql(inventory_list)
56
+ end
57
+ end
58
+ end
@@ -181,7 +181,7 @@ describe NetSuite::Records::Invoice do
181
181
  NetSuite::Actions::Add.should_receive(:call).
182
182
  with([invoice], {}).
183
183
  and_return(response)
184
- invoice.add.should be_true
184
+ invoice.add.should be_truthy
185
185
  end
186
186
  end
187
187
 
@@ -193,7 +193,7 @@ describe NetSuite::Records::Invoice do
193
193
  NetSuite::Actions::Add.should_receive(:call).
194
194
  with([invoice], {}).
195
195
  and_return(response)
196
- invoice.add.should be_false
196
+ invoice.add.should be_falsey
197
197
  end
198
198
  end
199
199
  end
@@ -207,7 +207,7 @@ describe NetSuite::Records::Invoice do
207
207
  NetSuite::Actions::Delete.should_receive(:call).
208
208
  with([invoice], {}).
209
209
  and_return(response)
210
- invoice.delete.should be_true
210
+ invoice.delete.should be_truthy
211
211
  end
212
212
  end
213
213
 
@@ -219,7 +219,7 @@ describe NetSuite::Records::Invoice do
219
219
  NetSuite::Actions::Delete.should_receive(:call).
220
220
  with([invoice], {}).
221
221
  and_return(response)
222
- invoice.delete.should be_false
222
+ invoice.delete.should be_falsey
223
223
  end
224
224
  end
225
225
  end
@@ -111,7 +111,7 @@ describe NetSuite::Records::Job do
111
111
  NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Job, {:external_id => 1}], {}).and_return(response)
112
112
  job = NetSuite::Records::Job.get(:external_id => 1)
113
113
  job.should be_kind_of(NetSuite::Records::Job)
114
- job.account_number.should be_true
114
+ job.account_number.should be_truthy
115
115
  end
116
116
  end
117
117
 
@@ -138,7 +138,7 @@ describe NetSuite::Records::Job do
138
138
  NetSuite::Actions::Add.should_receive(:call).
139
139
  with([job], {}).
140
140
  and_return(response)
141
- job.add.should be_true
141
+ job.add.should be_truthy
142
142
  end
143
143
  end
144
144
 
@@ -149,7 +149,7 @@ describe NetSuite::Records::Job do
149
149
  NetSuite::Actions::Add.should_receive(:call).
150
150
  with([job], {}).
151
151
  and_return(response)
152
- job.add.should be_false
152
+ job.add.should be_falsey
153
153
  end
154
154
  end
155
155
  end
@@ -162,7 +162,7 @@ describe NetSuite::Records::Job do
162
162
  NetSuite::Actions::Delete.should_receive(:call).
163
163
  with([job], {}).
164
164
  and_return(response)
165
- job.delete.should be_true
165
+ job.delete.should be_truthy
166
166
  end
167
167
  end
168
168
 
@@ -173,7 +173,7 @@ describe NetSuite::Records::Job do
173
173
  NetSuite::Actions::Delete.should_receive(:call).
174
174
  with([job], {}).
175
175
  and_return(response)
176
- job.delete.should be_false
176
+ job.delete.should be_falsey
177
177
  end
178
178
  end
179
179
  end
@@ -185,7 +185,7 @@ describe NetSuite::Records::Job do
185
185
  it 'returns true' do
186
186
  NetSuite::Actions::Update.should_receive(:call).with([NetSuite::Records::Job, {:external_id => 1, :account_number => 7}], {}).and_return(response)
187
187
  job = NetSuite::Records::Job.new(:external_id => 1)
188
- job.update(:account_number => 7).should be_true
188
+ job.update(:account_number => 7).should be_truthy
189
189
  end
190
190
  end
191
191
 
@@ -195,7 +195,7 @@ describe NetSuite::Records::Job do
195
195
  it 'raises a RecordNotFound exception' do
196
196
  NetSuite::Actions::Update.should_receive(:call).with([NetSuite::Records::Job, {:internal_id => 1, :account_number => 7}], {}).and_return(response)
197
197
  job = NetSuite::Records::Job.new(:internal_id => 1)
198
- job.update(:account_number => 7).should be_false
198
+ job.update(:account_number => 7).should be_falsey
199
199
  end
200
200
  end
201
201
  end
@@ -69,7 +69,7 @@ describe NetSuite::Records::JournalEntry do
69
69
  NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::JournalEntry, {:external_id => 1}], {}).and_return(response)
70
70
  customer = NetSuite::Records::JournalEntry.get(:external_id => 1)
71
71
  customer.should be_kind_of(NetSuite::Records::JournalEntry)
72
- customer.approved.should be_true
72
+ customer.approved.should be_truthy
73
73
  end
74
74
  end
75
75
 
@@ -96,7 +96,7 @@ describe NetSuite::Records::JournalEntry do
96
96
  NetSuite::Actions::Add.should_receive(:call).
97
97
  with([entry], {}).
98
98
  and_return(response)
99
- entry.add.should be_true
99
+ entry.add.should be_truthy
100
100
  end
101
101
  end
102
102
 
@@ -107,7 +107,7 @@ describe NetSuite::Records::JournalEntry do
107
107
  NetSuite::Actions::Add.should_receive(:call).
108
108
  with([entry], {}).
109
109
  and_return(response)
110
- entry.add.should be_false
110
+ entry.add.should be_falsey
111
111
  end
112
112
  end
113
113
  end
@@ -120,7 +120,7 @@ describe NetSuite::Records::JournalEntry do
120
120
  NetSuite::Actions::Delete.should_receive(:call).
121
121
  with([entry], {}).
122
122
  and_return(response)
123
- entry.delete.should be_true
123
+ entry.delete.should be_truthy
124
124
  end
125
125
  end
126
126
 
@@ -131,7 +131,7 @@ describe NetSuite::Records::JournalEntry do
131
131
  NetSuite::Actions::Delete.should_receive(:call).
132
132
  with([entry], {}).
133
133
  and_return(response)
134
- entry.delete.should be_false
134
+ entry.delete.should be_falsey
135
135
  end
136
136
  end
137
137
  end
@@ -74,7 +74,7 @@ describe NetSuite::Records::NonInventorySaleItem do
74
74
  NetSuite::Actions::Add.should_receive(:call).
75
75
  with([item], {}).
76
76
  and_return(response)
77
- item.add.should be_true
77
+ item.add.should be_truthy
78
78
  end
79
79
  end
80
80
 
@@ -85,7 +85,7 @@ describe NetSuite::Records::NonInventorySaleItem do
85
85
  NetSuite::Actions::Add.should_receive(:call).
86
86
  with([item], {}).
87
87
  and_return(response)
88
- item.add.should be_false
88
+ item.add.should be_falsey
89
89
  end
90
90
  end
91
91
  end
@@ -98,7 +98,7 @@ describe NetSuite::Records::NonInventorySaleItem do
98
98
  NetSuite::Actions::Delete.should_receive(:call).
99
99
  with([item], {}).
100
100
  and_return(response)
101
- item.delete.should be_true
101
+ item.delete.should be_truthy
102
102
  end
103
103
  end
104
104
 
@@ -109,7 +109,7 @@ describe NetSuite::Records::NonInventorySaleItem do
109
109
  NetSuite::Actions::Delete.should_receive(:call).
110
110
  with([item], {}).
111
111
  and_return(response)
112
- item.delete.should be_false
112
+ item.delete.should be_falsey
113
113
  end
114
114
  end
115
115
  end
@@ -33,7 +33,7 @@ describe NetSuite::Records::PaymentMethod do
33
33
  NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::PaymentMethod, :external_id => 10], {}).and_return(response)
34
34
  payment_method = NetSuite::Records::PaymentMethod.get(:external_id => 10)
35
35
  payment_method.should be_kind_of(NetSuite::Records::PaymentMethod)
36
- payment_method.is_debit_card.should be_true
36
+ payment_method.is_debit_card.should be_truthy
37
37
  end
38
38
  end
39
39
 
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::PromotionCode do
4
+ let(:promo_code) { NetSuite::Records::PromotionCode.new }
5
+
6
+ it 'has all the right fields' do
7
+ [ :code, :code_pattern, :description, :discount_type, :display_line_discounts, :end_date,
8
+ :exclude_items, :is_inactive, :is_public, :minimum_order_amount, :name, :number_to_generate,
9
+ :rate, :start_date
10
+ ].each do |field|
11
+ promo_code.should have_field(field)
12
+ end
13
+ end
14
+
15
+ describe '.get' do
16
+ context 'when the response is successful' do
17
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :code => 'SUMMERSALE' }) }
18
+
19
+ it 'returns a Campaign instance populated with the data from the response object' do
20
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::PromotionCode, {:external_id => 1}], {}).and_return(response)
21
+ promo_code = NetSuite::Records::PromotionCode.get(:external_id => 1)
22
+ promo_code.should be_kind_of(NetSuite::Records::PromotionCode)
23
+ promo_code.code.should eql('SUMMERSALE')
24
+ end
25
+ end
26
+
27
+ context 'when the response is unsuccessful' do
28
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
29
+
30
+ it 'raises a RecordNotFound exception' do
31
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::PromotionCode, {:external_id => 1}], {}).and_return(response)
32
+ lambda {
33
+ NetSuite::Records::PromotionCode.get(:external_id => 1)
34
+ }.should raise_error(NetSuite::RecordNotFound,
35
+ /NetSuite::Records::PromotionCode with OPTIONS=(.*) could not be found/)
36
+ end
37
+ end
38
+ end
39
+
40
+ end
@@ -7,17 +7,17 @@ describe NetSuite::Records::SalesOrder do
7
7
 
8
8
  it 'has all the right fields' do
9
9
  [
10
- :alt_handling_cost, :alt_shipping_cost, :amount_paid, :amount_remaining, :applied, :auto_apply,
11
- :balance, :bill_address, :contrib_pct, :created_date, :currency_name, :deferred_revenue,
12
- :discount_rate, :discount_total, :email, :end_date, :est_gross_profit, :est_gross_profit_percent,
13
- :exchange_rate, :exclude_commission, :fax, :gift_cert_applied, :gift_cert_available,
14
- :gift_cert_total, :handling_cost, :handling_tax1_rate, :handling_tax2_rate, :is_taxable,
15
- :last_modified_date, :memo, :message, :on_credit_hold, :other_ref_num, :recognized_revenue,
16
- :rev_rec_on_rev_commitment, :sales_effective_date, :shipping_cost, :shipping_tax1_rate,
17
- :shipping_tax2_rate, :source, :start_date, :status, :sub_total, :sync_partner_teams,
18
- :sync_sales_teams, :tax2_total, :tax_rate, :tax_total, :to_be_emailed, :to_be_faxed, :to_be_printed,
19
- :total, :total_cost_estimate, :tran_date, :tran_id, :tran_is_vsoe_bundle, :unapplied, :vat_reg_num,
20
- :vsoe_auto_calc
10
+ :alt_handling_cost, :alt_shipping_cost, :amount_paid, :amount_remaining, :applied, :auto_apply,
11
+ :balance, :bill_address, :contrib_pct, :created_date, :currency_name, :deferred_revenue,
12
+ :discount_rate, :discount_total, :email, :end_date, :est_gross_profit, :est_gross_profit_percent,
13
+ :exchange_rate, :exclude_commission, :fax, :gift_cert_applied, :gift_cert_available,
14
+ :gift_cert_total, :handling_cost, :handling_tax1_rate, :handling_tax2_rate, :is_taxable,
15
+ :last_modified_date, :memo, :message, :on_credit_hold, :other_ref_num, :recognized_revenue,
16
+ :rev_rec_on_rev_commitment, :sales_effective_date, :shipping_cost, :shipping_tax1_rate,
17
+ :shipping_tax2_rate, :source, :start_date, :status, :sub_total, :sync_partner_teams,
18
+ :sync_sales_teams, :tax2_total, :tax_rate, :tax_total, :to_be_emailed, :to_be_faxed, :to_be_printed,
19
+ :total, :total_cost_estimate, :tran_date, :tran_id, :tran_is_vsoe_bundle, :unapplied, :vat_reg_num,
20
+ :vsoe_auto_calc, :cc_approved
21
21
  ].each do |field|
22
22
  salesorder.should have_field(field)
23
23
  end
@@ -25,9 +25,9 @@ describe NetSuite::Records::SalesOrder do
25
25
 
26
26
  it 'has all the right record refs' do
27
27
  [
28
- :account, :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item,
29
- :entity, :gift_cert, :handling_tax_code, :job, :klass, :lead_source, :location, :message_sel,
30
- :opportunity, :partner, :posting_period, :promo_code, :sales_group, :sales_rep,
28
+ :account, :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item,
29
+ :entity, :gift_cert, :handling_tax_code, :job, :klass, :lead_source, :location, :message_sel,
30
+ :opportunity, :partner, :posting_period, :promo_code, :sales_group, :sales_rep,
31
31
  :ship_method, :shipping_tax_code, :subsidiary, :tax_item
32
32
  ].each do |record_ref|
33
33
  salesorder.should have_record_ref(record_ref)
@@ -138,7 +138,7 @@ describe NetSuite::Records::SalesOrder do
138
138
  NetSuite::Actions::Add.should_receive(:call).
139
139
  with([salesorder], {}).
140
140
  and_return(response)
141
- salesorder.add.should be_true
141
+ salesorder.add.should be_truthy
142
142
  end
143
143
  end
144
144
 
@@ -150,7 +150,7 @@ describe NetSuite::Records::SalesOrder do
150
150
  NetSuite::Actions::Add.should_receive(:call).
151
151
  with([salesorder], {}).
152
152
  and_return(response)
153
- salesorder.add.should be_false
153
+ salesorder.add.should be_falsey
154
154
  end
155
155
  end
156
156
  end
@@ -166,7 +166,7 @@ describe NetSuite::Records::SalesOrder do
166
166
  NetSuite::Actions::Delete.should_receive(:call).
167
167
  with([salesorder], {}).
168
168
  and_return(response)
169
- salesorder.delete.should be_true
169
+ salesorder.delete.should be_truthy
170
170
  end
171
171
  end
172
172
 
@@ -178,7 +178,7 @@ describe NetSuite::Records::SalesOrder do
178
178
  NetSuite::Actions::Delete.should_receive(:call).
179
179
  with([salesorder], {}).
180
180
  and_return(response)
181
- salesorder.delete.should be_false
181
+ salesorder.delete.should be_falsey
182
182
  end
183
183
  end
184
184
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::SalesTaxItem do
4
+ subject(:sales_tax_item) { described_class.new }
5
+
6
+ it 'has all the right fields' do
7
+ [
8
+ :item_id, :display_name, :description, :rate, :is_inactive, :effective_from,
9
+ :valid_until, :include_children, :eccode, :reverse_charge, :service,
10
+ :exempt, :is_default, :exclude_from_tax_reports, :available, :export,
11
+ :county, :city, :state, :zip
12
+ ].each do |field|
13
+ sales_tax_item.should have_field(field)
14
+ end
15
+ end
16
+
17
+ it 'has all the right record refs' do
18
+ [
19
+ :tax_type, :tax_agency, :tax_account, :purchase_account, :sale_account,
20
+ :parent, :nexus_country
21
+ ].each do |record_ref|
22
+ sales_tax_item.should have_record_ref(record_ref)
23
+ end
24
+ end
25
+
26
+ describe '#subsidiary_list' do
27
+ it 'can be set from attributes'
28
+ it 'can be set from a RecordRefList object'
29
+ end
30
+ end
@@ -70,7 +70,7 @@ describe NetSuite::Records::ServiceSaleItem do
70
70
  NetSuite::Actions::Add.should_receive(:call).
71
71
  with([item], {}).
72
72
  and_return(response)
73
- item.add.should be_true
73
+ item.add.should be_truthy
74
74
  end
75
75
  end
76
76
 
@@ -81,7 +81,7 @@ describe NetSuite::Records::ServiceSaleItem do
81
81
  NetSuite::Actions::Add.should_receive(:call).
82
82
  with([item], {}).
83
83
  and_return(response)
84
- item.add.should be_false
84
+ item.add.should be_falsey
85
85
  end
86
86
  end
87
87
  end
@@ -94,7 +94,7 @@ describe NetSuite::Records::ServiceSaleItem do
94
94
  NetSuite::Actions::Delete.should_receive(:call).
95
95
  with([item], {}).
96
96
  and_return(response)
97
- item.delete.should be_true
97
+ item.delete.should be_truthy
98
98
  end
99
99
  end
100
100
 
@@ -105,7 +105,7 @@ describe NetSuite::Records::ServiceSaleItem do
105
105
  NetSuite::Actions::Delete.should_receive(:call).
106
106
  with([item], {}).
107
107
  and_return(response)
108
- item.delete.should be_false
108
+ item.delete.should be_falsey
109
109
  end
110
110
  end
111
111
  end