Sha256: d3e601204d83db0cdaac5735ccbf998da3d88af358197e44d705d197f5613536

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

# encoding: utf-8

module Zuora
  module Models
    class CardHolder
      include ActiveModel::Model

      ATTRIBUTES = :card_holder_name,
                   :address_line_1,
                   :address_line_2,
                   :city,
                   :state,
                   :zip_code,
                   :country,
                   :phone,
                   :email

      attr_accessor(*ATTRIBUTES)

      def attributes
        ATTRIBUTES
      end

      validates :card_holder_name,
                :address_line_1,
                :city,
                :state,
                :zip_code,
                :country,
                presence: true

      validates :card_holder_name,
                length: { maximum: 50 }

      validates :address_line_1,
                length: { maximum: 255 }

      validates :address_line_2,
                length: { maximum: 255 },
                allow_nil: true

      validates :city,
                length: { maximum: 40 }

      validates :state,
                inclusion: { in: Zuora::STATE_ABBREVIATIONS }

      validates :zip_code,
                length: { maximum: 20 }

      validates :phone,
                length: { maximum: 20 },
                allow_nil: true

      validates :email,
                length: { maximum: 80 },
                allow_nil: true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zuora-ruby-0.1.0 lib/zuora/models/card_holder.rb