Sha256: 6f24f3d6ba3f76d9750464579a64b67b3a1aac5240cb392d9d7a9915dfebe651

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

require 'dineromail/item'
module Dineromail
  class Operation
    include HappyMapper
    
    tag 'operacion'
    element :transaction_id, Integer, :tag => 'id'
    element :date, DateTime, :tag => 'fecha'
    element :status, Integer, :tag => 'estado'
    element :amount, Float, :tag => 'monto'
    element :net_amount, Float, :tag => 'montoneto'
    element :pay_method, String, :tag => 'metodopago'
    element :pay_medium, String, :tag => 'mediopago'
    has_one :buyer, Buyer, :tag => 'comprador'
    has_many :items, Dineromail::Item, :tag => 'item'
    
    PENDING_STATUS = 1
    COMPLETED_STATUS = 2
    CANCELLED_STATUS = 3
    
    def pending?
      status == PENDING_STATUS
    end
    
    def completed?
      status == COMPLETED_STATUS
    end
    
    def cancelled?
      status == CANCELLED_STATUS
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dineromail-0.1.4 lib/dineromail/operation.rb