netsuite 0.3.3 → 0.4.0

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.
Files changed (86) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +14 -12
  3. data/lib/netsuite.rb +16 -2
  4. data/lib/netsuite/actions/delete_list.rb +104 -0
  5. data/lib/netsuite/actions/login.rb +26 -1
  6. data/lib/netsuite/actions/search.rb +7 -3
  7. data/lib/netsuite/actions/upsert.rb +0 -4
  8. data/lib/netsuite/configuration.rb +1 -0
  9. data/lib/netsuite/namespaces/tran_purch.rb +11 -0
  10. data/lib/netsuite/records/cash_refund.rb +2 -2
  11. data/lib/netsuite/records/cash_sale.rb +41 -1
  12. data/lib/netsuite/records/cash_sale_item.rb +40 -0
  13. data/lib/netsuite/records/cash_sale_item_list.rb +25 -0
  14. data/lib/netsuite/records/contact.rb +1 -1
  15. data/lib/netsuite/records/contact_list.rb +1 -4
  16. data/lib/netsuite/records/credit_memo.rb +1 -1
  17. data/lib/netsuite/records/credit_memo_apply_list.rb +1 -4
  18. data/lib/netsuite/records/credit_memo_item.rb +1 -0
  19. data/lib/netsuite/records/credit_memo_item_list.rb +1 -4
  20. data/lib/netsuite/records/custom_field_list.rb +3 -0
  21. data/lib/netsuite/records/customer.rb +8 -8
  22. data/lib/netsuite/records/customer_payment.rb +1 -1
  23. data/lib/netsuite/records/customer_payment_apply.rb +1 -1
  24. data/lib/netsuite/records/customer_payment_apply_list.rb +13 -9
  25. data/lib/netsuite/records/customer_refund.rb +1 -1
  26. data/lib/netsuite/records/customer_refund_apply_list.rb +7 -3
  27. data/lib/netsuite/records/customer_refund_deposit_list.rb +1 -1
  28. data/lib/netsuite/records/deposit.rb +3 -3
  29. data/lib/netsuite/records/deposit_payment_list.rb +5 -2
  30. data/lib/netsuite/records/employee.rb +12 -4
  31. data/lib/netsuite/records/inventory_assignment.rb +1 -1
  32. data/lib/netsuite/records/inventory_assignment_list.rb +3 -1
  33. data/lib/netsuite/records/inventory_detail.rb +3 -3
  34. data/lib/netsuite/records/inventory_item.rb +4 -0
  35. data/lib/netsuite/records/invoice.rb +8 -4
  36. data/lib/netsuite/records/invoice_item_list.rb +4 -21
  37. data/lib/netsuite/records/job.rb +1 -1
  38. data/lib/netsuite/records/kit_item.rb +1 -1
  39. data/lib/netsuite/records/partner.rb +4 -2
  40. data/lib/netsuite/records/payment_method.rb +1 -1
  41. data/lib/netsuite/records/promotion_code.rb +1 -1
  42. data/lib/netsuite/records/rev_rec_template.rb +1 -1
  43. data/lib/netsuite/records/sales_order.rb +1 -1
  44. data/lib/netsuite/records/sales_order_item_list.rb +0 -1
  45. data/lib/netsuite/records/service_sale_item.rb +2 -2
  46. data/lib/netsuite/records/vendor_bill.rb +45 -0
  47. data/lib/netsuite/records/vendor_bill_expense.rb +40 -0
  48. data/lib/netsuite/records/vendor_bill_expense_list.rb +32 -0
  49. data/lib/netsuite/records/vendor_bill_item.rb +45 -0
  50. data/lib/netsuite/records/vendor_bill_item_list.rb +32 -0
  51. data/lib/netsuite/records/vendor_payment.rb +43 -0
  52. data/lib/netsuite/records/vendor_payment_apply.rb +16 -0
  53. data/lib/netsuite/records/vendor_payment_apply_list.rb +32 -0
  54. data/lib/netsuite/support/actions.rb +2 -2
  55. data/lib/netsuite/support/sublist.rb +13 -0
  56. data/lib/netsuite/version.rb +1 -1
  57. data/netsuite.gemspec +1 -1
  58. data/spec/netsuite/actions/delete_list_spec.rb +86 -0
  59. data/spec/netsuite/actions/login_spec.rb +21 -0
  60. data/spec/netsuite/records/cash_refund_spec.rb +1 -1
  61. data/spec/netsuite/records/cash_sale_item_list_spec.rb +27 -0
  62. data/spec/netsuite/records/cash_sale_item_spec.rb +23 -0
  63. data/spec/netsuite/records/credit_memo_apply_list_spec.rb +7 -8
  64. data/spec/netsuite/records/credit_memo_item_list_spec.rb +6 -8
  65. data/spec/netsuite/records/customer_payment_apply_list_spec.rb +25 -0
  66. data/spec/netsuite/records/customer_refund_apply_list_spec.rb +6 -8
  67. data/spec/netsuite/records/customer_spec.rb +6 -6
  68. data/spec/netsuite/records/employee_spec.rb +152 -0
  69. data/spec/netsuite/records/inventory_assignment_list_spec.rb +59 -0
  70. data/spec/netsuite/records/inventory_assignment_spec.rb +21 -0
  71. data/spec/netsuite/records/inventory_detail_spec.rb +13 -0
  72. data/spec/netsuite/records/invoice_spec.rb +3 -3
  73. data/spec/netsuite/records/job_spec.rb +4 -0
  74. data/spec/netsuite/records/vendor_bill_expense_list_spec.rb +36 -0
  75. data/spec/netsuite/records/vendor_bill_expense_spec.rb +72 -0
  76. data/spec/netsuite/records/vendor_bill_item_list_spec.rb +36 -0
  77. data/spec/netsuite/records/vendor_bill_item_spec.rb +118 -0
  78. data/spec/netsuite/records/vendor_bill_spec.rb +187 -0
  79. data/spec/netsuite/records/vendor_payment_apply_list_spec.rb +25 -0
  80. data/spec/netsuite/records/vendor_payment_apply_spec.rb +15 -0
  81. data/spec/netsuite/records/vendor_payment_spec.rb +164 -0
  82. data/spec/netsuite/support/sublist_spec.rb +6 -0
  83. data/spec/support/fixtures/delete_list/delete_list_customers.xml +26 -0
  84. data/spec/support/fixtures/delete_list/delete_list_customers_with_errors.xml +31 -0
  85. data/spec/support/fixtures/login.xml +35 -0
  86. metadata +58 -12
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListRel
9
9
 
10
- actions :get, :get_list, :add, :delete, :update, :upsert
10
+ actions :get, :get_list, :add, :delete, :search, :update, :upsert
11
11
 
12
12
  fields :account_number, :allocate_payroll_expenses, :allow_all_resources_for_tasks, :allow_expenses, :allow_time,
13
13
  :alt_name, :alt_phone, :bill_pay, :calculated_end_date, :calculated_end_date_baseline, :comments, :company_name,
@@ -1,7 +1,7 @@
1
1
  module NetSuite
2
2
  module Records
3
3
  class KitItem < InventoryItem
4
- field :member_list, MemberList
4
+
5
5
  end
6
6
  end
7
7
  end
@@ -10,9 +10,11 @@ module NetSuite
10
10
 
11
11
  actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :search
12
12
 
13
- fields :phone, :first_name, :last_name, :is_inactive, :email
13
+ fields :phone, :home_phone, :first_name, :last_name, :alt_name, :is_inactive, :email, :give_access,
14
+ :partner_code, :is_person, :company_name, :eligible_for_commission, :entity_id, :last_modified_date,
15
+ :date_created, :title, :mobile_phone, :comments, :middle_name
14
16
 
15
- record_refs :klass
17
+ record_refs :klass, :access_role
16
18
 
17
19
  attr_reader :internal_id
18
20
  end
@@ -5,7 +5,7 @@ module NetSuite
5
5
  include Support::RecordRefs
6
6
  include Support::Actions
7
7
 
8
- actions :get
8
+ actions :add, :delete, :get, :get_list, :search, :update, :upsert, :upsert_list
9
9
 
10
10
  fields :credit_card, :express_checkout_arrangement, :is_debit_card, :is_inactive, :is_online, :name,
11
11
  :pay_pal_email_address, :undep_funds, :use_express_checkout
@@ -9,7 +9,7 @@ module NetSuite
9
9
  include Support::Actions
10
10
  include Namespaces::ListMkt
11
11
 
12
- actions :get, :get_list, :add, :search, :delete, :update
12
+ actions :get, :get_list, :add, :search, :delete, :update, :upsert
13
13
 
14
14
  fields :code, :code_pattern, :description, :discount_type, :display_line_discounts, :end_date,
15
15
  :exclude_items, :is_inactive, :is_public, :minimum_order_amount, :name, :number_to_generate,
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
- actions :get
10
+ actions :get, :get_list, :add, :update, :upsert, :delete, :search
11
11
 
12
12
  fields :name, :is_inactive
13
13
 
@@ -17,7 +17,7 @@ module NetSuite
17
17
  :rev_rec_on_rev_commitment, :sales_effective_date, :ship_date, :shipping_cost, :shipping_tax1_rate, :shipping_tax2_rate, :source,
18
18
  :start_date, :status, :sync_partner_teams, :sync_sales_teams, :tax2_total, :tax_rate, :to_be_emailed, :to_be_faxed,
19
19
  :to_be_printed, :total_cost_estimate, :tran_date, :tran_id, :tran_is_vsoe_bundle, :vat_reg_num,
20
- :vsoe_auto_calc
20
+ :vsoe_auto_calc, :linked_tracking_numbers
21
21
 
22
22
  field :transaction_ship_address, ShipAddress
23
23
  field :transaction_bill_address, BillAddress
@@ -26,7 +26,6 @@ module NetSuite
26
26
  def to_record
27
27
  { "#{record_namespace}:item" => items.map(&:to_record) }
28
28
  end
29
-
30
29
  end
31
30
  end
32
31
  end
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
- actions :get, :get_list, :add, :delete, :upsert
10
+ actions :get, :get_list, :add, :update, :delete, :upsert
11
11
 
12
12
  fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date,
13
13
  :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description,
@@ -42,4 +42,4 @@ module NetSuite
42
42
 
43
43
  end
44
44
  end
45
- end
45
+ end
@@ -0,0 +1,45 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorBill
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::TranPurch
9
+
10
+ actions :add, :delete, :get, :get_list, :get_select_value, :initialize, :search, :update, :upsert, :upsert_list
11
+
12
+ fields :created_date, :credit_limit, :currency_name, :discount_amount, :discount_date, :due_date, :exchange_rate,
13
+ :landed_costs_list, :landed_cost_method, :landed_cost_per_line, :last_modified_date, :memo, :tax_total,
14
+ :tax_2_total, :transaction_number, :tran_date, :tran_id, :user_total, :vat_reg_num
15
+
16
+ field :custom_field_list, CustomFieldList
17
+ field :expense_list, VendorBillExpenseList
18
+ field :item_list, VendorBillItemList
19
+ field :purchase_order_list, RecordRefList
20
+
21
+ read_only_fields :status
22
+
23
+ record_refs :custom_form, :account, :entity, :subsidiary, :approval_status, :next_approver, :posting_period, :terms,
24
+ :currency, :klass, :department, :location
25
+
26
+ attr_reader :internal_id
27
+ attr_accessor :external_id
28
+
29
+ def initialize(attributes = {})
30
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
31
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
32
+ initialize_from_attributes_hash(attributes)
33
+ end
34
+
35
+ def to_record
36
+ rec = super
37
+ if rec["#{record_namespace}:customFieldList"]
38
+ rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
39
+ end
40
+ rec
41
+ end
42
+
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,40 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorBillExpense
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::TranPurch
8
+
9
+ fields :amount, :amortization_end_date, :amortiz_start_date, :amortization_residual, :gross_amt, :is_billable,
10
+ :line, :memo, :order_doc, :order_line, :tax_1_amt, :tax_rate_1, :tax_rate_2
11
+
12
+ field :custom_field_list, CustomFieldList
13
+
14
+ record_refs :account, :amortization_sched, :klass, :category, :customer, :department, :location, :tax_code
15
+
16
+ def initialize(attributes_or_record = {})
17
+ case attributes_or_record
18
+ when Hash
19
+ initialize_from_attributes_hash(attributes_or_record)
20
+ when self.class
21
+ initialize_from_record(attributes_or_record)
22
+ end
23
+ end
24
+
25
+ def initialize_from_record(record)
26
+ self.attributes = record.send(:attributes)
27
+ end
28
+
29
+ def to_record
30
+ rec = super
31
+ if rec["#{record_namespace}:customFieldList"]
32
+ rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
33
+ end
34
+ rec
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+
@@ -0,0 +1,32 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorBillExpenseList
4
+ include Support::Fields
5
+ include Namespaces::TranPurch
6
+
7
+ fields :expense
8
+
9
+ def initialize(attributes = {})
10
+ initialize_from_attributes_hash(attributes)
11
+ end
12
+
13
+ def expense=(expenses)
14
+ case expenses
15
+ when Hash
16
+ self.expenses << VendorBillExpense.new(expenses)
17
+ when Array
18
+ expenses.each { |expense| self.expenses << VendorBillExpense.new(expense) }
19
+ end
20
+ end
21
+
22
+ def expenses
23
+ @expenses ||= []
24
+ end
25
+
26
+ def to_record
27
+ { "#{record_namespace}:expense" => expenses.map(&:to_record) }
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,45 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorBillItem
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::TranPurch
8
+
9
+ fields :amortization_end_date, :amortization_residual, :amortiz_start_date, :bin_numbers, :bill_variance_status,
10
+ :description, :expiration_date, :gross_amt, :inventory_detail, :is_billable, :landed_cost, :line,
11
+ :order_doc, :order_line, :quantity, :serial_numbers, :tax_rate_1, :tax_rate_2, :tax_1_amt, :vendor_name
12
+
13
+ field :bill_receipts_list, RecordRefList
14
+ field :custom_field_list, CustomFieldList
15
+ field :options, CustomFieldList
16
+
17
+ read_only_fields :amount
18
+
19
+ record_refs :amortization_sched, :klass, :customer, :department, :item, :landed_cost_category, :location,
20
+ :tax_code, :units
21
+
22
+ def initialize(attributes_or_record = {})
23
+ case attributes_or_record
24
+ when Hash
25
+ initialize_from_attributes_hash(attributes_or_record)
26
+ when self.class
27
+ initialize_from_record(attributes_or_record)
28
+ end
29
+ end
30
+
31
+ def initialize_from_record(record)
32
+ self.attributes = record.send(:attributes)
33
+ end
34
+
35
+ def to_record
36
+ rec = super
37
+ if rec["#{record_namespace}:customFieldList"]
38
+ rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
39
+ end
40
+ rec
41
+ end
42
+
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,32 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorBillItemList
4
+ include Support::Fields
5
+ include Namespaces::TranPurch
6
+
7
+ fields :item
8
+
9
+ def initialize(attributes = {})
10
+ initialize_from_attributes_hash(attributes)
11
+ end
12
+
13
+ def item=(items)
14
+ case items
15
+ when Hash
16
+ self.items << VendorBillItem.new(items)
17
+ when Array
18
+ items.each { |item| self.items << VendorBillItem.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
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,43 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorPayment
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::TranPurch
9
+
10
+ actions :get, :get_list, :initialize, :add, :delete, :update, :upsert
11
+
12
+ fields :address, :balance, :bill_pay, :created_at, :credit_list, :currency_name, :exchange_rate, :last_modified_date,
13
+ :memo, :print_voucher, :status, :to_ach, :to_be_printed, :total, :tran_date, :tran_id, :transaction_number
14
+
15
+ field :apply_list, VendorPaymentApplyList
16
+ field :custom_field_list, CustomFieldList
17
+
18
+ record_refs :account, :ap_acct, :currency, :custom_form, :department, :entity, :klass, :location, :posting_period,
19
+ :subsidiary, :void_journal
20
+
21
+ attr_reader :internal_id
22
+ attr_accessor :external_id
23
+
24
+ def initialize(attributes = {})
25
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
26
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
27
+ initialize_from_attributes_hash(attributes)
28
+ end
29
+
30
+ def to_record
31
+ rec = super
32
+ if rec["#{record_namespace}:customFieldList"]
33
+ rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
34
+ end
35
+ rec
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+
42
+
43
+
@@ -0,0 +1,16 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorPaymentApply
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Namespaces::TranPurch
7
+
8
+ fields :amount, :apply, :apply_date, :currency, :disc, :disc_amt, :disc_date, :doc,
9
+ :due, :line, :job, :ref_num, :total, :type
10
+
11
+ def initialize(attributes = {})
12
+ initialize_from_attributes_hash(attributes)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,32 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorPaymentApplyList
4
+ include Support::Fields
5
+ include Namespaces::TranPurch
6
+
7
+ fields :apply
8
+
9
+ def initialize(attributes = {})
10
+ initialize_from_attributes_hash(attributes)
11
+ end
12
+
13
+ def apply=(applies)
14
+ case applies
15
+ when Hash
16
+ @applies = [VendorPaymentApply.new(applies)]
17
+ when Array
18
+ @applies = applies.map { |apply| VendorPaymentApply.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
+
30
+ end
31
+ end
32
+ end
@@ -28,8 +28,6 @@ module NetSuite
28
28
  self.send(:include, NetSuite::Actions::GetSelectValue::Support)
29
29
  when :search
30
30
  self.send(:include, NetSuite::Actions::Search::Support)
31
- when :search_more_with_id
32
- self.send(:include, NetSuite::Actions::SearchMoreWithId::Support)
33
31
  when :add
34
32
  self.send(:include, NetSuite::Actions::Add::Support)
35
33
  when :upsert
@@ -38,6 +36,8 @@ module NetSuite
38
36
  self.send(:include, NetSuite::Actions::UpsertList::Support)
39
37
  when :delete
40
38
  self.send(:include, NetSuite::Actions::Delete::Support)
39
+ when :delete_list
40
+ self.send(:include, NetSuite::Actions::DeleteList::Support)
41
41
  when :update
42
42
  self.send(:include, NetSuite::Actions::Update::Support)
43
43
  when :initialize
@@ -40,11 +40,24 @@ module NetSuite
40
40
  rec
41
41
  end
42
42
 
43
+ def <<(item)
44
+ @list ||= []
45
+ @list << self.process_sublist_item(item)
46
+ end
47
+
43
48
  protected
44
49
  def process_sublist(list)
45
50
  list = [ list ] if !list.is_a?(Array)
46
51
 
47
52
  @list = list.map do |item|
53
+ self.process_sublist_item(item)
54
+ end
55
+ end
56
+
57
+ def process_sublist_item(item)
58
+ if item.class == self.sublist_class
59
+ item
60
+ else
48
61
  self.sublist_class.new(item)
49
62
  end
50
63
  end
@@ -1,3 +1,3 @@
1
1
  module Netsuite
2
- VERSION = '0.3.3'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ['ryan.moran@gmail.com', 'mike@cliffsidemedia.com']
7
7
  gem.description = %q{NetSuite SuiteTalk API Wrapper}
8
8
  gem.summary = %q{NetSuite SuiteTalk API (SOAP) Wrapper}
9
- gem.homepage = 'https://github.com/RevolutionPrep/netsuite'
9
+ gem.homepage = 'https://github.com/NetSweet/netsuite'
10
10
 
11
11
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
12
  gem.files = `git ls-files`.split("\n")