class NetSuite::Support::Country

Constants

ISO_TO_NETSUITE

Public Class Methods

new(iso_or_name = '') click to toggle source
# File lib/netsuite/support/country.rb, line 260
def initialize(iso_or_name = '')
  if iso_or_name =~ /^[A-Z]{2}/
    @id = iso_to_netsuite.fetch(iso_or_name)
  else
    @id = iso_or_name
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/netsuite/support/country.rb, line 268
def ==(other)
  other.class == self.class && other.to_iso == self.to_iso
end
Also aliased as: eql?
eql?(other)
Alias for: ==
iso_to_netsuite() click to toggle source
# File lib/netsuite/support/country.rb, line 282
def iso_to_netsuite
  # NOTE GB country code changed on 2016_1
  if NetSuite::Configuration.api_version <= "2015_2"
    ISO_TO_NETSUITE.merge({ 'GB' => '_unitedKingdomGB' })
  else
    ISO_TO_NETSUITE
  end
end
to_iso() click to toggle source
# File lib/netsuite/support/country.rb, line 274
def to_iso
  iso_to_netsuite.key(@id)
end
to_record() click to toggle source
# File lib/netsuite/support/country.rb, line 278
def to_record
  @id
end