Class: Tickethub::Supplier
- Defined in:
- lib/tickethub/supplier.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Answer, App, Bill, Booking, Charge, Coupon, Customer, Dispute, Extra, Fee, Import, Invoice, Message, Option, Order, Payment, Product, Question, Rate, Receipt, Reseller, Scan, Season, Source, Subscription, Tax, Ticket, Tier, User, Variant, Voucher
Instance Attribute Summary
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(endpoint, attributes = nil) ⇒ Supplier
constructor
A new instance of Supplier.
Methods inherited from Resource
#==, #[], #[]=, all, association, attribute, attributes, collection, collection_method, collection_methods, descendants, #destroy, dump_value, #eql?, #errors, #hash, inherited, #inspect, load, #load, load_value, path, polymorphic, register_type, registered_types, #reload!, #respond_to?, scope, scopes, serialize, singleton?, #to_h, #to_param, #to_s, #update, #valid?
Constructor Details
#initialize(endpoint, attributes = nil) ⇒ Supplier
Returns a new instance of Supplier.
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/tickethub/supplier.rb', line 75 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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Tickethub::Resource
Class Method Details
.[](attributes) ⇒ Object
69 70 71 72 73 |
# File 'lib/tickethub/supplier.rb', line 69 def self.[](attributes) token = attributes[:token].is_a?(String) ? attributes[:token] : attributes[:token][:access_token] self.load Tickethub.endpoint(auth_type: :bearer, password: token)[path] end |