netsuite 0.8.2 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/.tool-versions +1 -0
  5. data/Gemfile +4 -3
  6. data/README.md +129 -38
  7. data/circle.yml +36 -13
  8. data/lib/netsuite.rb +40 -19
  9. data/lib/netsuite/actions/login.rb +20 -1
  10. data/lib/netsuite/actions/search.rb +1 -6
  11. data/lib/netsuite/actions/update.rb +6 -2
  12. data/lib/netsuite/actions/update_list.rb +109 -0
  13. data/lib/netsuite/actions/upsert.rb +2 -0
  14. data/lib/netsuite/configuration.rb +34 -4
  15. data/lib/netsuite/errors.rb +1 -0
  16. data/lib/netsuite/records/accounting_period.rb +2 -2
  17. data/lib/netsuite/records/assembly_build.rb +4 -1
  18. data/lib/netsuite/records/assembly_item.rb +1 -0
  19. data/lib/netsuite/records/assembly_unbuild.rb +3 -0
  20. data/lib/netsuite/records/bin_number.rb +18 -0
  21. data/lib/netsuite/records/bin_number_list.rb +1 -20
  22. data/lib/netsuite/records/bin_transfer.rb +38 -0
  23. data/lib/netsuite/records/bin_transfer_inventory.rb +20 -0
  24. data/lib/netsuite/records/bin_transfer_inventory_list.rb +10 -0
  25. data/lib/netsuite/records/cash_refund_item.rb +1 -1
  26. data/lib/netsuite/records/classification.rb +5 -2
  27. data/lib/netsuite/records/contact.rb +1 -1
  28. data/lib/netsuite/records/credit_memo.rb +1 -1
  29. data/lib/netsuite/records/custom_field_list.rb +10 -2
  30. data/lib/netsuite/records/custom_record.rb +3 -3
  31. data/lib/netsuite/records/custom_record_ref.rb +1 -0
  32. data/lib/netsuite/records/customer.rb +5 -4
  33. data/lib/netsuite/records/customer_credit_cards.rb +36 -0
  34. data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
  35. data/lib/netsuite/records/customer_deposit.rb +9 -6
  36. data/lib/netsuite/records/customer_payment.rb +6 -2
  37. data/lib/netsuite/records/customer_payment_credit.rb +17 -0
  38. data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
  39. data/lib/netsuite/records/customer_sales_team.rb +24 -0
  40. data/lib/netsuite/records/customer_sales_team_list.rb +9 -0
  41. data/lib/netsuite/records/customer_status.rb +29 -0
  42. data/lib/netsuite/records/customer_subscription.rb +18 -0
  43. data/lib/netsuite/records/customer_subscriptions_list.rb +10 -0
  44. data/lib/netsuite/records/employee.rb +1 -1
  45. data/lib/netsuite/records/entity_custom_field.rb +53 -0
  46. data/lib/netsuite/records/estimate.rb +42 -0
  47. data/lib/netsuite/records/estimate_item.rb +40 -0
  48. data/lib/netsuite/records/estimate_item_list.rb +11 -0
  49. data/lib/netsuite/records/inbound_shipment.rb +33 -0
  50. data/lib/netsuite/records/inbound_shipment_item.rb +39 -0
  51. data/lib/netsuite/records/inbound_shipment_item_list.rb +11 -0
  52. data/lib/netsuite/records/inter_company_journal_entry.rb +48 -0
  53. data/lib/netsuite/records/inter_company_journal_entry_line.rb +28 -0
  54. data/lib/netsuite/records/inter_company_journal_entry_line_list.rb +14 -0
  55. data/lib/netsuite/records/inventory_item.rb +3 -2
  56. data/lib/netsuite/records/invoice.rb +1 -1
  57. data/lib/netsuite/records/item_fulfillment.rb +1 -1
  58. data/lib/netsuite/records/lot_numbered_inventory_item.rb +116 -0
  59. data/lib/netsuite/records/matrix_option_list.rb +12 -4
  60. data/lib/netsuite/records/message.rb +30 -0
  61. data/lib/netsuite/records/non_inventory_resale_item.rb +3 -2
  62. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  63. data/lib/netsuite/records/other_charge_sale_item.rb +2 -2
  64. data/lib/netsuite/records/partner.rb +7 -5
  65. data/lib/netsuite/records/price.rb +17 -0
  66. data/lib/netsuite/records/price_level.rb +26 -0
  67. data/lib/netsuite/records/price_list.rb +9 -0
  68. data/lib/netsuite/records/pricing.rb +20 -0
  69. data/lib/netsuite/records/pricing_matrix.rb +2 -2
  70. data/lib/netsuite/records/promotions.rb +26 -0
  71. data/lib/netsuite/records/promotions_list.rb +9 -0
  72. data/lib/netsuite/records/return_authorization_item.rb +1 -1
  73. data/lib/netsuite/records/sales_order.rb +1 -0
  74. data/lib/netsuite/records/sales_order_item.rb +12 -5
  75. data/lib/netsuite/records/sales_role.rb +26 -0
  76. data/lib/netsuite/records/sales_tax_item.rb +3 -1
  77. data/lib/netsuite/records/serialized_assembly_item.rb +239 -0
  78. data/lib/netsuite/records/service_resale_item.rb +1 -1
  79. data/lib/netsuite/records/service_sale_item.rb +1 -1
  80. data/lib/netsuite/records/support_case.rb +1 -1
  81. data/lib/netsuite/records/support_case_type.rb +26 -0
  82. data/lib/netsuite/records/tax_group.rb +2 -2
  83. data/lib/netsuite/records/transaction_body_custom_field.rb +61 -0
  84. data/lib/netsuite/records/transaction_column_custom_field.rb +59 -0
  85. data/lib/netsuite/records/vendor.rb +2 -1
  86. data/lib/netsuite/records/vendor_credit.rb +2 -0
  87. data/lib/netsuite/records/vendor_currency.rb +26 -0
  88. data/lib/netsuite/records/vendor_currency_list.rb +9 -0
  89. data/lib/netsuite/records/work_order.rb +8 -0
  90. data/lib/netsuite/support/actions.rb +2 -0
  91. data/lib/netsuite/support/country.rb +27 -15
  92. data/lib/netsuite/support/search_result.rb +20 -5
  93. data/lib/netsuite/utilities.rb +83 -21
  94. data/lib/netsuite/version.rb +1 -1
  95. data/netsuite.gemspec +4 -3
  96. data/spec/netsuite/actions/login_spec.rb +23 -0
  97. data/spec/netsuite/actions/update_list_spec.rb +107 -0
  98. data/spec/netsuite/actions/update_spec.rb +42 -0
  99. data/spec/netsuite/configuration_spec.rb +111 -6
  100. data/spec/netsuite/records/address_spec.rb +10 -0
  101. data/spec/netsuite/records/basic_record_spec.rb +19 -2
  102. data/spec/netsuite/records/bin_number_spec.rb +23 -0
  103. data/spec/netsuite/records/classification_spec.rb +10 -1
  104. data/spec/netsuite/records/custom_field_list_spec.rb +39 -4
  105. data/spec/netsuite/records/custom_record_spec.rb +1 -1
  106. data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
  107. data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
  108. data/spec/netsuite/records/customer_payment_spec.rb +1 -6
  109. data/spec/netsuite/records/customer_sales_team_list_spec.rb +41 -0
  110. data/spec/netsuite/records/customer_spec.rb +44 -2
  111. data/spec/netsuite/records/customer_subscription_spec.rb +41 -0
  112. data/spec/netsuite/records/customer_subscriptions_list_spec.rb +19 -0
  113. data/spec/netsuite/records/employee_spec.rb +2 -2
  114. data/spec/netsuite/records/entity_custom_field_spec.rb +34 -0
  115. data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
  116. data/spec/netsuite/records/estimate_item_spec.rb +40 -0
  117. data/spec/netsuite/records/estimate_spec.rb +216 -0
  118. data/spec/netsuite/records/inter_company_journal_entry_line_list_spec.rb +26 -0
  119. data/spec/netsuite/records/inter_company_journal_entry_line_spec.rb +60 -0
  120. data/spec/netsuite/records/inter_company_journal_entry_spec.rb +156 -0
  121. data/spec/netsuite/records/inventory_item_spec.rb +57 -0
  122. data/spec/netsuite/records/matrix_option_list_spec.rb +15 -5
  123. data/spec/netsuite/records/message_spec.rb +49 -0
  124. data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
  125. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +1 -1
  126. data/spec/netsuite/records/partner_spec.rb +143 -0
  127. data/spec/netsuite/records/price_level_spec.rb +16 -0
  128. data/spec/netsuite/records/pricing_matrix_spec.rb +15 -13
  129. data/spec/netsuite/records/return_authorization_item_spec.rb +1 -1
  130. data/spec/netsuite/records/sales_order_item_spec.rb +11 -5
  131. data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
  132. data/spec/netsuite/records/support_case_type_spec.rb +22 -0
  133. data/spec/netsuite/records/transaction_body_custom_field_spec.rb +32 -0
  134. data/spec/netsuite/records/transaction_column_custom_field_spec.rb +32 -0
  135. data/spec/netsuite/records/vendor_credit_spec.rb +29 -0
  136. data/spec/netsuite/records/vendor_spec.rb +1 -1
  137. data/spec/netsuite/support/search_result_spec.rb +24 -0
  138. data/spec/netsuite/utilities_spec.rb +44 -6
  139. data/spec/spec_helper.rb +5 -4
  140. data/spec/support/fixtures/update_list/update_list_items.xml +22 -0
  141. data/spec/support/fixtures/update_list/update_list_one_item.xml +18 -0
  142. data/spec/support/fixtures/update_list/update_list_with_errors.xml +32 -0
  143. metadata +111 -11
@@ -9,7 +9,7 @@ module NetSuite
9
9
 
10
10
  actions :get, :get_list, :add, :update, :delete, :upsert, :search
11
11
 
12
- fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date,
12
+ fields :available_to_partners, :cost, :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,
14
14
  :include_children, :is_donation_item, :is_fulfillable, :is_gco_compliant, :is_inactive, :is_online, :is_taxable,
15
15
  :item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html,
@@ -26,7 +26,7 @@ module NetSuite
26
26
  record_refs :billing_schedule, :cost_category, :custom_form, :deferred_revenue_account, :department, :income_account,
27
27
  :issue_product, :item_options_list, :klass, :location, :parent, :pricing_group, :purchase_tax_code,
28
28
  :quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :store_display_image,
29
- :store_display_thumbnail, :store_item_template, :tax_schedule, :units_type
29
+ :store_display_thumbnail, :store_item_template, :tax_schedule, :units_type, :revenue_recognition_rule
30
30
 
31
31
  field :pricing_matrix, PricingMatrix
32
32
  field :custom_field_list, CustomFieldList
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListSupport
9
9
 
10
- actions :get, :get_list, :add, :delete, :update, :upsert
10
+ actions :get, :get_list, :add, :delete, :update, :upsert, :search
11
11
 
12
12
  fields :end_date, :incoming_message, :outgoing_message, :search_solution, :email_form,
13
13
  :internal_only, :title, :case_number, :start_date, :email, :phone, :inbound_email,
@@ -0,0 +1,26 @@
1
+ module NetSuite
2
+ module Records
3
+ class SupportCaseType
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::ListSupport
9
+
10
+ actions :get
11
+
12
+ fields :description, :is_inactive, :name
13
+
14
+ record_refs :insert_before
15
+
16
+ attr_reader :internal_id
17
+ attr_accessor :external_id
18
+
19
+ def initialize(attributes = {})
20
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
21
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
22
+ initialize_from_attributes_hash(attributes)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -7,8 +7,8 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
- # NOTE search not available on TaxGroup!
11
-
10
+ # NOTE `get_all` is not available API > 2017_1
11
+ # `search` is available API > 2016_2
12
12
  actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search, :get_all
13
13
 
14
14
  fields :city, :county, :description, :include_children, :is_default, :is_inactive,
@@ -0,0 +1,61 @@
1
+ module NetSuite
2
+ module Records
3
+ class TransactionBodyCustomField
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::SetupCustom
9
+
10
+ actions :get, :get_list, :add, :delete, :update, :upsert, :upsert_list
11
+
12
+ # http://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_1/schema/record/transactionbodycustomfield.html
13
+ fields(
14
+ :label,
15
+ :store_value,
16
+ :display_type,
17
+ :is_mandatory,
18
+ :default_checked,
19
+ :is_formula,
20
+ :body_assembly_build,
21
+ :body_bom,
22
+ :body_b_tegata,
23
+ :body_customer_payment,
24
+ :body_deposit,
25
+ :body_expense_report,
26
+ :body_inventory_adjustment,
27
+ :body_item_fulfillment,
28
+ :body_item_fulfillment_order,
29
+ :body_item__receipt,
30
+ :body_item__receipt_order,
31
+ :body_journal,
32
+ :body_opportunity,
33
+ :body_other_transaction,
34
+ :body_picking_ticket,
35
+ :body_print_flag,
36
+ :body_print_packing_slip,
37
+ :body_print_statement,
38
+ :body_purchase,
39
+ :body_sale,
40
+ :body_store,
41
+ :body_transfer_order,
42
+ :body_vendor_payment,
43
+ :access_level,
44
+ :search_level,
45
+ :field_type,
46
+ :script_id
47
+ )
48
+
49
+ record_refs :owner
50
+
51
+ attr_reader :internal_id
52
+ attr_accessor :external_id
53
+
54
+ def initialize(attributes = {})
55
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
56
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
57
+ initialize_from_attributes_hash(attributes)
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,59 @@
1
+ module NetSuite
2
+ module Records
3
+ class TransactionColumnCustomField
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::SetupCustom
9
+
10
+ actions :get, :get_list, :add, :delete, :update, :upsert, :upsert_list
11
+
12
+ # http://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_1/schema/record/transactioncolumncustomfield.html
13
+ fields(
14
+ :label,
15
+ :store_value,
16
+ :display_type,
17
+ :is_mandatory,
18
+ :default_checked,
19
+ :is_formula,
20
+ :col_expense,
21
+ :col_purchase,
22
+ :col_sale,
23
+ :col_opportunity,
24
+ :col_store,
25
+ :col_store_hidden,
26
+ :col_journal,
27
+ :col_expense_report,
28
+ :col_time,
29
+ :col_transfer_order,
30
+ :col_item_receipt,
31
+ :col_item_receipt_order,
32
+ :col_item_fulfillment,
33
+ :col_item_fulfillment_order,
34
+ :col_print_flag,
35
+ :col_picking_ticket,
36
+ :col_packing_slip,
37
+ :col_return_form,
38
+ :col_store_with_groups,
39
+ :col_group_on_invoices,
40
+ :col_kit_item,
41
+ :access_level,
42
+ :search_level,
43
+ :field_type,
44
+ :script_id
45
+ )
46
+
47
+ record_refs :owner
48
+
49
+ attr_reader :internal_id
50
+ attr_accessor :external_id
51
+
52
+ def initialize(attributes = {})
53
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
54
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
55
+ initialize_from_attributes_hash(attributes)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -11,7 +11,7 @@ module NetSuite
11
11
 
12
12
  fields :account_number, :alt_email, :alt_name, :alt_phone, :balance,
13
13
  :balance_primary, :bcn, :bill_pay, :comments, :company_name, :credit_limit,
14
- :currency_list, :date_created, :default_address, :eligible_for_commission,
14
+ :date_created, :default_address, :eligible_for_commission,
15
15
  :email, :email_preference, :email_transactions, :entity_id, :fax, :fax_transactions,
16
16
  :first_name, :give_access, :global_subscription_status, :home_phone, :is1099_eligible,
17
17
  :is_accountant, :is_inactive, :is_job_resource_vend, :is_person, :labor_cost,
@@ -22,6 +22,7 @@ module NetSuite
22
22
  :url, :vat_reg_number
23
23
 
24
24
  field :custom_field_list, CustomFieldList
25
+ field :currency_list, VendorCurrencyList
25
26
  # TODO should change name to VendorAddressBookList
26
27
  field :addressbook_list, CustomerAddressbookList
27
28
 
@@ -33,9 +33,11 @@ module NetSuite
33
33
  field :custom_field_list, CustomFieldList
34
34
 
35
35
  attr_reader :internal_id
36
+ attr_accessor :external_id
36
37
 
37
38
  def initialize(attributes = {})
38
39
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
40
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
39
41
  initialize_from_attributes_hash(attributes)
40
42
  end
41
43
 
@@ -0,0 +1,26 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorCurrency
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::ListRel
8
+
9
+ fields :balance, :consol_balance, :consol_deposit_balance, :consol_overdue_balance,
10
+ :consol_unbilled_orders, :deposit_balance, :display_symbol, :overdue_balance,
11
+ :override_currency_format, :symbol_placement, :unbilled_orders
12
+
13
+ record_refs :currency
14
+
15
+ def initialize(attributes_or_record = {})
16
+ case attributes_or_record
17
+ when Hash
18
+ initialize_from_attributes_hash(attributes_or_record)
19
+ when self.class
20
+ initialize_from_record(attributes_or_record)
21
+ end
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ module NetSuite
2
+ module Records
3
+ class VendorCurrencyList < Support::Sublist
4
+ include Namespaces::ListRel
5
+
6
+ sublist :vendor_currency, NetSuite::Records::VendorCurrency
7
+ end
8
+ end
9
+ end
@@ -33,6 +33,14 @@ module NetSuite
33
33
  @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
34
34
  initialize_from_attributes_hash(attributes)
35
35
  end
36
+
37
+ def self.search_class_name
38
+ "Transaction"
39
+ end
40
+
41
+ def self.search_class_namespace
42
+ 'tranSales'
43
+ end
36
44
  end
37
45
  end
38
46
  end
@@ -42,6 +42,8 @@ module NetSuite
42
42
  self.send(:include, NetSuite::Actions::DeleteList::Support)
43
43
  when :update
44
44
  self.send(:include, NetSuite::Actions::Update::Support)
45
+ when :update_list
46
+ self.send(:include, NetSuite::Actions::UpdateList::Support)
45
47
  when :initialize
46
48
  self.send(:include, NetSuite::Actions::Initialize::Support)
47
49
  else
@@ -4,6 +4,7 @@ module NetSuite
4
4
 
5
5
  ISO_TO_NETSUITE = {
6
6
  'AF' => '_afghanistan',
7
+ 'AX' => '_alandIslands',
7
8
  'AL' => '_albania',
8
9
  'DZ' => '_algeria',
9
10
  'AS' => '_americanSamoa',
@@ -29,6 +30,7 @@ module NetSuite
29
30
  'BM' => '_bermuda',
30
31
  'BT' => '_bhutan',
31
32
  'BO' => '_bolivia',
33
+ 'BQ' => '_bonaireSaintEustatiusAndSaba',
32
34
  'BA' => '_bosniaAndHerzegovina',
33
35
  'BW' => '_botswana',
34
36
  'BV' => '_bouvetIsland',
@@ -41,9 +43,11 @@ module NetSuite
41
43
  'KH' => '_cambodia',
42
44
  'CM' => '_cameroon',
43
45
  'CA' => '_canada',
44
- 'CV' => '_capVerde',
46
+ 'IC' => '_canaryIslands',
47
+ 'CV' => '_capeVerde',
45
48
  'KY' => '_caymanIslands',
46
49
  'CF' => '_centralAfricanRepublic',
50
+ 'EA' => '_ceutaAndMelilla',
47
51
  'TD' => '_chad',
48
52
  'CL' => '_chile',
49
53
  'CN' => '_china',
@@ -65,7 +69,7 @@ module NetSuite
65
69
  'DJ' => '_djibouti',
66
70
  'DM' => '_dominica',
67
71
  'DO' => '_dominicanRepublic',
68
- 'TP' => '_eastTimor',
72
+ 'TL' => '_eastTimor',
69
73
  'EC' => '_ecuador',
70
74
  'EG' => '_egypt',
71
75
  'SV' => '_elSalvador',
@@ -73,7 +77,7 @@ module NetSuite
73
77
  'ER' => '_eritrea',
74
78
  'EE' => '_estonia',
75
79
  'ET' => '_ethiopia',
76
- 'FK' => '_falklandIslandsMalvina',
80
+ 'FK' => '_falklandIslands',
77
81
  'FO' => '_faroeIslands',
78
82
  'FJ' => '_fiji',
79
83
  'FI' => '_finland',
@@ -121,6 +125,7 @@ module NetSuite
121
125
  'KI' => '_kiribati',
122
126
  'KP' => '_koreaDemocraticPeoplesRepublic',
123
127
  'KR' => '_koreaRepublicOf',
128
+ 'XK' => '_kosovo',
124
129
  'KW' => '_kuwait',
125
130
  'KG' => '_kyrgyzstan',
126
131
  'LA' => '_laoPeoplesDemocraticRepublic',
@@ -128,7 +133,7 @@ module NetSuite
128
133
  'LB' => '_lebanon',
129
134
  'LS' => '_lesotho',
130
135
  'LR' => '_liberia',
131
- 'LY' => '_libyanArabJamahiriya',
136
+ 'LY' => '_libya',
132
137
  'LI' => '_liechtenstein',
133
138
  'LT' => '_lithuania',
134
139
  'LU' => '_luxembourg',
@@ -159,7 +164,6 @@ module NetSuite
159
164
  'NR' => '_nauru',
160
165
  'NP' => '_nepal',
161
166
  'NL' => '_netherlands',
162
- 'AN' => '_netherlandsAntilles',
163
167
  'NC' => '_newCaledonia',
164
168
  'NZ' => '_newZealand',
165
169
  'NI' => '_nicaragua',
@@ -172,7 +176,7 @@ module NetSuite
172
176
  'OM' => '_oman',
173
177
  'PK' => '_pakistan',
174
178
  'PW' => '_palau',
175
- 'PS' => '_palestinianTerritories',
179
+ 'PS' => '_stateOfPalestine',
176
180
  'PA' => '_panama',
177
181
  'PG' => '_papuaNewGuinea',
178
182
  'PY' => '_paraguay',
@@ -185,18 +189,19 @@ module NetSuite
185
189
  'QA' => '_qatar',
186
190
  'RE' => '_reunionIsland',
187
191
  'RO' => '_romania',
188
- 'RS' => '_serbia',
189
192
  'RU' => '_russianFederation',
190
193
  'RW' => '_rwanda',
191
194
  'BL' => '_saintBarthelemy',
195
+ 'SH' => '_saintHelena',
192
196
  'KN' => '_saintKittsAndNevis',
193
197
  'LC' => '_saintLucia',
198
+ 'MF' => '_saintMartin',
194
199
  'VC' => '_saintVincentAndTheGrenadines',
195
200
  'SM' => '_sanMarino',
196
201
  'ST' => '_saoTomeAndPrincipe',
197
202
  'SA' => '_saudiArabia',
198
203
  'SN' => '_senegal',
199
- 'CS' => '_serbia',
204
+ 'RS' => '_serbia',
200
205
  'SC' => '_seychelles',
201
206
  'SL' => '_sierraLeone',
202
207
  'SG' => '_singapore',
@@ -207,9 +212,9 @@ module NetSuite
207
212
  'SO' => '_somalia',
208
213
  'ZA' => '_southAfrica',
209
214
  'GS' => '_southGeorgia',
215
+ 'SS' => '_southSudan',
210
216
  'ES' => '_spain',
211
217
  'LK' => '_sriLanka',
212
- 'SH' => '_stHelena',
213
218
  'PM' => '_stPierreAndMiquelon',
214
219
  'SD' => '_sudan',
215
220
  'SR' => '_suriname',
@@ -234,8 +239,7 @@ module NetSuite
234
239
  'UG' => '_uganda',
235
240
  'UA' => '_ukraine',
236
241
  'AE' => '_unitedArabEmirates',
237
- # NOTE GB country code changed on 2016_1
238
- 'GB' => NetSuite::Configuration.api_version <= "2015_2" ? '_unitedKingdomGB' : '_unitedKingdom',
242
+ 'GB' => '_unitedKingdom',
239
243
  'US' => '_unitedStates',
240
244
  'UY' => '_uruguay',
241
245
  'UM' => '_uSMinorOutlyingIslands',
@@ -247,16 +251,15 @@ module NetSuite
247
251
  'VI' => '_virginIslandsUSA',
248
252
  'WF' => '_wallisAndFutunaIslands',
249
253
  'EH' => '_westernSahara',
250
- 'WS' => '_westernSamoa',
254
+ 'WS' => '_samoa',
251
255
  'YE' => '_yemen',
252
- 'YU' => '_yugoslavia',
253
256
  'ZM' => '_zambia',
254
257
  'ZW' => '_zimbabwe'
255
258
  }
256
259
 
257
260
  def initialize(iso_or_name = '')
258
261
  if iso_or_name =~ /^[A-Z]{2}/
259
- @id = ISO_TO_NETSUITE.fetch(iso_or_name)
262
+ @id = iso_to_netsuite.fetch(iso_or_name)
260
263
  else
261
264
  @id = iso_or_name
262
265
  end
@@ -269,13 +272,22 @@ module NetSuite
269
272
  alias :eql? :==
270
273
 
271
274
  def to_iso
272
- ISO_TO_NETSUITE.key(@id)
275
+ iso_to_netsuite.key(@id)
273
276
  end
274
277
 
275
278
  def to_record
276
279
  @id
277
280
  end
278
281
 
282
+ def iso_to_netsuite
283
+ # NOTE GB country code changed on 2016_1
284
+ if NetSuite::Configuration.api_version <= "2015_2"
285
+ ISO_TO_NETSUITE.merge({ 'GB' => '_unitedKingdomGB' })
286
+ else
287
+ ISO_TO_NETSUITE
288
+ end
289
+ end
290
+
279
291
  end
280
292
  end
281
293
  end