Sha256: 4f207dfa705ce4bd1a1d8a02ddf1423a862f75aae663aafe8780081b80e935f1

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

module Eddy
  module Elements
    # ### Element Summary:
    #
    # - Id: 116
    # - Name: Postal Code
    # - Type: ID
    # - Min/Max: 3/15
    # - Description: Code defining international postal zone code excluding punctuation and blanks (zip code for United States)
    #
    # ### Notes:
    #
    # - There are too many valid values for this, so it uses a regular expression instead of a codelist.
    # - FIXME: Implement that ☝
    # - See [Segment and Data Element Definitions - X12 RFI](http://www.x12.org/rfis/Segment%20and%20Data%20Element%20Definitions.pdf)
    class E116 < Eddy::Models::Element::AN

      # @param val [String] (nil)
      # @param req [String] (nil)
      # @param ref [String] (nil)
      # @return [void]
      def initialize(val: nil, req: nil, ref: nil)
        @id = "116"
        @name = "Postal Code"
        @description = "Code defining international postal zone code excluding punctuation and blanks (zip code for United States)"
        super(
          min: 3,
          max: 15,
          req: req,
          ref: ref,
          val: val,
        )
      end

      # Matches any valid US zip code.
      #
      # @return [Regexp]
      def pattern
        return /^[0-9]{5}(?:-[0-9]{4})?$/
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
eddy-0.10.0 lib/definitions/elements/manual/116.postal_code.rb
eddy-0.9.2 lib/definitions/elements/manual/116.postal_code.rb
eddy-0.9.1 lib/definitions/elements/manual/116.postal_code.rb
eddy-0.9.0 lib/definitions/elements/manual/116.postal_code.rb
eddy-0.8.4 lib/definitions/elements/manual/116.postal_code.rb
eddy-0.8.3 lib/definitions/elements/manual/116.postal_code.rb
eddy-0.8.2 lib/definitions/elements/manual/116.postal_code.rb
eddy-0.8.1 lib/definitions/elements/manual/116.postal_code.rb
eddy-0.8.0 lib/definitions/elements/manual/116.postal_code.rb
eddy-0.7.0 lib/definitions/elements/manual/116.postal_code.rb
eddy-0.6.0 lib/definitions/elements/manual/116.postal_code.rb