netsuite 0.6.6 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/netsuite.rb +1 -1
- data/lib/netsuite/records/contact_role.rb +23 -0
- data/lib/netsuite/records/kit_item.rb +66 -2
- data/lib/netsuite/records/transfer_order.rb +2 -2
- data/lib/netsuite/records/vendor_bill.rb +8 -0
- data/lib/netsuite/records/vendor_payment.rb +11 -2
- data/lib/netsuite/version.rb +1 -1
- data/spec/netsuite/records/basic_record_spec.rb +1 -0
- data/spec/netsuite/records/kit_item_spec.rb +117 -0
- data/spec/netsuite/records/vendor_payment_spec.rb +1 -1
- metadata +5 -2
data/lib/netsuite.rb
CHANGED
@@ -112,6 +112,7 @@ module NetSuite
|
|
112
112
|
autoload :CustomerPartner, 'netsuite/records/customer_partner'
|
113
113
|
autoload :ContactList, 'netsuite/records/contact_list'
|
114
114
|
autoload :Contact, 'netsuite/records/contact'
|
115
|
+
autoload :ContactRole, 'netsuite/records/contact_role'
|
115
116
|
autoload :ContactAccessRoles, 'netsuite/records/contact_access_roles'
|
116
117
|
autoload :ContactAccessRolesList, 'netsuite/records/contact_access_roles_list'
|
117
118
|
autoload :Currency, 'netsuite/records/currency'
|
@@ -195,7 +196,6 @@ module NetSuite
|
|
195
196
|
autoload :Task, 'netsuite/records/task'
|
196
197
|
autoload :Term, 'netsuite/records/term'
|
197
198
|
autoload :TimeBill, 'netsuite/records/time_bill'
|
198
|
-
autoload :Transaction, 'netsuite/records/transaction'
|
199
199
|
autoload :TransferOrder, 'netsuite/records/transfer_order'
|
200
200
|
autoload :TransferOrderItemList, 'netsuite/records/transfer_order_item_list'
|
201
201
|
autoload :TransferOrderItem, 'netsuite/records/transfer_order_item'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class ContactRole
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Support::Actions
|
8
|
+
include Namespaces::ListAcct
|
9
|
+
|
10
|
+
actions :get, :get_list, :initialize, :search
|
11
|
+
|
12
|
+
fields :name, :is_inactive, :description, :created_date
|
13
|
+
|
14
|
+
attr_reader :internal_id
|
15
|
+
|
16
|
+
def initialize(attributes = {})
|
17
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
18
|
+
initialize_from_attributes_hash(attributes)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,7 +1,71 @@
|
|
1
1
|
module NetSuite
|
2
2
|
module Records
|
3
|
-
class KitItem
|
4
|
-
|
3
|
+
class KitItem
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Support::Actions
|
8
|
+
include Namespaces::ListAcct
|
9
|
+
|
10
|
+
actions :get, :get_list, :add, :delete, :search, :update, :upsert
|
11
|
+
|
12
|
+
fields :available_to_partners, :cost_estimate, :created_date, :defer_rev_rec, :description, :display_name,
|
13
|
+
:dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description, :handling_cost,
|
14
|
+
:hazmat_hazard_class, :hazmat_id, :hazmat_item_units, :hazmat_item_units_qty, :hazmat_shipping_name, :include_children,
|
15
|
+
:is_donation_item, :is_fulfillable, :is_gco_compliant, :is_hazmat_item, :is_inactive, :is_online, :is_taxable, :item_id,
|
16
|
+
:last_modified_date, :manufacturer, :manufactureraddr1, :manufacturer_city, :manufacturer_state, :manufacturer_tariff,
|
17
|
+
:manufacturer_tax_id, :manufacturer_zip, :max_donation_amount, :meta_tag_html, :minimum_quantity, :mpn,
|
18
|
+
:mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support, :on_special, :out_of_stock_message,
|
19
|
+
:page_title, :prices_include_tax, :print_items, :producer, :rate, :related_items_description, :schedule_b_number,
|
20
|
+
:schedule_b_quantity, :search_keywords, :ship_individually, :shipping_cost, :shopping_dot_com_category,
|
21
|
+
:shopzilla_category_id, :show_default_donation_amount, :specials_description, :stock_description, :store_description,
|
22
|
+
:store_detailed_description, :store_display_name, :upc_code, :url_component, :use_marginal_rates, :vsoe_delivered,
|
23
|
+
:vsoe_price, :weight
|
24
|
+
|
25
|
+
record_refs :billing_schedule, :custom_form, :default_item_ship_method, :deferred_revenue_account, :department,
|
26
|
+
:income_account, :issue_product, :item_revenue_category, :klass, :location, :parent, :pricing_group,
|
27
|
+
:quantity_pricing_schedule, :revenue_allocation_group, :revenue_recognition_rule, :rev_rec_schedule, :sales_tax_code,
|
28
|
+
:schedule_b_code, :ship_package, :soft_descriptor, :store_display_image, :store_display_thumbnail, :store_item_template,
|
29
|
+
:tax_schedule, :weight_unit
|
30
|
+
|
31
|
+
field :custom_field_list, CustomFieldList
|
32
|
+
field :pricing_matrix, PricingMatrix
|
33
|
+
field :subsidiary_list, RecordRefList
|
34
|
+
|
35
|
+
# TODO custom records need to be implemented
|
36
|
+
# field :accounting_book_detail_list, ItemAccountingBookDetailList
|
37
|
+
# field :cost_estimate_type, ItemCostEstimateType
|
38
|
+
# field :country_of_manufacture, Country
|
39
|
+
# field :create_revenue_plans_on, ItemCreateRevenuePlansOn
|
40
|
+
# field :hazmat_packing_group, HazmatPackingGroup
|
41
|
+
# field :item_carrier, ItemCarrier
|
42
|
+
# field :item_options_list, ItemOptionsList
|
43
|
+
# field :item_ship_method_list, RecordRefList
|
44
|
+
# field :member_list, ItemMemberList
|
45
|
+
# field :out_of_stock_behavior, ItemOutOfStockBehavior
|
46
|
+
# field :overall_quantity_pricing_type, ItemOverallQuantityPricingType
|
47
|
+
# field :preference_criterion, ItemPreferenceCriterion
|
48
|
+
# field :presentation_item_list, PresentationItemList
|
49
|
+
# field :product_feed_list, ProductFeedList
|
50
|
+
# field :site_category_list, SiteCategoryList
|
51
|
+
# field :sitemap_priority, SitemapPriority
|
52
|
+
# field :translations_list, TranslationList
|
53
|
+
# field :vsoe_deferral, VsoeDeferral
|
54
|
+
# field :vsoe_permit_discount, VsoePermitDiscount
|
55
|
+
# field :vsoe_sop_group, VsoeSopGroup
|
56
|
+
|
57
|
+
attr_reader :internal_id
|
58
|
+
attr_accessor :external_id
|
59
|
+
|
60
|
+
def initialize(attributes = {})
|
61
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
62
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
63
|
+
initialize_from_attributes_hash(attributes)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.search_class_name
|
67
|
+
"Item"
|
68
|
+
end
|
5
69
|
end
|
6
70
|
end
|
7
71
|
end
|
@@ -13,10 +13,10 @@ module NetSuite
|
|
13
13
|
:handling_tax2_rate, :last_modified_date, :linked_tracking_numbers,
|
14
14
|
:memo, :ship_complete, :ship_date, :ship_is_residential, :shipping_cost,
|
15
15
|
:shipping_tax1_rate, :shipping_tax2_rate, :source, :status, :sub_total,
|
16
|
-
:total, :tracking_numbers, :tran_date, :tran_id
|
16
|
+
:total, :tracking_numbers, :tran_date, :tran_id, :order_status
|
17
17
|
|
18
18
|
record_refs :transfer_location, :shipping_tax_code, :subsidiary, :shipping_address,
|
19
|
-
:ship_method, :
|
19
|
+
:ship_method, :employee, :handling_tax_code,
|
20
20
|
:location, :custom_form, :department, :klass, :ship_address_list
|
21
21
|
|
22
22
|
field :custom_field_list, CustomFieldList
|
@@ -7,11 +7,13 @@ module NetSuite
|
|
7
7
|
include Support::Actions
|
8
8
|
include Namespaces::TranPurch
|
9
9
|
|
10
|
-
actions :get, :get_list, :initialize, :add, :delete, :update, :upsert
|
10
|
+
actions :get, :get_list, :initialize, :add, :delete, :update, :upsert, :search
|
11
11
|
|
12
|
-
fields :address, :balance, :bill_pay, :
|
12
|
+
fields :address, :balance, :bill_pay, :created_date, :credit_list, :currency_name, :exchange_rate, :last_modified_date,
|
13
13
|
:memo, :print_voucher, :status, :to_ach, :to_be_printed, :total, :tran_date, :tran_id, :transaction_number
|
14
14
|
|
15
|
+
alias_method :created_at, :created_date
|
16
|
+
|
15
17
|
field :apply_list, VendorPaymentApplyList
|
16
18
|
field :custom_field_list, CustomFieldList
|
17
19
|
|
@@ -35,6 +37,13 @@ module NetSuite
|
|
35
37
|
rec
|
36
38
|
end
|
37
39
|
|
40
|
+
def self.search_class_name
|
41
|
+
"Transaction"
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.search_class_namespace
|
45
|
+
'tranSales'
|
46
|
+
end
|
38
47
|
end
|
39
48
|
end
|
40
49
|
end
|
data/lib/netsuite/version.rb
CHANGED
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::KitItem do
|
4
|
+
let(:item) { NetSuite::Records::KitItem.new }
|
5
|
+
|
6
|
+
it 'has all the right fields' do
|
7
|
+
[
|
8
|
+
:available_to_partners, :cost_estimate, :created_date, :defer_rev_rec, :description, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description, :handling_cost, :hazmat_hazard_class, :hazmat_id, :hazmat_item_units, :hazmat_item_units_qty, :hazmat_shipping_name, :include_children, :is_donation_item, :is_fulfillable, :is_gco_compliant, :is_hazmat_item, :is_inactive, :is_online, :is_taxable, :item_id, :last_modified_date, :manufacturer, :manufactureraddr1, :manufacturer_city, :manufacturer_state, :manufacturer_tariff, :manufacturer_tax_id, :manufacturer_zip, :max_donation_amount, :meta_tag_html, :minimum_quantity, :mpn, :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support, :on_special, :out_of_stock_message, :page_title, :prices_include_tax, :print_items, :producer, :rate, :related_items_description, :schedule_b_number, :schedule_b_quantity, :search_keywords, :ship_individually, :shipping_cost, :shopping_dot_com_category, :shopzilla_category_id, :show_default_donation_amount, :specials_description, :stock_description, :store_description, :store_detailed_description, :store_display_name, :upc_code, :url_component, :use_marginal_rates, :vsoe_delivered, :vsoe_price, :weight
|
9
|
+
].each do |field|
|
10
|
+
expect(item).to have_field(field)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'has all the right record refs' do
|
15
|
+
[
|
16
|
+
:billing_schedule, :custom_form, :default_item_ship_method, :deferred_revenue_account, :department, :income_account, :issue_product, :item_revenue_category, :location, :parent, :pricing_group, :quantity_pricing_schedule, :revenue_allocation_group, :revenue_recognition_rule, :rev_rec_schedule, :sales_tax_code, :schedule_b_code, :ship_package, :soft_descriptor, :store_display_image, :store_display_thumbnail, :store_item_template, :tax_schedule, :weight_unit
|
17
|
+
].each do |record_ref|
|
18
|
+
expect(item).to have_record_ref(record_ref)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '.get' do
|
23
|
+
context 'when the response is successful' do
|
24
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :item_id => "Item100" }) }
|
25
|
+
|
26
|
+
it 'returns a KitItem instance populated with the data from the response object' do
|
27
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::KitItem, {:external_id => 1}], {}).and_return(response)
|
28
|
+
item = NetSuite::Records::KitItem.get(:external_id => 1)
|
29
|
+
expect(item).to be_kind_of(NetSuite::Records::KitItem)
|
30
|
+
expect(item.item_id).to eql("Item100")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when the response is unsuccessful' do
|
35
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
36
|
+
|
37
|
+
it 'raises a RecordNotFound exception' do
|
38
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::KitItem, {:external_id => 1}], {}).and_return(response)
|
39
|
+
expect {
|
40
|
+
NetSuite::Records::KitItem.get(:external_id => 1)
|
41
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
42
|
+
/NetSuite::Records::KitItem with OPTIONS=(.*) could not be found/)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#add' do
|
48
|
+
let(:item) { NetSuite::Records::KitItem.new(:item_id => "Item100", :is_inactive => false) }
|
49
|
+
|
50
|
+
context 'when the response is successful' do
|
51
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
52
|
+
|
53
|
+
it 'returns true' do
|
54
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
55
|
+
with([item], {}).
|
56
|
+
and_return(response)
|
57
|
+
expect(item.add).to be_truthy
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'when the response is unsuccessful' do
|
62
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
63
|
+
|
64
|
+
it 'returns false' do
|
65
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
66
|
+
with([item], {}).
|
67
|
+
and_return(response)
|
68
|
+
expect(item.add).to be_falsey
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe '#delete' do
|
74
|
+
context 'when the response is successful' do
|
75
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
76
|
+
|
77
|
+
it 'returns true' do
|
78
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
79
|
+
with([item], {}).
|
80
|
+
and_return(response)
|
81
|
+
expect(item.delete).to be_truthy
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'when the response is unsuccessful' do
|
86
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
87
|
+
|
88
|
+
it 'returns false' do
|
89
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
90
|
+
with([item], {}).
|
91
|
+
and_return(response)
|
92
|
+
expect(item.delete).to be_falsey
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '#to_record' do
|
98
|
+
before do
|
99
|
+
item.item_id = "Item100"
|
100
|
+
item.is_inactive = false
|
101
|
+
end
|
102
|
+
it 'can represent itself as a SOAP record' do
|
103
|
+
record = {
|
104
|
+
'listAcct:itemId' => "Item100",
|
105
|
+
'listAcct:isInactive' => false
|
106
|
+
}
|
107
|
+
expect(item.to_record).to eql(record)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe '#record_type' do
|
112
|
+
it 'returns a string representation of the SOAP type' do
|
113
|
+
expect(item.record_type).to eql('listAcct:KitItem')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
@@ -7,7 +7,7 @@ describe NetSuite::Records::VendorPayment do
|
|
7
7
|
|
8
8
|
it 'has all the right fields' do
|
9
9
|
[
|
10
|
-
:address, :balance, :bill_pay, :
|
10
|
+
:address, :balance, :bill_pay, :created_date, :credit_list, :currency_name, :exchange_rate, :last_modified_date,
|
11
11
|
:memo, :print_voucher, :status, :to_ach, :to_be_printed, :total, :tran_date, :tran_id, :transaction_number
|
12
12
|
].each do |field|
|
13
13
|
expect(payment).to have_field(field)
|
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.6.
|
4
|
+
version: 0.6.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-06-
|
13
|
+
date: 2016-06-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: savon
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- lib/netsuite/records/contact_access_roles.rb
|
123
123
|
- lib/netsuite/records/contact_access_roles_list.rb
|
124
124
|
- lib/netsuite/records/contact_list.rb
|
125
|
+
- lib/netsuite/records/contact_role.rb
|
125
126
|
- lib/netsuite/records/credit_memo.rb
|
126
127
|
- lib/netsuite/records/credit_memo_apply.rb
|
127
128
|
- lib/netsuite/records/credit_memo_apply_list.rb
|
@@ -340,6 +341,7 @@ files:
|
|
340
341
|
- spec/netsuite/records/journal_entry_line_list_spec.rb
|
341
342
|
- spec/netsuite/records/journal_entry_line_spec.rb
|
342
343
|
- spec/netsuite/records/journal_entry_spec.rb
|
344
|
+
- spec/netsuite/records/kit_item_spec.rb
|
343
345
|
- spec/netsuite/records/location_spec.rb
|
344
346
|
- spec/netsuite/records/matrix_option_list_spec.rb
|
345
347
|
- spec/netsuite/records/non_inventory_sale_item_spec.rb
|
@@ -517,6 +519,7 @@ test_files:
|
|
517
519
|
- spec/netsuite/records/journal_entry_line_list_spec.rb
|
518
520
|
- spec/netsuite/records/journal_entry_line_spec.rb
|
519
521
|
- spec/netsuite/records/journal_entry_spec.rb
|
522
|
+
- spec/netsuite/records/kit_item_spec.rb
|
520
523
|
- spec/netsuite/records/location_spec.rb
|
521
524
|
- spec/netsuite/records/matrix_option_list_spec.rb
|
522
525
|
- spec/netsuite/records/non_inventory_sale_item_spec.rb
|