Sha256: ea4089142fb7c976a11215759db459c0fc08cf29291fc77af60318dcbeee9349
Contents?: true
Size: 919 Bytes
Versions: 6
Compression:
Stored size: 919 Bytes
Contents
module Tickethub class App < Resource path '/apps' require_relative 'contact' require_relative 'app/category' require_relative 'app/subscription' association :contact, Tickethub::Contact association :token, Tickethub::Token association :category, App::Category collection :subscriptions, App::Subscription attribute :currency, type: :currency def self.[](attributes) token = attributes[:token].is_a?(String) ? attributes[:token] : attributes[:token][:access_token] self.new Tickethub.endpoint['/app', auth_type: :bearer, password: token] 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
6 entries across 6 versions & 1 rubygems