Module: JamBase4R

Extended by:
Utility
Defined in:
lib/api.rb,
lib/utility.rb,
lib/jambase4r.rb,
lib/http_gateway.rb,
lib/models/event.rb,
lib/models/model.rb,
lib/models/venue.rb,
lib/models/artist.rb,
lib/jambase4r_view_helper.rb

Defined Under Namespace

Modules: Model, Utility, ViewHelper Classes: API, Artist, Event, HttpGateway, JamBaseError, Venue

Constant Summary collapse

@@api_key =
nil
@@logger =
nil

Class Method Summary collapse

Methods included from Utility

log_error, log_info

Class Method Details

.api_key ⇒ Object



20
21
22
# File 'lib/jambase4r.rb', line 20

def self.api_key
  @@api_key
end

.api_key=(key) ⇒ Object



24
25
26
# File 'lib/jambase4r.rb', line 24

def self.api_key=(key)
  @@api_key = key
end

.configure(&block) ⇒ Object

Raises:

  • (ArgumentError)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/jambase4r.rb', line 36

def self.configure(&block)
  raise ArgumentError.new("A block is expected.") unless block_given?
  block.call(self)
  log_error("You must supply an API key.") if api_key.blank?
  raise ArgumentError.new("You must supply an api key.") if api_key.blank?
  if defined? ActionView
    ActionView::Base.send(:include, JamBase4R::ViewHelper)
  end
  if defined? Sinatra
    helpers do
      include JamBase4R::ViewHelper
    end
  end
end

.logger ⇒ Object



28
29
30
# File 'lib/jambase4r.rb', line 28

def self.logger
  @@logger
end

.logger=(logger) ⇒ Object



32
33
34
# File 'lib/jambase4r.rb', line 32

def self.logger=(logger)
  @@logger = logger
end