Sha256: b4f6cfda3c637991e7f09a9824c1982a712ba55000d35a0bda193fc2b75599e8

Contents?: true

Size: 1.82 KB

Versions: 9

Compression:

Stored size: 1.82 KB

Contents

require_relative '../resource'

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

    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 'tier'
    require_relative 'scan'
    require_relative 'ticket'
    require_relative 'discount'
    require_relative 'broadcast'
    require_relative 'party'
    require_relative 'weather'

    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 :tiers, Supplier::Tier
    collection :tickets, Supplier::Ticket
    collection :discounts, Supplier::Discount
    collection :scans, Supplier::Scan

    association :order, Supplier::Order
    association :rate, Supplier::Rate
    association :coupon, Supplier::Coupon
    association :product, Supplier::Product
    association :variant, Supplier::Variant
    association :party, Supplier::Party
    association :weather, Supplier::Weather

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

    attribute :expires_on, type: :date
    attribute :valid_from, type: :datetime
    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

9 entries across 9 versions & 1 rubygems

Version Path
tickethub-0.3.100 lib/tickethub/supplier/booking.rb
tickethub-0.3.99 lib/tickethub/supplier/booking.rb
tickethub-0.3.98 lib/tickethub/supplier/booking.rb
tickethub-0.3.97 lib/tickethub/supplier/booking.rb
tickethub-0.3.96 lib/tickethub/supplier/booking.rb
tickethub-0.3.95 lib/tickethub/supplier/booking.rb
tickethub-0.3.94 lib/tickethub/supplier/booking.rb
tickethub-0.3.93 lib/tickethub/supplier/booking.rb
tickethub-0.3.92 lib/tickethub/supplier/booking.rb