Sha256: 5d3a31d1b9db74511715fb6c63260b85996b219518deb800b9f9a743be79470b

Contents?: true

Size: 1.54 KB

Versions: 9

Compression:

Stored size: 1.54 KB

Contents

require 'date'
require_relative '../resource'
require_relative '../collection'

module Tickethub
  class Supplier::Product < Resource
    path '/supplier/products'

    require_relative '../contact'
    require_relative '../address'

    require_relative 'booking'
    require_relative 'voucher'
    require_relative 'ticket'
    require_relative 'option'
    require_relative 'tier'
    require_relative 'variant'
    require_relative 'season'
    require_relative 'rate'
    require_relative 'coupon'
    require_relative 'reseller'
    require_relative 'question'
    require_relative 'answer'
    require_relative 'tax'

    collection :bookings, Supplier::Booking
    collection :vouchers, Supplier::Voucher
    collection :tickets, Supplier::Ticket
    collection :tiers, Supplier::Tier
    collection :variants, Supplier::Variant
    collection :seasons, Supplier::Season
    collection :coupons, Supplier::Coupon
    collection :rates, Supplier::Rate
    collection :questions, Supplier::Question
    collection :answers, Supplier::Answer
    collection :taxes, Supplier::Tax

    collection :options, Supplier::Option do
      def dates(from, to, booking = {})
        @endpoint[:dates].get(from: from, to: to, booking: booking).decoded
      end
    end

    association :contact, Tickethub::Contact
    association :address, Tickethub::Address

    attribute :time_zone, type: :timezone
    attribute :currency, type: :currency

    def resellers
      Collection.new @endpoint['/supplier/resellers'], Supplier::Reseller, filters: { products: [id] }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tickethub-0.0.9 lib/tickethub/supplier/product.rb
tickethub-0.0.8 lib/tickethub/supplier/product.rb
tickethub-0.0.7 lib/tickethub/supplier/product.rb
tickethub-0.0.6 lib/tickethub/supplier/product.rb
tickethub-0.0.5 lib/tickethub/supplier/product.rb
tickethub-0.0.4 lib/tickethub/supplier/product.rb
tickethub-0.0.3 lib/tickethub/supplier/product.rb
tickethub-0.0.2 lib/tickethub/supplier/product.rb
tickethub-0.0.1 lib/tickethub/supplier/product.rb