Class: TicketMaster
- Inherits:
-
Object
- Object
- TicketMaster
- Defined in:
- lib/ticketmaster.rb,
lib/ticketmaster.rb
Overview
This is the TicketMaster class
Defined Under Namespace
Modules: Provider Classes: Authenticator, Exception
Instance Attribute Summary collapse
-
#default_project ⇒ Object
Returns the value of attribute default_project.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Instance Method Summary collapse
-
#authorize(authentication = {}) ⇒ Object
Providers should over-write this method.
-
#initialize(system = nil, authentication = nil) ⇒ TicketMaster
constructor
This initializes the TicketMaster instance and prepares the provider If called without any arguments, it conveniently tries searching for the information in ~/.ticketmaster.yml See the documentation for more information on the format of that file.
Constructor Details
#initialize(system = nil, authentication = nil) ⇒ TicketMaster
This initializes the TicketMaster instance and prepares the provider If called without any arguments, it conveniently tries searching for the information in ~/.ticketmaster.yml See the documentation for more information on the format of that file.
What it DOES NOT do is auto-require the provider…so make sure you have the providers required.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ticketmaster.rb', line 36 def initialize(system = nil, authentication = nil) if system.nil? or authentication.nil? require 'yaml' data = YAML.load_file File.(ENV['TICKETMASTER_CONFIG'] || '~/.ticketmaster.yml') system = system.nil? ? data['default'] || data.first.first : system.to_s authentication = data[system]['authentication'] if authentication.nil? and data[system]['authentication'] end self.extend TicketMaster::Provider.const_get(system.to_s.capitalize) authentication @symbol = system.to_sym @provider = TicketMaster::Provider.const_get(system.to_s.capitalize) end |
Instance Attribute Details
#default_project ⇒ Object
Returns the value of attribute default_project.
28 29 30 |
# File 'lib/ticketmaster.rb', line 28 def default_project @default_project end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
27 28 29 |
# File 'lib/ticketmaster.rb', line 27 def provider @provider end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
27 28 29 |
# File 'lib/ticketmaster.rb', line 27 def symbol @symbol end |
Instance Method Details
#authorize(authentication = {}) ⇒ Object
Providers should over-write this method
50 51 52 |
# File 'lib/ticketmaster.rb', line 50 def (authentication = {}) raise TicketMaster::Exception.new("This method must be reimplemented in the provider") end |