Sha256: 036c24ff4ef5955cb6d1895e8ce6f85a43f8999dc10244ecc487005469f86bd5

Contents?: true

Size: 770 Bytes

Versions: 5

Compression:

Stored size: 770 Bytes

Contents

module InvoiceBar
  module Billable
    # Specific features to invoicing. It specifies +due_date+ and
    # whether the invoice is received or issued.
    module Invoicing
      extend ActiveSupport::Concern

      included do
        attr_accessible :due_date, :payment_identification_number, :issuer
        validates :payment_identification_number, numericality: true, allow_blank: true

        class << self
          def received
            where(issuer: false)
          end

          def issued
            where(issuer: true)
          end
        end

        def received?
          if self.issuer?
            false
          else
            true
          end
        end

        def issued?
          !received?
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
invoice_bar-0.0.11 app/concerns/invoice_bar/billable/invoicing.rb
invoice_bar-0.0.10 app/concerns/invoice_bar/billable/invoicing.rb
invoice_bar-0.0.9 app/concerns/invoice_bar/billable/invoicing.rb
invoice_bar-0.0.8 app/concerns/invoice_bar/billable/invoicing.rb
invoice_bar-0.0.7 app/concerns/invoice_bar/billable/invoicing.rb