netsuite 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +32 -0
  3. data/lib/netsuite.rb +5 -1
  4. data/lib/netsuite/actions/add.rb +4 -4
  5. data/lib/netsuite/actions/delete.rb +7 -7
  6. data/lib/netsuite/actions/get.rb +5 -5
  7. data/lib/netsuite/actions/get_list.rb +24 -11
  8. data/lib/netsuite/actions/get_select_value.rb +5 -5
  9. data/lib/netsuite/actions/initialize.rb +5 -5
  10. data/lib/netsuite/actions/login.rb +33 -0
  11. data/lib/netsuite/actions/search.rb +5 -5
  12. data/lib/netsuite/actions/update.rb +5 -5
  13. data/lib/netsuite/actions/upsert.rb +4 -4
  14. data/lib/netsuite/configuration.rb +9 -9
  15. data/lib/netsuite/records/account.rb +1 -1
  16. data/lib/netsuite/records/custom_field_list.rb +2 -0
  17. data/lib/netsuite/records/custom_record.rb +1 -1
  18. data/lib/netsuite/records/customer.rb +9 -6
  19. data/lib/netsuite/records/deposit.rb +2 -2
  20. data/lib/netsuite/records/deposit_cash_back.rb +42 -0
  21. data/lib/netsuite/records/deposit_cash_back_list.rb +32 -0
  22. data/lib/netsuite/records/deposit_other.rb +45 -0
  23. data/lib/netsuite/records/deposit_other_list.rb +32 -0
  24. data/lib/netsuite/records/item_fulfillment.rb +7 -1
  25. data/lib/netsuite/records/item_fulfillment_item.rb +1 -1
  26. data/lib/netsuite/records/item_fulfillment_package_list.rb +22 -1
  27. data/lib/netsuite/records/sales_order.rb +1 -1
  28. data/lib/netsuite/records/service_sale_item.rb +1 -1
  29. data/lib/netsuite/support/requests.rb +5 -4
  30. data/lib/netsuite/version.rb +1 -1
  31. data/netsuite.gemspec +1 -1
  32. data/spec/netsuite/actions/add_spec.rb +5 -5
  33. data/spec/netsuite/actions/delete_spec.rb +2 -2
  34. data/spec/netsuite/actions/get_spec.rb +4 -4
  35. data/spec/netsuite/actions/initialize_spec.rb +2 -2
  36. data/spec/netsuite/actions/search_spec.rb +6 -6
  37. data/spec/netsuite/actions/update_spec.rb +4 -4
  38. data/spec/netsuite/actions/upsert_spec.rb +5 -5
  39. data/spec/netsuite/records/account_spec.rb +6 -6
  40. data/spec/netsuite/records/accounting_period_spec.rb +6 -6
  41. data/spec/netsuite/records/classification_spec.rb +4 -4
  42. data/spec/netsuite/records/credit_memo_spec.rb +8 -8
  43. data/spec/netsuite/records/custom_field_list_spec.rb +10 -0
  44. data/spec/netsuite/records/custom_field_spec.rb +1 -1
  45. data/spec/netsuite/records/custom_record_ref_spec.rb +1 -1
  46. data/spec/netsuite/records/custom_record_spec.rb +6 -6
  47. data/spec/netsuite/records/custom_record_type_spec.rb +6 -6
  48. data/spec/netsuite/records/customer_payment_spec.rb +9 -9
  49. data/spec/netsuite/records/customer_refund_spec.rb +8 -8
  50. data/spec/netsuite/records/customer_spec.rb +10 -10
  51. data/spec/netsuite/records/department_spec.rb +6 -6
  52. data/spec/netsuite/records/deposit_spec.rb +10 -10
  53. data/spec/netsuite/records/inventory_item_spec.rb +6 -6
  54. data/spec/netsuite/records/invoice_spec.rb +8 -8
  55. data/spec/netsuite/records/item_fulfillment_package_list_spec.rb +27 -0
  56. data/spec/netsuite/records/item_fulfillment_spec.rb +49 -0
  57. data/spec/netsuite/records/job_spec.rb +8 -8
  58. data/spec/netsuite/records/journal_entry_spec.rb +6 -6
  59. data/spec/netsuite/records/location_spec.rb +2 -2
  60. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +6 -6
  61. data/spec/netsuite/records/payment_method_spec.rb +2 -2
  62. data/spec/netsuite/records/rev_rec_template_spec.rb +2 -2
  63. data/spec/netsuite/records/sales_order_spec.rb +9 -9
  64. data/spec/netsuite/records/service_sale_item_spec.rb +6 -6
  65. data/spec/netsuite/records/support_case_spec.rb +8 -8
  66. data/spec/netsuite/records/term_spec.rb +6 -6
  67. data/spec/netsuite/support/actions_spec.rb +1 -1
  68. data/spec/netsuite/support/attributes_spec.rb +1 -1
  69. data/spec/spec_helper.rb +1 -1
  70. metadata +13 -5
  71. data/lib/netsuite/actions/search_more_with_id.rb +0 -107
@@ -87,7 +87,7 @@ describe NetSuite::Records::CustomerRefund do
87
87
  let(:response) { NetSuite::Response.new(:success => true, :body => { :is_person => true }) }
88
88
 
89
89
  it 'returns an CustomerRefund instance populated with the data from the response object' do
90
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::CustomerRefund, :external_id => 10).and_return(response)
90
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CustomerRefund, {:external_id => 10}], {}).and_return(response)
91
91
  refund = NetSuite::Records::CustomerRefund.get(:external_id => 10)
92
92
  refund.should be_kind_of(NetSuite::Records::CustomerRefund)
93
93
  end
@@ -97,7 +97,7 @@ describe NetSuite::Records::CustomerRefund do
97
97
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
98
98
 
99
99
  it 'raises a RecordNotFound exception' do
100
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::CustomerRefund, :external_id => 10).and_return(response)
100
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CustomerRefund, {:external_id => 10}], {}).and_return(response)
101
101
  lambda {
102
102
  NetSuite::Records::CustomerRefund.get(:external_id => 10)
103
103
  }.should raise_error(NetSuite::RecordNotFound,
@@ -109,14 +109,14 @@ describe NetSuite::Records::CustomerRefund do
109
109
  describe '.initialize' do
110
110
  context 'when the request is successful' do
111
111
  it 'returns an initialized invoice from the customer entity' do
112
- NetSuite::Actions::Initialize.should_receive(:call).with(NetSuite::Records::CustomerRefund, memo).and_return(response)
112
+ NetSuite::Actions::Initialize.should_receive(:call).with([NetSuite::Records::CustomerRefund, memo], {}).and_return(response)
113
113
  refund = NetSuite::Records::CustomerRefund.initialize(memo)
114
114
  refund.should be_kind_of(NetSuite::Records::CustomerRefund)
115
115
  end
116
116
  end
117
117
 
118
118
  context 'when the response is unsuccessful' do
119
- pending
119
+ skip
120
120
  end
121
121
  end
122
122
 
@@ -129,7 +129,7 @@ describe NetSuite::Records::CustomerRefund do
129
129
  it 'returns true' do
130
130
  refund = NetSuite::Records::CustomerRefund.new(test_data)
131
131
  NetSuite::Actions::Add.should_receive(:call).
132
- with(refund).
132
+ with([refund], {}).
133
133
  and_return(response)
134
134
  refund.add.should be_true
135
135
  end
@@ -141,7 +141,7 @@ describe NetSuite::Records::CustomerRefund do
141
141
  it 'returns false' do
142
142
  refund = NetSuite::Records::CustomerRefund.new(test_data)
143
143
  NetSuite::Actions::Add.should_receive(:call).
144
- with(refund).
144
+ with([refund], {}).
145
145
  and_return(response)
146
146
  refund.add.should be_false
147
147
  end
@@ -155,7 +155,7 @@ describe NetSuite::Records::CustomerRefund do
155
155
  it 'returns true' do
156
156
  refund = NetSuite::Records::CustomerRefund.new
157
157
  NetSuite::Actions::Delete.should_receive(:call).
158
- with(refund).
158
+ with([refund], {}).
159
159
  and_return(response)
160
160
  refund.delete.should be_true
161
161
  end
@@ -167,7 +167,7 @@ describe NetSuite::Records::CustomerRefund do
167
167
  it 'returns false' do
168
168
  refund = NetSuite::Records::CustomerRefund.new
169
169
  NetSuite::Actions::Delete.should_receive(:call).
170
- with(refund).
170
+ with([refund], {}).
171
171
  and_return(response)
172
172
  refund.delete.should be_false
173
173
  end
@@ -6,19 +6,19 @@ describe NetSuite::Records::Customer do
6
6
  it 'has all the right fields' do
7
7
  [
8
8
  :access_role, :account_number, :aging, :alt_email, :alt_name, :alt_phone, :balance, :bill_pay,
9
- :buying_reason, :buying_time_frame, :campaign_category, :category, :click_stream, :comments, :company_name,
9
+ :buying_reason, :buying_time_frame, :campaign_category, :click_stream, :comments, :company_name,
10
10
  :consol_aging, :consol_balance, :consol_days_overdue, :consol_deposit_balance, :consol_overdue_balance,
11
11
  :consol_unbilled_orders, :contact_roles_list, :contrib_pct, :credit_cards_list, :credit_hold_override, :credit_limit,
12
12
  :currency, :currency_list, :date_created, :days_overdue, :default_address,
13
13
  :deposit_balance, :download_list, :email, :email_preference, :email_transactions, :end_date, :entity_id,
14
14
  :estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
15
15
  :group_pricing_list, :home_phone, :image, :is_budget_approved, :is_inactive, :is_person, :item_pricing_list, :keywords,
16
- :language, :last_modified_date, :last_name, :last_page_visited, :last_visit, :lead_source, :middle_name, :mobile_phone,
16
+ :language, :last_modified_date, :last_name, :last_page_visited, :last_visit, :middle_name, :mobile_phone,
17
17
  :opening_balance, :opening_balance_account, :opening_balance_date, :overdue_balance, :parent, :partners_list,
18
- :password, :password2, :phone, :phonetic_name, :pref_cc_processor, :price_level, :print_on_check_as,
18
+ :password, :password2, :phone, :phonetic_name, :pref_cc_processor,:print_on_check_as,
19
19
  :print_transactions, :referrer, :reminder_days, :representing_subsidiary, :require_pwd_change, :resale_number,
20
20
  :sales_group, :sales_readiness, :sales_rep, :sales_team_list, :salutation, :send_email, :ship_complete, :shipping_item,
21
- :stage, :start_date, :subscriptions_list, :subsidiary, :sync_partner_teams, :tax_exempt, :tax_item, :taxable, :terms,
21
+ :stage, :start_date, :subscriptions_list, :sync_partner_teams, :tax_exempt, :tax_item, :taxable, :terms,
22
22
  :territory, :third_party_acct, :third_party_country, :third_party_zipcode, :title, :unbilled_orders, :url,
23
23
  :vat_reg_number, :visits, :web_lead
24
24
  ].each do |field|
@@ -88,7 +88,7 @@ describe NetSuite::Records::Customer do
88
88
  let(:response) { NetSuite::Response.new(:success => true, :body => { :is_person => true }) }
89
89
 
90
90
  it 'returns a Customer instance populated with the data from the response object' do
91
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Customer, :external_id => 1).and_return(response)
91
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Customer, {:external_id => 1}], {}).and_return(response)
92
92
  customer = NetSuite::Records::Customer.get(:external_id => 1)
93
93
  customer.should be_kind_of(NetSuite::Records::Customer)
94
94
  customer.is_person.should be_true
@@ -99,7 +99,7 @@ describe NetSuite::Records::Customer do
99
99
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
100
100
 
101
101
  it 'raises a RecordNotFound exception' do
102
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Customer, :external_id => 1).and_return(response)
102
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Customer, {:external_id => 1}], {}).and_return(response)
103
103
  lambda {
104
104
  NetSuite::Records::Customer.get(:external_id => 1)
105
105
  }.should raise_error(NetSuite::RecordNotFound,
@@ -116,7 +116,7 @@ describe NetSuite::Records::Customer do
116
116
 
117
117
  it 'returns true' do
118
118
  NetSuite::Actions::Add.should_receive(:call).
119
- with(customer).
119
+ with([customer], {}).
120
120
  and_return(response)
121
121
  customer.add.should be_true
122
122
  end
@@ -127,7 +127,7 @@ describe NetSuite::Records::Customer do
127
127
 
128
128
  it 'returns false' do
129
129
  NetSuite::Actions::Add.should_receive(:call).
130
- with(customer).
130
+ with([customer], {}).
131
131
  and_return(response)
132
132
  customer.add.should be_false
133
133
  end
@@ -140,7 +140,7 @@ describe NetSuite::Records::Customer do
140
140
 
141
141
  it 'returns true' do
142
142
  NetSuite::Actions::Delete.should_receive(:call).
143
- with(customer).
143
+ with([customer], {}).
144
144
  and_return(response)
145
145
  customer.delete.should be_true
146
146
  end
@@ -151,7 +151,7 @@ describe NetSuite::Records::Customer do
151
151
 
152
152
  it 'returns false' do
153
153
  NetSuite::Actions::Delete.should_receive(:call).
154
- with(customer).
154
+ with([customer], {}).
155
155
  and_return(response)
156
156
  customer.delete.should be_false
157
157
  end
@@ -24,7 +24,7 @@ describe NetSuite::Records::Department do
24
24
  let(:response) { NetSuite::Response.new(:success => true, :body => { :name => 'Department 1' }) }
25
25
 
26
26
  it 'returns a Department instance populated with the data from the response object' do
27
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Department, :external_id => 1).and_return(response)
27
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Department, {:external_id => 1}], {}).and_return(response)
28
28
  department = NetSuite::Records::Department.get(:external_id => 1)
29
29
  department.should be_kind_of(NetSuite::Records::Department)
30
30
  department.name.should eql('Department 1')
@@ -35,7 +35,7 @@ describe NetSuite::Records::Department do
35
35
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
36
36
 
37
37
  it 'raises a RecordNotFound exception' do
38
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Department, :external_id => 1).and_return(response)
38
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Department, {:external_id => 1}], {}).and_return(response)
39
39
  lambda {
40
40
  NetSuite::Records::Department.get(:external_id => 1)
41
41
  }.should raise_error(NetSuite::RecordNotFound,
@@ -53,7 +53,7 @@ describe NetSuite::Records::Department do
53
53
  it 'returns true' do
54
54
  department = NetSuite::Records::Department.new(test_data)
55
55
  NetSuite::Actions::Add.should_receive(:call).
56
- with(department).
56
+ with([department], {}).
57
57
  and_return(response)
58
58
  department.add.should be_true
59
59
  end
@@ -65,7 +65,7 @@ describe NetSuite::Records::Department do
65
65
  it 'returns false' do
66
66
  department = NetSuite::Records::Department.new(test_data)
67
67
  NetSuite::Actions::Add.should_receive(:call).
68
- with(department).
68
+ with([department], {}).
69
69
  and_return(response)
70
70
  department.add.should be_false
71
71
  end
@@ -81,7 +81,7 @@ describe NetSuite::Records::Department do
81
81
  it 'returns true' do
82
82
  department = NetSuite::Records::Department.new(test_data)
83
83
  NetSuite::Actions::Delete.should_receive(:call).
84
- with(department).
84
+ with([department], {}).
85
85
  and_return(response)
86
86
  department.delete.should be_true
87
87
  end
@@ -93,7 +93,7 @@ describe NetSuite::Records::Department do
93
93
  it 'returns false' do
94
94
  department = NetSuite::Records::Department.new(test_data)
95
95
  NetSuite::Actions::Delete.should_receive(:call).
96
- with(department).
96
+ with([department], {}).
97
97
  and_return(response)
98
98
  department.delete.should be_false
99
99
  end
@@ -44,13 +44,13 @@ describe NetSuite::Records::Deposit do
44
44
 
45
45
  describe '.get' do
46
46
  context 'when the response is successful' do
47
- let(:response) { NetSuite::Response.new(:success => true, :body => { :alt_shipping_cost => 100 }) }
47
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :memo => 'transfer for subscriptions' }) }
48
48
 
49
49
  it 'returns a Deposit instance populated with the data from the response object' do
50
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Deposit, :external_id => 1).and_return(response)
50
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Deposit, {:external_id => 1}], {}).and_return(response)
51
51
  deposit = NetSuite::Records::Deposit.get(:external_id => 1)
52
52
  deposit.should be_kind_of(NetSuite::Records::Deposit)
53
- deposit.alt_shipping_cost.should eql(100)
53
+ deposit.memo.should eql('transfer for subscriptions')
54
54
  end
55
55
  end
56
56
 
@@ -58,7 +58,7 @@ describe NetSuite::Records::Deposit do
58
58
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
59
59
 
60
60
  it 'raises a RecordNotFound exception' do
61
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Deposit, :external_id => 1).and_return(response)
61
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Deposit, {:external_id => 1}], {}).and_return(response)
62
62
  lambda {
63
63
  NetSuite::Records::Deposit.get(:external_id => 1)
64
64
  }.should raise_error(NetSuite::RecordNotFound,
@@ -76,7 +76,7 @@ describe NetSuite::Records::Deposit do
76
76
  it 'returns true' do
77
77
  deposit = NetSuite::Records::Deposit.new(test_data)
78
78
  NetSuite::Actions::Add.should_receive(:call).
79
- with(deposit).
79
+ with([deposit], {}).
80
80
  and_return(response)
81
81
  deposit.add.should be_true
82
82
  end
@@ -88,7 +88,7 @@ describe NetSuite::Records::Deposit do
88
88
  it 'returns false' do
89
89
  deposit = NetSuite::Records::Deposit.new(test_data)
90
90
  NetSuite::Actions::Add.should_receive(:call).
91
- with(deposit).
91
+ with([deposit], {}).
92
92
  and_return(response)
93
93
  deposit.add.should be_false
94
94
  end
@@ -104,7 +104,7 @@ describe NetSuite::Records::Deposit do
104
104
  it 'returns true' do
105
105
  deposit = NetSuite::Records::Deposit.new(test_data)
106
106
  NetSuite::Actions::Delete.should_receive(:call).
107
- with(deposit).
107
+ with([deposit], {}).
108
108
  and_return(response)
109
109
  deposit.delete.should be_true
110
110
  end
@@ -116,7 +116,7 @@ describe NetSuite::Records::Deposit do
116
116
  it 'returns false' do
117
117
  deposit = NetSuite::Records::Deposit.new(test_data)
118
118
  NetSuite::Actions::Delete.should_receive(:call).
119
- with(deposit).
119
+ with([deposit], {}).
120
120
  and_return(response)
121
121
  deposit.delete.should be_false
122
122
  end
@@ -125,12 +125,12 @@ describe NetSuite::Records::Deposit do
125
125
 
126
126
  describe '#to_record' do
127
127
  before do
128
- deposit.email = 'something@example.com'
128
+ deposit.memo = 'something@example.com'
129
129
  deposit.tran_id = '4'
130
130
  end
131
131
  it 'can represent itself as a SOAP record' do
132
132
  record = {
133
- 'tranBank:email' => 'something@example.com',
133
+ 'tranBank:memo' => 'something@example.com',
134
134
  'tranBank:tranId' => '4'
135
135
  }
136
136
  deposit.to_record.should eql(record)
@@ -104,7 +104,7 @@ describe NetSuite::Records::InventoryItem do
104
104
  let(:response) { NetSuite::Response.new(:success => true, :body => { :cost => 100 }) }
105
105
 
106
106
  it 'returns a InventoryItem instance populated with the data from the response object' do
107
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::InventoryItem, :external_id => 1).and_return(response)
107
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::InventoryItem, {:external_id => 1}], {}).and_return(response)
108
108
  item = NetSuite::Records::InventoryItem.get(:external_id => 1)
109
109
  item.should be_kind_of(NetSuite::Records::InventoryItem)
110
110
  item.cost.should eql(100)
@@ -115,7 +115,7 @@ describe NetSuite::Records::InventoryItem do
115
115
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
116
116
 
117
117
  it 'raises a RecordNotFound exception' do
118
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::InventoryItem, :external_id => 1).and_return(response)
118
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::InventoryItem, {:external_id => 1}], {}).and_return(response)
119
119
  lambda {
120
120
  NetSuite::Records::InventoryItem.get(:external_id => 1)
121
121
  }.should raise_error(NetSuite::RecordNotFound,
@@ -132,7 +132,7 @@ describe NetSuite::Records::InventoryItem do
132
132
 
133
133
  it 'returns true' do
134
134
  NetSuite::Actions::Add.should_receive(:call).
135
- with(item).
135
+ with([item], {}).
136
136
  and_return(response)
137
137
  item.add.should be_true
138
138
  end
@@ -143,7 +143,7 @@ describe NetSuite::Records::InventoryItem do
143
143
 
144
144
  it 'returns false' do
145
145
  NetSuite::Actions::Add.should_receive(:call).
146
- with(item).
146
+ with([item], {}).
147
147
  and_return(response)
148
148
  item.add.should be_false
149
149
  end
@@ -156,7 +156,7 @@ describe NetSuite::Records::InventoryItem do
156
156
 
157
157
  it 'returns true' do
158
158
  NetSuite::Actions::Delete.should_receive(:call).
159
- with(item).
159
+ with([item], {}).
160
160
  and_return(response)
161
161
  item.delete.should be_true
162
162
  end
@@ -167,7 +167,7 @@ describe NetSuite::Records::InventoryItem do
167
167
 
168
168
  it 'returns false' do
169
169
  NetSuite::Actions::Delete.should_receive(:call).
170
- with(item).
170
+ with([item], {}).
171
171
  and_return(response)
172
172
  item.delete.should be_false
173
173
  end
@@ -137,7 +137,7 @@ describe NetSuite::Records::Invoice do
137
137
  let(:response) { NetSuite::Response.new(:success => true, :body => { :is_person => true }) }
138
138
 
139
139
  it 'returns an Invoice instance populated with the data from the response object' do
140
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Invoice, :external_id => 10).and_return(response)
140
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Invoice, {:external_id => 10}], {}).and_return(response)
141
141
  invoice = NetSuite::Records::Invoice.get(:external_id => 10)
142
142
  invoice.should be_kind_of(NetSuite::Records::Invoice)
143
143
  end
@@ -147,7 +147,7 @@ describe NetSuite::Records::Invoice do
147
147
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
148
148
 
149
149
  it 'raises a RecordNotFound exception' do
150
- NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Invoice, :external_id => 10).and_return(response)
150
+ NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Invoice, {:external_id => 10}], {}).and_return(response)
151
151
  lambda {
152
152
  NetSuite::Records::Invoice.get(:external_id => 10)
153
153
  }.should raise_error(NetSuite::RecordNotFound,
@@ -159,14 +159,14 @@ describe NetSuite::Records::Invoice do
159
159
  describe '.initialize' do
160
160
  context 'when the request is successful' do
161
161
  it 'returns an initialized invoice from the customer entity' do
162
- NetSuite::Actions::Initialize.should_receive(:call).with(NetSuite::Records::Invoice, customer).and_return(response)
162
+ NetSuite::Actions::Initialize.should_receive(:call).with([NetSuite::Records::Invoice, customer], {}).and_return(response)
163
163
  invoice = NetSuite::Records::Invoice.initialize(customer)
164
164
  invoice.should be_kind_of(NetSuite::Records::Invoice)
165
165
  end
166
166
  end
167
167
 
168
168
  context 'when the response is unsuccessful' do
169
- pending
169
+ skip
170
170
  end
171
171
  end
172
172
 
@@ -179,7 +179,7 @@ describe NetSuite::Records::Invoice do
179
179
  it 'returns true' do
180
180
  invoice = NetSuite::Records::Invoice.new(test_data)
181
181
  NetSuite::Actions::Add.should_receive(:call).
182
- with(invoice).
182
+ with([invoice], {}).
183
183
  and_return(response)
184
184
  invoice.add.should be_true
185
185
  end
@@ -191,7 +191,7 @@ describe NetSuite::Records::Invoice do
191
191
  it 'returns false' do
192
192
  invoice = NetSuite::Records::Invoice.new(test_data)
193
193
  NetSuite::Actions::Add.should_receive(:call).
194
- with(invoice).
194
+ with([invoice], {}).
195
195
  and_return(response)
196
196
  invoice.add.should be_false
197
197
  end
@@ -205,7 +205,7 @@ describe NetSuite::Records::Invoice do
205
205
  it 'returns true' do
206
206
  invoice = NetSuite::Records::Invoice.new
207
207
  NetSuite::Actions::Delete.should_receive(:call).
208
- with(invoice).
208
+ with([invoice], {}).
209
209
  and_return(response)
210
210
  invoice.delete.should be_true
211
211
  end
@@ -217,7 +217,7 @@ describe NetSuite::Records::Invoice do
217
217
  it 'returns false' do
218
218
  invoice = NetSuite::Records::Invoice.new
219
219
  NetSuite::Actions::Delete.should_receive(:call).
220
- with(invoice).
220
+ with([invoice], {}).
221
221
  and_return(response)
222
222
  invoice.delete.should be_false
223
223
  end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::ItemFulfillmentPackageList do
4
+ let(:list) { NetSuite::Records::ItemFulfillmentPackageList.new }
5
+
6
+ it 'has a packages attribute' do
7
+ list.packages.should be_kind_of(Array)
8
+ end
9
+
10
+ describe '#to_record' do
11
+ before do
12
+ list.packages << NetSuite::Records::ItemFulfillmentPackage.new(
13
+ :package_tracking_number => '1Z12354645757686786'
14
+ )
15
+ end
16
+
17
+ it 'can represent itself as a SOAP record' do
18
+ record = {
19
+ 'tranSales:package' => [
20
+ 'tranSales:packageTrackingNumber' => '1Z12354645757686786'
21
+ ]
22
+ }
23
+
24
+ list.to_record.should eql(record)
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ module NetSuite
4
+ module Records
5
+ describe ItemFulfillment do
6
+ context "unify package list attributes" do
7
+ let(:package_ups_list) do
8
+ {
9
+ :package_weight_ups=>"4.0",
10
+ :package_tracking_number_ups=>"1ZYA95390396947456",
11
+ :packaging_ups=>"_yourPackaging",
12
+ :use_insured_value_ups=>false,
13
+ :reference1_ups=>"spree@example.com",
14
+ :reference2_ups=>"spree@example.com",
15
+ :package_length_ups=>"24",
16
+ :package_width_ups=>"24",
17
+ :package_height_ups=>"24",
18
+ :additional_handling_ups=>false,
19
+ :use_cod_ups=>false
20
+ }
21
+ end
22
+
23
+ let(:list) do
24
+ { package_ups_list: { package_ups: package_ups_list } }
25
+ end
26
+
27
+ subject do
28
+ described_class.new(list)
29
+ end
30
+
31
+ it "access ups attributes via package_list" do
32
+ package = subject.package_list.packages.first
33
+ expect(package.package_tracking_number).to eq package_ups_list[:package_tracking_number_ups]
34
+ end
35
+
36
+ context "array" do
37
+ let(:list) do
38
+ { package_ups_list: { package_ups: [package_ups_list, package_ups_list] } }
39
+ end
40
+
41
+ it "access ups attributes via package_list" do
42
+ package = subject.package_list.packages.first
43
+ expect(package.package_tracking_number).to eq package_ups_list[:package_tracking_number_ups]
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end