class LUSI::API::Country::AddressCountry

Represents the country component of an address in the LUSI API

Attributes

region[RW]

@!attribute [rw] region

@return [String. nil] the text description of the region of the address

Public Class Methods

get_instance(api = nil, lookup = nil, iso_alpha2_code: nil, region: nil, **kwargs) click to toggle source

Returns AddressCountry instances matching the supplied parameters @param (see LUSI::API::Country::Country#get_instance) @param iso_alpha2_code [String, nil] the ISO alpha-2 code to search for @param region [String, nil] the region to search for @return [Array<AddressCountry>, nil] the matching AddressCountry instances @yield [obj] Passes the AddressCountry instance to the block @yieldparam obj [LUSI::API::Country::AddressCountry] the AddressCountry instance

Calls superclass method LUSI::API::Core::Code::get_instance
# File lib/lusi_api/country.rb, line 48
def self.get_instance(api = nil, lookup = nil, iso_alpha2_code: nil, region: nil, **kwargs)
  super(api, lookup, 'LUSIReference', 'Lookup.asmx', 'GetAddressCountries', 'xmlns:AddressCountry',
        iso_alpha2_code: iso_alpha2_code, region: region, **kwargs)
end
new(xml = nil, lookup = nil, region: nil, **kwargs) click to toggle source

Initialises a new AddressCountry instance @param (see Country#initialize) @param region [String, nil] the default region @return [void]

Calls superclass method LUSI::API::Country::Country::new
# File lib/lusi_api/country.rb, line 57
def initialize(xml = nil, lookup = nil, region: nil, **kwargs)
  super(xml, lookup, **kwargs)
  @region = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Region', region)
end

Protected Class Methods

get_instance_params(**kwargs) click to toggle source

Returns a parameter hash for the LUSI API call @params (see get_instance) @return [Hash<String, any] the parameter hash for the LUSI API call

# File lib/lusi_api/country.rb, line 67
def self.get_instance_params(**kwargs)
  params = super(**kwargs)
  params[:ISOAlpha2Code] = kwargs[:iso_alpha2_code] || ''
  params[:Region] = kwargs[:region] || ''
  params
end