netsuite 0.0.23 → 0.0.25
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.
- data/Rakefile +1 -2
- data/lib/netsuite.rb +35 -25
- data/lib/netsuite/records/account.rb +3 -9
- data/lib/netsuite/records/classification.rb +3 -9
- data/lib/netsuite/records/credit_memo.rb +3 -23
- data/lib/netsuite/records/custom_record.rb +5 -11
- data/lib/netsuite/records/custom_record_type.rb +3 -9
- data/lib/netsuite/records/customer.rb +3 -14
- data/lib/netsuite/records/customer_payment.rb +10 -25
- data/lib/netsuite/records/customer_refund.rb +31 -0
- data/lib/netsuite/records/customer_refund_apply.rb +16 -0
- data/lib/netsuite/records/customer_refund_apply_list.rb +27 -0
- data/lib/netsuite/records/customer_refund_deposit.rb +16 -0
- data/lib/netsuite/records/customer_refund_deposit_list.rb +28 -0
- data/lib/netsuite/records/inventory_item.rb +3 -14
- data/lib/netsuite/records/invoice.rb +3 -23
- data/lib/netsuite/records/job.rb +3 -14
- data/lib/netsuite/records/journal_entry.rb +3 -14
- data/lib/netsuite/records/location.rb +3 -9
- data/lib/netsuite/records/non_inventory_sale_item.rb +3 -9
- data/lib/netsuite/records/payment_method.rb +3 -9
- data/lib/netsuite/support/actions.rb +80 -0
- data/lib/netsuite/version.rb +1 -1
- data/lib/netsuite/xml_logger.rb +31 -0
- data/netsuite.gemspec +1 -0
- data/spec/netsuite/records/customer_refund_apply_list_spec.rb +27 -0
- data/spec/netsuite/records/customer_refund_apply_spec.rb +14 -0
- data/spec/netsuite/records/customer_refund_deposit_list_spec.rb +27 -0
- data/spec/netsuite/records/customer_refund_deposit_spec.rb +14 -0
- data/spec/netsuite/records/customer_refund_spec.rb +172 -0
- data/spec/netsuite/support/actions_spec.rb +5 -0
- metadata +43 -10
data/Rakefile
CHANGED
@@ -12,7 +12,6 @@ end
|
|
12
12
|
|
13
13
|
desc 'Generate code coverage'
|
14
14
|
RSpec::Core::RakeTask.new(:coverage) do |t|
|
15
|
-
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
16
15
|
t.rcov = true
|
17
|
-
t.rcov_opts = ['--exclude', 'spec']
|
16
|
+
t.rcov_opts = ['--exclude', '/gems/,spec']
|
18
17
|
end
|
data/lib/netsuite.rb
CHANGED
@@ -2,6 +2,7 @@ require 'set'
|
|
2
2
|
|
3
3
|
require 'netsuite/version'
|
4
4
|
require 'netsuite/errors'
|
5
|
+
require 'netsuite/xml_logger'
|
5
6
|
|
6
7
|
module NetSuite
|
7
8
|
autoload :Configuration, 'netsuite/configuration'
|
@@ -19,6 +20,7 @@ module NetSuite
|
|
19
20
|
end
|
20
21
|
|
21
22
|
module Support
|
23
|
+
autoload :Actions, 'netsuite/support/actions'
|
22
24
|
autoload :Attributes, 'netsuite/support/attributes'
|
23
25
|
autoload :Fields, 'netsuite/support/fields'
|
24
26
|
autoload :RecordRefs, 'netsuite/support/record_refs'
|
@@ -34,37 +36,45 @@ module NetSuite
|
|
34
36
|
end
|
35
37
|
|
36
38
|
module Records
|
37
|
-
autoload :Account,
|
38
|
-
autoload :BillAddress,
|
39
|
-
autoload :Classification,
|
40
|
-
autoload :CreditMemo,
|
41
|
-
autoload :CustomField,
|
42
|
-
autoload :CustomFieldList,
|
43
|
-
autoload :CustomRecord,
|
44
|
-
autoload :CustomRecordRef,
|
45
|
-
autoload :CustomRecordType,
|
46
|
-
autoload :Customer,
|
47
|
-
autoload :CustomerAddressbook,
|
48
|
-
autoload :CustomerAddressbookList,
|
49
|
-
autoload :CustomerPayment,
|
50
|
-
autoload :
|
51
|
-
autoload :
|
52
|
-
autoload :
|
53
|
-
autoload :
|
54
|
-
autoload :
|
55
|
-
autoload :
|
56
|
-
autoload :
|
57
|
-
autoload :
|
58
|
-
autoload :
|
59
|
-
autoload :
|
60
|
-
autoload :
|
61
|
-
autoload :
|
39
|
+
autoload :Account, 'netsuite/records/account'
|
40
|
+
autoload :BillAddress, 'netsuite/records/bill_address'
|
41
|
+
autoload :Classification, 'netsuite/records/classification'
|
42
|
+
autoload :CreditMemo, 'netsuite/records/credit_memo'
|
43
|
+
autoload :CustomField, 'netsuite/records/custom_field'
|
44
|
+
autoload :CustomFieldList, 'netsuite/records/custom_field_list'
|
45
|
+
autoload :CustomRecord, 'netsuite/records/custom_record'
|
46
|
+
autoload :CustomRecordRef, 'netsuite/records/custom_record_ref'
|
47
|
+
autoload :CustomRecordType, 'netsuite/records/custom_record_type'
|
48
|
+
autoload :Customer, 'netsuite/records/customer'
|
49
|
+
autoload :CustomerAddressbook, 'netsuite/records/customer_addressbook'
|
50
|
+
autoload :CustomerAddressbookList, 'netsuite/records/customer_addressbook_list'
|
51
|
+
autoload :CustomerPayment, 'netsuite/records/customer_payment'
|
52
|
+
autoload :CustomerRefund, 'netsuite/records/customer_refund'
|
53
|
+
autoload :CustomerRefundApply, 'netsuite/records/customer_refund_apply'
|
54
|
+
autoload :CustomerRefundApplyList, 'netsuite/records/customer_refund_apply_list'
|
55
|
+
autoload :CustomerRefundDeposit, 'netsuite/records/customer_refund_deposit'
|
56
|
+
autoload :CustomerRefundDepositList, 'netsuite/records/customer_refund_deposit_list'
|
57
|
+
autoload :Duration, 'netsuite/records/duration'
|
58
|
+
autoload :InventoryItem, 'netsuite/records/inventory_item'
|
59
|
+
autoload :Invoice, 'netsuite/records/invoice'
|
60
|
+
autoload :InvoiceItem, 'netsuite/records/invoice_item'
|
61
|
+
autoload :InvoiceItemList, 'netsuite/records/invoice_item_list'
|
62
|
+
autoload :Job, 'netsuite/records/job'
|
63
|
+
autoload :JournalEntry, 'netsuite/records/journal_entry'
|
64
|
+
autoload :JournalEntryLine, 'netsuite/records/journal_entry_line'
|
65
|
+
autoload :JournalEntryLineList, 'netsuite/records/journal_entry_line_list'
|
66
|
+
autoload :Location, 'netsuite/records/location'
|
67
|
+
autoload :NonInventorySaleItem, 'netsuite/records/non_inventory_sale_item'
|
68
|
+
autoload :PaymentMethod, 'netsuite/records/payment_method'
|
62
69
|
autoload :RecordRef, 'netsuite/records/record_ref'
|
63
70
|
autoload :ShipAddress, 'netsuite/records/ship_address'
|
64
71
|
end
|
65
72
|
|
66
73
|
def self.configure(&block)
|
67
74
|
NetSuite::Configuration.instance_eval(&block)
|
75
|
+
Savon.configure do |config|
|
76
|
+
config.logger = NetSuite::XmlLogger.new(STDOUT)
|
77
|
+
end
|
68
78
|
end
|
69
79
|
|
70
80
|
end
|
@@ -3,6 +3,9 @@ module NetSuite
|
|
3
3
|
class Account
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
|
+
include Support::Actions
|
7
|
+
|
8
|
+
actions :get
|
6
9
|
|
7
10
|
fields :acct_name, :acct_number, :acct_type, :cash_flow_rate, :cur_doc_num, :description, :eliminate, :exchange_rate,
|
8
11
|
:general_rate, :include_children, :inventory, :is_inactive, :opening_balance, :revalue, :tran_date
|
@@ -18,15 +21,6 @@ module NetSuite
|
|
18
21
|
initialize_from_attributes_hash(attributes)
|
19
22
|
end
|
20
23
|
|
21
|
-
def self.get(options = {})
|
22
|
-
response = Actions::Get.call(self, options)
|
23
|
-
if response.success?
|
24
|
-
new(response.body)
|
25
|
-
else
|
26
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
24
|
end
|
31
25
|
end
|
32
26
|
end
|
@@ -2,6 +2,9 @@ module NetSuite
|
|
2
2
|
module Records
|
3
3
|
class Classification
|
4
4
|
include Support::Fields
|
5
|
+
include Support::Actions
|
6
|
+
|
7
|
+
actions :get
|
5
8
|
|
6
9
|
fields :name, :include_children, :is_inactive, :class_translation_list, :subsidiary_list, :custom_field_list
|
7
10
|
|
@@ -14,15 +17,6 @@ module NetSuite
|
|
14
17
|
initialize_from_attributes_hash(attributes)
|
15
18
|
end
|
16
19
|
|
17
|
-
def self.get(options = {})
|
18
|
-
response = Actions::Get.call(self, options)
|
19
|
-
if response.success?
|
20
|
-
new(response.body)
|
21
|
-
else
|
22
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
20
|
end
|
27
21
|
end
|
28
22
|
end
|
@@ -4,8 +4,11 @@ module NetSuite
|
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Records
|
7
|
+
include Support::Actions
|
7
8
|
include Namespaces::TranCust
|
8
9
|
|
10
|
+
actions :get, :add, :initialize
|
11
|
+
|
9
12
|
fields :alt_handling_cost, :alt_shipping_cost, :amount_paid, :amount_remaining, :auto_apply, :balance,
|
10
13
|
:bill_address, :contrib_pct, :created_date, :currency_name, :deferred_revenue, :discount_rate, :email,
|
11
14
|
:est_gross_profit, :est_gross_profit_percent, :exchange_rate, :exclude_commission, :fax, :gift_cert_applied,
|
@@ -31,29 +34,6 @@ module NetSuite
|
|
31
34
|
initialize_from_attributes_hash(attributes)
|
32
35
|
end
|
33
36
|
|
34
|
-
def self.get(options = {})
|
35
|
-
response = Actions::Get.call(self, options)
|
36
|
-
if response.success?
|
37
|
-
new(response.body)
|
38
|
-
else
|
39
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.initialize(object)
|
44
|
-
response = Actions::Initialize.call(self, object)
|
45
|
-
if response.success?
|
46
|
-
new(response.body)
|
47
|
-
else
|
48
|
-
raise InitializationError, "#{self}.initialize with #{object} failed."
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def add
|
53
|
-
response = Actions::Add.call(self)
|
54
|
-
response.success?
|
55
|
-
end
|
56
|
-
|
57
37
|
end
|
58
38
|
end
|
59
39
|
end
|
@@ -4,8 +4,11 @@ module NetSuite
|
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Records
|
7
|
+
include Support::Actions
|
7
8
|
include Namespaces::SetupCustom
|
8
9
|
|
10
|
+
actions :get, :add
|
11
|
+
|
9
12
|
fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :created,
|
10
13
|
:custom_record_id, :description, :disclaimer, :enabl_email_merge, :enable_numbering, :include_name,
|
11
14
|
:is_available_offline, :is_inactive, :is_numbering_updateable, :is_ordered, :last_modified, :name,
|
@@ -28,17 +31,8 @@ module NetSuite
|
|
28
31
|
|
29
32
|
def self.get(options = {})
|
30
33
|
options.merge!(:type_id => type_id) unless options[:type_id]
|
31
|
-
|
32
|
-
|
33
|
-
new(response.body)
|
34
|
-
else
|
35
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def add
|
40
|
-
response = Actions::Add.call(self)
|
41
|
-
response.success?
|
34
|
+
options.merge!(:custom => true)
|
35
|
+
super(options)
|
42
36
|
end
|
43
37
|
|
44
38
|
def self.type_id(id = nil)
|
@@ -3,6 +3,9 @@ module NetSuite
|
|
3
3
|
class CustomRecordType
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
|
+
include Support::Actions
|
7
|
+
|
8
|
+
actions :get
|
6
9
|
|
7
10
|
fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :description,
|
8
11
|
:disclaimer, :enable_mail_merge, :enable_numbering, :include_name, :is_available_offline, :is_inactive,
|
@@ -22,15 +25,6 @@ module NetSuite
|
|
22
25
|
initialize_from_attributes_hash(attributes)
|
23
26
|
end
|
24
27
|
|
25
|
-
def self.get(options = {})
|
26
|
-
response = Actions::Get.call(self, options)
|
27
|
-
if response.success?
|
28
|
-
new(response.body)
|
29
|
-
else
|
30
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
28
|
end
|
35
29
|
end
|
36
30
|
end
|
@@ -4,8 +4,11 @@ module NetSuite
|
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Records
|
7
|
+
include Support::Actions
|
7
8
|
include Namespaces::ListRel
|
8
9
|
|
10
|
+
actions :get, :add
|
11
|
+
|
9
12
|
fields :access_role, :account_number, :aging, :alt_email, :alt_name, :alt_phone, :bill_pay,
|
10
13
|
:buying_reason, :buying_time_frame, :campaign_category, :category, :click_stream, :comments, :company_name,
|
11
14
|
:consol_aging, :consol_days_overdue, :contact_roles_list, :contrib_pct, :credit_cards_list, :credit_hold_override,
|
@@ -38,20 +41,6 @@ module NetSuite
|
|
38
41
|
initialize_from_attributes_hash(attributes)
|
39
42
|
end
|
40
43
|
|
41
|
-
def self.get(options = {})
|
42
|
-
response = Actions::Get.call(self, options)
|
43
|
-
if response.success?
|
44
|
-
new(response.body)
|
45
|
-
else
|
46
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def add
|
51
|
-
response = Actions::Add.call(self)
|
52
|
-
response.success?
|
53
|
-
end
|
54
|
-
|
55
44
|
end
|
56
45
|
end
|
57
46
|
end
|
@@ -4,9 +4,12 @@ module NetSuite
|
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Records
|
7
|
+
include Support::Actions
|
7
8
|
include Namespaces::TranCust
|
8
9
|
|
9
|
-
|
10
|
+
actions :get, :initialize, :add
|
11
|
+
|
12
|
+
fields :auth_code, :auto_apply, :cc_approved, :cc_avs_street_match, :cc_avs_zip_match,
|
10
13
|
:cc_expire_date, :cc_name, :cc_number, :cc_security_code, :cc_security_code_match, :cc_street, :cc_zip_code,
|
11
14
|
:charge_it, :check_num, :created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :ignore_avs,
|
12
15
|
:last_modified_date, :memo, :payment, :pending, :pn_ref_num, :status, :three_d_status_code, :tran_date,
|
@@ -14,38 +17,20 @@ module NetSuite
|
|
14
17
|
|
15
18
|
field :custom_field_list, CustomFieldList
|
16
19
|
|
17
|
-
read_only_fields :applied, :total, :unapplied
|
20
|
+
read_only_fields :applied, :balance, :total, :unapplied
|
18
21
|
|
19
22
|
record_refs :account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass,
|
20
23
|
:location, :payment_method, :posting_period, :subsidiary
|
21
24
|
|
25
|
+
attr_reader :internal_id
|
26
|
+
attr_accessor :external_id
|
27
|
+
|
22
28
|
def initialize(attributes = {})
|
29
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
30
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
23
31
|
initialize_from_attributes_hash(attributes)
|
24
32
|
end
|
25
33
|
|
26
|
-
def self.get(options = {})
|
27
|
-
response = Actions::Get.call(self, options)
|
28
|
-
if response.success?
|
29
|
-
new(response.body)
|
30
|
-
else
|
31
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.initialize(object)
|
36
|
-
response = Actions::Initialize.call(self, object)
|
37
|
-
if response.success?
|
38
|
-
new(response.body)
|
39
|
-
else
|
40
|
-
raise InitializationError, "#{self}.initialize with #{object} failed."
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def add
|
45
|
-
response = Actions::Add.call(self)
|
46
|
-
response.success?
|
47
|
-
end
|
48
|
-
|
49
34
|
end
|
50
35
|
end
|
51
36
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CustomerRefund
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Support::Actions
|
8
|
+
include Namespaces::TranCust
|
9
|
+
|
10
|
+
actions :get, :initialize, :add
|
11
|
+
|
12
|
+
fields :address, :balance, :cc_approved, :cc_expire_date, :cc_name, :cc_number, :cc_street, :cc_zip_code, :charge_it,
|
13
|
+
:created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :last_modified_date, :memo, :pn_ref_num, :status,
|
14
|
+
:to_be_printed, :tran_date, :tran_id, :valid_from
|
15
|
+
|
16
|
+
field :custom_field_list, CustomFieldList
|
17
|
+
field :apply_list, CustomerRefundApplyList
|
18
|
+
field :deposit_list, CustomerRefundDepositList
|
19
|
+
|
20
|
+
read_only_fields :total
|
21
|
+
|
22
|
+
record_refs :account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass,
|
23
|
+
:location, :payment_method, :posting_period, :subsidiary, :void_journal
|
24
|
+
|
25
|
+
def initialize(attributes = {})
|
26
|
+
initialize_from_attributes_hash(attributes)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CustomerRefundApply
|
4
|
+
include Support::Fields
|
5
|
+
include Support::Records
|
6
|
+
include Namespaces::TranCust
|
7
|
+
|
8
|
+
fields :amount, :apply, :apply_date, :currency, :doc, :due, :line, :ref_num, :total, :type
|
9
|
+
|
10
|
+
def initialize(attributes = {})
|
11
|
+
initialize_from_attributes_hash(attributes)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CustomerRefundApplyList
|
4
|
+
include Namespaces::TranCust
|
5
|
+
|
6
|
+
def initialize(attributes = {})
|
7
|
+
case attributes[:apply]
|
8
|
+
when Hash
|
9
|
+
applies << CustomerRefundApply.new(attributes[:apply])
|
10
|
+
when Array
|
11
|
+
attributes[:apply].each { |apply| applies << CustomerRefundApply.new(apply) }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def applies
|
16
|
+
@applies ||= []
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_record
|
20
|
+
applies.map do |apply|
|
21
|
+
{ "#{record_namespace}:apply" => apply.to_record }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CustomerRefundDeposit
|
4
|
+
include Support::Fields
|
5
|
+
include Support::Records
|
6
|
+
include Namespaces::TranCust
|
7
|
+
|
8
|
+
fields :amount, :apply, :currency, :deposit_date, :doc, :line, :ref_num, :remaining, :total
|
9
|
+
|
10
|
+
def initialize(attributes = {})
|
11
|
+
initialize_from_attributes_hash(attributes)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CustomerRefundDepositList
|
4
|
+
include Support::Records
|
5
|
+
include Namespaces::TranCust
|
6
|
+
|
7
|
+
def initialize(attributes = {})
|
8
|
+
case attributes[:customer_refund_deposit]
|
9
|
+
when Hash
|
10
|
+
deposits << CustomerRefundDeposit.new(attributes[:customer_refund_deposit])
|
11
|
+
when Array
|
12
|
+
attributes[:customer_refund_deposit].each { |deposit| deposits << CustomerRefundDeposit.new(deposit) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def deposits
|
17
|
+
@deposits ||= []
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_record
|
21
|
+
deposits.map do |deposit|
|
22
|
+
{ "#{record_namespace}:customerRefundDeposit" => deposit.to_record }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -4,8 +4,11 @@ module NetSuite
|
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Records
|
7
|
+
include Support::Actions
|
7
8
|
include Namespaces::ListAcct
|
8
9
|
|
10
|
+
actions :get, :add
|
11
|
+
|
9
12
|
fields :auto_lead_time, :auto_preferred_stock_level, :auto_reorder_point, :available_to_partners, :average_cost,
|
10
13
|
:copy_description, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :cost_units, :costing_method,
|
11
14
|
:costing_method_display, :country_of_manufacture, :created_date, :currency, :date_converted_to_inv,
|
@@ -46,20 +49,6 @@ module NetSuite
|
|
46
49
|
initialize_from_attributes_hash(attributes)
|
47
50
|
end
|
48
51
|
|
49
|
-
def self.get(options = {})
|
50
|
-
response = Actions::Get.call(self, options)
|
51
|
-
if response.success?
|
52
|
-
new(response.body)
|
53
|
-
else
|
54
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def add
|
59
|
-
response = Actions::Add.call(self)
|
60
|
-
response.success?
|
61
|
-
end
|
62
|
-
|
63
52
|
end
|
64
53
|
end
|
65
54
|
end
|
@@ -4,8 +4,11 @@ module NetSuite
|
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Records
|
7
|
+
include Support::Actions
|
7
8
|
include Namespaces::TranSales
|
8
9
|
|
10
|
+
actions :get, :initialize, :add
|
11
|
+
|
9
12
|
fields :alt_handling_cost, :alt_shipping_cost, :balance, :bill_address,
|
10
13
|
:billing_schedule, :contrib_pct, :created_date, :created_from, :currency_name, :custom_field_list,
|
11
14
|
:deferred_revenue, :department, :discount_amount, :discount_date, :discount_item, :discount_rate,
|
@@ -45,29 +48,6 @@ module NetSuite
|
|
45
48
|
initialize_from_attributes_hash(attributes)
|
46
49
|
end
|
47
50
|
|
48
|
-
def self.get(options = {})
|
49
|
-
response = Actions::Get.call(self, options)
|
50
|
-
if response.success?
|
51
|
-
new(response.body)
|
52
|
-
else
|
53
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.initialize(object)
|
58
|
-
response = Actions::Initialize.call(self, object)
|
59
|
-
if response.success?
|
60
|
-
new(response.body)
|
61
|
-
else
|
62
|
-
raise InitializationError, "#{self}.initialize with #{object} failed."
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def add
|
67
|
-
response = Actions::Add.call(self)
|
68
|
-
response.success?
|
69
|
-
end
|
70
|
-
|
71
51
|
end
|
72
52
|
end
|
73
53
|
end
|
data/lib/netsuite/records/job.rb
CHANGED
@@ -4,8 +4,11 @@ module NetSuite
|
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Records
|
7
|
+
include Support::Actions
|
7
8
|
include Namespaces::ListRel
|
8
9
|
|
10
|
+
actions :get, :add
|
11
|
+
|
9
12
|
fields :account_number, :allocate_payroll_expenses, :allow_all_resources_for_tasks, :allow_expenses, :allow_time,
|
10
13
|
:alt_name, :alt_phone, :bill_pay, :calculated_end_date, :calculated_end_date_baseline, :comments, :company_name,
|
11
14
|
:date_created, :default_address, :email, :email_preference, :end_date, :entity_id, :estimated_cost,
|
@@ -32,20 +35,6 @@ module NetSuite
|
|
32
35
|
initialize_from_attributes_hash(attributes)
|
33
36
|
end
|
34
37
|
|
35
|
-
def self.get(options = {})
|
36
|
-
response = Actions::Get.call(self, options)
|
37
|
-
if response.success?
|
38
|
-
new(response.body)
|
39
|
-
else
|
40
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def add
|
45
|
-
response = Actions::Add.call(self)
|
46
|
-
response.success?
|
47
|
-
end
|
48
|
-
|
49
38
|
end
|
50
39
|
end
|
51
40
|
end
|
@@ -4,8 +4,11 @@ module NetSuite
|
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Records
|
7
|
+
include Support::Actions
|
7
8
|
include Namespaces::TranGeneral
|
8
9
|
|
10
|
+
actions :get, :add
|
11
|
+
|
9
12
|
fields :approved, :created_date, :exchange_rate, :last_modified_date, :reversal_date, :reversal_defer, :reversal_entry,
|
10
13
|
:tran_date, :tran_id
|
11
14
|
|
@@ -19,20 +22,6 @@ module NetSuite
|
|
19
22
|
initialize_from_attributes_hash(attributes)
|
20
23
|
end
|
21
24
|
|
22
|
-
def self.get(options = {})
|
23
|
-
response = Actions::Get.call(self, options)
|
24
|
-
if response.success?
|
25
|
-
new(response.body)
|
26
|
-
else
|
27
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def add
|
32
|
-
response = Actions::Add.call(self)
|
33
|
-
response.success?
|
34
|
-
end
|
35
|
-
|
36
25
|
end
|
37
26
|
end
|
38
27
|
end
|
@@ -3,6 +3,9 @@ module NetSuite
|
|
3
3
|
class Location
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
|
+
include Support::Actions
|
7
|
+
|
8
|
+
actions :get
|
6
9
|
|
7
10
|
fields :addr1, :addr2, :addr3, :addr_phone, :addr_text, :addressee, :attention, :city, :country, :include_children,
|
8
11
|
:is_inactive, :make_inventory_available, :make_inventory_available_store, :name, :override, :state, :tran_prefix, :zip
|
@@ -18,15 +21,6 @@ module NetSuite
|
|
18
21
|
initialize_from_attributes_hash(attributes)
|
19
22
|
end
|
20
23
|
|
21
|
-
def self.get(options = {})
|
22
|
-
response = Actions::Get.call(self, options)
|
23
|
-
if response.success?
|
24
|
-
new(response.body)
|
25
|
-
else
|
26
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
24
|
end
|
31
25
|
end
|
32
26
|
end
|
@@ -4,8 +4,11 @@ module NetSuite
|
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Records
|
7
|
+
include Support::Actions
|
7
8
|
include Namespaces::ListAcct
|
8
9
|
|
10
|
+
actions :get
|
11
|
+
|
9
12
|
fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture,
|
10
13
|
:created_date, :custom_field_list, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap,
|
11
14
|
:featured_description, :handling_cost, :handling_cost_units, :include_children, :is_donation_item, :is_fulfillable,
|
@@ -36,15 +39,6 @@ module NetSuite
|
|
36
39
|
initialize_from_attributes_hash(attributes)
|
37
40
|
end
|
38
41
|
|
39
|
-
def self.get(options = {})
|
40
|
-
response = Actions::Get.call(self, options)
|
41
|
-
if response.success?
|
42
|
-
new(response.body)
|
43
|
-
else
|
44
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
42
|
end
|
49
43
|
end
|
50
44
|
end
|
@@ -3,6 +3,9 @@ module NetSuite
|
|
3
3
|
class PaymentMethod
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
|
+
include Support::Actions
|
7
|
+
|
8
|
+
actions :get
|
6
9
|
|
7
10
|
fields :credit_card, :express_checkout_arrangement, :is_debit_card, :is_inactive, :is_online, :name,
|
8
11
|
:pay_pal_email_address, :undep_funds, :use_express_checkout
|
@@ -18,15 +21,6 @@ module NetSuite
|
|
18
21
|
initialize_from_attributes_hash(attributes)
|
19
22
|
end
|
20
23
|
|
21
|
-
def self.get(options = {})
|
22
|
-
response = Actions::Get.call(self, options)
|
23
|
-
if response.success?
|
24
|
-
new(response.body)
|
25
|
-
else
|
26
|
-
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
24
|
end
|
31
25
|
end
|
32
26
|
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Support
|
3
|
+
module Actions
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.send(:extend, ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
|
11
|
+
def actions(*args)
|
12
|
+
instance_module = Module.new
|
13
|
+
class_module = Module.new
|
14
|
+
args.each do |action|
|
15
|
+
define_action(instance_module, class_module, action)
|
16
|
+
end
|
17
|
+
self.send(:include, instance_module)
|
18
|
+
self.send(:extend, class_module)
|
19
|
+
end
|
20
|
+
|
21
|
+
def define_action(instance_module, class_module, action)
|
22
|
+
case action
|
23
|
+
when :get
|
24
|
+
define_get(class_module)
|
25
|
+
when :add
|
26
|
+
define_add(instance_module)
|
27
|
+
when :initialize
|
28
|
+
define_initialize(class_module)
|
29
|
+
else
|
30
|
+
raise "Unknown action: #{action.inspect}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def define_get(class_module)
|
35
|
+
class_module.module_eval do
|
36
|
+
define_method :get do |*args|
|
37
|
+
options, *ignored = *args
|
38
|
+
response = NetSuite::Actions::Get.call(self, options)
|
39
|
+
if response.success?
|
40
|
+
new(response.body)
|
41
|
+
else
|
42
|
+
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def define_add(instance_module)
|
49
|
+
instance_module.module_eval do
|
50
|
+
define_method :add do
|
51
|
+
response = NetSuite::Actions::Add.call(self)
|
52
|
+
response.success?
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def define_initialize(class_module)
|
58
|
+
(class << self; self; end).instance_eval do
|
59
|
+
define_method :initialize do |*args|
|
60
|
+
super(*args)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class_module.module_eval do
|
65
|
+
define_method :initialize do |object|
|
66
|
+
response = NetSuite::Actions::Initialize.call(self, object)
|
67
|
+
if response.success?
|
68
|
+
new(response.body)
|
69
|
+
else
|
70
|
+
raise InitializationError, "#{self}.initialize with #{object} failed."
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/lib/netsuite/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
module NetSuite
|
2
|
+
require 'logger'
|
3
|
+
class XmlLogger < ::Logger
|
4
|
+
def format_message(severity, timestamp, progname, msg)
|
5
|
+
if msg.match('<?xml') && !(msg.match('SOAPAction'))
|
6
|
+
xp(msg)
|
7
|
+
else
|
8
|
+
"#{msg}\n"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def xp(xml_text)
|
13
|
+
xsl = <<XSL
|
14
|
+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
15
|
+
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
|
16
|
+
<xsl:strip-space elements="*"/>
|
17
|
+
<xsl:template match="/">
|
18
|
+
<xsl:copy-of select="."/>
|
19
|
+
</xsl:template>
|
20
|
+
</xsl:stylesheet>
|
21
|
+
XSL
|
22
|
+
|
23
|
+
doc = Nokogiri::XML(xml_text)
|
24
|
+
xslt = Nokogiri::XSLT(xsl)
|
25
|
+
out = xslt.transform(doc)
|
26
|
+
|
27
|
+
puts out.to_xml
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
data/netsuite.gemspec
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::CustomerRefundApplyList do
|
4
|
+
let(:list) { NetSuite::Records::CustomerRefundApplyList.new }
|
5
|
+
|
6
|
+
it 'has a applies attribute' do
|
7
|
+
list.applies.should be_kind_of(Array)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#to_record' do
|
11
|
+
before do
|
12
|
+
list.applies << NetSuite::Records::CustomerRefundApply.new(:amount => 10)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'can represent itself as a SOAP record' do
|
16
|
+
record = [
|
17
|
+
{
|
18
|
+
'tranCust:apply' => {
|
19
|
+
'tranCust:amount' => 10
|
20
|
+
}
|
21
|
+
}
|
22
|
+
]
|
23
|
+
list.to_record.should eql(record)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::CustomerRefundApply do
|
4
|
+
let(:apply) { NetSuite::Records::CustomerRefundApply.new }
|
5
|
+
|
6
|
+
it 'has all the right fields' do
|
7
|
+
[
|
8
|
+
:amount, :apply, :apply_date, :currency, :doc, :due, :line, :ref_num, :total, :type
|
9
|
+
].each do |field|
|
10
|
+
apply.should have_field(field)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::CustomerRefundDepositList do
|
4
|
+
let(:list) { NetSuite::Records::CustomerRefundDepositList.new }
|
5
|
+
|
6
|
+
it 'has a deposits attribute' do
|
7
|
+
list.deposits.should be_kind_of(Array)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#to_record' do
|
11
|
+
before do
|
12
|
+
list.deposits << NetSuite::Records::CustomerRefundDeposit.new(:apply => false)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'can represent itself as a SOAP record' do
|
16
|
+
record = [
|
17
|
+
{
|
18
|
+
'tranCust:customerRefundDeposit' => {
|
19
|
+
'tranCust:apply' => false
|
20
|
+
}
|
21
|
+
}
|
22
|
+
]
|
23
|
+
list.to_record.should eql(record)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::CustomerRefundDeposit do
|
4
|
+
let(:deposit) { NetSuite::Records::CustomerRefundDeposit.new }
|
5
|
+
|
6
|
+
it 'has all the right fields' do
|
7
|
+
[
|
8
|
+
:amount, :apply, :currency, :deposit_date, :doc, :line, :ref_num, :remaining, :total
|
9
|
+
].each do |field|
|
10
|
+
deposit.should have_field(field)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::CustomerRefund do
|
4
|
+
let(:refund) { NetSuite::Records::CustomerRefund.new }
|
5
|
+
let(:memo) { NetSuite::Records::CreditMemo.new }
|
6
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
7
|
+
|
8
|
+
# <element name="depositList" type="tranCust:CustomerRefundDepositList" minOccurs="0"/>
|
9
|
+
|
10
|
+
it 'has all the right fields' do
|
11
|
+
[
|
12
|
+
:address, :balance, :cc_approved, :cc_expire_date, :cc_name, :cc_number, :cc_street, :cc_zip_code, :charge_it,
|
13
|
+
:created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :last_modified_date, :memo, :pn_ref_num, :status,
|
14
|
+
:to_be_printed, :total, :tran_date, :tran_id, :valid_from
|
15
|
+
].each do |field|
|
16
|
+
refund.should have_field(field)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'has all the right record refs' do
|
21
|
+
[
|
22
|
+
:account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass, :location,
|
23
|
+
:payment_method, :posting_period, :subsidiary, :void_journal
|
24
|
+
].each do |record_ref|
|
25
|
+
refund.should have_record_ref(record_ref)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#custom_field_list' do
|
30
|
+
it 'can be set from attributes' do
|
31
|
+
attributes = {
|
32
|
+
:custom_field => {
|
33
|
+
:amount => 10
|
34
|
+
}
|
35
|
+
}
|
36
|
+
refund.custom_field_list = attributes
|
37
|
+
refund.custom_field_list.should be_kind_of(NetSuite::Records::CustomFieldList)
|
38
|
+
refund.custom_field_list.custom_fields.length.should eql(1)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'can be set from a CustomFieldList object' do
|
42
|
+
custom_field_list = NetSuite::Records::CustomFieldList.new
|
43
|
+
refund.custom_field_list = custom_field_list
|
44
|
+
refund.custom_field_list.should eql(custom_field_list)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#apply_list' do
|
49
|
+
it 'can be set from attributes' do
|
50
|
+
attributes = {
|
51
|
+
:apply => {
|
52
|
+
:amount => 10
|
53
|
+
}
|
54
|
+
}
|
55
|
+
refund.apply_list = attributes
|
56
|
+
refund.apply_list.should be_kind_of(NetSuite::Records::CustomerRefundApplyList)
|
57
|
+
refund.apply_list.applies.length.should eql(1)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'can be set from a CustomerRefundApplyList object' do
|
61
|
+
apply_list = NetSuite::Records::CustomerRefundApplyList.new
|
62
|
+
refund.apply_list = apply_list
|
63
|
+
refund.apply_list.should eql(apply_list)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#deposit_list' do
|
68
|
+
it 'can be set from attributes' do
|
69
|
+
attributes = {
|
70
|
+
:customer_refund_deposit => {
|
71
|
+
:apply => false
|
72
|
+
}
|
73
|
+
}
|
74
|
+
refund.deposit_list = attributes
|
75
|
+
refund.deposit_list.should be_kind_of(NetSuite::Records::CustomerRefundDepositList)
|
76
|
+
refund.deposit_list.deposits.length.should eql(1)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'can be set from a CustomerRefundDepositList object' do
|
80
|
+
deposit_list = NetSuite::Records::CustomerRefundDepositList.new
|
81
|
+
refund.deposit_list = deposit_list
|
82
|
+
refund.deposit_list.should eql(deposit_list)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe '.get' do
|
87
|
+
context 'when the response is successful' do
|
88
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :is_person => true }) }
|
89
|
+
|
90
|
+
it 'returns an CustomerRefund instance populated with the data from the response object' do
|
91
|
+
NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::CustomerRefund, :external_id => 10).and_return(response)
|
92
|
+
refund = NetSuite::Records::CustomerRefund.get(:external_id => 10)
|
93
|
+
refund.should be_kind_of(NetSuite::Records::CustomerRefund)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context 'when the response is unsuccessful' do
|
98
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
99
|
+
|
100
|
+
it 'raises a RecordNotFound exception' do
|
101
|
+
NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::CustomerRefund, :external_id => 10).and_return(response)
|
102
|
+
lambda {
|
103
|
+
NetSuite::Records::CustomerRefund.get(:external_id => 10)
|
104
|
+
}.should raise_error(NetSuite::RecordNotFound,
|
105
|
+
/NetSuite::Records::CustomerRefund with OPTIONS=(.*) could not be found/)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe '.initialize' do
|
111
|
+
context 'when the request is successful' do
|
112
|
+
it 'returns an initialized invoice from the customer entity' do
|
113
|
+
NetSuite::Actions::Initialize.should_receive(:call).with(NetSuite::Records::CustomerRefund, memo).and_return(response)
|
114
|
+
refund = NetSuite::Records::CustomerRefund.initialize(memo)
|
115
|
+
refund.should be_kind_of(NetSuite::Records::CustomerRefund)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
context 'when the response is unsuccessful' do
|
120
|
+
pending
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe '#add' do
|
125
|
+
let(:test_data) { { :memo => 'This is a memo', :balance => 100 } }
|
126
|
+
|
127
|
+
context 'when the response is successful' do
|
128
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
129
|
+
|
130
|
+
it 'returns true' do
|
131
|
+
refund = NetSuite::Records::CustomerRefund.new(test_data)
|
132
|
+
NetSuite::Actions::Add.should_receive(:call).
|
133
|
+
with(refund).
|
134
|
+
and_return(response)
|
135
|
+
refund.add.should be_true
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context 'when the response is unsuccessful' do
|
140
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
141
|
+
|
142
|
+
it 'returns false' do
|
143
|
+
refund = NetSuite::Records::Invoice.new(test_data)
|
144
|
+
NetSuite::Actions::Add.should_receive(:call).
|
145
|
+
with(refund).
|
146
|
+
and_return(response)
|
147
|
+
refund.add.should be_false
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe '#to_record' do
|
153
|
+
before do
|
154
|
+
refund.memo = 'This is a memo'
|
155
|
+
refund.balance = 100
|
156
|
+
end
|
157
|
+
it 'can represent itself as a SOAP record' do
|
158
|
+
record = {
|
159
|
+
'tranCust:memo' => 'This is a memo',
|
160
|
+
'tranCust:balance' => 100
|
161
|
+
}
|
162
|
+
refund.to_record.should eql(record)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
describe '#record_type' do
|
167
|
+
it 'returns a string representation of the SOAP type' do
|
168
|
+
refund.record_type.should eql('tranCust:CustomerRefund')
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsuite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 45
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 25
|
10
|
+
version: 0.0.25
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Moran
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: savon
|
@@ -34,9 +34,23 @@ dependencies:
|
|
34
34
|
type: :runtime
|
35
35
|
version_requirements: *id001
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
37
|
+
name: nokogiri
|
38
38
|
prerelease: false
|
39
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rspec
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
54
|
none: false
|
41
55
|
requirements:
|
42
56
|
- - "="
|
@@ -48,11 +62,11 @@ dependencies:
|
|
48
62
|
- 0
|
49
63
|
version: 2.8.0
|
50
64
|
type: :development
|
51
|
-
version_requirements: *
|
65
|
+
version_requirements: *id003
|
52
66
|
- !ruby/object:Gem::Dependency
|
53
67
|
name: autotest-standalone
|
54
68
|
prerelease: false
|
55
|
-
requirement: &
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
56
70
|
none: false
|
57
71
|
requirements:
|
58
72
|
- - "="
|
@@ -64,11 +78,11 @@ dependencies:
|
|
64
78
|
- 9
|
65
79
|
version: 4.5.9
|
66
80
|
type: :development
|
67
|
-
version_requirements: *
|
81
|
+
version_requirements: *id004
|
68
82
|
- !ruby/object:Gem::Dependency
|
69
83
|
name: savon_spec
|
70
84
|
prerelease: false
|
71
|
-
requirement: &
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
72
86
|
none: false
|
73
87
|
requirements:
|
74
88
|
- - "="
|
@@ -80,7 +94,7 @@ dependencies:
|
|
80
94
|
- 6
|
81
95
|
version: 0.1.6
|
82
96
|
type: :development
|
83
|
-
version_requirements: *
|
97
|
+
version_requirements: *id005
|
84
98
|
description: NetSuite SuiteTalk API Wrapper
|
85
99
|
email:
|
86
100
|
- ryan.moran@gmail.com
|
@@ -127,6 +141,11 @@ files:
|
|
127
141
|
- lib/netsuite/records/customer_addressbook.rb
|
128
142
|
- lib/netsuite/records/customer_addressbook_list.rb
|
129
143
|
- lib/netsuite/records/customer_payment.rb
|
144
|
+
- lib/netsuite/records/customer_refund.rb
|
145
|
+
- lib/netsuite/records/customer_refund_apply.rb
|
146
|
+
- lib/netsuite/records/customer_refund_apply_list.rb
|
147
|
+
- lib/netsuite/records/customer_refund_deposit.rb
|
148
|
+
- lib/netsuite/records/customer_refund_deposit_list.rb
|
130
149
|
- lib/netsuite/records/duration.rb
|
131
150
|
- lib/netsuite/records/inventory_item.rb
|
132
151
|
- lib/netsuite/records/invoice.rb
|
@@ -142,12 +161,14 @@ files:
|
|
142
161
|
- lib/netsuite/records/record_ref.rb
|
143
162
|
- lib/netsuite/records/ship_address.rb
|
144
163
|
- lib/netsuite/response.rb
|
164
|
+
- lib/netsuite/support/actions.rb
|
145
165
|
- lib/netsuite/support/attributes.rb
|
146
166
|
- lib/netsuite/support/fields.rb
|
147
167
|
- lib/netsuite/support/record_refs.rb
|
148
168
|
- lib/netsuite/support/records.rb
|
149
169
|
- lib/netsuite/support/requests.rb
|
150
170
|
- lib/netsuite/version.rb
|
171
|
+
- lib/netsuite/xml_logger.rb
|
151
172
|
- netsuite.gemspec
|
152
173
|
- spec/netsuite/actions/add_spec.rb
|
153
174
|
- spec/netsuite/actions/get_spec.rb
|
@@ -166,6 +187,11 @@ files:
|
|
166
187
|
- spec/netsuite/records/customer_addressbook_list_spec.rb
|
167
188
|
- spec/netsuite/records/customer_addressbook_spec.rb
|
168
189
|
- spec/netsuite/records/customer_payment_spec.rb
|
190
|
+
- spec/netsuite/records/customer_refund_apply_list_spec.rb
|
191
|
+
- spec/netsuite/records/customer_refund_apply_spec.rb
|
192
|
+
- spec/netsuite/records/customer_refund_deposit_list_spec.rb
|
193
|
+
- spec/netsuite/records/customer_refund_deposit_spec.rb
|
194
|
+
- spec/netsuite/records/customer_refund_spec.rb
|
169
195
|
- spec/netsuite/records/customer_spec.rb
|
170
196
|
- spec/netsuite/records/duration_spec.rb
|
171
197
|
- spec/netsuite/records/inventory_item_spec.rb
|
@@ -182,6 +208,7 @@ files:
|
|
182
208
|
- spec/netsuite/records/record_ref_spec.rb
|
183
209
|
- spec/netsuite/records/ship_address_spec.rb
|
184
210
|
- spec/netsuite/response_spec.rb
|
211
|
+
- spec/netsuite/support/actions_spec.rb
|
185
212
|
- spec/netsuite/support/attributes_spec.rb
|
186
213
|
- spec/netsuite/support/fields_spec.rb
|
187
214
|
- spec/netsuite/support/record_refs_spec.rb
|
@@ -253,6 +280,11 @@ test_files:
|
|
253
280
|
- spec/netsuite/records/customer_addressbook_list_spec.rb
|
254
281
|
- spec/netsuite/records/customer_addressbook_spec.rb
|
255
282
|
- spec/netsuite/records/customer_payment_spec.rb
|
283
|
+
- spec/netsuite/records/customer_refund_apply_list_spec.rb
|
284
|
+
- spec/netsuite/records/customer_refund_apply_spec.rb
|
285
|
+
- spec/netsuite/records/customer_refund_deposit_list_spec.rb
|
286
|
+
- spec/netsuite/records/customer_refund_deposit_spec.rb
|
287
|
+
- spec/netsuite/records/customer_refund_spec.rb
|
256
288
|
- spec/netsuite/records/customer_spec.rb
|
257
289
|
- spec/netsuite/records/duration_spec.rb
|
258
290
|
- spec/netsuite/records/inventory_item_spec.rb
|
@@ -269,6 +301,7 @@ test_files:
|
|
269
301
|
- spec/netsuite/records/record_ref_spec.rb
|
270
302
|
- spec/netsuite/records/ship_address_spec.rb
|
271
303
|
- spec/netsuite/response_spec.rb
|
304
|
+
- spec/netsuite/support/actions_spec.rb
|
272
305
|
- spec/netsuite/support/attributes_spec.rb
|
273
306
|
- spec/netsuite/support/fields_spec.rb
|
274
307
|
- spec/netsuite/support/record_refs_spec.rb
|