netsuite 0.4.9 → 0.5.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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2VmMmY0OGFlY2M1NmM2NDI5NTk5NDk3OGM4YzI1YWM2ZmQzNDIzNQ==
4
+ ZDZiODM3YmMxMWE2MTc1YWEyOWMxY2I5MzM5MDUzZTAyNjllZTJjZg==
5
5
  data.tar.gz: !binary |-
6
- OGJhM2M0ZGZhNzAyNmYzYTdmYTI5OTc0ZjkyZjk2NGUwYjQ5MzMyMQ==
6
+ YTZlYzc5MGU2Y2RkMDg4ZmE4ZTJjMjM0ZTRiNmVhZGVmMjUyN2IyNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDZjNjE0N2JmNmNiZTI1Nzc4NjNlZmI1YmU0OTljMzIzM2VhYTIwMWQxODI5
10
- NTJiM2JlYjJmMWVmYmJhMDdjOWZhNTdkNDc1ODJhYjAxMmYxNTIyMTI4NmY4
11
- NGE0OThmYjhlYzNlODdlNjYwZDk1YzZlOWFlNTVjMjdjNzM1N2U=
9
+ NTdkZWVkZDJhMjg0ZmRlNDdjMjk3NmU1NTM0NWM1ZDk5M2I0NjA5ZDE2ZmJk
10
+ MWZhNmM4MmJjYTRjOWUyMzVmZDQzNGE0ZDMzZTMxNjg1NzczMjE3ZWQ3OGIy
11
+ Y2Y2YjkwMWI5ODk4ZGJiN2Q0N2YyNGYzNGZlOTk4YzcxZDFiZTE=
12
12
  data.tar.gz: !binary |-
13
- ODNhNDBhMGUwZDFiYmFiNWQzYzdlN2M3ZjRiNTQyZDRmMzRmN2UwZmQ2NmYx
14
- MDg2M2U0YTJiNmZjNGJhMDkxZDFjMTkxMWU3Y2U1ODM3MGIxOWU1NGRmYWNj
15
- YWQ3MDE0ZDI5NDJmMmJmNDRjMzdjNDA3NzNhMWM0NDk2Y2I2NmY=
13
+ N2YzZTUzMWRlYjRjNTlkMDZhMTg5NWVjYmE4NTQ2MDNjNDdmZWRmNmYwYjli
14
+ ZGFmNzJhNzQ3NGQ5YzcyNWIyMGUyZWFiMmZkZTg0YmJmNWRiNmMwYmUzMDc5
15
+ MmUyMGNmYmM1NDlmYjE0ODkzYTRhZWI5NWQyOGI1MDQxZmY4ZWU=
data/README.md CHANGED
@@ -114,6 +114,12 @@ NetSuite::Records::BaseRefList.get_select_value(
114
114
  }
115
115
  )
116
116
 
117
+ # using get_select_value with a standard record
118
+ NetSuite::Records::BaseRefList.get_select_value(
119
+ recordType: 'serviceSaleItem',
120
+ field: 'taxSchedule'
121
+ )
122
+
117
123
  # updating a custom field list
118
124
  # you need to push ALL the values of ALL of the custom fields that you want set on the record
119
125
  # you can't just push the values of the fields that you want to update: all of the values of
@@ -1,35 +1,15 @@
1
1
  module NetSuite
2
2
  module Records
3
- class DepositPaymentList
4
- include Support::Fields
3
+ class DepositPaymentList < Support::Sublist
5
4
  include Namespaces::TranBank
6
5
 
7
- attr_accessor :replace_all
8
-
9
- fields :deposit_payment
10
-
11
- def initialize(attributes = {})
12
- initialize_from_attributes_hash(attributes)
13
- end
14
-
15
- def payment=(payments)
16
- case payments
17
- when Hash
18
- self.payments << DepositPayment.new(payments)
19
- when Array
20
- payments.each { |p| self.payments << DepositPayment.new(p) }
21
- end
22
- end
6
+ sublist :deposit_payment, DepositPayment
23
7
 
8
+ # legacy support
24
9
  def payments
25
- @payments ||= []
10
+ self.deposit_payment
26
11
  end
27
12
 
28
- def to_record
29
- rec = { "#{record_namespace}:depositPayment" => payments.map(&:to_record) }
30
- rec[:@replaceAll] = @replace_all unless @replace_all.nil?
31
- rec
32
- end
33
13
  end
34
14
  end
35
15
  end
@@ -29,7 +29,7 @@ module NetSuite
29
29
 
30
30
  record_refs :account, :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item, :entity, :gift_cert,
31
31
  :handling_tax_code, :job, :klass, :lead_source, :location, :message_sel, :opportunity, :partner, :posting_period, :promo_code,
32
- :sales_group, :sales_rep, :ship_method, :shipping_tax_code, :subsidiary, :terms, :tax_item, :payment_method, :bill_address_list
32
+ :sales_group, :sales_rep, :ship_method, :shipping_tax_code, :subsidiary, :terms, :tax_item, :payment_method, :ship_address_list
33
33
 
34
34
  attr_reader :internal_id
35
35
  attr_accessor :external_id
@@ -16,7 +16,7 @@ module NetSuite
16
16
  elsif v.respond_to?(:to_record)
17
17
  v = v.to_record
18
18
  end
19
-
19
+
20
20
  hash[kname] = v
21
21
  hash
22
22
  end
@@ -40,7 +40,7 @@ module NetSuite
40
40
  hash[:attributes!][kname] ||= {}
41
41
  hash[:attributes!][kname]['type'] = v.type.lower_camelcase
42
42
  end
43
-
43
+
44
44
  if v.kind_of?(NetSuite::Records::CustomRecordRef) && v.type_id
45
45
  hash[:attributes!] ||= {}
46
46
  hash[:attributes!][kname] ||= {}
@@ -52,6 +52,16 @@ module NetSuite
52
52
  "#{record_namespace}:#{self.class.to_s.split('::').last}"
53
53
  end
54
54
 
55
+ def refresh(credentials = {})
56
+ fresh_record = self.class.get(self.internal_id, credentials)
57
+
58
+ self.attributes = fresh_record.send(:attributes)
59
+ self.external_id = fresh_record.external_id
60
+ self.errors = nil
61
+
62
+ self
63
+ end
64
+
55
65
  end
56
66
  end
57
67
  end
@@ -1,3 +1,3 @@
1
1
  module Netsuite
2
- VERSION = '0.4.9'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ['lib']
16
16
  gem.version = Netsuite::VERSION
17
17
 
18
- gem.add_dependency 'savon', '~> 2.3.0'
18
+ gem.add_dependency 'savon', '>= 2.3.0'
19
19
 
20
20
  gem.add_development_dependency 'rspec', '~> 3.1.0'
21
21
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'NetSuite::Records::*#refresh' do
4
+ it 'should refresh a netsuite object in place' do
5
+ shutter_fly_record = NetSuite::Records::Customer.new({ :internal_id => 123, :external_id => 'extid', :entity_id => 'Shutter Fly', :company_name => 'Shutter Fly, Inc.' })
6
+ shutter_fly_record.errors = ['error 1', 'error 2']
7
+
8
+ current_record = shutter_fly_record
9
+
10
+ allow(NetSuite::Records::Customer).to receive(:get).and_return(shutter_fly_record)
11
+
12
+ customer = NetSuite::Records::Customer.get({:internal_id => 123})
13
+
14
+ expect(customer.errors.size).to eq(2)
15
+ expect(customer.entity_id).to eq('Shutter Fly')
16
+ expect(customer.company_name).to eq('Shutter Fly, Inc.')
17
+ expect(customer.external_id).to eq('extid')
18
+ expect(customer.internal_id).to eq(123)
19
+
20
+ allow(NetSuite::Records::Customer).to receive(:get).and_return(NetSuite::Records::Customer.new({ :external_id => 'newextid', :entity_id => 'Totally New', :account_number => '1234' }))
21
+ customer.refresh
22
+
23
+ expect(customer.errors).to be_nil
24
+ expect(customer.entity_id).to_not eq('Shutter Fly')
25
+ expect(customer.account_number).to eq('1234')
26
+ expect(customer.company_name).to be_nil
27
+ expect(customer.external_id).to eq('newextid')
28
+ expect(customer.internal_id).to eq(123)
29
+ end
30
+ end
@@ -11,7 +11,8 @@ describe 'basic records' do
11
11
  NetSuite::Records::Invoice,
12
12
  NetSuite::Records::PayrollItem,
13
13
  NetSuite::Records::Opportunity,
14
- NetSuite::Records::VendorCategory
14
+ NetSuite::Records::VendorCategory,
15
+ NetSuite::Records::Deposit,
15
16
  ]
16
17
  }
17
18
 
@@ -30,7 +30,7 @@ describe NetSuite::Records::Deposit do
30
30
  type: 'CashSale'
31
31
  }
32
32
  }
33
- deposit.payment_list.payment = attributes
33
+ deposit.payment_list.deposit_payment = attributes
34
34
  expect(deposit.payment_list).to be_kind_of(NetSuite::Records::DepositPaymentList)
35
35
  expect(deposit.payment_list.payments.length).to eql(1)
36
36
  end
@@ -48,7 +48,7 @@ describe NetSuite::Records::Deposit do
48
48
  amount: 100,
49
49
  memo: "test"
50
50
  }
51
-
51
+
52
52
  deposit.cash_back_list.deposit_cash_back = attributes
53
53
  expect(deposit.cash_back_list).to be_kind_of(NetSuite::Records::DepositCashBackList)
54
54
  expect(deposit.cash_back_list.deposit_cash_back.length).to eql(1)
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.4.9
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Moran
@@ -9,20 +9,20 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-13 00:00:00.000000000 Z
12
+ date: 2015-10-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - ! '>='
19
19
  - !ruby/object:Gem::Version
20
20
  version: 2.3.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - ! '>='
26
26
  - !ruby/object:Gem::Version
27
27
  version: 2.3.0
28
28
  - !ruby/object:Gem::Dependency
@@ -247,6 +247,7 @@ files:
247
247
  - spec/netsuite/actions/get_spec.rb
248
248
  - spec/netsuite/actions/initialize_spec.rb
249
249
  - spec/netsuite/actions/login_spec.rb
250
+ - spec/netsuite/actions/refresh_spec.rb
250
251
  - spec/netsuite/actions/search_spec.rb
251
252
  - spec/netsuite/actions/update_spec.rb
252
253
  - spec/netsuite/actions/upsert_list_spec.rb
@@ -416,6 +417,7 @@ test_files:
416
417
  - spec/netsuite/actions/get_spec.rb
417
418
  - spec/netsuite/actions/initialize_spec.rb
418
419
  - spec/netsuite/actions/login_spec.rb
420
+ - spec/netsuite/actions/refresh_spec.rb
419
421
  - spec/netsuite/actions/search_spec.rb
420
422
  - spec/netsuite/actions/update_spec.rb
421
423
  - spec/netsuite/actions/upsert_list_spec.rb