lib/tickethub/supplier.rb in tickethub-0.1.4 vs lib/tickethub/supplier.rb in tickethub-0.2.0

- old
+ new

@@ -1,8 +1,8 @@ module Tickethub class Supplier < Resource - path '/supplier' + path '/supplier', singleton: true require_relative 'supplier/bill' require_relative 'supplier/customer' require_relative 'supplier/order' require_relative 'supplier/booking' @@ -64,18 +64,18 @@ attribute :updated_at, type: :datetime def self.[](attributes) token = attributes[:token].is_a?(String) ? attributes[:token] : attributes[:token][:access_token] - self.new Tickethub.endpoint['/supplier', auth_type: :bearer, password: token] + self.load Tickethub.endpoint(auth_type: :bearer, password: token)[path] end def initialize(endpoint, attributes = nil) attributes ||= endpoint.get if attributes['token'] - endpoint = Tickethub.endpoint['/supplier', { - auth_type: :bearer, password: attributes['token']['access_token'] }] + endpoint = Tickethub.endpoint(auth_type: :bearer, + password: attributes['token']['access_token'])[self.class.path] end super(endpoint, attributes) end \ No newline at end of file