Module: Entrance

Defined in:
lib/entrance/addons/sinatra.rb,
lib/entrance.rb,
lib/entrance/model.rb,
lib/entrance/config.rb,
lib/entrance/fields.rb,
lib/entrance/ciphers.rb,
lib/entrance/version.rb,
lib/entrance/controller.rb,
lib/entrance/addons/omniauth.rb

Overview

require ‘sinatra/base’ require ‘omniauth-twitter’ require ‘entrance/addons/omniauth’

class Hello < Sinatra::Base

register Entrance::OmniAuth

set :sessions, true
set :auth_test, false    # only true for testing
set :auth_remember, true # enables 'remember me' for omniauth logins
set :auth_redirect, '/'  # where to redirect on successful login
set :auth_providers, {
  :twitter => {
    :key => 'foobar'
  }
}

end

Defined Under Namespace

Modules: Ciphers, Controller, Model, OmniAuth, Sinatra Classes: Config, Fields

Constant Summary collapse

MAJOR =
0
MINOR =
6
PATCH =
0
VERSION =
[MAJOR, MINOR, PATCH].join('.')

Class Method Summary collapse

Class Method Details

.configObject



10
11
12
# File 'lib/entrance.rb', line 10

def self.config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



22
23
24
25
# File 'lib/entrance.rb', line 22

def self.configure
  yield config
  config.validate!
end

.fieldsObject



18
19
20
# File 'lib/entrance.rb', line 18

def self.fields
  @fields ||= Fields.new
end

.generate_token(length = 40) ⇒ Object



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

def self.generate_token(length = 40)
  str = Digest::SHA1.hexdigest([Time.now, rand].join)
  str[0..(length-1)]
end

.modelObject



14
15
16
# File 'lib/entrance.rb', line 14

def self.model
  @model ||= get_class(config.model)
end