netsuite 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDZiODM3YmMxMWE2MTc1YWEyOWMxY2I5MzM5MDUzZTAyNjllZTJjZg==
4
+ NDI2Mzg2OGE2MDk3ZDc1ZTAyNzI4ODRkZmNiYzY2ZGRmNTk3YTk1OA==
5
5
  data.tar.gz: !binary |-
6
- YTZlYzc5MGU2Y2RkMDg4ZmE4ZTJjMjM0ZTRiNmVhZGVmMjUyN2IyNw==
6
+ NTA4Y2I5ZDE2Y2EwZTBkODE4MWEyYTU4MjRjMzViNjgwZjY5ZGUwNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTdkZWVkZDJhMjg0ZmRlNDdjMjk3NmU1NTM0NWM1ZDk5M2I0NjA5ZDE2ZmJk
10
- MWZhNmM4MmJjYTRjOWUyMzVmZDQzNGE0ZDMzZTMxNjg1NzczMjE3ZWQ3OGIy
11
- Y2Y2YjkwMWI5ODk4ZGJiN2Q0N2YyNGYzNGZlOTk4YzcxZDFiZTE=
9
+ ODY4MjZhYWFjMDVlNjA1ZjI2MmUzODkxNTllZDYyYmQxYzQ1OTM0ZWZjYTBj
10
+ NWQwY2UwZTA4NWU5MzE2N2IzZWUwYTM3MDRlMDhiNDRmYmRmNThmOWYwNDI0
11
+ MmJmN2Q3N2FlNTMxMWQwZmYzNDEzOTY4NmQ0YTk0MmM1ZGZjY2M=
12
12
  data.tar.gz: !binary |-
13
- N2YzZTUzMWRlYjRjNTlkMDZhMTg5NWVjYmE4NTQ2MDNjNDdmZWRmNmYwYjli
14
- ZGFmNzJhNzQ3NGQ5YzcyNWIyMGUyZWFiMmZkZTg0YmJmNWRiNmMwYmUzMDc5
15
- MmUyMGNmYmM1NDlmYjE0ODkzYTRhZWI5NWQyOGI1MDQxZmY4ZWU=
13
+ OWM1YTkzZmUzZTUxYTZkZDZhZmFlZDIxODQyYWViNGE0YjJhYTlhMWFiNmQw
14
+ YzRmYTk4Njc0YjAwZTM1YjM2MzdiNzIxODViM2U1ZDJjMDM0YmYwZjBmZWZh
15
+ ZTJlOGE0NGRhMWE0MDkxYmM0NDM4YTRjOGViMmNmMzc2MzE5N2I=
data/lib/netsuite.rb CHANGED
@@ -64,6 +64,7 @@ module NetSuite
64
64
  autoload :AssemblyItem, 'netsuite/records/assembly_item'
65
65
  autoload :Account, 'netsuite/records/account'
66
66
  autoload :AccountingPeriod, 'netsuite/records/accounting_period'
67
+ autoload :Address, 'netsuite/records/address'
67
68
  autoload :BaseRefList, 'netsuite/records/base_ref_list'
68
69
  autoload :BillAddress, 'netsuite/records/bill_address'
69
70
  autoload :BillingSchedule, 'netsuite/records/billing_schedule'
@@ -0,0 +1,45 @@
1
+ module NetSuite
2
+ module Records
3
+ class Address
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Namespaces::PlatformCommon
7
+
8
+ # internalId is a bit strange on this record
9
+ # https://github.com/NetSweet/netsuite/wiki/Miscellaneous-Web-Services-Quirks#customer
10
+
11
+ fields :addr1, :addr2, :addressee, :addr_phone, :attention, :city, :custom_field_list, :internal_id, :override, :state, :zip
12
+
13
+ field :country, NetSuite::Support::Country
14
+
15
+ read_only_fields :addr_text
16
+
17
+ def initialize(attributes_or_record = {})
18
+ case attributes_or_record
19
+ when self.class
20
+ initialize_from_record(attributes_or_record)
21
+ when Hash
22
+ attributes_or_record = attributes_or_record[:address] if attributes_or_record[:address]
23
+ initialize_from_attributes_hash(attributes_or_record)
24
+ end
25
+ end
26
+
27
+ def initialize_from_record(obj)
28
+ self.addr1 = obj.addr1
29
+ self.addr2 = obj.addr2
30
+ self.addressee = obj.addressee
31
+ self.addr_phone = obj.addr_phone
32
+ self.addr_text = obj.addr_text
33
+ self.attention = obj.attention
34
+ self.city = obj.city
35
+ self.country = obj.country
36
+ self.custom_field_list = obj.custom_field_list
37
+ self.internal_id = obj.internal_id
38
+ self.override = obj.override
39
+ self.state = obj.state
40
+ self.zip = obj.zip
41
+ end
42
+
43
+ end
44
+ end
45
+ end
@@ -5,16 +5,21 @@ module NetSuite
5
5
  include Support::Records
6
6
  include Namespaces::ListRel
7
7
 
8
- # internalId is a bit strange on this record
9
- # https://github.com/NetSweet/netsuite/wiki/Miscellaneous-Web-Services-Quirks#customer
8
+ # address implementation changed
9
+ # https://github.com/NetSweet/netsuite/pull/213
10
10
 
11
- fields :default_shipping, :default_billing, :is_residential, :label, :attention, :addressee,
12
- :phone, :addr1, :addr2, :addr3, :city, :zip, :override, :state, :internal_id
11
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2015_1/schema/other/customeraddressbook.html?mode=package
13
12
 
14
- field :country, NetSuite::Support::Country
13
+ fields :default_shipping, :default_billing, :is_residential, :label, :internal_id
15
14
 
15
+ # NOTE API < 2014_2
16
+ fields :attention, :addressee, :phone, :addr1, :addr2, :addr3, :city, :zip, :override, :state
17
+ field :country, NetSuite::Support::Country
16
18
  read_only_fields :addr_text
17
19
 
20
+ # NOTE API >= 2014_2
21
+ field :addressbook_address, NetSuite::Records::Address
22
+
18
23
  def initialize(attributes_or_record = {})
19
24
  case attributes_or_record
20
25
  when self.class
@@ -26,23 +31,32 @@ module NetSuite
26
31
  end
27
32
 
28
33
  def initialize_from_record(obj)
29
- self.default_shipping = obj.default_shipping
30
- self.default_billing = obj.default_billing
31
- self.is_residential = obj.is_residential
32
- self.label = obj.label
33
- self.attention = obj.attention
34
- self.addressee = obj.addressee
35
- self.phone = obj.phone
36
- self.addr1 = obj.addr1
37
- self.addr2 = obj.addr2
38
- self.addr3 = obj.addr3
39
- self.city = obj.city
40
- self.zip = obj.zip
41
- self.country = obj.country
42
- self.addr_text = obj.addr_text
43
- self.override = obj.override
44
- self.state = obj.state
45
- self.internal_id = obj.internal_id
34
+ if NetSuite::Configuration.api_version < "2014_2"
35
+ self.default_shipping = obj.default_shipping
36
+ self.default_billing = obj.default_billing
37
+ self.is_residential = obj.is_residential
38
+ self.label = obj.label
39
+ self.attention = obj.attention
40
+ self.addressee = obj.addressee
41
+ self.phone = obj.phone
42
+ self.addr1 = obj.addr1
43
+ self.addr2 = obj.addr2
44
+ self.addr3 = obj.addr3
45
+ self.city = obj.city
46
+ self.zip = obj.zip
47
+ self.country = obj.country
48
+ self.addr_text = obj.addr_text
49
+ self.override = obj.override
50
+ self.state = obj.state
51
+ self.internal_id = obj.internal_id
52
+ else
53
+ self.addressbook_address = obj.addressbook_address
54
+ self.default_billing = obj.default_billing
55
+ self.default_shipping = obj.default_shipping
56
+ self.internal_id = obj.internal_id
57
+ self.is_residential = obj.is_residential
58
+ self.label = obj.label
59
+ end
46
60
  end
47
61
 
48
62
  end
@@ -1,37 +1,9 @@
1
1
  module NetSuite
2
2
  module Records
3
- class CustomerAddressbookList
3
+ class CustomerAddressbookList < Support::Sublist
4
4
  include Namespaces::ListRel
5
5
 
6
- def initialize(attributes = {})
7
- case attributes[:addressbook]
8
- when Hash
9
- addressbooks << CustomerAddressbook.new(attributes[:addressbook])
10
- when Array
11
- attributes[:addressbook].each { |addressbook| addressbooks << CustomerAddressbook.new(addressbook) }
12
- end
13
-
14
- @replace_all = true
15
- end
16
-
17
- def addressbooks
18
- @addressbooks ||= []
19
- end
20
-
21
- def replace_all
22
- @replace_all
23
- end
24
-
25
- def replace_all= new_replace_all
26
- @replace_all = !!new_replace_all
27
- end
28
-
29
- def to_record
30
- { "#{record_namespace}:addressbook" => addressbooks.map(&:to_record),
31
- "#{record_namespace}:replaceAll" => @replace_all
32
- }
33
- end
34
-
6
+ sublist :addressbook, CustomerAddressbook
35
7
  end
36
8
  end
37
9
  end
@@ -10,11 +10,22 @@ module NetSuite
10
10
  actions :add, :delete, :get, :get_list, :get_select_value, :search,
11
11
  :update, :upsert
12
12
 
13
- fields :addr1, :addr2, :addr3, :addr_phone, :addr_text, :addressee, :attention, :city, :country, :include_children,
14
- :is_inactive, :make_inventory_available, :make_inventory_available_store, :name, :override, :state, :tran_prefix, :zip
13
+ fields :include_children, :is_inactive
14
+
15
+ field :custom_field_list, CustomFieldList
16
+ # field :class_translation_list
17
+ field :subsidiary_list, RecordRefList
15
18
 
16
19
  record_refs :logo, :parent
17
20
 
21
+ # API >= 2014_2
22
+ field :main_address, Address
23
+ field :return_address, Address
24
+
25
+ # API < 2014_2
26
+ fields :addr1, :addr2, :addr3, :addr_phone, :addr_text, :addressee, :attention, :city, :country,
27
+ :make_inventory_available, :make_inventory_available_store, :name, :override, :state, :tran_prefix, :zip
28
+
18
29
  attr_reader :internal_id
19
30
  attr_accessor :external_id
20
31
 
@@ -20,8 +20,14 @@ module NetSuite
20
20
  :linked_tracking_numbers, :vsoe_auto_calc, :quantity, :bill_city, :bill_state, :ship_city, :ship_state, :cost_estimate,
21
21
  :amount, :is_ship_address
22
22
 
23
+ # NOTE API >= 2014_2 only
24
+ field :shipping_address, Address
25
+ field :billing_address, Address
26
+
27
+ # NOTE transaction address fields only applicable for API < 2014_2
23
28
  field :transaction_ship_address, ShipAddress
24
29
  field :transaction_bill_address, BillAddress
30
+
25
31
  field :item_list, SalesOrderItemList
26
32
  field :custom_field_list, CustomFieldList
27
33
 
@@ -34,7 +34,7 @@ module NetSuite
34
34
  rec = { "#{record_namespace}:#{sublist_key.to_s.lower_camelcase}" => send(self.sublist_key).map(&:to_record) }
35
35
 
36
36
  if !replace_all.nil?
37
- rec["#{record_namespace}:replaceAll"] = replace_all
37
+ rec["#{record_namespace}:replaceAll"] = !!replace_all
38
38
  end
39
39
 
40
40
  rec
@@ -1,3 +1,3 @@
1
1
  module Netsuite
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -0,0 +1,132 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::Address do
4
+ let(:attributes) do
5
+ {
6
+ :addr1 => '123 Happy Lane',
7
+ :addr2 => '#10-10 Big Building',
8
+ :addressee => 'Happy Pizza',
9
+ :addr_text => "123 Happy Lane\nLos Angeles CA 90007",
10
+ :addr_phone => '91828232',
11
+ :attention => 'Mr. Happy',
12
+ :city => 'Los Angeles',
13
+ :country => '_unitedStates',
14
+ :internal_id => '1232',
15
+ :override => false,
16
+ :state => 'CA',
17
+ :zip => '90007'
18
+ }
19
+ end
20
+ let(:list) { NetSuite::Records::Address.new(attributes) }
21
+
22
+ it 'has all the right fields' do
23
+ [
24
+ :addr1, :addr2, :addressee, :addr_phone, :attention, :city, :custom_field_list, :internal_id, :override, :state, :zip
25
+ ].each do |field|
26
+ expect(list).to have_field(field)
27
+ end
28
+ end
29
+
30
+ it 'has all the right read_only_fields' do
31
+ [
32
+ :addr_text
33
+ ].each do |field|
34
+ expect(NetSuite::Records::Address).to have_read_only_field(field)
35
+ end
36
+ end
37
+
38
+ describe '#initialize' do
39
+ context 'when taking in a hash of attributes' do
40
+ it 'sets the attributes for the object given the attributes hash' do
41
+ expect(list.addr1).to eql('123 Happy Lane')
42
+ expect(list.addr2).to eql('#10-10 Big Building')
43
+ expect(list.addressee).to eql('Happy Pizza')
44
+ expect(list.addr_text).to eql("123 Happy Lane\nLos Angeles CA 90007")
45
+ expect(list.addr_phone).to eql('91828232')
46
+ expect(list.attention).to eql('Mr. Happy')
47
+ expect(list.city).to eql('Los Angeles')
48
+ expect(list.country.to_record).to eql('_unitedStates')
49
+ expect(list.internal_id).to eql('1232')
50
+ expect(list.override).to be_falsey
51
+ expect(list.state).to eql('CA')
52
+ expect(list.zip).to eql('90007')
53
+ end
54
+ end
55
+
56
+ context 'when taking in a CustomerAddressbookList instance' do
57
+ it 'sets the attributes for the object given the record attributes' do
58
+ old_list = NetSuite::Records::Address.new(attributes)
59
+ list = NetSuite::Records::Address.new(old_list)
60
+ expect(list.addr1).to eql('123 Happy Lane')
61
+ expect(list.addr2).to eql('#10-10 Big Building')
62
+ expect(list.addressee).to eql('Happy Pizza')
63
+ expect(list.addr_text).to eql("123 Happy Lane\nLos Angeles CA 90007")
64
+ expect(list.addr_phone).to eql('91828232')
65
+ expect(list.attention).to eql('Mr. Happy')
66
+ expect(list.city).to eql('Los Angeles')
67
+ expect(list.country.to_record).to eql('_unitedStates')
68
+ expect(list.internal_id).to eql('1232')
69
+ expect(list.override).to be_falsey
70
+ expect(list.state).to eql('CA')
71
+ expect(list.zip).to eql('90007')
72
+ end
73
+ end
74
+ end
75
+
76
+ describe '#to_record' do
77
+ it 'can represent itself as a SOAP record' do
78
+ record = {
79
+ 'platformCommon:addr1' => '123 Happy Lane',
80
+ 'platformCommon:addr2' => '#10-10 Big Building',
81
+ 'platformCommon:addressee' => 'Happy Pizza',
82
+ 'platformCommon:addrPhone' => '91828232',
83
+ 'platformCommon:attention' => 'Mr. Happy',
84
+ 'platformCommon:city' => 'Los Angeles',
85
+ 'platformCommon:country' => '_unitedStates',
86
+ 'platformCommon:internalId' => '1232',
87
+ 'platformCommon:override' => false,
88
+ 'platformCommon:state' => 'CA',
89
+ 'platformCommon:zip' => '90007'
90
+ }
91
+ expect(list.to_record).to eql(record)
92
+ end
93
+ end
94
+
95
+ describe '#record_type' do
96
+ it 'returns a string of the record SOAP type' do
97
+ expect(list.record_type).to eql('platformCommon:Address')
98
+ end
99
+ end
100
+
101
+ describe "#country" do
102
+ context "when it's specified as a 2 character ISO code" do
103
+ it "is converted to the appropriate NetSuite enum value" do
104
+ addressbook = NetSuite::Records::Address.new country: "US"
105
+ expect(addressbook.to_record["platformCommon:country"]).to eql "_unitedStates"
106
+ end
107
+ end
108
+
109
+ context "when the country code is a YAML reserved word (NO)" do
110
+ it "is converted to the appropriate NetSuite enum value" do
111
+ addressbook = NetSuite::Records::Address.new country: "NO"
112
+ expect(addressbook.to_record["platformCommon:country"]).to eql "_norway"
113
+ end
114
+ end
115
+
116
+ it "can be specified as the NetSuite enum value" do
117
+ addressbook = NetSuite::Records::Address.new country: "_unitedStates"
118
+ expect(addressbook.to_record["platformCommon:country"]).to eql "_unitedStates"
119
+
120
+ # country with two uppercase letters (looks like ISO2)
121
+ addressbook = NetSuite::Records::Address.new country: "_unitedKingdomGB"
122
+ expect(addressbook.to_record["platformCommon:country"]).to eql "_unitedKingdomGB"
123
+ end
124
+
125
+ it "can be unspecified" do
126
+ addressbook = NetSuite::Records::Address.new country: ''
127
+ expect(addressbook.country.to_record).to eql ""
128
+ expect(addressbook.to_record["platformCommon:country"]).to eql ""
129
+ end
130
+ end
131
+
132
+ end
@@ -4,11 +4,13 @@ describe NetSuite::Records::CustomerAddressbookList do
4
4
  let(:list) { NetSuite::Records::CustomerAddressbookList.new }
5
5
 
6
6
  it 'has an addressbooks attribute' do
7
- expect(list.addressbooks).to be_kind_of(Array)
7
+ expect(list.addressbook).to be_kind_of(Array)
8
8
  end
9
9
 
10
10
  describe '#to_record' do
11
11
  it 'can represent itself as a SOAP record' do
12
+ list.replace_all = true
13
+
12
14
  record = {
13
15
  'listRel:addressbook' => [],
14
16
  'listRel:replaceAll' => true
@@ -18,10 +20,6 @@ describe NetSuite::Records::CustomerAddressbookList do
18
20
  end
19
21
 
20
22
  describe "#replace_all" do
21
- it "returns true by default" do
22
- expect(list.replace_all).to eql(true)
23
- end
24
-
25
23
  it "can be changed via accessor" do
26
24
  list.replace_all = false
27
25
 
@@ -30,7 +28,13 @@ describe NetSuite::Records::CustomerAddressbookList do
30
28
 
31
29
  it "coerces to a boolean" do
32
30
  list.replace_all = "goober"
33
- expect(list.replace_all).to eql(true)
31
+
32
+ record = {
33
+ 'listRel:addressbook' => [],
34
+ 'listRel:replaceAll' => true
35
+ }
36
+
37
+ expect(list.to_record).to eql(record)
34
38
  end
35
39
  end
36
40
 
@@ -1,57 +1,60 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe NetSuite::Records::CustomerAddressbook do
4
+ # address schema changed in 2014.2. We support < 2014.2 schema, but we don't test support
5
+
6
+ before do
7
+ NetSuite::Configuration.api_version = '2014_2'
8
+ end
9
+
4
10
  let(:attributes) do
5
11
  {
6
12
  :addressbook => {
7
- :addr1 => '123 Happy Lane',
8
- :addr_text => "123 Happy Lane\nLos Angeles CA 90007",
9
- :city => 'Los Angeles',
10
- :country => '_unitedStates',
13
+ :addressbook_address => NetSuite::Records::Address.new({
14
+ :addr1 => '123 Happy Lane',
15
+ :addr_text => "123 Happy Lane\nLos Angeles CA 90007",
16
+ :city => 'Los Angeles',
17
+ :country => '_unitedStates',
18
+ :state => 'CA',
19
+ :override => false,
20
+ :zip => '90007'
21
+ }),
11
22
  :default_billing => true,
12
23
  :default_shipping => true,
13
24
  :internal_id => '567',
14
25
  :is_residential => false,
15
- :label => '123 Happy Lane',
16
- :override => false,
17
- :state => 'CA',
18
- :zip => '90007'
26
+ :label => '123 Happy Lane'
19
27
  }
20
28
  }
21
29
  end
30
+
22
31
  let(:list) { NetSuite::Records::CustomerAddressbook.new(attributes) }
23
32
 
24
33
  it 'has all the right fields' do
25
34
  [
26
- :default_shipping, :default_billing, :is_residential, :label, :attention, :addressee,
27
- :phone, :addr1, :addr2, :addr3, :city, :zip, :addr_text, :override, :state
35
+ :default_billing, :default_shipping, :internal_id,
36
+ :is_residential, :label
28
37
  ].each do |field|
29
38
  expect(list).to have_field(field)
30
39
  end
31
- end
32
40
 
33
- it 'has all the right read_only_fields' do
34
- [
35
- :addr_text
36
- ].each do |field|
37
- expect(NetSuite::Records::CustomerAddressbook).to have_read_only_field(field)
38
- end
41
+ expect(list.addressbook_address).to_not be_nil
39
42
  end
40
43
 
41
44
  describe '#initialize' do
42
45
  context 'when taking in a hash of attributes' do
43
46
  it 'sets the attributes for the object given the attributes hash' do
44
- expect(list.addr1).to eql('123 Happy Lane')
45
- expect(list.addr_text).to eql("123 Happy Lane\nLos Angeles CA 90007")
46
- expect(list.city).to eql('Los Angeles')
47
- expect(list.country.to_record).to eql('_unitedStates')
47
+ expect(list.addressbook_address.addr1).to eql('123 Happy Lane')
48
+ expect(list.addressbook_address.addr_text).to eql("123 Happy Lane\nLos Angeles CA 90007")
49
+ expect(list.addressbook_address.city).to eql('Los Angeles')
50
+ expect(list.addressbook_address.country.to_record).to eql('_unitedStates')
51
+ expect(list.addressbook_address.override).to be_falsey
52
+ expect(list.addressbook_address.state).to eql('CA')
53
+ expect(list.addressbook_address.zip).to eql('90007')
48
54
  expect(list.default_billing).to be_truthy
49
55
  expect(list.default_shipping).to be_truthy
50
56
  expect(list.is_residential).to be_falsey
51
57
  expect(list.label).to eql('123 Happy Lane')
52
- expect(list.override).to be_falsey
53
- expect(list.state).to eql('CA')
54
- expect(list.zip).to eql('90007')
55
58
  expect(list.internal_id).to eql('567')
56
59
  end
57
60
  end
@@ -60,17 +63,17 @@ describe NetSuite::Records::CustomerAddressbook do
60
63
  it 'sets the attributes for the object given the record attributes' do
61
64
  old_list = NetSuite::Records::CustomerAddressbook.new(attributes)
62
65
  list = NetSuite::Records::CustomerAddressbook.new(old_list)
63
- expect(list.addr1).to eql('123 Happy Lane')
64
- expect(list.addr_text).to eql("123 Happy Lane\nLos Angeles CA 90007")
65
- expect(list.city).to eql('Los Angeles')
66
- expect(list.country.to_record).to eql('_unitedStates')
66
+ expect(list.addressbook_address.addr1).to eql('123 Happy Lane')
67
+ expect(list.addressbook_address.addr_text).to eql("123 Happy Lane\nLos Angeles CA 90007")
68
+ expect(list.addressbook_address.city).to eql('Los Angeles')
69
+ expect(list.addressbook_address.country.to_record).to eql('_unitedStates')
70
+ expect(list.addressbook_address.override).to be_falsey
71
+ expect(list.addressbook_address.state).to eql('CA')
72
+ expect(list.addressbook_address.zip).to eql('90007')
67
73
  expect(list.default_billing).to be_truthy
68
74
  expect(list.default_shipping).to be_truthy
69
75
  expect(list.is_residential).to be_falsey
70
76
  expect(list.label).to eql('123 Happy Lane')
71
- expect(list.override).to be_falsey
72
- expect(list.state).to eql('CA')
73
- expect(list.zip).to eql('90007')
74
77
  expect(list.internal_id).to eql('567')
75
78
  end
76
79
  end
@@ -79,53 +82,24 @@ describe NetSuite::Records::CustomerAddressbook do
79
82
  describe '#to_record' do
80
83
  it 'can represent itself as a SOAP record' do
81
84
  record = {
82
- 'listRel:addr1' => '123 Happy Lane',
83
- 'listRel:city' => 'Los Angeles',
84
- 'listRel:country' => '_unitedStates',
85
+ 'listRel:addressbookAddress' => {
86
+ 'platformCommon:addr1' => '123 Happy Lane',
87
+ 'platformCommon:city' => 'Los Angeles',
88
+ 'platformCommon:country' => '_unitedStates',
89
+ 'platformCommon:override' => false,
90
+ 'platformCommon:state' => 'CA',
91
+ 'platformCommon:zip' => '90007'
92
+ },
85
93
  'listRel:defaultBilling' => true,
86
94
  'listRel:defaultShipping' => true,
87
95
  'listRel:isResidential' => false,
88
96
  'listRel:label' => '123 Happy Lane',
89
- 'listRel:override' => false,
90
- 'listRel:state' => 'CA',
91
- 'listRel:zip' => '90007',
92
- "listRel:internalId" => "567"
97
+ 'listRel:internalId' => '567'
93
98
  }
94
99
  expect(list.to_record).to eql(record)
95
100
  end
96
101
  end
97
102
 
98
- describe "#country" do
99
- context "when it's specified as a 2 character ISO code" do
100
- it "is converted to the appropriate NetSuite enum value" do
101
- addressbook = NetSuite::Records::CustomerAddressbook.new country: "US"
102
- expect(addressbook.to_record["listRel:country"]).to eql "_unitedStates"
103
- end
104
- end
105
-
106
- context "when the country code is a YAML reserved word (NO)" do
107
- it "is converted to the appropriate NetSuite enum value" do
108
- addressbook = NetSuite::Records::CustomerAddressbook.new country: "NO"
109
- expect(addressbook.to_record["listRel:country"]).to eql "_norway"
110
- end
111
- end
112
-
113
- it "can be specified as the NetSuite enum value" do
114
- addressbook = NetSuite::Records::CustomerAddressbook.new country: "_unitedStates"
115
- expect(addressbook.to_record["listRel:country"]).to eql "_unitedStates"
116
-
117
- # country with two uppercase letters (looks like ISO2)
118
- addressbook = NetSuite::Records::CustomerAddressbook.new country: "_unitedKingdomGB"
119
- expect(addressbook.to_record["listRel:country"]).to eql "_unitedKingdomGB"
120
- end
121
-
122
- it "can be unspecified" do
123
- addressbook = NetSuite::Records::CustomerAddressbook.new country: ''
124
- expect(addressbook.country.to_record).to eql ""
125
- expect(addressbook.to_record["listRel:country"]).to eql ""
126
- end
127
- end
128
-
129
103
  describe '#record_type' do
130
104
  it 'returns a string of the record SOAP type' do
131
105
  expect(list.record_type).to eql('listRel:CustomerAddressbook')
@@ -55,7 +55,7 @@ describe NetSuite::Records::Customer do
55
55
  }
56
56
  }
57
57
  expect(customer.addressbook_list).to be_kind_of(NetSuite::Records::CustomerAddressbookList)
58
- expect(customer.addressbook_list.addressbooks.length).to eql(1)
58
+ expect(customer.addressbook_list.addressbook.length).to eql(1)
59
59
  end
60
60
 
61
61
  it 'can be set from a CustomerAddressbookList object' do
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.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Moran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-19 00:00:00.000000000 Z
12
+ date: 2015-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -91,6 +91,7 @@ files:
91
91
  - lib/netsuite/namespaces/tran_sales.rb
92
92
  - lib/netsuite/records/account.rb
93
93
  - lib/netsuite/records/accounting_period.rb
94
+ - lib/netsuite/records/address.rb
94
95
  - lib/netsuite/records/assembly_item.rb
95
96
  - lib/netsuite/records/base_ref_list.rb
96
97
  - lib/netsuite/records/bill_address.rb
@@ -255,6 +256,7 @@ files:
255
256
  - spec/netsuite/configuration_spec.rb
256
257
  - spec/netsuite/records/account_spec.rb
257
258
  - spec/netsuite/records/accounting_period_spec.rb
259
+ - spec/netsuite/records/address_spec.rb
258
260
  - spec/netsuite/records/assembly_item_spec.rb
259
261
  - spec/netsuite/records/basic_record_spec.rb
260
262
  - spec/netsuite/records/bill_address_spec.rb
@@ -425,6 +427,7 @@ test_files:
425
427
  - spec/netsuite/configuration_spec.rb
426
428
  - spec/netsuite/records/account_spec.rb
427
429
  - spec/netsuite/records/accounting_period_spec.rb
430
+ - spec/netsuite/records/address_spec.rb
428
431
  - spec/netsuite/records/assembly_item_spec.rb
429
432
  - spec/netsuite/records/basic_record_spec.rb
430
433
  - spec/netsuite/records/bill_address_spec.rb