Sha256: 0738004117272eaccaee22d072bf6693bb1dd4fc673fa3df8061ba5b4fba10ed

Contents?: true

Size: 708 Bytes

Versions: 5

Compression:

Stored size: 708 Bytes

Contents

module Comee
  module Core
    class Address < ApplicationRecord
      self.abstract_class = true

      BASIC_ADDRESS = "Basic Address".freeze
      SHIPPING_ADDRESS = "Shipping Address".freeze
      DELIVERY_ADDRESS = "Delivery Address".freeze
      INVOICING_ADDRESS = "Invoicing Address".freeze

      ADDRESS_TYPES = [BASIC_ADDRESS, SHIPPING_ADDRESS, DELIVERY_ADDRESS, INVOICING_ADDRESS].freeze

      belongs_to :country, -> { where(lookup_type: :country) }, class_name: "Comee::Core::Lookup"

      validates :address_line1, :address_type, presence: true
      validates :address_type, inclusion: {in: ADDRESS_TYPES}
      validates :email, format: {with: URI::MailTo::EMAIL_REGEXP}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
comee_core-0.3.9 app/models/comee/core/address.rb
comee_core-0.3.8 app/models/comee/core/address.rb
comee_core-0.3.7 app/models/comee/core/address.rb
comee_core-0.3.6 app/models/comee/core/address.rb
comee_core-0.3.5 app/models/comee/core/address.rb