Sha256: da49c44130b0391d1f52e7686e6920a6cf2b07b7168e65a9f6f68d61bf49b331

Contents?: true

Size: 1.48 KB

Versions: 17

Compression:

Stored size: 1.48 KB

Contents

require_relative '../resource'

module Tickethub
  class Supplier::Booking < Resource
    path '/supplier/bookings'

    require_relative 'booking/ticket'
    require_relative 'booking/voucher'

    require_relative 'rate'
    require_relative 'order'
    require_relative 'answer'
    require_relative 'product'
    require_relative 'variant'
    require_relative 'message'
    require_relative 'purchase'
    require_relative 'fee'
    require_relative 'discount'
    require_relative 'broadcast'

    collection_method :broadcast do |params|
      Supplier::Broadcast.call self.endpoint, begin
        post(:broadcast, params)
      rescue Tickethub::ResourceInvalid => err
        Tickethub::Response.new(err.response).decoded
      end
    end

    collection :answers, Supplier::Answer
    collection :messages, Supplier::Message
    collection :purchases, Supplier::Purchase
    collection :fees, Supplier::Fee
    collection :discounts, Supplier::Discount

    association :order, Supplier::Order
    association :rate, Supplier::Rate
    association :coupon, Supplier::Coupon
    association :product, Supplier::Product
    association :variant, Supplier::Variant

    attribute :amount, type: :money
    attribute :discount, type: :money
    attribute :tax, type: :money
    attribute :total, type: :money

    attribute :created_at, type: :datetime
    attribute :updated_at, type: :datetime
    attribute :cancelled_at, type: :datetime

    def notify
      @endpoint[:notify].post
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
tickethub-0.3.58 lib/tickethub/supplier/booking.rb
tickethub-0.3.57 lib/tickethub/supplier/booking.rb
tickethub-0.3.56 lib/tickethub/supplier/booking.rb
tickethub-0.3.55 lib/tickethub/supplier/booking.rb
tickethub-0.3.54 lib/tickethub/supplier/booking.rb
tickethub-0.3.53 lib/tickethub/supplier/booking.rb
tickethub-0.3.52 lib/tickethub/supplier/booking.rb
tickethub-0.3.51 lib/tickethub/supplier/booking.rb
tickethub-0.3.50 lib/tickethub/supplier/booking.rb
tickethub-0.3.49 lib/tickethub/supplier/booking.rb
tickethub-0.3.47 lib/tickethub/supplier/booking.rb
tickethub-0.3.46 lib/tickethub/supplier/booking.rb
tickethub-0.3.45 lib/tickethub/supplier/booking.rb
tickethub-0.3.44 lib/tickethub/supplier/booking.rb
tickethub-0.3.43 lib/tickethub/supplier/booking.rb
tickethub-0.3.42 lib/tickethub/supplier/booking.rb
tickethub-0.3.41 lib/tickethub/supplier/booking.rb