Sha256: 84570316a30d8e928adf74a4553df4bebe92fa3b309b93789475270eff3c7370

Contents?: true

Size: 696 Bytes

Versions: 5

Compression:

Stored size: 696 Bytes

Contents

module WireClient
  module AccountTransactionHelpers
    def country_subdivision_abbr
      return US_STATES[@country_subdivision] if a_full_name_us_state?
      @country_subdivision
    end

    def country_subdivision_name
      return US_STATES.key(@country_subdivision) if an_abbreviated_us_state?
      @country_subdivision
    end

    protected

    def within_the_us?
      @country == 'US'
    end

    def an_abrreviated_state_name?
      @country_subdivision.match(/\A[A-Z]{2,2}\z/)
    end

    def an_abbreviated_us_state?
      within_the_us? && an_abrreviated_state_name?
    end

    def a_full_name_us_state?
      within_the_us? && !an_abrreviated_state_name?
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wire_client-0.4.1 lib/wire_client/base/account_transaction_helpers.rb
wire_client-0.4.0 lib/wire_client/base/account_transaction_helpers.rb
wire_client-0.2.0 lib/wire_client/base/account_transaction_helpers.rb
wire_client-0.1.4 lib/wire_client/base/account_transaction_helpers.rb
wire_client-0.1.3 lib/wire_client/base/account_transaction_helpers.rb