netsuite 0.8.5 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/Gemfile +3 -2
- data/README.md +8 -2
- data/circle.yml +33 -14
- data/lib/netsuite.rb +5 -0
- data/lib/netsuite/configuration.rb +8 -4
- data/lib/netsuite/records/classification.rb +4 -1
- data/lib/netsuite/records/custom_record.rb +1 -1
- data/lib/netsuite/records/customer.rb +2 -1
- data/lib/netsuite/records/customer_credit_cards.rb +36 -0
- data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
- data/lib/netsuite/records/customer_payment.rb +1 -0
- data/lib/netsuite/records/employee.rb +1 -1
- data/lib/netsuite/records/estimate.rb +42 -0
- data/lib/netsuite/records/estimate_item.rb +40 -0
- data/lib/netsuite/records/estimate_item_list.rb +11 -0
- data/lib/netsuite/records/invoice.rb +1 -1
- data/lib/netsuite/records/item_fulfillment.rb +1 -1
- data/lib/netsuite/records/non_inventory_resale_item.rb +1 -0
- data/lib/netsuite/records/partner.rb +1 -1
- data/lib/netsuite/records/service_resale_item.rb +1 -1
- data/lib/netsuite/utilities.rb +1 -1
- data/lib/netsuite/version.rb +1 -1
- data/netsuite.gemspec +3 -2
- data/spec/netsuite/configuration_spec.rb +61 -6
- data/spec/netsuite/records/classification_spec.rb +10 -1
- data/spec/netsuite/records/custom_field_list_spec.rb +6 -4
- data/spec/netsuite/records/custom_record_spec.rb +1 -1
- data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
- data/spec/netsuite/records/customer_spec.rb +22 -1
- data/spec/netsuite/records/employee_spec.rb +2 -2
- data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
- data/spec/netsuite/records/estimate_item_spec.rb +40 -0
- data/spec/netsuite/records/estimate_spec.rb +216 -0
- data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
- data/spec/netsuite/records/partner_spec.rb +141 -0
- data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
- metadata +31 -6
@@ -0,0 +1,165 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::NonInventoryResaleItem do
|
4
|
+
let(:item) { NetSuite::Records::NonInventoryResaleItem.new }
|
5
|
+
|
6
|
+
it 'has the right fields' do
|
7
|
+
[
|
8
|
+
:available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture, :created_date,
|
9
|
+
:display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap,
|
10
|
+
:featured_description, :handling_cost, :handling_cost_units, :include_children, :is_donation_item, :is_fulfillable,
|
11
|
+
:is_gco_compliant, :is_inactive, :is_online, :is_taxable, :item_id, :last_modified_date, :manufacturer, :manufacturer_addr1,
|
12
|
+
:manufacturer_city, :manufacturer_state, :manufacturer_tariff, :manufacturer_tax_id, :manufacturer_zip, :matrix_option_list,
|
13
|
+
:matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity, :minimum_quantity_units, :mpn,
|
14
|
+
:mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
|
15
|
+
:out_of_stock_message, :overall_quantity_pricing_type, :page_title, :preference_criterion, :presentation_item_list,
|
16
|
+
:prices_include_tax, :producer, :product_feed_list, :rate, :related_items_description, :sales_description,
|
17
|
+
:schedule_b_code, :schedule_b_number, :schedule_b_quantity, :search_keywords, :ship_individually, :shipping_cost,
|
18
|
+
:shipping_cost_units, :shopping_dot_com_category, :shopzilla_category_id, :show_default_donation_amount,
|
19
|
+
:site_category_list, :sitemap_priority, :soft_descriptor, :specials_description, :stock_description, :store_description,
|
20
|
+
:store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component, :use_marginal_rates,
|
21
|
+
:vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :weight, :weight_unit, :weight_units
|
22
|
+
].each do |field|
|
23
|
+
expect(item).to have_field(field)
|
24
|
+
end
|
25
|
+
|
26
|
+
# TODO there is a probably a more robust way to test this
|
27
|
+
expect(item.custom_field_list.class).to eq(NetSuite::Records::CustomFieldList)
|
28
|
+
expect(item.pricing_matrix.class).to eq(NetSuite::Records::PricingMatrix)
|
29
|
+
expect(item.subsidiary_list.class).to eq(NetSuite::Records::RecordRefList)
|
30
|
+
expect(item.item_vendor_list.class).to eq(NetSuite::Records::ItemVendorList)
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'has the right record_refs' do
|
35
|
+
[
|
36
|
+
:billing_schedule, :cost_category, :custom_form, :deferred_revenue_account, :department, :income_account,
|
37
|
+
:issue_product, :item_options_list, :klass, :location, :parent, :pricing_group, :purchase_tax_code,
|
38
|
+
:quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :ship_package, :store_display_image,
|
39
|
+
:store_display_thumbnail, :store_item_template, :tax_schedule, :units_type, :expense_account
|
40
|
+
].each do |record_ref|
|
41
|
+
expect(item).to have_record_ref(record_ref)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '.get' do
|
46
|
+
context 'when the response is successful' do
|
47
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :manufacturer_zip => '90401' }) }
|
48
|
+
|
49
|
+
it 'returns a NonInventoryResaleItem instance populated with the data from the response object' do
|
50
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::NonInventoryResaleItem, {:external_id => 20}], {}).and_return(response)
|
51
|
+
customer = NetSuite::Records::NonInventoryResaleItem.get(:external_id => 20)
|
52
|
+
expect(customer).to be_kind_of(NetSuite::Records::NonInventoryResaleItem)
|
53
|
+
expect(customer.manufacturer_zip).to eql('90401')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when the response is unsuccessful' do
|
58
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
59
|
+
|
60
|
+
it 'raises a RecordNotFound exception' do
|
61
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::NonInventoryResaleItem, {:external_id => 20}], {}).and_return(response)
|
62
|
+
expect {
|
63
|
+
NetSuite::Records::NonInventoryResaleItem.get(:external_id => 20)
|
64
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
65
|
+
/NetSuite::Records::NonInventoryResaleItem with OPTIONS=(.*) could not be found/)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe '#add' do
|
71
|
+
context 'when the response is successful' do
|
72
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
73
|
+
|
74
|
+
it 'returns true' do
|
75
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
76
|
+
with([item], {}).
|
77
|
+
and_return(response)
|
78
|
+
expect(item.add).to be_truthy
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'when the response is unsuccessful' do
|
83
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
84
|
+
|
85
|
+
it 'returns false' do
|
86
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
87
|
+
with([item], {}).
|
88
|
+
and_return(response)
|
89
|
+
expect(item.add).to be_falsey
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '#update' do
|
95
|
+
context 'when the response is successful' do
|
96
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
97
|
+
|
98
|
+
it 'returns true' do
|
99
|
+
expect(NetSuite::Actions::Update).to receive(:call).
|
100
|
+
with([item.class, {external_id: 'foo'}], {}).
|
101
|
+
and_return(response)
|
102
|
+
item.external_id = 'foo'
|
103
|
+
expect(item.update).to be_truthy
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context 'when the response is unsuccessful' do
|
108
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
109
|
+
|
110
|
+
it 'returns false' do
|
111
|
+
expect(NetSuite::Actions::Update).to receive(:call).
|
112
|
+
with([item.class, {external_id: 'foo'}], {}).
|
113
|
+
and_return(response)
|
114
|
+
item.external_id = 'foo'
|
115
|
+
expect(item.update).to be_falsey
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe '#delete' do
|
121
|
+
context 'when the response is successful' do
|
122
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
123
|
+
|
124
|
+
it 'returns true' do
|
125
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
126
|
+
with([item], {}).
|
127
|
+
and_return(response)
|
128
|
+
expect(item.delete).to be_truthy
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'when the response is unsuccessful' do
|
133
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
134
|
+
|
135
|
+
it 'returns false' do
|
136
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
137
|
+
with([item], {}).
|
138
|
+
and_return(response)
|
139
|
+
expect(item.delete).to be_falsey
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe '#to_record' do
|
145
|
+
before do
|
146
|
+
item.handling_cost = 100.0
|
147
|
+
item.is_online = true
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'can represent itself as a SOAP record' do
|
151
|
+
record = {
|
152
|
+
'listAcct:handlingCost' => 100.0,
|
153
|
+
'listAcct:isOnline' => true
|
154
|
+
}
|
155
|
+
expect(item.to_record).to eql(record)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe '#record_type' do
|
160
|
+
it 'returns a string of the SOAP type' do
|
161
|
+
expect(item.record_type).to eql('listAcct:NonInventoryResaleItem')
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::Partner do
|
4
|
+
let(:partner) { NetSuite::Records::Partner.new }
|
5
|
+
|
6
|
+
it 'has all the right fields' do
|
7
|
+
[
|
8
|
+
:phone, :home_phone, :first_name, :last_name, :alt_name, :is_inactive, :email, :give_access,
|
9
|
+
:partner_code, :is_person, :company_name, :eligible_for_commission, :entity_id, :last_modified_date,
|
10
|
+
:date_created, :title, :mobile_phone, :comments, :middle_name, :send_email, :password, :password2
|
11
|
+
].each do |field|
|
12
|
+
expect(partner).to have_field(field)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'has all the right record refs' do
|
17
|
+
[
|
18
|
+
:klass, :access_role, :department, :subsidiary
|
19
|
+
].each do |record_ref|
|
20
|
+
expect(partner).to have_record_ref(record_ref)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.get' do
|
25
|
+
context 'when the response is successful' do
|
26
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :account_number => 7 }) }
|
27
|
+
|
28
|
+
it 'returns an Partner instance populated with the data from the response object' do
|
29
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Partner, { :external_id => 1 }], {}).and_return(response)
|
30
|
+
Partner = NetSuite::Records::Partner.get(:external_id => 1)
|
31
|
+
expect(Partner).to be_kind_of(NetSuite::Records::Partner)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when the response is unsuccessful' do
|
36
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
37
|
+
|
38
|
+
it 'raises a RecordNotFound exception' do
|
39
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Partner, { :external_id => 1 }], {}).and_return(response)
|
40
|
+
expect {
|
41
|
+
NetSuite::Records::Partner.get(:external_id => 1)
|
42
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
43
|
+
/NetSuite::Records::Partner with OPTIONS=(.*) could not be found/)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#add' do
|
49
|
+
let(:partner) { NetSuite::Records::Partner.new(:email => 'dale.cooper@example.com') }
|
50
|
+
|
51
|
+
context 'when the response is successful' do
|
52
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
53
|
+
|
54
|
+
it 'returns true' do
|
55
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
56
|
+
with([partner], {}).
|
57
|
+
and_return(response)
|
58
|
+
expect(partner.add).to be_truthy
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'when the response is unsuccessful' do
|
63
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
64
|
+
|
65
|
+
it 'returns false' do
|
66
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
67
|
+
with([partner], {}).
|
68
|
+
and_return(response)
|
69
|
+
expect(partner.add).to be_falsey
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '#delete' do
|
75
|
+
context 'when the response is successful' do
|
76
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
77
|
+
|
78
|
+
it 'returns true' do
|
79
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
80
|
+
with([partner], {}).
|
81
|
+
and_return(response)
|
82
|
+
expect(partner.delete).to be_truthy
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'when the response is unsuccessful' do
|
87
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
88
|
+
|
89
|
+
it 'returns false' do
|
90
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
91
|
+
with([partner], {}).
|
92
|
+
and_return(response)
|
93
|
+
expect(partner.delete).to be_falsey
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe '.update' do
|
99
|
+
context 'when the response is successful' do
|
100
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :email => 'leland.palmer@example.com' }) }
|
101
|
+
|
102
|
+
it 'returns true' do
|
103
|
+
expect(NetSuite::Actions::Update).to receive(:call).with([NetSuite::Records::Partner, { :internal_id => 1, :email => 'leland.palmer@example.com' }], {}).and_return(response)
|
104
|
+
partner = NetSuite::Records::Partner.new(:internal_id => 1)
|
105
|
+
expect(partner.update(:email => 'leland.palmer@example.com')).to be_truthy
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'when the response is unsuccessful' do
|
110
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
111
|
+
|
112
|
+
it 'raises a RecordNotFound exception' do
|
113
|
+
expect(NetSuite::Actions::Update).to receive(:call).with([NetSuite::Records::Partner, { :internal_id => 1, :account_number => 7 }], {}).and_return(response)
|
114
|
+
partner = NetSuite::Records::Partner.new(:internal_id => 1)
|
115
|
+
expect(partner.update(:account_number => 7)).to be_falsey
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe '#to_record' do
|
121
|
+
let(:partner) { NetSuite::Records::Partner.new(:email => 'bob@example.com') }
|
122
|
+
|
123
|
+
it 'returns a hash of attributes that can be used in a SOAP request' do
|
124
|
+
expect(partner.to_record).to eql({ 'listRel:email' => 'bob@example.com' })
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#record_type' do
|
129
|
+
it 'returns a string type for the record to be used in a SOAP request' do
|
130
|
+
expect(partner.record_type).to eql('listRel:Partner')
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'has the right record_refs' do
|
135
|
+
[
|
136
|
+
:klass, :access_role, :department, :subsidiary
|
137
|
+
].each do |record_ref|
|
138
|
+
expect(partner).to have_record_ref(record_ref)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::ServiceResaleItem do
|
4
|
+
let(:item) { NetSuite::Records::ServiceResaleItem.new }
|
5
|
+
|
6
|
+
it 'has the right fields' do
|
7
|
+
[
|
8
|
+
:available_to_partners, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date,
|
9
|
+
:display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description,
|
10
|
+
:include_children, :is_donation_item, :is_fulfillable, :is_gco_compliant, :is_inactive, :is_online, :is_taxable,
|
11
|
+
:item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html,
|
12
|
+
:minimum_quantity, :minimum_quantity_units, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
|
13
|
+
:out_of_stock_message, :overall_quantity_pricing_type, :page_title, :presentation_item_list, :prices_include_tax,
|
14
|
+
:show_default_donation_amount, :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description,
|
15
|
+
:store_description, :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component,
|
16
|
+
:use_marginal_rates, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :vsoe_sop_group
|
17
|
+
].each do |field|
|
18
|
+
expect(item).to have_field(field)
|
19
|
+
end
|
20
|
+
|
21
|
+
# TODO there is a probably a more robust way to test this
|
22
|
+
expect(item.custom_field_list.class).to eq(NetSuite::Records::CustomFieldList)
|
23
|
+
expect(item.pricing_matrix.class).to eq(NetSuite::Records::PricingMatrix)
|
24
|
+
expect(item.subsidiary_list.class).to eq(NetSuite::Records::RecordRefList)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'has the right record_refs' do
|
28
|
+
[
|
29
|
+
:billing_schedule, :cost_category, :custom_form, :deferred_revenue_account, :department, :income_account,
|
30
|
+
:issue_product, :item_options_list, :klass, :location, :parent, :pricing_group, :purchase_tax_code,
|
31
|
+
:quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :store_display_image,
|
32
|
+
:store_display_thumbnail, :store_item_template, :tax_schedule, :units_type
|
33
|
+
].each do |record_ref|
|
34
|
+
expect(item).to have_record_ref(record_ref)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '.get' do
|
39
|
+
context 'when the response is successful' do
|
40
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :item_id => 'penguins' }) }
|
41
|
+
|
42
|
+
it 'returns a ServiceResaleItem instance populated with the data from the response object' do
|
43
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::ServiceResaleItem, :external_id => 20], {}).and_return(response)
|
44
|
+
customer = NetSuite::Records::ServiceResaleItem.get(:external_id => 20)
|
45
|
+
expect(customer).to be_kind_of(NetSuite::Records::ServiceResaleItem)
|
46
|
+
expect(customer.item_id).to eql('penguins')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'when the response is unsuccessful' do
|
51
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
52
|
+
|
53
|
+
it 'raises a RecordNotFound exception' do
|
54
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::ServiceResaleItem, :external_id => 20], {}).and_return(response)
|
55
|
+
expect {
|
56
|
+
NetSuite::Records::ServiceResaleItem.get(:external_id => 20)
|
57
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
58
|
+
/NetSuite::Records::ServiceResaleItem with OPTIONS=(.*) could not be found/)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#add' do
|
64
|
+
let(:item) { NetSuite::Records::ServiceResaleItem.new(:cost => 100, :is_inactive => false) }
|
65
|
+
|
66
|
+
context 'when the response is successful' do
|
67
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
68
|
+
|
69
|
+
it 'returns true' do
|
70
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
71
|
+
with([item], {}).
|
72
|
+
and_return(response)
|
73
|
+
expect(item.add).to be_truthy
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when the response is unsuccessful' do
|
78
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
79
|
+
|
80
|
+
it 'returns false' do
|
81
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
82
|
+
with([item], {}).
|
83
|
+
and_return(response)
|
84
|
+
expect(item.add).to be_falsey
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe '#delete' do
|
90
|
+
context 'when the response is successful' do
|
91
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
92
|
+
|
93
|
+
it 'returns true' do
|
94
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
95
|
+
with([item], {}).
|
96
|
+
and_return(response)
|
97
|
+
expect(item.delete).to be_truthy
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'when the response is unsuccessful' do
|
102
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
103
|
+
|
104
|
+
it 'returns false' do
|
105
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
106
|
+
with([item], {}).
|
107
|
+
and_return(response)
|
108
|
+
expect(item.delete).to be_falsey
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe '#to_record' do
|
114
|
+
before do
|
115
|
+
item.item_id = 'penguins'
|
116
|
+
item.is_online = true
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'can represent itself as a SOAP record' do
|
120
|
+
record = {
|
121
|
+
'listAcct:itemId' => 'penguins',
|
122
|
+
'listAcct:isOnline' => true
|
123
|
+
}
|
124
|
+
expect(item.to_record).to eql(record)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#record_type' do
|
129
|
+
it 'returns a string of the SOAP type' do
|
130
|
+
expect(item.record_type).to eql('listAcct:ServiceResaleItem')
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsuite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Moran
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-09-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -18,6 +18,9 @@ dependencies:
|
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 2.3.0
|
21
|
+
- - "<="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.11.1
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -25,6 +28,9 @@ dependencies:
|
|
25
28
|
- - ">="
|
26
29
|
- !ruby/object:Gem::Version
|
27
30
|
version: 2.3.0
|
31
|
+
- - "<="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.11.1
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: rspec
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,7 +48,7 @@ dependencies:
|
|
42
48
|
description: NetSuite SuiteTalk API Wrapper
|
43
49
|
email:
|
44
50
|
- ryan.moran@gmail.com
|
45
|
-
- mike@
|
51
|
+
- mike@mikebian.co
|
46
52
|
executables: []
|
47
53
|
extensions: []
|
48
54
|
extra_rdoc_files: []
|
@@ -150,6 +156,8 @@ files:
|
|
150
156
|
- lib/netsuite/records/customer_addressbook.rb
|
151
157
|
- lib/netsuite/records/customer_addressbook_list.rb
|
152
158
|
- lib/netsuite/records/customer_category.rb
|
159
|
+
- lib/netsuite/records/customer_credit_cards.rb
|
160
|
+
- lib/netsuite/records/customer_credit_cards_list.rb
|
153
161
|
- lib/netsuite/records/customer_currency.rb
|
154
162
|
- lib/netsuite/records/customer_currency_list.rb
|
155
163
|
- lib/netsuite/records/customer_deposit.rb
|
@@ -184,6 +192,9 @@ files:
|
|
184
192
|
- lib/netsuite/records/duration.rb
|
185
193
|
- lib/netsuite/records/employee.rb
|
186
194
|
- lib/netsuite/records/entity_custom_field.rb
|
195
|
+
- lib/netsuite/records/estimate.rb
|
196
|
+
- lib/netsuite/records/estimate_item.rb
|
197
|
+
- lib/netsuite/records/estimate_item_list.rb
|
187
198
|
- lib/netsuite/records/file.rb
|
188
199
|
- lib/netsuite/records/folder.rb
|
189
200
|
- lib/netsuite/records/gift_cert_redemption.rb
|
@@ -394,6 +405,7 @@ files:
|
|
394
405
|
- spec/netsuite/records/custom_record_type_spec.rb
|
395
406
|
- spec/netsuite/records/customer_addressbook_list_spec.rb
|
396
407
|
- spec/netsuite/records/customer_addressbook_spec.rb
|
408
|
+
- spec/netsuite/records/customer_credit_cards_list_spec.rb
|
397
409
|
- spec/netsuite/records/customer_payment_apply_list_spec.rb
|
398
410
|
- spec/netsuite/records/customer_payment_spec.rb
|
399
411
|
- spec/netsuite/records/customer_refund_apply_list_spec.rb
|
@@ -411,6 +423,9 @@ files:
|
|
411
423
|
- spec/netsuite/records/duration_spec.rb
|
412
424
|
- spec/netsuite/records/employee_spec.rb
|
413
425
|
- spec/netsuite/records/entity_custom_field_spec.rb
|
426
|
+
- spec/netsuite/records/estimate_item_list_spec.rb
|
427
|
+
- spec/netsuite/records/estimate_item_spec.rb
|
428
|
+
- spec/netsuite/records/estimate_spec.rb
|
414
429
|
- spec/netsuite/records/file_spec.rb
|
415
430
|
- spec/netsuite/records/folder_spec.rb
|
416
431
|
- spec/netsuite/records/gift_cert_redemption_list_spec.rb
|
@@ -440,9 +455,11 @@ files:
|
|
440
455
|
- spec/netsuite/records/location_spec.rb
|
441
456
|
- spec/netsuite/records/matrix_option_list_spec.rb
|
442
457
|
- spec/netsuite/records/message_spec.rb
|
458
|
+
- spec/netsuite/records/non_inventory_resale_item_spec.rb
|
443
459
|
- spec/netsuite/records/non_inventory_sale_item_spec.rb
|
444
460
|
- spec/netsuite/records/note_spec.rb
|
445
461
|
- spec/netsuite/records/note_type_spec.rb
|
462
|
+
- spec/netsuite/records/partner_spec.rb
|
446
463
|
- spec/netsuite/records/payment_item_spec.rb
|
447
464
|
- spec/netsuite/records/payment_method_spec.rb
|
448
465
|
- spec/netsuite/records/phone_call_spec.rb
|
@@ -457,6 +474,7 @@ files:
|
|
457
474
|
- spec/netsuite/records/sales_order_item_spec.rb
|
458
475
|
- spec/netsuite/records/sales_order_spec.rb
|
459
476
|
- spec/netsuite/records/sales_tax_item_spec.rb
|
477
|
+
- spec/netsuite/records/service_resale_item_spec.rb
|
460
478
|
- spec/netsuite/records/service_sale_item_spec.rb
|
461
479
|
- spec/netsuite/records/ship_address_spec.rb
|
462
480
|
- spec/netsuite/records/site_category_spec.rb
|
@@ -535,7 +553,8 @@ files:
|
|
535
553
|
- spec/support/record_ref_matcher.rb
|
536
554
|
- spec/support/savon.rb
|
537
555
|
homepage: https://github.com/NetSweet/netsuite
|
538
|
-
licenses:
|
556
|
+
licenses:
|
557
|
+
- MIT
|
539
558
|
metadata: {}
|
540
559
|
post_install_message:
|
541
560
|
rdoc_options: []
|
@@ -552,8 +571,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
552
571
|
- !ruby/object:Gem::Version
|
553
572
|
version: '0'
|
554
573
|
requirements: []
|
555
|
-
|
556
|
-
rubygems_version: 2.5.1
|
574
|
+
rubygems_version: 3.0.3
|
557
575
|
signing_key:
|
558
576
|
specification_version: 4
|
559
577
|
summary: NetSuite SuiteTalk API (SOAP) Wrapper
|
@@ -607,6 +625,7 @@ test_files:
|
|
607
625
|
- spec/netsuite/records/custom_record_type_spec.rb
|
608
626
|
- spec/netsuite/records/customer_addressbook_list_spec.rb
|
609
627
|
- spec/netsuite/records/customer_addressbook_spec.rb
|
628
|
+
- spec/netsuite/records/customer_credit_cards_list_spec.rb
|
610
629
|
- spec/netsuite/records/customer_payment_apply_list_spec.rb
|
611
630
|
- spec/netsuite/records/customer_payment_spec.rb
|
612
631
|
- spec/netsuite/records/customer_refund_apply_list_spec.rb
|
@@ -624,6 +643,9 @@ test_files:
|
|
624
643
|
- spec/netsuite/records/duration_spec.rb
|
625
644
|
- spec/netsuite/records/employee_spec.rb
|
626
645
|
- spec/netsuite/records/entity_custom_field_spec.rb
|
646
|
+
- spec/netsuite/records/estimate_item_list_spec.rb
|
647
|
+
- spec/netsuite/records/estimate_item_spec.rb
|
648
|
+
- spec/netsuite/records/estimate_spec.rb
|
627
649
|
- spec/netsuite/records/file_spec.rb
|
628
650
|
- spec/netsuite/records/folder_spec.rb
|
629
651
|
- spec/netsuite/records/gift_cert_redemption_list_spec.rb
|
@@ -653,9 +675,11 @@ test_files:
|
|
653
675
|
- spec/netsuite/records/location_spec.rb
|
654
676
|
- spec/netsuite/records/matrix_option_list_spec.rb
|
655
677
|
- spec/netsuite/records/message_spec.rb
|
678
|
+
- spec/netsuite/records/non_inventory_resale_item_spec.rb
|
656
679
|
- spec/netsuite/records/non_inventory_sale_item_spec.rb
|
657
680
|
- spec/netsuite/records/note_spec.rb
|
658
681
|
- spec/netsuite/records/note_type_spec.rb
|
682
|
+
- spec/netsuite/records/partner_spec.rb
|
659
683
|
- spec/netsuite/records/payment_item_spec.rb
|
660
684
|
- spec/netsuite/records/payment_method_spec.rb
|
661
685
|
- spec/netsuite/records/phone_call_spec.rb
|
@@ -670,6 +694,7 @@ test_files:
|
|
670
694
|
- spec/netsuite/records/sales_order_item_spec.rb
|
671
695
|
- spec/netsuite/records/sales_order_spec.rb
|
672
696
|
- spec/netsuite/records/sales_tax_item_spec.rb
|
697
|
+
- spec/netsuite/records/service_resale_item_spec.rb
|
673
698
|
- spec/netsuite/records/service_sale_item_spec.rb
|
674
699
|
- spec/netsuite/records/ship_address_spec.rb
|
675
700
|
- spec/netsuite/records/site_category_spec.rb
|