class Tickethub::Supplier

Public Class Methods

[](attributes) click to toggle source
# File lib/tickethub/supplier.rb, line 92
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
new(endpoint, attributes = nil) click to toggle source
Calls superclass method Tickethub::Resource::new
# File lib/tickethub/supplier.rb, line 98
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