netsuite 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,6 +40,10 @@ module NetSuite
40
40
  autoload :BillAddress, 'netsuite/records/bill_address'
41
41
  autoload :Classification, 'netsuite/records/classification'
42
42
  autoload :CreditMemo, 'netsuite/records/credit_memo'
43
+ autoload :CreditMemoApply, 'netsuite/records/credit_memo_apply'
44
+ autoload :CreditMemoApplyList, 'netsuite/records/credit_memo_apply_list'
45
+ autoload :CreditMemoItem, 'netsuite/records/credit_memo_item'
46
+ autoload :CreditMemoItemList, 'netsuite/records/credit_memo_item_list'
43
47
  autoload :CustomField, 'netsuite/records/custom_field'
44
48
  autoload :CustomFieldList, 'netsuite/records/custom_field_list'
45
49
  autoload :CustomRecord, 'netsuite/records/custom_record'
@@ -19,6 +19,9 @@ module NetSuite
19
19
  :to_be_printed, :total_cost_estimate, :tran_date, :tran_id, :tran_is_vsoe_bundle, :vat_reg_num,
20
20
  :vsoe_auto_calc
21
21
 
22
+ field :item_list, CreditMemoItemList
23
+ field :apply_list, CreditMemoApplyList
24
+
22
25
  read_only_fields :applied, :discount_total, :sub_total, :tax_total, :total, :unapplied
23
26
 
24
27
  record_refs :account, :bill_address_list, :created_from, :custom_form, :department, :discount_item, :entity, :gift_cert,
@@ -0,0 +1,16 @@
1
+ module NetSuite
2
+ module Records
3
+ class CreditMemoApply
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Namespaces::TranCust
7
+
8
+ fields :amount, :apply, :apply_date, :currency, :doc, :due, :job, :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 CreditMemoApplyList
4
+ include Namespaces::TranCust
5
+
6
+ def initialize(attributes = {})
7
+ case attributes[:apply]
8
+ when Hash
9
+ applies << CreditMemoApply.new(attributes[:apply])
10
+ when Array
11
+ attributes[:apply].each { |apply| applies << CreditMemoApply.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,23 @@
1
+ module NetSuite
2
+ module Records
3
+ class CreditMemoItem
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::TranCust
8
+
9
+ fields :amount, :bin_numbers, :cost_estimate, :cost_estimate_type, :defer_rev_rec, :description, :gift_cert_from,
10
+ :gift_cert_message, :gift_cert_number, :gift_cert_recipient_email, :gift_cert_recipient_name, :gross_amt, :is_taxable,
11
+ :line, :order_line, :quantity, :rate, :rev_rec_end_date, :rev_rec_start_date, :rev_rec_term_in_months, :serial_numbers,
12
+ :tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral, :vsoe_delivered,
13
+ :vsoe_permit_discount, :vsoe_price
14
+
15
+ record_refs :department, :item, :job, :klass, :location, :price, :rev_rec_schedule, :tax_code, :units
16
+
17
+ def initialize(attributes = {})
18
+ initialize_from_attributes_hash(attributes)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ module NetSuite
2
+ module Records
3
+ class CreditMemoItemList
4
+ include Namespaces::TranCust
5
+
6
+ def initialize(attributes = {})
7
+ case attributes[:item]
8
+ when Hash
9
+ items << CreditMemoItem.new(attributes[:item])
10
+ when Array
11
+ attributes[:item].each { |item| items << CreditMemoItem.new(item) }
12
+ end
13
+ end
14
+
15
+ def items
16
+ @items ||= []
17
+ end
18
+
19
+ def to_record
20
+ items.map do |item|
21
+ { "#{record_namespace}:item" => item.to_record }
22
+ end
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -1,3 +1,3 @@
1
1
  module Netsuite
2
- VERSION = '0.0.25'
2
+ VERSION = '0.0.26'
3
3
  end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CreditMemoApplyList do
4
+ let(:list) { NetSuite::Records::CreditMemoApplyList.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::CreditMemoApply.new(
13
+ :job => 'something'
14
+ )
15
+ end
16
+
17
+ it 'can represent itself as a SOAP record' do
18
+ record = [
19
+ {
20
+ 'tranCust:apply' => {
21
+ 'tranCust:job' => 'something'
22
+ }
23
+ }
24
+ ]
25
+ list.to_record.should eql(record)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CreditMemoApply do
4
+ let(:apply) { NetSuite::Records::CreditMemoApply.new }
5
+
6
+ it 'has all the right fields' do
7
+ [
8
+ :amount, :apply, :apply_date, :currency, :doc, :due, :job, :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,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CreditMemoItemList do
4
+ let(:list) { NetSuite::Records::CreditMemoItemList.new }
5
+
6
+ it 'has a items attribute' do
7
+ list.items.should be_kind_of(Array)
8
+ end
9
+
10
+ describe '#to_record' do
11
+ before do
12
+ list.items << NetSuite::Records::CreditMemoItem.new(
13
+ :rate => 10
14
+ )
15
+ end
16
+
17
+ it 'can represent itself as a SOAP record' do
18
+ record = [
19
+ {
20
+ 'tranCust:item' => {
21
+ 'tranCust:rate' => 10
22
+ }
23
+ }
24
+ ]
25
+ list.to_record.should eql(record)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CreditMemoItem do
4
+ let(:item) { NetSuite::Records::CreditMemoItem.new }
5
+
6
+ # <element name="options" type="platformCore:CustomFieldList" minOccurs="0"/>
7
+ # <element name="inventoryDetail" type="platformCommon:InventoryDetail" minOccurs="0"/>
8
+ # <element name="customFieldList" type="platformCore:CustomFieldList" minOccurs="0"/>
9
+
10
+ it 'has all the right fields' do
11
+ [
12
+ :amount, :bin_numbers, :cost_estimate, :cost_estimate_type, :defer_rev_rec, :description, :gift_cert_from,
13
+ :gift_cert_message, :gift_cert_number, :gift_cert_recipient_email, :gift_cert_recipient_name, :gross_amt, :is_taxable,
14
+ :line, :order_line, :quantity, :rate, :rev_rec_end_date, :rev_rec_start_date, :rev_rec_term_in_months, :serial_numbers,
15
+ :tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount,
16
+ :vsoe_price
17
+ ].each do |field|
18
+ item.should have_field(field)
19
+ end
20
+ end
21
+
22
+ it 'has all the right record refs' do
23
+ [
24
+ :department, :item, :job, :klass, :location, :price, :rev_rec_schedule, :tax_code, :units
25
+ ].each do |record_ref|
26
+ item.should have_record_ref(record_ref)
27
+ end
28
+ end
29
+
30
+ end
@@ -28,12 +28,48 @@ describe NetSuite::Records::CreditMemo do
28
28
  end
29
29
  end
30
30
 
31
+ describe '#item_list' do
32
+ it 'can be set from attributes' do
33
+ attributes = {
34
+ :item => {
35
+ :amount => 10
36
+ }
37
+ }
38
+ memo.item_list = attributes
39
+ memo.item_list.should be_kind_of(NetSuite::Records::CreditMemoItemList)
40
+ memo.item_list.items.length.should eql(1)
41
+ end
42
+
43
+ it 'can be set from a CreditMemoItemList object' do
44
+ item_list = NetSuite::Records::CreditMemoItemList.new
45
+ memo.item_list = item_list
46
+ memo.item_list.should eql(item_list)
47
+ end
48
+ end
49
+
50
+ describe '#apply_list' do
51
+ it 'can be set from attributes' do
52
+ attributes = {
53
+ :apply => {
54
+ :job => 'something'
55
+ }
56
+ }
57
+ memo.apply_list = attributes
58
+ memo.apply_list.should be_kind_of(NetSuite::Records::CreditMemoApplyList)
59
+ memo.apply_list.applies.length.should eql(1)
60
+ end
61
+
62
+ it 'can be set from a CreditMemoApplyList object' do
63
+ apply_list = NetSuite::Records::CreditMemoApplyList.new
64
+ memo.apply_list = apply_list
65
+ memo.apply_list.should eql(apply_list)
66
+ end
67
+ end
68
+
31
69
  # <element name="transactionBillAddress" type="platformCommon:BillAddress" minOccurs="0"/>
32
70
  # <element name="revenueStatus" type="platformCommonTyp:RevenueStatus" minOccurs="0"/>
33
71
  # <element name="salesTeamList" type="tranCust:CreditMemoSalesTeamList" minOccurs="0"/>
34
- # <element name="itemList" type="tranCust:CreditMemoItemList" minOccurs="0"/>
35
72
  # <element name="partnersList" type="tranCust:CreditMemoPartnersList" minOccurs="0"/>
36
- # <element name="applyList" type="tranCust:CreditMemoApplyList" minOccurs="0"/>
37
73
  # <element name="customFieldList" type="platformCore:CustomFieldList" minOccurs="0"/>
38
74
 
39
75
  describe '.get' do
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: 45
4
+ hash: 43
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 25
10
- version: 0.0.25
9
+ - 26
10
+ version: 0.0.26
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Moran
@@ -132,6 +132,10 @@ files:
132
132
  - lib/netsuite/records/bill_address.rb
133
133
  - lib/netsuite/records/classification.rb
134
134
  - lib/netsuite/records/credit_memo.rb
135
+ - lib/netsuite/records/credit_memo_apply.rb
136
+ - lib/netsuite/records/credit_memo_apply_list.rb
137
+ - lib/netsuite/records/credit_memo_item.rb
138
+ - lib/netsuite/records/credit_memo_item_list.rb
135
139
  - lib/netsuite/records/custom_field.rb
136
140
  - lib/netsuite/records/custom_field_list.rb
137
141
  - lib/netsuite/records/custom_record.rb
@@ -178,6 +182,10 @@ files:
178
182
  - spec/netsuite/records/account_spec.rb
179
183
  - spec/netsuite/records/bill_address_spec.rb
180
184
  - spec/netsuite/records/classification_spec.rb
185
+ - spec/netsuite/records/credit_memo_apply_list_spec.rb
186
+ - spec/netsuite/records/credit_memo_apply_spec.rb
187
+ - spec/netsuite/records/credit_memo_item_list_spec.rb
188
+ - spec/netsuite/records/credit_memo_item_spec.rb
181
189
  - spec/netsuite/records/credit_memo_spec.rb
182
190
  - spec/netsuite/records/custom_field_list_spec.rb
183
191
  - spec/netsuite/records/custom_field_spec.rb
@@ -271,6 +279,10 @@ test_files:
271
279
  - spec/netsuite/records/account_spec.rb
272
280
  - spec/netsuite/records/bill_address_spec.rb
273
281
  - spec/netsuite/records/classification_spec.rb
282
+ - spec/netsuite/records/credit_memo_apply_list_spec.rb
283
+ - spec/netsuite/records/credit_memo_apply_spec.rb
284
+ - spec/netsuite/records/credit_memo_item_list_spec.rb
285
+ - spec/netsuite/records/credit_memo_item_spec.rb
274
286
  - spec/netsuite/records/credit_memo_spec.rb
275
287
  - spec/netsuite/records/custom_field_list_spec.rb
276
288
  - spec/netsuite/records/custom_field_spec.rb