Sha256: 7180083b24abfd08aaf19f183f53be9d76ec50673d9f88ab1faa1e6685f9a935
Contents?: true
Size: 1.44 KB
Versions: 8
Compression:
Stored size: 1.44 KB
Contents
module Tickethub class Channel < Resource path '/channel', singleton: true require_relative 'channel/voucher' require_relative 'channel/coupon' require_relative 'channel/tier' require_relative 'channel/variant' require_relative 'channel/extra' require_relative 'channel/question' require_relative 'channel/booking' require_relative 'channel/order' require_relative 'channel/payment' require_relative 'channel/option' require_relative 'channel/product' require_relative 'channel/supplier' collection :vouchers, Voucher collection :coupons, Coupon collection :tiers, Tier collection :variants, Variant collection :extras, Extra collection :questions, Question collection :bookings, Booking collection :orders, Order collection :payments, Payment collection :options, Option association :product, Product association :supplier, Supplier def self.[](attributes) token = attributes[:token].is_a?(String) ? attributes[:token] : attributes[:token][:access_token] self.call Tickethub.endpoint(auth_type: :bearer, password: token)[path] end def initialize(endpoint, attributes = nil) attributes ||= endpoint.get if attributes['token'] endpoint = Tickethub.endpoint(auth_type: :bearer, password: attributes['token']['access_token'])[self.class.path] end super(endpoint, attributes) end end end
Version data entries
8 entries across 8 versions & 1 rubygems