Class: LUSI::API::Country::AddressCountry

Inherits:
Country show all
Defined in:
lib/lusi_api/country.rb

Overview

Represents the country component of an address in the LUSI API

Instance Attribute Summary collapse

Attributes inherited from Country

#iso_alpha2_code

Attributes inherited from LUSI::API::Core::BasicCode

#description, #identity

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Country

#to_s

Methods inherited from LUSI::API::Core::BasicCode

#to_s

Constructor Details

#initialize(xml = nil, lookup = nil, region: nil, **kwargs) ⇒ void

Initialises a new AddressCountry instance

Parameters:

  • region (String, nil) (defaults to: nil)

    the default region

  • iso_alpha2_code (String, nil)

    the default ISO alpha-2 code for the country



57
58
59
60
# 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

Instance Attribute Details

#regionString. nil

Returns the text description of the region of the address.

Returns:

  • (String. nil)

    the text description of the region of the address



39
40
41
# File 'lib/lusi_api/country.rb', line 39

def region
  @region
end

Class Method Details

.get_instance(api = nil, lookup = nil, iso_alpha2_code: nil, region: nil, **kwargs) {|obj| ... } ⇒ Array<AddressCountry>?

Returns AddressCountry instances matching the supplied parameters

Parameters:

  • iso_alpha2_code (String, nil) (defaults to: nil)

    the ISO alpha-2 code to search for

  • region (String, nil) (defaults to: nil)

    the region to search for

Yields:

  • (obj)

    Passes the AddressCountry instance to the block

Yield Parameters:

Returns:

  • (Array<AddressCountry>, nil)

    the matching AddressCountry instances



48
49
50
51
# 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