netsuite 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/lib/netsuite.rb +6 -2
- data/lib/netsuite/configuration.rb +2 -8
- data/lib/netsuite/records/base_ref_list.rb +3 -19
- data/lib/netsuite/records/billing_schedule_milestone_list.rb +4 -23
- data/lib/netsuite/records/billing_schedule_recurrence_list.rb +4 -23
- data/lib/netsuite/records/bin_number_list.rb +5 -23
- data/lib/netsuite/records/cash_refund_item_list.rb +3 -23
- data/lib/netsuite/records/cash_sale_item_list.rb +3 -15
- data/lib/netsuite/records/customer_payment_apply_list.rb +3 -22
- data/lib/netsuite/records/customer_refund_apply_list.rb +3 -20
- data/lib/netsuite/records/deposit_payment_list.rb +3 -4
- data/lib/netsuite/records/gift_certificate_item.rb +84 -0
- data/lib/netsuite/records/inventory_transfer_inventory_list.rb +2 -23
- data/lib/netsuite/records/item_fulfillment_package_list.rb +3 -19
- data/lib/netsuite/records/journal_entry_line_list.rb +3 -23
- data/lib/netsuite/records/member_list.rb +3 -22
- data/lib/netsuite/records/other_charge_sale_item.rb +73 -0
- data/lib/netsuite/records/record_ref_list.rb +2 -20
- data/lib/netsuite/records/units_type_uom_list.rb +2 -23
- data/lib/netsuite/records/vendor.rb +4 -1
- data/lib/netsuite/records/vendor_bill_item_list.rb +3 -23
- data/lib/netsuite/records/vendor_payment_apply_list.rb +3 -23
- data/lib/netsuite/records/work_order_item_list.rb +3 -23
- data/lib/netsuite/rest/utilities/request.rb +53 -0
- data/lib/netsuite/rest/utilities/roles.rb +45 -0
- data/lib/netsuite/utilities.rb +20 -0
- data/lib/netsuite/version.rb +1 -1
- data/spec/netsuite/actions/search_spec.rb +1 -1
- data/spec/netsuite/configuration_spec.rb +3 -3
- data/spec/netsuite/records/basic_record_spec.rb +2 -0
- data/spec/netsuite/records/custom_record_spec.rb +1 -1
- data/spec/netsuite/records/invoice_item_spec.rb +1 -1
- data/spec/netsuite/records/journal_entry_spec.rb +1 -1
- data/spec/netsuite/records/vendor_bill_expense_spec.rb +1 -1
- data/spec/netsuite/records/vendor_bill_item_spec.rb +2 -2
- data/spec/netsuite/utilities/request_spec.rb +29 -0
- data/spec/netsuite/utilities/roles_spec.rb +98 -0
- data/{wsdl/2011_2.wsdl → spec/support/2015.wsdl} +190 -56
- data/spec/support/configuration.rb +1 -0
- metadata +12 -4
- data/wsdl/2012_1.wsdl +0 -2283
data/Gemfile
CHANGED
data/lib/netsuite.rb
CHANGED
@@ -4,6 +4,8 @@ require 'savon'
|
|
4
4
|
require 'netsuite/version'
|
5
5
|
require 'netsuite/errors'
|
6
6
|
require 'netsuite/utilities'
|
7
|
+
require 'netsuite/rest/utilities/roles'
|
8
|
+
require 'netsuite/rest/utilities/request'
|
7
9
|
require 'netsuite/core_ext/string/lower_camelcase'
|
8
10
|
|
9
11
|
module NetSuite
|
@@ -132,6 +134,7 @@ module NetSuite
|
|
132
134
|
autoload :Employee, 'netsuite/records/employee'
|
133
135
|
autoload :File, 'netsuite/records/file'
|
134
136
|
autoload :GiftCertificate, 'netsuite/records/gift_certificate'
|
137
|
+
autoload :GiftCertificateItem, 'netsuite/records/gift_certificate_item'
|
135
138
|
autoload :GiftCertRedemption, 'netsuite/records/gift_cert_redemption'
|
136
139
|
autoload :GiftCertRedemptionList, 'netsuite/records/gift_cert_redemption_list'
|
137
140
|
autoload :Folder, 'netsuite/records/folder'
|
@@ -176,6 +179,7 @@ module NetSuite
|
|
176
179
|
autoload :Opportunity, 'netsuite/records/opportunity'
|
177
180
|
autoload :OpportunityItem, 'netsuite/records/opportunity_item'
|
178
181
|
autoload :OpportunityItemList, 'netsuite/records/opportunity_item_list'
|
182
|
+
autoload :OtherChargeSaleItem, 'netsuite/records/other_charge_sale_item'
|
179
183
|
autoload :Partner, 'netsuite/records/partner'
|
180
184
|
autoload :PaymentItem, 'netsuite/records/payment_item'
|
181
185
|
autoload :PaymentMethod, 'netsuite/records/payment_method'
|
@@ -226,8 +230,8 @@ module NetSuite
|
|
226
230
|
autoload :VendorCreditApplyList, 'netsuite/records/vendor_credit_apply_list'
|
227
231
|
autoload :VendorCreditItem, 'netsuite/records/vendor_credit_item'
|
228
232
|
autoload :VendorCreditItemList, 'netsuite/records/vendor_credit_item_list'
|
229
|
-
autoload :VendorCreditExpense,
|
230
|
-
autoload :VendorCreditExpenseList,
|
233
|
+
autoload :VendorCreditExpense, 'netsuite/records/vendor_credit_expense'
|
234
|
+
autoload :VendorCreditExpenseList, 'netsuite/records/vendor_credit_expense_list'
|
231
235
|
autoload :VendorPayment, 'netsuite/records/vendor_payment'
|
232
236
|
autoload :VendorPaymentApply, 'netsuite/records/vendor_payment_apply'
|
233
237
|
autoload :VendorPaymentApplyList, 'netsuite/records/vendor_payment_apply_list'
|
@@ -45,7 +45,7 @@ module NetSuite
|
|
45
45
|
if version
|
46
46
|
self.api_version = version
|
47
47
|
else
|
48
|
-
attributes[:api_version] ||= '
|
48
|
+
attributes[:api_version] ||= '2015_1'
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -81,13 +81,7 @@ module NetSuite
|
|
81
81
|
if sandbox
|
82
82
|
"https://webservices.sandbox.netsuite.com/wsdl/v#{api_version}_0/netsuite.wsdl"
|
83
83
|
else
|
84
|
-
|
85
|
-
|
86
|
-
unless File.exists? wsdl_path
|
87
|
-
wsdl_path = "https://#{wsdl_domain}/wsdl/v#{api_version}_0/netsuite.wsdl"
|
88
|
-
end
|
89
|
-
|
90
|
-
wsdl_path
|
84
|
+
"https://#{wsdl_domain}/wsdl/v#{api_version}_0/netsuite.wsdl"
|
91
85
|
end
|
92
86
|
end
|
93
87
|
end
|
@@ -2,31 +2,15 @@
|
|
2
2
|
|
3
3
|
module NetSuite
|
4
4
|
module Records
|
5
|
-
class BaseRefList
|
6
|
-
include Support::Fields
|
5
|
+
class BaseRefList < Support::Sublist
|
7
6
|
include Support::Actions
|
8
7
|
include Namespaces::PlatformCore
|
9
8
|
|
10
9
|
actions :get_select_value
|
11
10
|
|
12
|
-
|
11
|
+
sublist :base_ref, RecordRef
|
13
12
|
|
14
|
-
|
15
|
-
initialize_from_attributes_hash(attrs)
|
16
|
-
end
|
17
|
-
|
18
|
-
def base_ref=(refs)
|
19
|
-
case refs
|
20
|
-
when Hash
|
21
|
-
self.base_ref << RecordRef.new(refs)
|
22
|
-
when Array
|
23
|
-
refs.each { |ref| self.base_ref << RecordRef.new(ref) }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def base_ref
|
28
|
-
@base_ref ||= []
|
29
|
-
end
|
13
|
+
alias :base_refs :base_ref
|
30
14
|
|
31
15
|
end
|
32
16
|
end
|
@@ -1,31 +1,12 @@
|
|
1
1
|
module NetSuite
|
2
2
|
module Records
|
3
|
-
class BillingScheduleMilestoneList
|
4
|
-
include Support::Fields
|
3
|
+
class BillingScheduleMilestoneList < Support::Sublist
|
5
4
|
include Namespaces::ListAcct
|
6
5
|
|
7
|
-
|
6
|
+
sublist :billing_schedule_milestone, BillingScheduleMilestone
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
def milestone=(milestones)
|
14
|
-
case milestones
|
15
|
-
when Hash
|
16
|
-
self.milestones << BillingScheduleMilestone.new(milestones)
|
17
|
-
when Array
|
18
|
-
milestones.each { |milestone| self.milestones << BillingScheduleMilestone.new(milestone) }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def milestones
|
23
|
-
@milestones ||= []
|
24
|
-
end
|
25
|
-
|
26
|
-
def to_record
|
27
|
-
{ "#{record_namespace}:billingScheduleMilestone" => milestones.map(&:to_record) }
|
28
|
-
end
|
8
|
+
alias :milestones :billing_schedule_milestone
|
9
|
+
alias :milestone= :billing_schedule_milestone=
|
29
10
|
|
30
11
|
end
|
31
12
|
end
|
@@ -1,31 +1,12 @@
|
|
1
1
|
module NetSuite
|
2
2
|
module Records
|
3
|
-
class BillingScheduleRecurrenceList
|
4
|
-
include Support::Fields
|
3
|
+
class BillingScheduleRecurrenceList < Support::Sublist
|
5
4
|
include Namespaces::ListAcct
|
6
5
|
|
7
|
-
|
6
|
+
sublist :billing_schedule_recurrence, BillingScheduleRecurrence
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
def recurrence=(recurrences)
|
14
|
-
case recurrences
|
15
|
-
when Hash
|
16
|
-
self.recurrences << BillingScheduleRecurrence.new(recurrences)
|
17
|
-
when Array
|
18
|
-
recurrences.each { |recurrence| self.recurrences << BillingScheduleRecurrence.new(recurrence) }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def recurrences
|
23
|
-
@recurrences ||= []
|
24
|
-
end
|
25
|
-
|
26
|
-
def to_record
|
27
|
-
{ "#{record_namespace}:billingScheduleRecurrence" => recurrences.map(&:to_record) }
|
28
|
-
end
|
8
|
+
alias :recurrences :billing_schedule_recurrence
|
9
|
+
alias :recurrence= :billing_schedule_recurrence=
|
29
10
|
|
30
11
|
end
|
31
12
|
end
|
@@ -2,7 +2,7 @@ module NetSuite
|
|
2
2
|
module Records
|
3
3
|
# TODO this is fairly messy: shouldn't mix multiple classes in one file
|
4
4
|
# might be possible to trash the GenericField as well
|
5
|
-
|
5
|
+
|
6
6
|
class GenericField
|
7
7
|
include Support::Attributes
|
8
8
|
include Support::Fields
|
@@ -13,36 +13,18 @@ module NetSuite
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class BinNumber < GenericField
|
16
|
+
include Support::Records
|
16
17
|
|
17
18
|
end
|
18
19
|
|
19
|
-
class BinNumberList
|
20
|
-
include Support::Fields
|
20
|
+
class BinNumberList < Support::Sublist
|
21
21
|
include Namespaces::PlatformCore
|
22
22
|
# include Namespaces::ListAcct
|
23
23
|
|
24
|
-
|
24
|
+
sublist :bin_number, BinNumber
|
25
25
|
|
26
|
-
|
27
|
-
initialize_from_attributes_hash(attributes)
|
28
|
-
end
|
26
|
+
alias :bin_numbers :bin_number
|
29
27
|
|
30
|
-
def bin_number=(items)
|
31
|
-
case items
|
32
|
-
when Hash
|
33
|
-
self.bin_numbers << BinNumber.new(items)
|
34
|
-
when Array
|
35
|
-
items.each { |item| self.bin_numbers << BinNumber.new(item) }
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def bin_numbers
|
40
|
-
@bin_numbers ||= []
|
41
|
-
end
|
42
|
-
|
43
|
-
def to_record
|
44
|
-
{ "#{record_namespace}:item" => bin_numbers.map(&:to_record) }
|
45
|
-
end
|
46
28
|
end
|
47
29
|
end
|
48
30
|
end
|
@@ -1,31 +1,11 @@
|
|
1
1
|
module NetSuite
|
2
2
|
module Records
|
3
|
-
class CashRefundItemList
|
4
|
-
include Support::Fields
|
3
|
+
class CashRefundItemList < Support::Sublist
|
5
4
|
include Namespaces::TranCust
|
6
5
|
|
7
|
-
|
6
|
+
sublist :item, CashRefundItem
|
8
7
|
|
9
|
-
|
10
|
-
initialize_from_attributes_hash(attributes)
|
11
|
-
end
|
12
|
-
|
13
|
-
def item=(items)
|
14
|
-
case items
|
15
|
-
when Hash
|
16
|
-
self.items << CashRefundItem.new(items)
|
17
|
-
when Array
|
18
|
-
items.each { |item| self.items << CashRefundItem.new(item) }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def items
|
23
|
-
@items ||= []
|
24
|
-
end
|
25
|
-
|
26
|
-
def to_record
|
27
|
-
{ "#{record_namespace}:item" => items.map(&:to_record) }
|
28
|
-
end
|
8
|
+
alias :items :item
|
29
9
|
|
30
10
|
end
|
31
11
|
end
|
@@ -1,24 +1,12 @@
|
|
1
1
|
module NetSuite
|
2
2
|
module Records
|
3
|
-
class CashSaleItemList
|
3
|
+
class CashSaleItemList < Support::Sublist
|
4
4
|
include Namespaces::TranSales
|
5
5
|
|
6
|
-
|
7
|
-
case attributes[:item]
|
8
|
-
when Hash
|
9
|
-
items << CashSaleItem.new(attributes[:item])
|
10
|
-
when Array
|
11
|
-
attributes[:item].each { |item| items << CashSaleItem.new(item) }
|
12
|
-
end
|
13
|
-
end
|
6
|
+
sublist :item, CashSaleItem
|
14
7
|
|
15
|
-
|
16
|
-
@items ||= []
|
17
|
-
end
|
8
|
+
alias :items :item
|
18
9
|
|
19
|
-
def to_record
|
20
|
-
{ "#{record_namespace}:item" => items.map(&:to_record) }
|
21
|
-
end
|
22
10
|
end
|
23
11
|
end
|
24
12
|
end
|
@@ -1,31 +1,12 @@
|
|
1
1
|
module NetSuite
|
2
2
|
module Records
|
3
|
-
class CustomerPaymentApplyList
|
4
|
-
include Support::Fields
|
3
|
+
class CustomerPaymentApplyList < Support::Sublist
|
5
4
|
include Namespaces::TranCust
|
6
5
|
|
7
|
-
|
6
|
+
sublist :apply, CustomerPaymentApply
|
8
7
|
|
9
|
-
|
10
|
-
initialize_from_attributes_hash(attributes)
|
11
|
-
end
|
8
|
+
alias :applies :apply
|
12
9
|
|
13
|
-
def apply=(applies)
|
14
|
-
case applies
|
15
|
-
when Hash
|
16
|
-
self.applies << CustomerPaymentApply.new(applies)
|
17
|
-
when Array
|
18
|
-
applies.each { |apply| self.applies << CustomerPaymentApply.new(apply) }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def applies
|
23
|
-
@applies ||= []
|
24
|
-
end
|
25
|
-
|
26
|
-
def to_record
|
27
|
-
{ "#{record_namespace}:apply" => applies.map(&:to_record) }
|
28
|
-
end
|
29
10
|
end
|
30
11
|
end
|
31
12
|
end
|
@@ -1,30 +1,13 @@
|
|
1
1
|
module NetSuite
|
2
2
|
module Records
|
3
|
-
class CustomerRefundApplyList
|
3
|
+
class CustomerRefundApplyList < Support::Sublist
|
4
4
|
include Namespaces::TranCust
|
5
5
|
|
6
|
-
# TODO should use new sublist implementation
|
7
|
-
|
8
6
|
attr_accessor :replace_all
|
9
7
|
|
10
|
-
|
11
|
-
case attributes[:apply]
|
12
|
-
when Hash
|
13
|
-
applies << CustomerRefundApply.new(attributes[:apply])
|
14
|
-
when Array
|
15
|
-
attributes[:apply].each { |apply| applies << CustomerRefundApply.new(apply) }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def applies
|
20
|
-
@applies ||= []
|
21
|
-
end
|
8
|
+
sublist :apply, CustomerRefundApply
|
22
9
|
|
23
|
-
|
24
|
-
rec = { "#{record_namespace}:apply" => applies.map(&:to_record) }
|
25
|
-
rec[:@replaceAll] = @replace_all unless @replace_all.nil?
|
26
|
-
rec
|
27
|
-
end
|
10
|
+
alias :applies :apply
|
28
11
|
|
29
12
|
end
|
30
13
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class GiftCertificateItem
|
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, :upsert
|
11
|
+
|
12
|
+
fields :auth_codes_list,
|
13
|
+
:available_to_partners,
|
14
|
+
:billing_schedule,
|
15
|
+
:cost_estimate,
|
16
|
+
:cost_estimate_type,
|
17
|
+
:created_date,
|
18
|
+
:days_before_expiration,
|
19
|
+
:display_name,
|
20
|
+
:dont_show_price,
|
21
|
+
:exclude_from_sitemap,
|
22
|
+
:featured_description,
|
23
|
+
:include_children,
|
24
|
+
:is_donation_item,
|
25
|
+
:is_fulfillable,
|
26
|
+
:is_gco_compliant,
|
27
|
+
:is_inactive,
|
28
|
+
:is_online,
|
29
|
+
:is_taxable,
|
30
|
+
:item_id,
|
31
|
+
:item_options_list,
|
32
|
+
:last_modified_date,
|
33
|
+
:liability_account,
|
34
|
+
:max_donation_amount,
|
35
|
+
:meta_tag_html,
|
36
|
+
:no_price_message,
|
37
|
+
:offer_support,
|
38
|
+
:on_special,
|
39
|
+
:out_of_stock_behavior,
|
40
|
+
:out_of_stock_message,
|
41
|
+
:page_title,
|
42
|
+
:presentation_item_list,
|
43
|
+
:prices_include_tax,
|
44
|
+
:pricing_matrix,
|
45
|
+
:rate,
|
46
|
+
:related_items_description,
|
47
|
+
:sales_description,
|
48
|
+
:search_keywords,
|
49
|
+
:show_default_donation_amount,
|
50
|
+
:site_category_list,
|
51
|
+
:sitemap_priority,
|
52
|
+
:specials_description,
|
53
|
+
:store_description,
|
54
|
+
:store_detailed_description,
|
55
|
+
:store_display_image,
|
56
|
+
:store_display_name,
|
57
|
+
:store_display_thumbnail,
|
58
|
+
:store_item_template,
|
59
|
+
:subsidiary_list,
|
60
|
+
:translations_list,
|
61
|
+
:upc_code,
|
62
|
+
:url_component
|
63
|
+
|
64
|
+
field :custom_field_list, CustomFieldList
|
65
|
+
|
66
|
+
record_refs :klass, :custom_form, :department, :income_account,
|
67
|
+
:issue_product, :location, :parent, :sales_tax_code, :tax_schedule
|
68
|
+
|
69
|
+
attr_reader :internal_id
|
70
|
+
attr_accessor :external_id
|
71
|
+
|
72
|
+
def initialize(attributes = {})
|
73
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
74
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
75
|
+
initialize_from_attributes_hash(attributes)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.search_class_name
|
79
|
+
"Item"
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|