Sha256: 6c722af058f84ef4b00b9ab08e78601a0a7f6cb239d398c391053417f8df069a

Contents?: true

Size: 417 Bytes

Versions: 1

Compression:

Stored size: 417 Bytes

Contents

require 'money'

module TicketingHub
  class Ticket < Resource
    schema do
      integer :id, :tier_id, :order_id
      float :commission, :price, default: 0
      string :code
    end

    belongs_to :tier
    belongs_to :order
    delegate :currency, to: :order

    def price
      attributes[:price].to_money currency
    end

    def commission
      attributes[:commission].to_money currency
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ticketinghub-0.0.2 lib/ticketing_hub/ticket.rb